Simple Calculator

Hello, I'm trying to make a simple calculator using C++ as I have just started to learn it. I get and error once it hits the case command do you know whats wrong?

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int nNumberOfArgs, char* pszArgs[])
{
char choice;
cout << "Please enter the type of calculation you wish to make.\n" << "Calculations: * / + -\n";
cin >> choice;

switch(choice)
{
case *:
int times1;
cout << "Please enter your first number:";
cin >> times1;
int times2;
cout << "Please enter your second number:";
cin >> times2;
cout << "The accumulated value is:" << times1 * times2 << "\n";
break;

case /:
int divide1;
cout << "Please enter your first number:";
cin >> divide1;
int divide2;
cout << "Please enter your second number:";
cin >> divide2;
cout << "The accumulated value is:" << divide1 / divide2 << "\n";
break;

case +:
int add1;
cout << "Please enter your first number:";
cin >> add1;
int add2;
cout << "Please enter your second number:";
cin >> add2;
cout << "The accumulated value is:" << add1 * add2 << "\n";
break; 

case -:
int times1;
cout << "Please enter your first number:";
cin >> minus1;
int minus2;
cout << "Please enter your second number:";
cin >> minus2;
cout << "The accumulated value is:" << minus1 * minus2 << "\n";
break;

default:
cout << "You did not enter a vaild cacluation.\n";            
}
 
system("PAUSE");
return 0;         
}
Lines 15, 25, 35, and 45: Single quotes (') for characters (e.g. '*'). The compiler is complaining because you have operators there, not integral values.

And fix lines 42 and 52.
Ok thanks for your help.
Topic archived. No new replies allowed.