#include <iostream.h>
#include <conio.h>
class time
{
int hrs;
int mins;
public:
time()
{}
time(int t)
{
hrs=t/60;
mins=t%60;
}
void display()
{
cout<<"\nHours = "<<hrs;
cout<<"\nMinutes = "<<mins;
}
};
void main()
{
clrscr();
time o1;
int duration;
cout<<"Enter Duration : ";
cin>>duration;
o1=duration; //Invoke the constructor
o1.display();
getch();
}
#include <conio.h>
class time
{
int hrs;
int mins;
public:
time()
{}
time(int t)
{
hrs=t/60;
mins=t%60;
}
void display()
{
cout<<"\nHours = "<<hrs;
cout<<"\nMinutes = "<<mins;
}
};
void main()
{
clrscr();
time o1;
int duration;
cout<<"Enter Duration : ";
cin>>duration;
o1=duration; //Invoke the constructor
o1.display();
getch();
}
0 comments:
Post a Comment