For C++ class we were assigned to write a simple introductory C++ program.
One of the requirements was that a signature block be included with the output of the program. Here is what I came up with:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
// signature block
cout << "-----------------------------" << endl;
cout << "Jim Jones" << endl;
cout << "jim.jones@gmail.com" << endl;
cout << "C++ Programming" << endl;
cout << "Fall 2013" << endl;
Cout << "-----------------------------" << endl << endl;
// request user's name and store in a variable
string name;
cout << "What is your name? ";
getline( cin, name );
// print "Hello" and the user's name
cout << "Hello, " << name << "!" << endl;
return 0;
}
|
I lost points on the signature block portion. Here are the comments I got with my grade:
"Signature block implementation should be separate file. Good job using getline. Use strings or single formatted line for signature block instead of line-by-line outputs."
Being new to C++, I'm not sure exactly what the instructor is looking for. There were no specific instructions on how to implement the signature block and, after I emailed my instructor requesting more info, he has not written back.
So, I was hoping someone on this forum could provide some insight. How can I implement the signature block in a separate file? Should I create a signature block class and create a new signature block object in the main function?
Thanks for any suggestions.