So my problem here is I am trying to print each the highest and the lowest grades after the user inputs a grade for each. Then ill print the entire list unsorted and then sorted followed by the average and highest grade and lowest grade. Its been awhile but I think a nested loop here is needed but im not sure where to implement it or even how.
Here's what's actually done:
cout<<"How many grades do you have?"<<endl;
for (int x=1; x<=grades;x++)
cout<<"\nGrade on test "<<x<<"?";
runtotal= runtotal + a[x];
cout<<"your average is: "<<runtotal/grades<<endl;
Alright Ive made some progress but it gives me the wrong numbers, anyone could clarify this for me? What I put in comments was giving me problems and when I took it out the error was gone and it ran but the numbers come out wrong.
a) for(int y=1; y<y+1; y++); //line 17 there are two things wrong here. the first being y<y+1. thats an infinite loop. y will always be one less than y+1. secondly there is a semicolon at the end, cause for another infinite loop.
b) line 19) why? its pointless to have an if statement (in 90% of the cases, with this being one of them) that is followed immediately by a semicolon.
finally... fix your formatting. its very hard to read your code