Program -
#include<iostream.h>
#include<iostream.h>
#include<conio.h>
class abc
{
private:
int a,b,c;
public:
void read();
void write()
{
cout<<"\n
sum of two no is:"<<sum();
}
int sum()
{
c=a+b;
return(c);
}
};
void abc::read()
{
cout<<"\n
enter the value of a & b:";
cin>>a>>b;
}
void main()
{
class abc m1;
clrscr();
m1.read();
m1.write();
getch();
}
Output :
enter the value of a & b:5 7
sum of two no is:12
0 comments:
Post a Comment