Problem with a code (newbie)
i wrote this program to collect students marks and names , the problem is , when i run it it skips the name typing part ( getline(cin, name) ) , here's the code : #include <iostream> #include <string> using namespace std; int main() { float m[6]; int r; int x,a=1; string n[6]; string name; while(a==1) { cout << "Enter the student's number : " << endl; cin >> r ; cout << "\nType his full name : " << endl; getline(cin, name) ; n[r] = name ; cout << "\nType in his mark : " << endl; cin >> m[r] ; cout << "\n \n The student number : " <<r<< "\n Name : " << n[r] <<"\n Mark : " << m[r] << endl; cout <<"Enter another student's mark ? \n 1-Yes \n 2-No " << endl; cin >> a ; } cout << "The classroom's Marks are : " << endl; for (x=0;x<6;x++) { cout << n[x] << " NR : "<<x<<" Mark : " <<m[x]<< endl; } return.0; }