I just can't figure it out. I'm not allowed to use the string library, first of all. But, I want the user to enter their major into a char array, but if they enter too many (runs into input buffer), then present a message and prompt to re-enter their major into the same array. Do I need to somehow erase the array and then have them re-enter? Or, do I check input buffer with cin.peek() != '\n'? I just don't know what to do...
I've been trying a bunch of different things but I'm just stuck going back to my code below for a new solution.
const int MAJORSIZE = 21;
int main()
{
char major[MAJORSIZE];
//Get user's major
cout << "What is your major?: ";
cin.get(major, MAJORSIZE, '\n');
cin.ignore(100, '\n');
return 0;
}