Ace school

with brainly

  • Get help from millions of students
  • Learn from experts with step-by-step explanations
  • Level-up by helping others

A community for students.

Plzzz help Write a C++ program with multiple methods to intake the two integers and do the, Addition, Subtraction, Multiplication, and Division.On your main method u hav to implement selection and repetition of the arithmetic operation

Computer Science
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SEE EXPERT ANSWER

To see the expert answer you'll need to create a free account at Brainly

#include using namespace std; class Arithmetic { private: int answer; int numberA; int numberB; public: int addition(int numberA,int numberB); int subtraction(int numberA,int numberB); int multiplication(int numberA,int numberB); int division(int numberA,int numberB); int getNumberA(); void setNumberA(int numberA); int getNumberB(); void setNumberB(int result); int getAnswer(); void setAnswer(int result); void printOnScreen(); }; int Arithmetic::getNumberA() { return numberA; } void Arithmetic::setNumberA(int A) { numberA=A; } int Arithmetic::getNumberB() { return numberB; } void Arithmetic::setNumberB(int B) { numberB=B; } int Arithmetic::addition(int numberA,int numberB) { return (numberA+numberB); } int Arithmetic::subtraction(int numberA,int numberB) { return (numberA-numberB); } int Arithmetic::multiplication(int numberA,int numberB) { return (numberA*numberB); } int Arithmetic::division(int numberA,int numberB) { return (numberA/numberB); } int Arithmetic::getAnswer() { return answer; } void Arithmetic::setAnswer(int result) { answer=result; } void Arithmetic::printOnScreen() { cout<>choice; switch(choice) { case 1: answer=a.addition(A,B); a.setAnswer(answer); a.printOnScreen(); answer=a.addition(A,B)+A; a.setAnswer(answer); break; case 2: answer=a.subtraction(A,B); a.setAnswer(answer); break; case 3: answer=a.multiplication(A,B); a.setAnswer(answer); break; case 4: answer=a.division(A,B); a.setAnswer(answer); break; default: cout<<"Wrong choice"<
With the exception of this: answer=a.addition(A,B)+A; it all looks pretty good. Were you having difficulty with this code?
No. vat my problem is i dnt knw how to include a code that instructs the arithmetic operations to be repeated. because that's vat the question asks me to do.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

You could enclose the main switch section in a while loop, this would cause it to repeat until some condition, maybe while(choice != 0). Is that what you're looking to do?
while(choice != 0) { cout<<"Enter the choice:\n"; cout<<"Press 1 for addition:\n"; cout<<"Press 2 for subtraction:\n"; cout<<"Press 3 for multiplication:\n"; cout<<"Press 4 for division:\n"; cout<<"Press 0 to exit:"; cin>>choice; switch(choice) { case 0: break; case 1: answer=a.addition(A,B); a.setAnswer(answer); a.printOnScreen(); answer=a.addition(A,B)+A; a.setAnswer(answer); break; case 2: answer=a.subtraction(A,B); a.setAnswer(answer); break; case 3: answer=a.multiplication(A,B); a.setAnswer(answer); break; case 4: answer=a.division(A,B); a.setAnswer(answer); break; default: cout<<"Wrong choice"<
No. i didn't mean this. I want the addition operation to repeat again by the insertion of single code.

Not the answer you are looking for?

Search for more explanations.

Ask your own question