View difference between Paste ID: nwKxb0jZ and nNefYfWQ
SHOW: | | - or go back to the newest paste.
1-
/*This is a advanced command line calculator that ask for two numbers and what you want to do with	 two numbers.  It's kinda boring but that's fine!							*/
1+
/This is a advanced command line calculator that ask for two numbers and what you want to do with	 two numbers.  It's kinda boring but that's fine!							*/
2
3
4
#include <iostream>
5
using namespace std;
6
int main()
7
{
8
	int num1; //first number inputed
9
	int num2; //second number inputed
10
	char action; //The user defining what type of action to take
11
12
13
	cout << "Enter the first number: ";
14
	cin >> num1;
15
	cout << "Enter the second number: ";
16
	cin >> num2;
17
	if (num2 == 0) { cout << "Please put in a nonzero number!\n"; return 1; }
18
	
19
	action = 0;
20
	while (action != 'N')
21
	{
22-
		cout << "Would you like to do \nAddition(A) \nSubtraction(S) \nMultiplication(M) \nRemainder(R) \naVerage(V) \ncheck if the first numeber is Less than the second number(L) \ncheck if the first numeber is Greater than the second number(G) \nor None(N)?\n";
22+
		cout << "Would you like to do:\n Addition(A), Subtraction(S), Multiplication(M), Remainder(R), \naVerage(V), check if the first number is Less than the second number(L), check if the first number is Greater than the second number(G), or None(N)?\n";
23
			cin >> action;
24-
			if (action == 'A') { cout << "The sum is " << num1 + num2 << ".\n\n"; }
24+
		if (action == 'A') { cout << "The sum is " << num1 + num2 << ".\n\n"; }
25-
		if (action == 'S') { cout << "The difference is " << num1 - num2 << ".\n\n"; }
25+
		else if (action == 'S') { cout << "The difference is " << num1 - num2 << ".\n\n"; }
26-
		if (action == 'M') { cout << "The product is " << num1 * num2 << ".\n\n"; }
26+
		else if (action == 'M') { cout << "The product is " << num1 * num2 << ".\n\n"; }
27-
		if (action == 'R') { cout << "The remainder is " << num1 % num2 << ".\n\n"; }
27+
		else if (action == 'R') { cout << "The remainder is " << num1 % num2 << ".\n\n"; }
28-
		if (action == 'V') { cout << "The average is " << (num1 + num2)/2 << ".\n\n"; }
28+
		else if (action == 'V') { cout << "The average is " << (num1 + num2)/2 << ".\n\n"; }
29-
		if (action == 'L')
29+
		else if (action == 'L')
30
		{
31
			if (num1 < num2) { cout << "The first number is less than the second number.\n\n"; }
32
			if (num1 > num2) { cout << "The first number is greater than the second number.\n\n";}
33
		}
34-
		if (action == 'G')
34+
		else if (action == 'G')
35
		{
36
			if (num1 < num2) { cout << "The first number is less than the second number.\n\n"; }
37
			if (num1 > num2) { cout << "The first number is greater than the second number.\n\n"; }
38
		}
39
		else if (action == 'N') { cout << "Okay we're done here!\n"; }
40
		else { cout << "Please put in one of the valid choices!\n"; }
41-
		cout << "Thanks for using this calculator!  Have a nice day!" << endl;
41+
42
		cout << "Thanks for using Gene's calculator!  Have a nice day!" << endl;
43
		system("PAUSE");
44
	return 0;
45
}