cout<<" STUDENT #1 \n"<<endl;
cout<<"What is your major?"<<endl;
cin.getline(major, 20);
cout<<"What is your first name?"<<endl;
cin>> firstname;
cout<<"What is your last name?"<<endl;
cin>> lastname;
cout<<"How old are you?"<<endl;
cin>> age;
cout<<"What is your GPA?"<<endl;
cin>> gpa;
if(gpa <2 )
{ cout<<"INVALID!"<<endl;
cout<<" Enter GPA, where GPA cannot be less than 2 or greater than 4";
cin>> gpa;}
if(gpa >4 )
{ cout<<"INVALID!"<<endl;
cout<<" Enter GPA, where GPA cannot be less than 2 or greater than 4\n";
cin>> gpa;}
cout<<"\n";
cout<<"Hello "<<firstname<<" "<<lastname<<"\n"<<endl;
cout<<"You are "<< age<<" years of age"<<" and your major is "<<major<<"\n"<<endl;
cout<<"Your present GPA is:"<<gpa<<"\n"<<endl;
cout<<"\n"<<endl;
cout<<" STUDENT #2 \n"<<endl;
cout<<"What is your major?"<<endl;
cin.getline(major2, 20);
cout<<"What is your first name?"<<endl;
cin>> firstname;
cout<<"What is your last name?"<<endl;
cin>> lastname;
cout<<"How old are you?"<<endl;
cin>> age;
cout<<"What is your GPA?"<<endl;
cin>> gpa;
if(gpa <2 )
{ cout<<"INVALID!"<<endl;
cout<<" Enter GPA, where GPA cannot be less than 2 or greater than 4";
cin>> gpa;}
if(gpa >4 )
{ cout<<"INVALID!"<<endl;
cout<<" Enter GPA, where GPA cannot be less than 2 or greater than 4\n";
cin>> gpa;}
cout<<"\n"<<endl;
cout<<"Hello "<<firstname<<" "<<lastname<<"\n"<<endl;
cout<<"You are "<< age<<" years of age"<<" and your major is "<<major2<<"\n"<<endl;
cout<<"Your present GPA is:"<<gpa<<"\n"<<endl;
cout<<"\n";
The cin.get(ch) will eat up the newline that cin >> gpa; left in the stream. With your original code, cin.getline(major2, 20) reads that newline, discards it, and returns. That's why you don't get a chance to enter the major.