Wrong Value In Debug Mode, Need Help

Hi, I finished writing my code and am expecting my integer to be a value of 0 when looking at the debug perspective, but when I begin debugging, instead of the variable "score" being an integer value of zero, its value reads, "4202014". That is weird! I specifically applied a value of 0, so why does it do that? Also, the program refuses to debug all the way through past the first line, and when I try to terminate the debug process, it initially fails to terminate unless I try to terminate it a second time, and I receive an error message reading, "Termination failed" or something like that. Can you please help me out? Here's my code:

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
  //Write a program that asks the user for a
//score between 0 and 100. Based on the imputted
//score and the table below, the program will output
//the appropriate message.
//90-100 Awesome!
//80-89  Well done!
//70-79  Average
//60-69  Bummer
//0-59   Sad times

#include <iostream>
using namespace std;

int main()
{
	int score = 0;
	cout << "Enter an integer score between 0 - 100." << endl;
	cin >> score;

	if (score >= 90 && score <= 100)
	{
		cout << "Awesome!" << endl;
	}
	if (score >= 80 && score <= 89)
	{
		cout << "Well done!" << endl;
	}
	if(score >= 70 && score <= 79)
	{
		cout << "Average." << endl;
	}
	if (score >= 60 && score <= 69)
	{
		cout << "Bummer." << endl;
	}
	if (score >= 0 && score <=59)
	{
		cout << "Sad times." << endl;
	}

	return 0;

}
Last edited on
This program works fine and no error while debugging.

Try to restart your IDE and make sure that you build your project every time you edit your code.
Last edited on
I tried rebuilding and restarting, but it didn't work.
Topic archived. No new replies allowed.