I encounter few times that Code::Blocks console can't close at all.
I tried Task Manager close,
Console is opened from Avast! antivirus virtual box, there is option to stop the running program but not working too,
normal close dotn work also, F4, Ctr+Alt+Del also.
I have to resstart the computer to close it.
A friend told me that this happens due to infinite loop, so here is my code, please ctake a time to check it.
Code:
while (tries != 0){
//get user input
input = getch();
//Search if inputed char exists in the word, if so apply them
for (unsigned int x = 0; x < strlen(word); x++){
if (input == word[x]){
hideWord[x] = input;
}
else{
wrongLetter++;
}
}
if (wrongLetter == strlen(word)){ //if letter do not exist in word, increment tries with 1
tries--;
}
wrongLetter = 0;
//Print changes
for (unsigned int i = 0; i < strlen (word); i++){
cout << hideWord[i] << " ";
}
cout << endl << "tries left: " << tries << endl;
} //while ends
PS: The code is just testing before implementing it to functions and adding to main project.