demo-getline - cout<<"Now type another line"...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Demo of getline #include <iostream.h> #include <stdio.h> int main() { char inputLine[80]; char inputWord[20]; cout << "Type something" << endl; cin.getline(inputLine, 80); cout << "you typed:" << endl; cout << inputLine; cout << "Now type just one word: "; cin >> inputWord;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << "Now type another line: "; // without this commented-out line, bad things happen! //cin.ignore(80, '\n'); cin.getline(inputLine, 80); cout << "The word: " << inputWord << endl; cout << "The line: " << inputLine << endl; return 0; }...
View Full Document

This document was uploaded on 02/10/2011.

Ask a homework question - tutors are online