source code
#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;
class time
{
public:
int h,m,s;
public:
void gettime()
{
int e=0;
while (e==0)
{
cout<<"hour : ";
cin>>h;
cout<<"minute : ";
cin>>m;
cout<<"secound : ";
cin>>s;
if (h<24 && m<60 && s<60)
{
e++;
}
else
{
system ("cls");
}
}
}
void conditions()
{
system("cls");
cout<<h<<":"<<m<<":"<<s<<endl;
Sleep(1000);
s++;
}
void secound()
{
if (s>59)
{
s=0;
m++;
}
}
void minute ()
{
if (m>59)
{
m=0;
h++;
}
}
void hour ()
{
if (h>24)
{
h=0;
}
}
};
int main()
{
int a=0;
time obj;
obj.gettime();
while(a==0)
{
obj.conditions();
obj.secound();
obj.minute();
obj.hour();
}
}
No comments:
Post a Comment