Wednesday, September 21, 2016

Basic To Class Type Conversion

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();
   
}