EchoNum - endl; getline(cin, filename); if(filename ==...

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

View Full Document Right Arrow Icon
#include <iostream> #include <fstream> using namespace std; // Note this is a reference: why is it? { int x; while(true) { input >> x; if(!input) break; cout << x << " "; } } int main() { string filename; cout << "Enter a filename to read from, or nothing to read from console:" <<
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: endl; getline(cin, filename); if(filename == "") { readFrom(cin); } else { ifstream fin(filename.c_str()); readFrom(fin); } cout << endl; }...
View Full Document

This note was uploaded on 10/28/2010 for the course CSCI 1113 taught by Professor Staff during the Spring '08 term at Minnesota.

Ask a homework question - tutors are online