Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
430 B
2
Indexable
Never
#include <iostream>
using namespace std;
class Calculate{
    private: 
    int a;
    int b;
           public: Calculate(int x,int y){
               a=x;
               b=y;
           }
           void display(){
               int s=a+b;
               cout<<"Sum is: "<<s;
           }
};

int main()
{
    int m,n;
    cout<<"Enter two number";
    cin>>m>>n;
    Calculate ob(m,n);
    ob.display();
    

    return 0;
}
Leave a Comment