helpppp

Write your question here.

[code]
#include <iostream>
#include <conio.h>
#include <Windows.h>

using namespace std;
int main()

{
int s,total;

cout << "Please enter the number of second : ";
cin >>s;

for(int sec = s; s>=0; s--)
{

cout <<s<< " seconds remaining" <<endl;
Sleep(200);

if (s == 5)
{
cout << "Warning : " <<s<< " seconds remaining!" <<endl;
Sleep(200);
}
}
cout << "TIMES UP !" <<endl;

return 0;
}

how to make the output become :

6 sec remaining
warning ! 5 seconds remaining
so on..
1
2
3
4
5
while (s > 0)
{
  cout << "warning ! " <<  s-- << " seconds remaining \n";
  Sleep(1000);
}
if i want to make the output become :

6 seconds remaining
warning ! 5 seconds remaining
4 seconds remaining
3 seconds remaining
2 seconds remaining
1 seconds remaining
TIMES UP!
1
2
3
4
5
6
while (s > 0)
{
  if (s==5) cout << "warning ! ";
  cout <<  s-- << " seconds remaining \n";
  Sleep(1000);
}
alright thank you mate :)
Topic archived. No new replies allowed.