Help - My code isn't working
So I'm trying to make a countdown, but this happens
Here's my code, any help is appreciated.
#include <iostream>
#include <windows.h>
using namespace std;
int sec = 0;
int minu = 1;
void Seconds () {
bool stay = true;
while (minu > 0) {
cout << minu << " minutes and " << sec << " seconds left!" << endl;
if (sec == 0) {
sec = 60;
minu -= 1;
}
Sleep (1000);
sec -= 1;
}
if (minu == 0) {
while (sec > 0) {
Sleep (1000);
cout << minu << " minutes and " << sec << " seconds left!" << endl;
}
cout << "Time is up!" << endl;
}
}
int main () {
Seconds ();
return 0;
}
and yes, I am using a windows PC
Voters
What is wrong? what is the desired output?
@ch1ck3n Nevermind, I forgot to -1 to seconds.