bartBorzeckiLabWeek3

bartBorzeckiLabWeek3 - Bart Borzecki CIS170 Lab 3 November...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Bart Borzecki CIS170 Lab 3 November 15,2008 Problem #1 #include <iostream> #include <fstream> using namespace std; int main() { char ch1 = 'U' ; char ch2 = 'R' ; short int age = 29; ofstream outAges; // ofstream is the data type, outAges is the variable (object) //Open the file. If the file does not exist it will be created. //If the file exists, it will be overwritten. outAges.open( "C:\\Cis170\\ages.dat" ); //Create a file called "ages.dat" outAges << ch1 << ' ' << ch2 << ' ' << age << " years old, in file ages.dat." << endl; cout << ch1 << ' ' << ch2 << ' ' << age << " years old, on the monitor." << endl; outAges.close(); return 0; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Bart Borzecki CIS170 Lab 3 November 15,2008 Problem #2 #include <iostream> #include <fstream> using namespace std; int main() { char ch1 = 'R' ; char ch2 = 'U' ; short int age = 54; ofstream outAges; // ofstream is the data type, outAges is the variable (object) //Open the file. Assume the file exists, and that it will be overwritten. outAges.open(
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

bartBorzeckiLabWeek3 - Bart Borzecki CIS170 Lab 3 November...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online