Question: Write a C + + Program that does the following steps: Write a program that does the following steps: a . stores the following fruits

Write a C++ Program that does the following steps:
Write a program that does the following steps:
a. stores the following fruits in the key of a map container:
string S[12]={"Banana", "Date", "Fig", "Grape", "Lemon", "Kiwi", "Watermelon", "Cherry", "Lime", "Raspberry", "Apple", "Blueberry"};
b. the corresponding data(weights - lbs) for each fruit is obtained from a random number generator that produces weights having a range (0-12). Use the randu() function to generate the random numbers that has been initialized with the function srand(19).
c. After populating the map container, print the entire contents of the container (key and data(weight))
d. After printing the original data, reduce the weight of each fruit by 0.75 if in excess of 10 lb
e. After reducing the weight of the map container, print the entire contents of the container
f. After printing the modified map container, count and output the number of fruits having weight >10 lbs.
g. Print the first letter of each fruit and corresponding weight for the entire map
h. Print the entire map showing weight in ounces (1 lb =16 oz)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!