Okay, I know this is a little weird, but my son needs some help figuring this out.
He is taking a Computer Programming for Engineers class, using C++ in the Sun environment. The lab instructor asked him for his algorithm. He had no clue what she was talking about. I'm a PHP programmer, so I sort of had an idea, but it's been a really long time since I was in college and we just had to turn in our code and output.
I have looked in my 2 C++ books and around on the internet a bit. I found a good definition, but couldn't find an example that was basic enough for this program. Essentially what he had to do was to print out about 7 lines of output:
// Lab3a.cpp cout spacing
#include <iostream>
using namespace std;
int main ()
{
cout << "*** ***" << endl;
cout << "Line 2 of the output\n";
cout << "Line 3 of the output\n";
cout << "\n";
cout << "A blank line is above this line" << endl;
cout << "Line 6 of the output\n";
//put 3 blank lines below this comment
cout << "\n\n\n";
cout << "Line 6 of the output\n";
cout << "*** ***" << endl;
return 0;
}
A very simple program. He got the required output, but I'm not exactly sure about how to tell him to go about writing an algorithm for it. I'm going to lab with him tomorrow night. Any ideas?
I don't think he'll ever be a programmer 🙁 but I think he'll make a good Civil Engineer as long as he gets to play in the dirt every now and then 🙂
Thanks