homework help please

thanks everyone.
Last edited on
Ha ha. This is the second post you see on the site, after the "welcome" post, which tells you to search before asking. try and read both.

http://www.cplusplus.com/forum/beginner/1988/

EDIT
Hypocrites confession:
I never read those posts either, I had to check just now to be doubly sure of what I wrote above.
Last edited on
add two line
1
2
3
#include<stdlib.h>// add header

system("pause");// before return 
return 0;
that threat is quite lengthy and shows quite some ways of doing it wrong

http://www.cplusplus.com/articles/iw6AC542/
a console program should be run from the console
however, the behaviour that you want should be one of the things an IDE provides, consult the documentation.
Use a for loop, this looks incompetent
or you can do this

1
2
3
#include <conio.h>// add header

_getch();//before return 
The problem with ``add this line before return'' solutions is that they are useless if the code does not reach that line. By instance:
- there is a call to `exit()' or `abort()'
- an exception is thrown and not catch
- there is a fatal error (segmentation fault)

However, if you run your program from the console, when it terminates you are left in the console.
thank you all for your input.
Topic archived. No new replies allowed.