Sunday, 15 January 2012

Program Of Addition Of Two Numbers Using Class In C++

    #include<iostream.h>
    #include<conio.h>
   
 class pawan
      {
private:
int x,y;
public:
void getdata(int p,int q)
{
x=p;
y=q;
}
void display()
     {
int z;
z=x+y;
cout<<z;
     }
     };

main()
{
pawan a1;
int a,b,c;
cout<<"entaer numbers=";
cin>>a>>b;
a1. getdata(a,b);
a1.display();
getch();
}

No comments:

Post a Comment