AUTOMATIC SHUTDOWN THE CONSOLE

i want the console auto shutdown after 1 minute because i dont want anyone who try fake ID and password.so how can i auto shutdown the consol after 1 minute....the code is just for show...have not finished yet....waitting for u

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<iostream>
#include<cstring>
#include<Windows.h>
using namespace std;
int main(){
system("color e9");


char id[]="1";
char id2[50];
char password[]="1";
char password2[50];
bool a=true;
int x=0;

while(a&&x<=2)
{
	
	cout<<"ID= ";cin>>id2;
	cout<<"PASSWORD= ";cin>>password2;
	if(strcmp(id,id2)==0&&strcmp(password,password2)==0){a=false;cout<<"DO IT\n";}
	if(strcmp(id,id2)!=0&&strcmp(password,password2)==0){cout<<"\t\t\t\tPASSWORD OK\n";x++;}
	if(strcmp(id,id2)==0&&strcmp(password,password2)!=0){cout<<"\t\t\t\tID OK\n";x++;}
	if(strcmp(id,id2)!=0&&strcmp(password,password2)!=0){cout<<"\t\t\t\tID & PASSWORD IS WRONG\n";x++;}
}
}


}
You need a thread. See this:

http://www.cplusplus.com/reference/condition_variable/condition_variable/

Replace wait() with wait_for(...). Set ready to true (and notify cv) if the login is sucessfull otherwise on timeout within the thread exit().
all the code you give me can not run....
i use dev c++...can any one help me
You need to enable C++11 in your settings. Go to Tools->Compiler options->Settings->Code generation->language standard and set it to ISO C++11. If it still won't work then post all the error messages you get.
i use dev c++...can any one help me

with dev c++ i'm afraid you're beyond help, the best u could do is switch to a modern IDE like Code::Blocks immediately
@gunnerfunner,
in Code::Blocks setting the compiler options is not much easier.
thomas - the question was not whether it was easier or not but which one is more modern - C::B admits (some of) the C++14 stuff which I don't think DevCPP does and the program in the link I posted has been tested with C::B
Dev-Cpp uses the same MinGW compiler that comes with Code::Blocks 16.01.
the program in the link I posted

Which one ? There are quite a few code examples.
Topic archived. No new replies allowed.