Monday, July 27, 2009

CPP Question?

Given this program:





#include %26lt;iostream%26gt;


int main()


{


std: :cout %26lt;%26lt; "Hello, world!\n";


}








modify it to produce this output:





Initialize


Hello, world!


Clean up





Do not change main() in any way.

CPP Question?
Looks like homework to me, so I'm not going to give you the code...





Tip: create a global instance of a class that outputs the required texts in its ctor and dtor, respectively.
Reply:Oh, OK, sorry about that then. Still, my way is more educational than giving you the answer. :-) Good on ya for trying the examples, that's the best way to learn! Report It



No comments:

Post a Comment