Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int mult ( int, int );
- int add ( int, int );
- int sub ( int, int );
- int divide ( int, int );
- int main()
- {
- int x;
- int y;
- char operation;
- cout<<"Please input two numbers to be multiplied: ";
- cin>> x >> y;
- cin.ignore();
- 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: ";
- cin>> operation;
- if (operation == "a")
- {
- cout<< "The sum of the numbers is "<< add (x, y) <<"\n";
- }
- cin.get();
- }
- int mult ( int x, int y )
- {
- return x * y;
- }
- int add ( int x, int y )
- {
- return x + y;
- }
- int sub (int x, int y)
- {
- return x - y;
- }
- int divide (int x, int y)
- {
- return x / y;
- }
Add Comment
Please, Sign In to add comment