March 18, 2021

Digital clock using C++

Digital clock using c++
Object oriented concepts are used in this program...........



 

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

find the cube of the range given digits. || codeAj

Find the cube of the range given Digits. Source Code r= int ( input ( "enter the range of digit : " )) def number_conter (n): ...