0% found this document useful (0 votes)
37 views1 page

Object As Argument

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

Object As Argument

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<iostream.

h>
#include<conio.h>

class Time
{
int hour;
int minute;
public:
/* void getData(int h,int m)
{
hour=h;
minute=m;
}*/
Time() //default constructor
{
hour=0;
minute=0;
}
Time(int n)
{
hour=minute=n;
}
Time(int h,int m)
{
hour=h;
minute=m;
}
void putData()
{
cout<<hour<<" Hour and "<<minute <<" Minutes "<<endl;
}
void sum(Time T2);
};
void Time::sum(Time T2)
{
Time T3;
T3.minute=minute+T2.minute;
T3.hour=T3.minute/60;
T3.minute=T3.minute%60;
T3.hour=T3.hour+hour+T2.hour;
cout<<T3.hour<<" Hour and "<<T3.minute <<" Minutes "<<endl;
}
int main()
{
clrscr();
Time T1(5,50);
Time T2(4,20); //T3=T1+T2;
T1.putData();
T2.putData();
T1.sum(T2);
getch();
return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy