Program doesn't print the bank account balance afteral, why?

#include <iostream>
using namespace std;

//cola machine!


int main()
{
int num;
double bankAcc = 2.00;

cout << "FOO, What do you want: 1) coke, 2)Sprite. " << endl;
cin >> num;

switch (num)
{
case '1':
{
bankAcc = bankAcc - 2;
cout << bankAcc << endl;
break;
}
case '2':
{
bankAcc -= 1.5;
cout << bankAcc << endl;
break;
}
}

return 0;
}

1 is not the same that '1'
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
#include <iostream>
using namespace std;

//cola machine!


int main()
{
int num;
double bankAcc = 2.00;

cout << "FOO, What do you want: 1) coke, 2)Sprite. " << endl;	
cin >> num;

switch (num)
{
case 1:
{
bankAcc = bankAcc - 2;
cout << bankAcc << endl;
break;
}
case 2:
{
bankAcc -= 1.5;
cout << bankAcc << endl;
break;
}
}

return 0;
}
Topic archived. No new replies allowed.