Apple-Picking

Short Lab:    ARRAYS

 

 

A group of 50 people have gone apple picking at Shady Brook Farm. Each person has collected a number of apples.  The fewest apples collected is 0, and the most appleas collected is 100. Write a program to perform the following:

a. Declare an array to the store 50 numbers (each corresponds to the number of apples that someone picked).


b. Input the 50 numbers into the array from data file c:\apple_trip.txt.   Create the data file yourself, using a short C++ program and the rand function.


c. Print out  how many of the people picked less than 25 apples.  


d. Print out how many of the numbers are between 80 and 100 apples.


e. Figure out and print the average number of apples picked.  


f. If the average is greater than 25, change all apple numbers less than 10 to 0.

 

g. Print out the contents of the array, 10 numbers on each line.