### Arithmetic Operators Help

The Program must allow users to enter any two positive numbers and then display the results.
i'm strugglin plzzz help
 ``1234567891011121314151617181920212223242526272829303132333435`` `````` #include using namespace std; class ArithmeticOperators{ private: int x; int y; public: void set_values(); int product(); int difference(); double quotient(); int addition(); }; void ArithmeticOperators::set_values(int,int) cout<<"Enter first value:"<>x; cout<<"Enter second value:"; cin>>y; product=x*y; difference=x-y; quotient=x/y; addition=x+y; } int main{ obj.product() obj.diffeence() obj.quotient() obj.addition obj.printproduct() obj.printdifference() obj.printquotient() obj.printaddition() return 0; } ``````
You have a number of syntax errors in you code (for example you need a pair of parentheses "()" after the main function).

Also in you class declaration set_values has nor arguments but when you define the function it takes two integer parameters. The set_values function should also give the two integer parameters names.

Finally what is this for? The integer class already has a set of operators to use. Normally when creating a class you might overload the operators to be specific to that classes use of the operator. If you need to do this then I would start with sorting out the syntax errors. Then make sure that you have coded all the function for the class. Then in you main function create an instance of the class before using it. You use obj.product() etc but what is obj? the compiler doesnt know about it because you never declare and create an instance of it.

`ArithmeticOperators obj;`
Topic archived. No new replies allowed.