There are several things you can do:
1. Use functions;
2. Use loops - for, while;
3. Use a switch statement.
Look in the reference & articles section - top left of this page.
The first part should go into a ShowMenu function, the rest should be in a switch with a default clause instead of the test:
if(opt2<1 && opt2!=0 || opt2>10)
A handy looping thing goes as follows:
1 2 3 4 5 6 7 8 9 10
|
bool Quit - false;
while (!Quit) {
//your code here
//ask user if they want to quit
//convert answer to upper case using toupper function
Quit = true;
}
|
Another thing - your cout statements don't have to be on one line - you can split them with the same effect:
1 2 3
|
cout <<"Student number: " << maxNumber << " Name: " << maxName ;
cout << "Last Name: " << maxLname << " Average: " << maxAv
cout << " Letter grade: " << maxLettergrade << "\n\n";
|
I put spaces in to make it much more readable.
Also, don't use the system function - there is an article of why not to do this & some alternatives.
Hope all goes well & have fun !!