These is my code and i need to change it so that the second out put replaces the first and so on.
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int a = 0;
int h;
int m;
int s;
mistake:
cout << "What is the current hour?\n";
cin >> h;
cout << "\nWhat is the current minute?\n";
cin >> m;
cout << "\nWhat is the current second?\n";
cin >> s;
if (h > 24 || m > 60 || s > 60)
{
cout << "\nPlease try again!\n\n";
goto mistake;
}
system("clear");
while (a == 0)
{
cout << h << ":" << m << ":" << s <<endl;
sleep(1);
system("clear");
s++;
if (s > 59)
{
s = 0;
m++;
if (m > 59)
{
m = 0;
h++;
if (h > 24)
{
h = 0;
}
}
}
}
return 0;
}
so does any one have any idea?