C++ a value of type cannot be assigned to an entity of type

Viewed 13872
while (gameon = true) {
  char ch = _getch();
  if (ch == 'd') {
    move = move + 1;
    ch = "";
  }
}

I get this error and kind find anything to fix this on this forum

1 Answers

With ch = "", you are attempting to assign a string to a char type. This is what the compiler is complaining about.

Since you are setting ch in each iteration of the loop, it is not necessary to try to clear the variable.

Also, you need to fix your while loop: replace = true with == true)

Related