Answer to Question #198474 in C++ for zain ul abdeen

Question #198474

Make a class with name as your arithematic.

Class one add two integer.second class subtract.third class multiply.four classes one main class.other feriend classes.using friend class.display output.



1
Expert's answer
2021-05-25T14:23:12-0400
#include<iostream>
using namespace std;
class Arithemetic
{
public:
    int num1,num2;
    int Add()
    {
        int add;
        return add=num1+num2;
    }
    int Subtract()
    {
        int subtract;
        return subtract=num1-num2;
    }
    int Multiply()
    {
        int multiply;
        return multiply=num1*num2;
    }
    void display()
    {
        cout<<"\nFirst number : "<<num1;
        cout<<"\nSecond number : "<<num2;
        cout<<"\nAddition : "<<Add();
        cout<<"\nSubtraction : "<<Subtract();
        cout<<"\nMultiplication : "<<Multiply();
    }


};
int main()
{
    Arithemetic a1;
    cout<<"Enter first number : ";
    cin>>a1.num1;
    cout<<"Enter second number : ";
    cin>>a1.num2;
    a1.display();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog