Program To Convert Basic data Type To Class Type:
#include<iostream>
using namespace std;
class time
{
int hours;
int minutes;
public:time()
{
}
time(int m)
{ hours=m/60;
minutes=m%60;
}
void display()
{
cout<<"\nTime Is "<<hours<<" Hours and "<<minutes<<"Minutes";
}
};
main()
{
time t(165);
t.display();
}
#include<iostream>
using namespace std;
class time
{
int hours;
int minutes;
public:time()
{
}
time(int m)
{ hours=m/60;
minutes=m%60;
}
void display()
{
cout<<"\nTime Is "<<hours<<" Hours and "<<minutes<<"Minutes";
}
};
main()
{
time t(165);
t.display();
}