hi! i am doing this for a school project and i need help with the output. this is what the output is suppose to look like but i don't know how to get their. please help me!
this is the sample output that my program is suppose to look like:
Enter Quiz #1 ===>> 87
Enter Quiz #2 ===>> 92
Enter Homework #1 ===>> 100
Enter Homework #2 ===>> 93
Enter Homework #3 ===>> 98
Enter Homework #4 ===>> 88
Enter Homework #5 ===>> 100
Enter Test #1 ===>> 90
Enter Test #2 ===>> 87
Enter Test #3 ===>> 92
You are very nearly there. Just a couple of comments. The important one is the sequence in which things take place. It should be:
• Input
• Process
• Output
Regarding the getline, you had
1 2 3
cout << "Enter Your Name ===>> ";
getline(cin, Name);
getline(cin, Name);
That is understandable. You have the getline twice because it doesn't work properly. The reason why? After the previous cin >> input, the user presses the enter key, which leaves a trailing newline character '\n' remaining in the input buffer. A more usual way to remove it is to use cin.ignore(). In the code below I use an value of 1000 which will read and discard up to 1000 characters, or until a newline is found.
And after all that, your code doesn't even use the name but outputs John Smith instead ;)
I already mentioned the sequence of events. I renamed some of the sections to make it clearer what each was doing. Use whatever names you wish, but keep things in this order.
Enter Quiz #1 ===>> 87
Enter Quiz #2 ===>> 92
Enter Your Name ===>> Fred Bloggs
Fred Bloggs's grades
Quiz Grades -->> 87, 92
Quiz Average
------------
89.50