Wednesday, 2 March 2016

Q. Average of two number ?

THE OUTPUT WOULD BE














#include<iostream.h>
#include<conio.h>
class A
{ float a,b,t;
public:
A()
{ a=9;
 b=10;
}
A(float x,float y)
{ a=x;
 b=y;
}
inline void B()
{ t=(a+b)/2;
 cout<<"The average of two number is "<<t;
 cout<<"\n";
}
};
void main()
{ clrscr();
A obj1,obj2(3,4);
obj1.B();
obj2.B();
getch();
}

No comments:

Post a Comment