المهم المهم

Page 1

<include <iostream.h# class complex } :public {}()complex ;(complex(float,float ;(complex operator+(complex ;(complex operator-(complex ;()void print :private ;float real,img ;{ (complex::complex(float r,float i } ;real=r ;img=i { (complex complex::operator+(complex a } ;complex temp ;temp.real= real+ a.real ;temp.img= img+ a.img ;cout<<"The sum of imaginary numbers"<<endl ;return temp { (complex complex::operator-(complex a } ;complex temp ;temp.real= real- a.real ;temp.img= img- a.img ;cout<<"The sub of imaginary numbers"<< endl ;return temp { ()void complex::print } ;cout<<real<<"+"<<img<<"i"<<endl { ()main } ;complex a(10,50),b(20,20),c ;c=a+b ;()c.print ;c=a-b ;()c.print ;return 0


<include <iostream.h# class time } :public {}()time ;(time(int,int,int ;(time operator+(time ;()void print :private ;int hour,minute,second ;{ (time::time(int h,int m,int s } ;hour=h ;minute=m ;second=s { (time time::operator+(time a } ;time temp ;temp.second=second+a.second (if(temp.second>60 } ;a.minute+=1 ;temp.second-=60 { ;temp.minute=minute+a.minute (if(temp.minute>60 } ;a.hour+=1 ;temp.minute-=60 { ;temp.hour=hour+a.hour ;return temp { ()void time::print } ;cout<<hour<<"/"<<minute<<"/"<<second<<endl { ()main } ;time a(12,59,2),b(2,14,3),c ;c=a+b ;()c.print ;return 0


{

{ (if(second<=59 ;++second else ;++minute} (if(minute<=59 ;++minute else ;++hour} (if(hour<=23 ;++hour else {{{;hour=24}


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.