If statement does not seem to work

Can someone help me figure out why the program does not exit when I set cont or cont1 to n or N without showing anything else. or do I need to use something other than an if statement?
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
#include <iostream>

using namespace std;

double const TAX = .07;
void getIceCream(int choice);

int main()
{
	int choice = 0;
	int  cont = 0;
	int cont1 = 0;
		cout << "Do you want to continue (Y/N): ";
		cin >> cont;

		if (cont = 'y' || 'Y')
		{
			cout << "Do you want to order an ice cream (Y/N): ";
			cin >> cont1;
			if (cont1 = 'y' || 'Y')
				getIceCream(choice);
			else
				if (cont1 = 'n' || 'N')
					exit(0);
		}
		else
			if (cont = 'n' || 'N')
				exit(0);


	system("pause");
	return 0;
};

void getIceCream(int choice)
{
	//do
	//{
		//display menu
		cout << endl;
		cout << "1. small bowl of vanilla ice cream - 3.00" << endl;
		cout << "2. drumstick                       - 2.50" << endl;
		cout << "3. waffle bowl                     - 4.00" << endl;
		cout << "4. sundae                          - 4.00" << endl;
		cout << "_________________________________________" << endl;
		cout << "What ice cream would you like: ";
		cin >> choice;
	//}

};
Last edited on
Change cont to char

char cont;

And you are not checking the conditions correctly.Your if statements should be
if ((cont == 'y') || (cont == 'Y'))

and

if ((cont == 'n') || (cont =='N'))
Topic archived. No new replies allowed.