simple arithmetic operator program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Jett Bailes
// 02/ 02/ 2010
// ArithmeticChoice.cpp : main project file.
// Enter an arithmetic operator to calculate two variables

#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
	// Declare variables
	char input = ' ';
	int num1, num2, sum, difference, product, quotient = 0;

	// Enter variables
	cout << "Enter number 1 ";
	cin >> num1;
	cout << "Enter number 2 ";
	cin >> num2;

	// Choose arithmetic operation
	cout << "Choose arithmetic process " << endl;
	cout << " A for add ";
	cout << " S for subtract ";
	cout << " M for multiply ";
	cout << " D for divide ";
	cin >> input;
	switch (input)
	{
	case 'A' || 'a':
		sum = num1 + num2;
		cout << "The sum is " << sum << endl;
	case 'S' || 's':
		difference = num1 - num2;
		cout << " The difference is " << difference << endl;
	case 'M' || 'm':
		product = num1 * num2;
		cout << " The product is " <<product << endl;
	case 'D' || 'd':
		quotient = num1 / num2;
		cout << "The quotient is " << quotient << endl;
	}
return 0;
}


Debug gives me 3 errors: case value 1 already in use. What am I doing wrong?
case 'A' || 'a':should be case 'A': case 'a':
Oh i didn't know you could list multiple cases like that, thankis
Topic archived. No new replies allowed.