Need help finishing program please and thank you!
Feb 27, 2012 at 3:49am UTC
Here is an example of what my program should do and print as the out put. But my program is only showing the scores and not per section and not high or low scores either.
Test Case 1: Class with three sections.
Sample input 1
2 80 97
5 69 79 89 99 58
7 60 70 80 90 100 0 59
Sample output 1
2 80 97
Scores for section 1
A's: 1
B's: 1
C's: 0
D's: 0
F's: 0
Lowest Score: 80
Highest Score: 97
Average Score: 88.50
5 69 79 89 99 58
Scores for section 2
A's: 1
B's: 1
C's: 1
D's: 1
F's: 1
Lowest Score: 58
Highest Score: 99
Average Score: 78.80
7 60 70 80 90 100 0 59
Scores for section 3
A's: 2
B's: 1
C's: 1
D's: 1
F's: 2
Lowest Score: 0
Highest Score: 100
Average Score: 65.57
Total number of sections: 3
Total number of scores: 14
Class Average: 73.57
That's all the sections!! Normal Termination.
Here is my program thus far. Thank you for your help!!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int score; // input variable
int section = 0;
int high_score = 0; // highest score of section
int low_score = 0; // lowest score of section
float average_section = 0; // average of all scores in the section
float average_score = 0; // average scores of class
int total_sections = 0; // total number of sections
int total_scores = 0; // total number of scores
int A_count = 0;
int B_count = 0;
int C_count = 0;
int D_count = 0;
int F_count = 0;
int loop_count = 0;
cout << fixed << showpoint << setprecision(2);
cin >>section;
cin >>score;
loop_count = section;
while (loop_count == section)
{
if ((score >= 90) && (score <= 100));
A_count++;
score++;
if ((score >= 80) && (score < 90));
B_count++;
score++;
if ((score >= 70) && (score < 80));
C_count++;
score++;
if ((score >= 60) && (score < 70));
D_count++;
score++;
if (score < 60);
F_count++;
score++;
if (high_score > score);
high_score = score;
if (low_score < score);
low_score = score;
total_scores = score + 1;
total_sections = section + 1;
loop_count = loop_count + 1;
loop_count++;
cout << "A's: " << A_count << endl;
cout << "B's: " << B_count << endl;
cout << "C's: " << C_count << endl;
cout << "D's: " << D_count << endl;
cout << "F's: " << F_count << endl;
cout << "Lowest Score: " << low_score << endl;
cout << "Highest Score: " << high_score << endl;
cout << "Average Score: " <<(high_score+low_score )/ 2.0 <<endl;
cout << "Total number of scores: " << total_scores << endl;
cout << "Total number of sections: " << section << endl;
cout << endl << "That's all the sections!! Normal Termination." << endl;
cin >> score;
}
return 0;
}
Topic archived. No new replies allowed.