Hey, i was just messing around and made a calculator and was just wondering if there was a way i could make it shorter? I'm not really bothered i just want to know?
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
system("TITLE My Calculator Program.");
system("COLOR 4");
double firstNumber, secondNumber;
char operation;
cout << "NOTE: YOU CAN USE X/x INSTEAD OF * FOR MULTIPLICATION!\n\n\n\n";
cout << "Please enter the first number : ";
cin >> firstNumber;
cout << "\nWhich type of calculation would you like to use? : ";
cin >> operation;
cout << "\nPlease enter the second number : ";
cin >> secondNumber;
switch(operation)
{
case '+':
cout << "\nAnswer = " << (firstNumber + secondNumber);
break;
case '-':
cout << "\nAnswer = " << (firstNumber - secondNumber);
break;
case '*':
cout << "\nAnswer = " << (firstNumber * secondNumber);
break;
case 'x':
cout << "\nAnswer = " << (firstNumber * secondNumber);
break;
case 'X':
cout << "\nAnswer = " << (firstNumber * secondNumber);
break;
case '/':
cout << "\nAnswer = " << (firstNumber / secondNumber);
break;
}
system("PAUSE > nul");
}
Thanks.