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

21st Oct 2016, 2:41 PM
wabu
6 Respuestas
+ 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.
24th Oct 2016, 4:10 PM
Zeke Williams
Zeke Williams - avatar
0
Code?
21st Oct 2016, 2:58 PM
wabu
0
Zeke thank you so much that shared some light... I will ask for more clarification if i am stuck
23rd Oct 2016, 10:21 PM
wabu
0
Would you care to write the full report card code please
23rd Oct 2016, 10:23 PM
wabu
- 1
ecrire
21st Oct 2016, 2:49 PM
ouaami mouh
- 1
variable n.p entier
21st Oct 2016, 2:50 PM
ouaami mouh