I'm using the getline function to read the Degree Program of the user but for some reason the program skips the degree program and goes on to the next line which asks for the courses that the useris doing this semester.
This is the code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
char name[256];
char id[256];
string degree;
char courses[256];
cout <<"Please insert your name " << endl;
cin.get(name,25 6);
cout << "Please insert your ID# " << endl;
cin>>id;
cout<<endl;
cout << "Please insert your Degree Program: " << endl;
cin.getline(deg ree,(256));
cout<<endl;
cout << "Please insert your Courses: " <<endl;
cin.getline(cou rses,256);
return 0;
}
This is the code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
char name[256];
char id[256];
string degree;
char courses[256];
cout <<"Please insert your name " << endl;
cin.get(name,25 6);
cout << "Please insert your ID# " << endl;
cin>>id;
cout<<endl;
cout << "Please insert your Degree Program: " << endl;
cin.getline(deg ree,(256));
cout<<endl;
cout << "Please insert your Courses: " <<endl;
cin.getline(cou rses,256);
return 0;
}
Comment