+ 1

Help readjust a c++ program

Good day, am trying to write a code that will take in inputs of two students scores in four subject and grade them with A, B, C, D and E The code is expected to collect the names of the students from the user, the four subjects they wish to grade and the scores they got from each subject. It will print the results. Example: Henry John English A Maths B Physics E Chemistry C It will print results for both students. But now am stuck, when I run the code, it doesn't follow sequence, so please can anyone help me to readjust the code to work? Please use comments so I can understand how you did it, thanks a lot Here is the code I wrote that isn't working, am new to c++ please go easy or should I say, go rookie in your codes so I can understand 😁 😁 Thanks again https://code.sololearn.com/c0yJLdos7D0c/?ref=app

1st May 2020, 10:18 PM
Mehzie
Mehzie - avatar
3 Answers
+ 1
https://code.sololearn.com/cJEqMkcj28iF/?ref=app Here's the code for printing single person's grade.. I used the input Chris Brown Maths 50 English 50 History 90 Geography 100 Also some mistakes i found in your code were : You used s1 for storing marks(int) then assigned grade(char) to s1.. Since the subject names are strings hence subject variables (sub1, sub2...) should be char arrays and not single chars.. You used to check only for grade of s1.. I modified it for all the subjects.. Also don't declare the grades(A, B, C.. )as variables as they are supposed to be characters.. Nice try though... Happy coding! 👍 I hope it helps
2nd May 2020, 10:23 AM
$hardul B
$hardul B - avatar
+ 1
$hardul B thanks, that really helped
3rd May 2020, 12:22 PM
Mehzie
Mehzie - avatar
0
https://code.sololearn.com/cf86j8NDoe3a/?ref=app Well i have changed somethings which were incorrect in your code.. Still I'm unable to print second user's name.. I tried the following input Shardul B Ma 50 Eng 50 Hist 90 Geog 100 Name SN Hss 70 Shshha 90 Sjjsjs 60 Shs 50 Well I'm trying to recode it...
2nd May 2020, 9:52 AM
$hardul B
$hardul B - avatar