C++ while Loop not exiting.

When i Execute my program everything seem to run perfect. but when i type N to exit the program. it continues playing... if you need the full code tell me i can paste if... its kinda long..

P.S i'm doing this program just to practice my C++ skills before school starts

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
62
63
64
65
66
67
68
69
 while(game = true)
	{
		//Genrating a number to bring up a question.
		option = rand() % 4 + 1;

		if(option == 1)
		{
			Add(answ);
			system("cls");
		}
		else if(option == 2)
		{
			Sub(answ);
			system("cls");
		}
		else if (option == 3)
		{
			Quot(answ);
			system("cls");
		}
		else if (option == 4)
		{
			Mult(answ);
			system("cls");
		}
		else
		{
			cout << "Error in the program.. will be fixed. Sorry" << endl << endl;
			return -1;
		}

		//Saving or Risking
		if(point >= 10)
		{
			cout << "You gained 100 points! Would you like to continue? <Y/N>" << endl;
			cin >> cont;
			if(cont == 'Y' || 'y')
			{
				cout << "Alright, up to you.. Good luck." << endl;
				system("pause");
				system("cls");
			}
			else if(cont == 'N' || 'n')
			{
				cout << "Alright, your highest score was " << point << " it will be saved for the next round" << endl << endl;
				system("pause");
				game = false; // DOES NOT EXIT THE GAME WHEN PROMOT! NEED FIX
			}
			else
			{
				cout << "What are yout trying to break the code? let me tell you right now this is not the way :)" << endl;
				system("pause");
				system ("cls");
			}

			//Making sure points are not negative or less than -10
			if(point <= -1)
			{
				cout << "You have points, you better get the next question correct if you want to keep playing." << endl;
			}
			else if(point <= -10)
			{
				cout << "You reached a limit :( " << point << " We cant save that as your score." << endl;
				game = false;
			}


		}
}
Topic archived. No new replies allowed.