C++ examples for File Stream:stream
Prints a name on the printer.
#include <fstream> #include <iostream> using namespace std; void main()// ww w . j ava 2 s . c om { char first[20]; char last[20]; cout << "What is your first name? "; cin >> first; cout << "What is your last name? "; cin >> last; // Send names to the printer. ofstream prn("PRN"); prn << "In a phone book, your name looks like this: \n"; prn << last << ", " << first << "\n"; return; }