This program will use the concept of arrays. This is also called subscripted variables.
You will be asked to calculate test average and letter grade for a class of 20-30 students.
Your program will start out by asking how many students in the class.
Must put randomize(); Just after main. Also, #include<stdlib.h>
cout<<”How
many in the class?”<<endl;
cin>>size;
Now
fill the array with random numbers in the range of 45-105.
Use a loop like this…
for(z=0;
z<size; ++z)
num[z]=random(61)+45;
Whenever I start thinking
that I am not living up to my potential, I remind myself of the old farmer
and his fight to the death with the insane pig. It’s an exciting story, and it takes my mind off all this
“potential” business. ~Jack Handey
Determine the letter grade for each person using a switch on
the score.
for(z=0;
z<size; ++z)
{
number=floor(num[z]/10)
switch(number)
ac is a counter.
Keep count for each grade. Start ac at 0.
{
case
10:
case 9: grade[z]=’A’;
ac++;
break;
*****************Class: Industrial Techno
Cooking******************* # TEST GRADE 1. 85 B 2. 77 C 3. 101 A 21. 55 F Students Processed: 21 Class average: 79.55 Grade distribution: A’s: 8 B’s: 7 C’s: 3 D’s: 1 F’s: 2
![]()
![]()
Print
the following chart when done…