/*************************************************************** CS177/CS477 First lab assignment: Edit, compile and run a C++ program. Here is the sequence of steps for the lab assignment: 1. save this message as a file, called message1 2. copy the file to a file called lab1.cc by: cp message1 lab1.cc 3. edit lab1.cc to extract only the program text. 4. edit the comment block to contain your name, save the file 5. compile the program text by: g++ lab1.cc 6. run the program by typing a.out to view the output 7. run the program with redirected output by: a.out > lab1.out, where lab1.out is a name of a new file 8. use the editor to insert the output file into the program text, at the end of the file. Save this file as lab1.submit 9. print the source code and output by: lpr lab1.submit 10. mail the file to the grader by: mail junpu < lab1.submit 11. hand the printed source code and output to me 12. go home happy!! ******************************************************/ ////////////////////////////////////////////////////// // This programs prints time and date on the screen // // Roger Hartley, Fall 1999, CS 177/477 // ////////////////////////////////////////////////////// #include #include #include int main() { time_t clock = time(0); tm *clockStruct = localtime(&clock); const int length = 10; char temp[10]; strftime(temp, length, "%D", clockStruct); string date(temp); strftime(temp, length, "%R %p", clockStruct); string time(temp); cout << "I finished this at " << time << " on " << date << endl; }