// Mr. Minich
// CMPSC 101
// Ch. 5 Demo Program #3
// January 30, 2000
// Purpose - to demonstrate opening one file for output and writing several pieces of data to the file.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
   string firstName; // user's first name
   string lastName; // user's last name
   int num1 = 0; // user's favorite number

   ofstream outfile("myfile.txt");

   cout << "What is your first name? ";
   cin >> firstName;
   cout << "What is your last name? ";
   cin >> lastName;

   outfile << firstName << " " << lastName << endl;

   cout << "What is your favorite number? ";
   cin >> num1;

   outfile << num1 << endl;

   cout << "This program has stored your name to one line of a file" << endl;
   cout << "and your favorite number to a second line of the same file" << endl;

   return 0;
}// end of main