Four-Function Calculator Dividing instead of Multiplying

I'm trying to make a basic four-function calculator, and it seems to be working just fine... except when testing it, whenever I try multiplication the numbers seem to come back divided, not multiplied. I can't see anything wrong with my code, but clearly there's something... anyone see it? Thanks.

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
  #include<iostream>
using namespace std;
int main()
{
	float firstNumber, secondNumber, result;
	char operation;

// Getting input from user
cout << "Please enter the first number.";
cout << endl;
cin >> firstNumber;
cout << "Please enter the second number.";
cout << endl;
cin >> secondNumber;
cout << "Please enter a single character to indicate the operation.";
cout << endl;
cin >> operation;

// Doing calculations
switch (operation)
{
case 'a':
	result = firstNumber+secondNumber;
	cout << endl;
case 'A':
	result = firstNumber+secondNumber;
case 's':
	result = firstNumber-secondNumber;
case 'S':
	result = firstNumber-secondNumber;
case 'm':
	result = firstNumber*secondNumber;
case 'M':
	result = firstNumber*secondNumber;
case 'd':
	result = firstNumber/secondNumber;
case 'D':
	result = firstNumber/secondNumber;
}

// Output of result
cout << result;
cout << endl;

return 0;
}
You are missing breaks and the end of your case statements, so they all fall through to the last one, which is division.
Thanks so much, that was such a quick response and that was exactly the problem.
Topic archived. No new replies allowed.