Ternary Operator

Thanks in advance, i have the following code, it returns an infinite statement and i know why cause of the while loop, but my problem is that it returns 1 instead of "OFF". I can make this work with an if else loop but i want to get comfortable using ternaries.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <string>
#include <iostream>
#include <ctime>
#include <Windows.h>

using namespace std;

int main ()
{
	bool healthStatus;
	while(!GetAsyncKeyState(VK_INSERT))
	{
		healthStatus = (GetAsyncKeyState(VK_HOME) == true ? "ON":"OFF");

	cout << " Health Status: " << healthStatus << endl;
	}

}


change line 10 to:
string healthStatus
Perfect appreciate it.
Topic archived. No new replies allowed.