// File: lab1.cpp // Author: // Id: // Course: CS2330.01 // Date: Friday January 17, 1997 // Problem statement: This program prints a // 'hello world!' message with user name. // #include #include const int STRLEN = 64; void main(void) { char lastName[STRLEN], // person's last name firstName[STRLEN]; // person's first name // Save the output file lab1.out in c:\temp, or other palces. // Here the path is c:/temp/lab1.out where a '/' is used, not // the regular DOS '\' to avoid the escape sequence. ofstream outFile("c:/temp/lab1.out"); // Get information cout << "Please type in your first name and last name : "; cin >> firstName; cin >> lastName; // Greetings cout << "hello world!" << " from " << firstName << " " << lastName << endl; // Copy information to output file outFile << "Please type in your first name and last name : "; outFile << firstName << " " << lastName << endl; outFile << "hello world!" << " from " << firstName << " " << lastName << endl; }