Need help. Not sure how to fix code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need help. Not sure how to fix code.

My cODE IS OUTPUTTING ALOT OF THE COUT STATEMENT AND DONT KNOW HOW TO FIX . NeED SOME HELP. Thanks https://code.sololearn.com/c961lGYP332t/?ref=app HERE IS MY CODE

20th Feb 2021, 3:05 AM
Carlye
Carlye  - avatar
9 Answers
0
hi Carlye that is because that code is in the while loop so will be printed every time the loop iterates
20th Feb 2021, 3:26 AM
Ollie Q
Ollie Q - avatar
0
how do i get to leave the loop once its done?
20th Feb 2021, 3:51 AM
Carlye
Carlye  - avatar
0
i also need it to be a do while loop. would that help the problem with the loop?
20th Feb 2021, 3:52 AM
Carlye
Carlye  - avatar
0
so what you need to do is... move this code so that it is outside and above the loop... cout<<"Enter 100 Grades separated by a single space, then press <Enter>: "; cin>>x; secondly you need to split the string before the while loop. thirdly the code will end automaticly at return 0;
20th Feb 2021, 4:44 AM
Ollie Q
Ollie Q - avatar
0
which part of the string?
20th Feb 2021, 11:20 PM
Carlye
Carlye  - avatar
0
sorry not sure what you mean
20th Feb 2021, 11:26 PM
Carlye
Carlye  - avatar
0
by split the string i mean take the variable x and split it into the hundred grades
21st Feb 2021, 12:02 AM
Ollie Q
Ollie Q - avatar
0
can i see an example. i dont think ive done what youare explaining
21st Feb 2021, 12:53 AM
Carlye
Carlye  - avatar