vendredi 8 mai 2015

Perform Infinite Loop While Waiting for Input C++

A C++ program that perform such:

 cout<<"Hello please enter in your age: "; 
 int age;
 cin>>age; 

While the system waits for input, I want to display this following loop:

for(;;)
{
 cout << "Waiting.............." << '\r' << flush; Sleep(500);
 cout << ".......Waiting......." << '\r' << flush; Sleep(500);
 cout << "..............Waiting" << '\r' << flush; Sleep(500);
}

The loop should stop when there is any input.

Aucun commentaire:

Enregistrer un commentaire