FANDOM


Programmer's Wiki
This page has been moved to the Programmer's Wiki.
Please do not make any changes or additions to this page.

Any modifications, if still appropriate, should be made on How to make a simple calculator at the Programmer's Wiki.

	#include <iostream.h>
#include <time.h>
#include <stdlib.h>

using namespace std;

int main()
	{
	double num1, num2;
        int opselect;

	cout << "\n welcome.";
	cout << "this is a simple calculator.";
	cout << "\n enter the first number: ";
	cin >> num1;
	cout << "enter operation: ";
	cout << "\n  1 = addition";
	cout << "\n  2 = subtraction";
	cout << "\n  3 = multiplication";
	cout << "\n  4 = division";
      cout << "\n  - ";
	cin >> opselect;
	cout << "enter the second number: ";
	cin >> num2;

	cout << "CALCULATING";
	cout << ".";
	cout << ".";
	cout << ".";

      if (num1 == 2, num2 == 2, opselect == 1)
         {
         cout << num1 << " + " << num2 << " = " << "chair" << endl;
         }
     else
     	switch (opselect)
     		{
	    	case 1:
		           	cout << num1 << " + " << num2 << " = " << num1+num2 << endl;
            		break;
            case 2:
			         cout << num1 << " - " << num2 << " = " << num1-num2 << endl;
			         break;
		    case 3:
                     cout << num1 << " X " << num2 << " = " << num1*num2 << endl;
                     break;
            case 4:
			         cout << num1 << " / " << num2 << " = " << num1/num2 << endl;
			         break;
            }
    system("PAUSE");
	return 0;
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.