Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- float input1;
- float input2;
- int function;
- cout << "1 is multiply, 2 is addication, 3 is subtraction, 4 is division" << endl;
- cin >> function;
- if (function == 1)
- {
- cout << "OK, multiplying" << endl;
- cout << "Enter your numbers" << endl;
- cin >> input1 >> input2;
- cout << "The answer is " << input1*input2 << endl;
- }
- else if (function == 2){
- cout << "OK, adding" << endl;
- cout << "Enter your numbers" << endl;
- cin >> input1 >> input2;
- cout << "The answer is " << input1 + input2 << endl;
- }
- else if (function == 3){
- cout << "OK, subtracting" << endl;
- cout << "Enter your numbers" << endl;
- cin >> input1 >> input2;
- cout << "The answer is " << input1 - input2 << endl;
- }
- else if (function == 4){
- cout << "OK, dividing" << endl;
- cout << "Enter your numbers" << endl;
- cin >> input1 >> input2;
- if (input2 == 0)
- {
- cout << "You're a noob, you cant divide by 0" << endl;
- }
- else if (input2 > 0)
- {
- cout << "The answer is " << input1 / input2 << endl;
- }
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement