Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Calc1.cpp : Defines the entry point for the console application.
- //
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- float input1;
- float input2;
- int function;
- cout << "1 is multiply, 2 is divide, 3 is addition, 4 is subtraction?" << 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, dividing" << endl;
- cout << "Enter your numbers" << endl;
- cin >> input1 >> input2;
- cout << "The answer is " << input1 / input2 << endl;
- }
- else if (function == 3){
- cout << "OK, adding" << 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 << "Your a noob and cant divide by 0" << endl;
- system("PAUSE");
- }
- else if (input2 > 0)
- {
- cout << "The answer is " << input1 / input2 << endl;
- system("PAUSE");
- }
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement