Posted: Tue Aug 14, 2007 9:44 pm Post subject: [C++] How do you?
In Visual C++ all I've done is use the
Code:
system("pause")
and
Code:
cin.get()
to stop the program from closing itself immediately, but I was wondering if there was a way to restart the program instead of closing it? Or a code that stops the program from closing until you click the X on the top right hand corner. _________________
What dosen't kill you, usually does the second time.
you can also use the goto syntax and the systen("cls") and system("pause>nul")
code template:
Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
begin:
cout << "Hello World!\n";
system("pause>nul"); //wait till keyboard pressed
system("cls"); //erase all from command line
goto begin;
return 0;
}
never ending*
use with switch function for better resault. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum