// testgetline.cpp // Program to test clear and ignore member functions // of cin. // Ray S. Babcock // 2/6/03 // #include using namespace std; int main (void) { int my_i(99); int my_j(98); char name[25]; cout << "Enter a value for my_i "; cin >> my_i; //cin.clear(); // clear input cin.ignore(256,'\n'); // ignore next character (new line) cout << "Enter a name :" ; cin.getline(name, 25); cout << "my_i = " << my_i; cout << ", name = " << name << endl; }