- 3 Print Alternative Country This Function Will Print The Alternative Nodes Of The List That Means You Have To Print 1 (109.49 KiB) Viewed 32 times
3. print_alternative_country(): This function will print the alternative nodes of the list. That means you have to print
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
3. print_alternative_country(): This function will print the alternative nodes of the list. That means you have to print
3. print_alternative_country(): This function will print the alternative nodes of the list. That means you have to print 1st node, then 3rd node, then 5th node and so on. For example, if you call print_alternative_country() for the given list in figure 1, it will print: USA, 329.5 million BD, 164.7 million 4. calculate_total_population: This function will print the sum of the population of all countries given in the list. For example, if you call calculate_total_population () for the given list in figure 1, it will print: 329.5 + 144.1 + 164.7 = 638.3 million You have to implement all these functions in one cpp file. The name of the nodes of the list should be "country. Each node will have two data values (name: string and population: double) and two pointers (next, previous). struct country{ string name; double population; country *next; country *prev; }; 12:06 AM /