Guest User

Untitled

a guest
May 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int mult ( int, int );
  6. int add ( int, int );
  7. int sub ( int, int );
  8. int divide ( int, int );
  9.  
  10. int main()
  11. {
  12.   int x;
  13.   int y;
  14.   char operation;
  15.  
  16.   cout<<"Please input two numbers to be multiplied: ";
  17.   cin>> x >> y;
  18.   cin.ignore();
  19.   cout<<"\nnow choose whether you would like to do with them.\ntype a for add\n type m for multiply\ntype d for divide\nor type s for subtract: ";
  20.   cin>> operation;
  21.   if (operation == "a")
  22.   {
  23.       cout<< "The sum of the numbers is "<< add (x, y) <<"\n";
  24.   }
  25.   cin.get();
  26. }
  27.  
  28. int mult ( int x, int y )
  29. {
  30.   return x * y;
  31. }
  32. int add ( int x, int y )
  33. {
  34.     return x + y;
  35. }
  36. int sub (int x, int y)
  37. {
  38.     return x - y;
  39. }
  40. int divide (int x, int y)
  41. {
  42.     return x / y;
  43. }
Add Comment
Please, Sign In to add comment