In Microsoft visual studio, when you press CTRL + F5, at the end of the program, you can press anything to exit.
How do you to put this into a program manually? So there is no need to press return or enter?
I usually use this at the end:
1 2
|
cin.ignore(99,'\n');
return 1;
|
But you have to hit enter to exit.
Edit: lol, I missed your last sentence.
Use this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
#include <iostream>
#include <conio.h>
using namespace std;
void end();
int main()
{
end();
return(0);
}
void end()
{
cin.ignore(0,'\n');
getch();
}
|
Hope this helps. :)
Last edited on