Input the minutes, then the seconds, and it will do the rest. Pretty simple but I just thought I'd post it. Made as a quick test for my game.
Countdown timer
#include <iostream>
#include <windows.h>
#include <cstdlib>
using namespace std;
int main(){
int minutes;
int seconds;
cin >> minutes >> seconds;
seconds = (minutes*60)+seconds;
cout << endl;
while(seconds>0){
if(seconds%60<10){
cout << seconds/60 << ":0" << seconds%60 << endl;
}
else{
cout << seconds/60 << ":" << seconds%60 << endl;
}
Sleep(1000);
seconds--;
}
}
Taywin 312 Posting Virtuoso
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
ben1996123 0 Junior Poster in Training
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
Taywin 312 Posting Virtuoso
doug65536 18 Light Poster
LevyDee 2 Posting Whiz in Training
ratatat 0 Newbie Poster
limaulime 0 Newbie Poster
doug65536 18 Light Poster
PalashBansal96 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.