Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int operatornum;
  9.     double a, b, c;
  10.     int d = 1;
  11. /*
  12.   ______                  _
  13.  / _____)                | |
  14. ( (____   ___   ____ ___ | |  _ _   _ _____
  15.  \____ \ / _ \ / ___) _ \| |_/ ) | | (____ |
  16.  _____) ) |_| | |  | |_| |  _ (| |_| / ___ |
  17. (______/ \___/|_|   \___/|_| \_)\__  \_____|
  18.                                (____/
  19. */
  20.     while (d == 1){
  21.     cout << "  ______                  _" << endl;
  22.     cout << " / _____)                | |" << endl;
  23.     cout << "( (____   ___   ____ ___ | |  _ _   _ _____" << endl;
  24.     cout << " \\____ \\ / _ \\ / ___) _ \\| |_/ ) | | (____ |" << endl;
  25.     cout << " _____) ) |_| | |  | |_| |  _ (| |_| / ___ |" << endl;
  26.     cout << "(______/ \\___/|_|   \\___/|_| \\_)\\__  \\_____|" << endl;
  27.     cout << "                               (____/" << endl;
  28.     cout << "                                         Calculator" << endl;
  29.     cout << "\nSelect your operator!" << endl;
  30.     cout << "1 - Addition \n" << "2 - Subtraction \n" << "3 - Multiplication \n" << "4 - Division \n";
  31.     cout << "\nOperator:";
  32.  
  33.     cin >> operatornum;
  34.  
  35.     cout << "\nEnter First Integer: ";
  36.     cin >> a;
  37.     cout << "Enter Second Integer: ";
  38.     cin >> b;
  39.  
  40.  
  41.     if (operatornum == 1){
  42.     c = a+b;
  43.     }
  44.     if (operatornum == 2){
  45.     c = a-b;
  46.     }
  47.     if (operatornum == 3){
  48.     c = a*b;
  49.     }
  50.     if (operatornum == 4){
  51.         if(b==0){
  52.             cout << "*earth blows up*\n";
  53.             system("pause");
  54.     system("cls");
  55.             main();
  56.         }
  57.     c = a / b;
  58.     }
  59.  
  60.  
  61.     cout << "\nThe Answer is " << c << endl;
  62.     system("pause");
  63.     system("cls");
  64.     }
  65.  
  66.     return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement