First thank you (Duthomhas,MikeStgt,JLBorges and jonnin)
Second : I want this loops run in same times . Means of "same time":
1. for example first loop is :
1 2 3 4 5
|
while(1!=2)
{
cout<<"Fist infinite loop is run\n"<<endl;
Sleep(2000);
}
| |
Output :
Fist infinite loop is run
2. for example second loop is :
1 2 3 4 5
|
while(1!=2)
{
cout<<"second infinite loop is run\n"<<endl;
Sleep(3000);
}
| |
Output :
second infinite loop is run
3. for example third loop is :
1 2 3 4 5
|
while(1!=2)
{
cout<<"third infinite loop is run\n"<<endl;
Sleep(4000);
}
| |
Output :
third infinite loop is run
4. When I use three loop in my program :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
while(1!=2)
{
cout<<"Fist infinite loop is run\n"<<endl;
Sleep(2000);
}
while(1!=2)
{
cout<<"second infinite loop is run\n"<<endl;
Sleep(3000);
}
while(1!=2)
{
cout<<"third infinite loop is run\n"<<endl;
Sleep(4000);
}
| |
Output is show only "first infinite loop is run"
is it possible third infinite loop code is run while not stop any loop ?
console output :
1 2 3 4 5 6 7
|
Fist infinite loop is run
second infinite loop is run
third infinite loop is run
Fist infinite loop is run
second infinite loop is run
third infinite loop is run
....
| |
three loop code is run at differente sleep time . loop first run 20 second second loop run 30 second and third loop run 40 second .