I am trying something like this.Its counting down seconds from 5-1.
#include<iostream>
#include<stdlib.h>
#include<windows.h>
#include<iomanip>
using namespace std;
int main()
{
for(int i=5;i>0;i--)
{
cout<<"\n\n\n\n\n\n";
cout<<setw(35);
cout<<i;
Sleep(1000);
system("CLS");
}
system("PAUSE");
}
And i trying to figure out a way to break the loop using a user input(from keyboard) to break it while its running. I have no idea about how to do this.I have heard about multi-threading. I don't even know if multi-threading has any application in my situation or not .So any ideas on how to break it in middle while its executing the loop?
Aucun commentaire:
Enregistrer un commentaire