Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //equation to be done in the main
- void AdditionEq(){
- int a, b, sum;
- cout<< "Please enter the 1st integer: ";
- cin>> a;
- cout<< "Please enter the 2nd integer: ";
- cin>> b;
- sum=a+b;
- cout<< "The result is: " <<sum<<endl;
- }
- void SubtractionEq(){
- int a, b, diff;
- cout<< "Please enter the 1st integer: ";
- cin>> a;
- cout<< "Please enter the 1st integer: ";
- cin>> b;
- diff=a-b;
- cout<< "The result is: " <<diff<<endl;
- }
- void DivisionEq(){
- int a, b, quad;
- cout<< "Please enter the 1st integer: ";
- cin>> a;
- cout<< "Please enter the 2nd integer: ";
- cin>> b;
- quad=a/b;
- cout<< "The result is: " <<quad<<endl;
- }
- void MultiplicationEq(){
- int a, b, pro;
- cout<< "Please enter the 1st integer: ";
- cin>> a;
- cout<< "Please enter the 1st integer: ";
- cin>> b;
- pro=a*b;
- cout<< "The result is: " <<pro<<endl;
- }
- int main()
- {
- //Options for user
- char opt;
- cout<< "Please enter 'a' for ADDITION, 's' for SUBTRACTION, 'd' for DIVISION and 'm' for MULTIPLICATION: ";
- cin>> opt;
- if(opt=='a' || 'A'){
- AdditionEq();
- }else if (opt=='s' || opt=='S'){
- SubtractionEq();
- }else if (opt=='d' || opt=='D'){
- DivisionEq();
- }else if (opt=='m' || opt=='M'){
- MultiplicationEq();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement