/* testio0.cpp CIS 150 5/31/2005 David Klick This program demonstrates a few cin input functions and the use of C-style strings. */ #include using std::cout; using std::cin; int main(void) { int n, n2; char ch; char line[30]; cout << "Enter a character: "; cin >> ch; cout << ch << '\n'; cin.ignore(); cout << "Enter a character: "; cin.get(ch); cout << ch << '\n'; /* // This technique will not work if name has spaces cout << "Enter your name: "; cin >> line; cout << line; */ // This technique reads a whole line cin.ignore(); cout << "Enter your name: "; cin.getline(line, 30); cout << line; return 0; }