[try Beta version]
Not logged in

 
homework help please

Feb 13, 2015 at 2:37pm
thanks everyone.
Last edited on Feb 15, 2015 at 1:59pm
Feb 13, 2015 at 3:15pm
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 Feb 13, 2015 at 3:16pm
Feb 13, 2015 at 4:04pm
add two line
1
2
3
#include<stdlib.h>// add header

system("pause");// before return 
return 0;
Feb 13, 2015 at 4:05pm
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.
Feb 13, 2015 at 5:55pm
Use a for loop, this looks incompetent
Feb 14, 2015 at 4:15am
or you can do this

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

_getch();//before return 
Feb 14, 2015 at 10:00am
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.
Feb 14, 2015 at 5:43pm
thank you all for your input.
Topic archived. No new replies allowed.