The sf::Event::KeyPressed doesn't have a break after its switch. After its cout statement executes it breaks out of the eventList.key.code switch but not the eventList.type switch, so it's falling through to the sf::Event::KeyReleased case. Try adding a break statement after the switch in case sf::Event::KeyPressed. I'd also recommend doing the same for case sf::Event::KeyReleased. In fact, I'd also consider restructuring the code a little more in this area; switch statements in case statements can get somewhat confusing.
Considering the missing "break;" i cant find it
Also putting "break;" after switch statement would not run the code after it but break out. Making the code after that (In this case sf::Event::KeyReleased) to not be checked.
Also in switch statement if case is not found "default is run" witch in each case is "break;" and thus will not run the code after it causing unexpected behavior.
About reconstructing code. I am surely considering that in my next project, but as it currently stands i started this way and am gonna finish it this way, just for the sake i don't edit thousand of lines to update the code cause am just training/learning.
EDIT:: I understand what your saying now. Took me some rethinking of what i did
int q = 1;
int i = 1;
switch(q)
{
case 0:
break;
case 1:
switch(i)
{
case 0:
break;
default:
break; // Breaking switch(i) but not the switch(q) and thus i get error
}
default:
break;
}
Thank you clever man!