D
dougmmika
why does the following code not let me enter the phone number nor the address. You would think that if I would have an unwanted \n hanging around my input the first cin.get() would absorb it and at least it would ask me for the address to be input. Instead after entering the first and last name the program quits. Why?
Many thanks to all.
cout<<"Please Enter your first name: ";
cin>>firstStudent.firstName;
cout<<"Please Enter your last name: ";
cin>>firstStudent.lastName;
cout<<"Please enter your Phone Number: (XXX) XXX-XXXX: ";
cin.get(phoneNumber, 15);
cin.get(dummy); //eat the end of line marker
cout<<"Please enter your address: ";
cin.get(address,51);
cin.get(dummy); //eat the end of line marker
Many thanks to all.
cout<<"Please Enter your first name: ";
cin>>firstStudent.firstName;
cout<<"Please Enter your last name: ";
cin>>firstStudent.lastName;
cout<<"Please enter your Phone Number: (XXX) XXX-XXXX: ";
cin.get(phoneNumber, 15);
cin.get(dummy); //eat the end of line marker
cout<<"Please enter your address: ";
cin.get(address,51);
cin.get(dummy); //eat the end of line marker