0
Generate a code for academic report card which has a student name ID marks and grade.
Marks are as follows A 76-100 B 60-75 C 50-59 S 20-49 F 0-19 Use loop Please help with the code
6 ответов
+ 3
int studentMarks[ 5 ] = { 84, 78 , 90 , 60 , 65 }; //assuming they take 5 classes
char studentName[ ] = "Bob"; // or a string
cout << studentName << "'s report card:" << endl;
for( int i = 0; i < 5; i++ ) {// this will iterate through each grade and test it
if (studentMarks[ i ] ≤ 100 && studentMarks[ i ] ≥ 76 ) {
cout << "A " << studentMarks[ i ] << endl;
} else if ( studentMarks[ i ] ≤ 75 && studentMarks[ i ] ≥ 60 ) {
cout << "B " << studentMarks[ i ] << endl;
} else if (studentMarks[ i ] <= 59 && studentMarks[ i ] >= 50) {
cout << "C " << studentMarks[ i ] << endl;
} else if (studentMarks[ i ] <= 49 && studentMarks[ i ] >= 20) {
cout << "S " << studentMarks[ i ] << endl;
} else if (studentMarks[ i ] <= 19 && studentMarks[ i ] >= 0) {
cout << "F " << studentMarks[ i ] << endl;
}
is this what you were looking for? I have edited and finished the report card for you.
0
Code?
0
Zeke thank you so much that shared some light... I will ask for more clarification if i am stuck
0
Would you care to write the full report card code please
- 1
ecrire
- 1
variable n.p entier