Hello all. I'm pretty new to C++ but not a total beginner. I have done a little program which basicly is a Timer. It's a clock that starts at zero and counts to 4min 45sec, then it playes a sound and restarts.
I want to add a feature which restarts the clock if the user presses the Enter key.
Here's the code (it's not very well organized but doesn't matter in such a small code):
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int kuk=1;
int kuk2=1;
int min;
int sec;
bool reset;
while (kuk2 <= 2){
sec=0;
min=0;
reset=false;
while (kuk <= 2){
PlaySound("alarm.wav",NULL,SND_ASYNC|SND_FILENAME);
Sleep(1000);
kuk++;
}
while (reset == false){
system("CLS");
cout << min << ":" << sec;
sec++;
Sleep(1000);
if (sec >= 60){
min++;
sec=00;
}
if (min == 4 && sec == 45){
reset=true;
}
}
}
return 0;
}