I was wondering if there is a way to make it so that someone can only input a specific data type.
My program ask for input of specific numbers for a menu. If I enter a character, the program crashes.
Is there a way to make it so that it the user is forced to enter an integer?
Here is a piece of the code that could use this. Cant copy the entire program as it is over 600 lines long.
do
{
record[x].setAssignments();
record[x].setGrades();
do
{
cout<<"\n\n\n|:1:| Enter Another Grade\n";
cout<<"|:2:| Exit\n";
cin>>y;
if(y!=1||y!=2)
{
cout<<"Invalid Answer...";
pause();
clear();
}
}while(y!=1||y!=2);
}while(y==1);