terminal not taking any input

closed account (i8bjz8AR)
Just running some code through the terminal and compiling it. No errors when I compile, but I try pressing y and Y, to see what I get for output, and nothing happens. How do i fix this?
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
#include <iostream>
using namespace std;

int main()
{

	//for loop
	//executes until the conditon becomes false. Test takes place before each iteration


	/*int i;

	for(i = 1; i <= 25; i++){

		std::cout << i;
		std::cout << endl;
	}
	return 0;*/

	char click_me;
	int num;

	while(click_me == 'y' || click_me == 'Y')
	{

		cout << "Enter a number: \n";
		cin >> num;

		if(num == 2)
			cout << "Good job, you won! \n";

		else
			cout << "Try again next time\n";
	}

}
Last edited on
You forgot to assign a value to the "click_me" variable before the "while" loop.Add "cin>>click_me" before 'while' loop.
closed account (i8bjz8AR)
oh wow! I was totally over thinking that.. Thanks!
Topic archived. No new replies allowed.