Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //i wrote all the other functions further up in the file, just testing with the add function for now
- void add(int a, int x)
- {
- int result = a + x;
- cout << a << " + " << x << " is equal to " << result;
- }
- int main()
- {
- srand(time(NULL));
- cout << "Please select your operation: \n";
- cout << "1. Addition \n2. Subtraction \n3. Multiplication \n4. Division \n5. Random Number \n0. Quit \n";
- int option;
- int first;
- int second;
- cin >> option;
- do
- {
- switch (option)
- {
- case 1:
- cout << "Please select the first number: ";
- cin >> first;
- cout << "Please select the second number: ";
- cin >> second;
- add(first, second);
- break;
- case 2:
- cout << "Please select the first number: ";
- cin >> first;
- cout << "Please select the second number: ";
- cin >> second;
- sub(first, second);
- break;
- case 3:
- cout << "Please select the first number: ";
- cin >> first;
- cout << "Please select the second number: ";
- cin >> second;
- multi(first, second);
- break;
- case 4:
- cout << "Please select the first number: ";
- cin >> first;
- cout << "Please select the second number: ";
- cin >> second;
- divide(first, second);
- break;
- case 5:
- int i;
- cout << "Please enter the size limit for your random number: ";
- cin >> i;
- randomnum(i);
- break;
- case 0:
- break;
- }
- } while (option != 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment