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:
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?
The instructor means that you have to put your signature in a file that can be included in your program, so that, for example, in a work environment, not all people will be stuck with your signature, and will only have to change a single file to change the signature. So first, put your signature in function:
#include <iostream>
#include <string>
usingnamespace std;
#include "JimSignature.h"
int main()
{
// signature block
DoSign();
// 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;
}
The instructor also didn't seem to like how I used multiple cout lines. In the comments with my grade he wrote, "Use strings or single formatted line for signature block instead of line-by-line outputs."
Does he mean just put the entire message into a string variable?