This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
2
Help with counting arrays
Post Flair (click to view more posts with a particular flair)
Post Body
I'm programming a student report card with arrays. This is a function that assigns the letter grade according to the numeric value
void SetGradeLetter(int studGrade[], char studGradeLetter[]) {
//SIZE is 10 because there should be 10 students
for (int i = 0; i < SIZE; i ) {
if (studGrade[i] <= 100 && studGrade[i] >= 90) {
studGradeLetter[i] = 'A';
}
else if (studGrade[i] <= 89 && studGrade[i] >= 80) {
studGradeLetter[i] = 'B';
}
else if (studGrade[i] <= 79 && studGrade[i] >= 70) {
studGradeLetter[i] = 'C';
}
else if (studGrade[i] <= 69 && studGrade[i] >= 60) {
studGradeLetter[i] = 'D';
}
else if (studGrade[i] <= 59 && studGrade[i] >= 0) {
studGradeLetter[i] = 'F';
}
}
}
the list looks something like this
Name Grade
code: studentname[] << setw << studGrade[] << " " << studGradeLetter[] << endl;
student1 80 B //example
student2 70 C
student3 90 A
student4 100 A
student5 50 F
student6 84 B
student7 91 A
student8 48 F
student9 91 A
student10 61 D
and I'm having trouble with a function that should cout the grades in order and show how many students got each grade.
it should look like this
Grade Total
A | 4
B | 2
C | 1
D | 1
F | 2
I'm confused how should I do the function
Author
Account Strength
100%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
12,047
Link Karma
5,919
Comment Karma
6,050
Profile updated: 15 hours ago
Posts updated: 4 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/programming...