Hello my problem in this program is that it dose not stop at 0 it also goes to negative numbers please someone fix this
Code:
#include <iostream>
#include <conio.h>
#include <windows.h>
void newline();
using namespace std;
int main()
{
int hours = 0;
int minutes = 0;
int seconds = 0;
cout<< "Please enter houres: ";
cin>>hours;
cout<< "Enter a minutes: ";
cin>>minutes;
cout<<"Enter seconds: ";
cin>>seconds;
for(;;){
newline();
cout<< hours <<" : "<< minutes <<" : "<< seconds << endl;
Sleep(750);
--seconds;
if(seconds == 0){
--minutes;
seconds = 60;
}
if ( minutes == 0){
-- hours;
minutes = 0 ;
}
if ( hours == 0){
hours = 0;
}
}
return 0;
}
void newline(){
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
}
Comment