Answer to Question #14119 in C++ for shalenee

Question #14119
(simulation clock countdown ). Write a program that prompts the user to enter the number of seconds to be counted down. Display a message each second of the countdown and include an additional warning every five seconds. Terminate when the time expires.
1
Expert's answer
2012-09-06T10:04:40-0400
#include <conio.h>
#include <iostream>
using namespace std;
int numberofseconds=0;
int main(){
int countforwarning=0;
cout<<"Enter the number of seconds to be counted down: ";
cin>>numberofseconds;
for(int i=0;i<5000000000;i++){
if(i0000000==1){
cout<<numberofseconds<<"
";
numberofseconds--;
countforwarning++;
if(countforwarning>0 && countforwarning%5==0){
cout<<"
An additional warning
";
}
if(numberofseconds<0){
break;
}

}
}
getch();
return(0);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS