Ch2_4_s15 - << endl ; 3. ifstream datain (...

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

View Full Document Right Arrow Icon
Chapter 2.4: Input/Output 1 Next Slide Previous Slide Example statements for text file input 1. ifstream input ( "data.txt“ ) ; input >> variable1 >> variable2 ; cout << variable1 << << variable2 << endl ; 2. ifstream stats ( "age_weight.txt“ ) ; stats >> age >> weight ; cout << "Your age: " << age ; cout << "\nYou weight: " << weight << " pounds\n"
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 ; 3. ifstream datain ( “numbin.txt“ ) ; ofstream dataout ( “numbout.txt” ) ; datain >> a >> b ; dataout << “\na = “ << a << “\nb = “ << b ; datain >> c >> d >> e >> f ; dataout << “\nc = “ << c << “\nd = “ << d ; dataout << “, e = “ << e << “, f = “ << f << endl ;...
View Full Document

This note was uploaded on 05/19/2008 for the course ENGR 25 taught by Professor All during the Spring '08 term at Lehigh University .

Ask a homework question - tutors are online