Here is my code:

```
int main()
{
    int nothing;
    string name;
    int classnum;
    bool classchosen;
    string classname;

    cout << "Welcome adventurer, your journey is about to begin.\n\n";
    cout << "Firstly, what's your name? ";
    cin >> name;
    classchosen = false;
    while (classchosen == false)
    {
        cout << "\n\nNow, " << name << ", choose your class entering its number.\n\n";
        cout << "1- Warrior\n" << "2- Mage\n" << "3- Paladin\n" << "4- Monk\n\n";
        cout << "Class number: ";
        cin >> classnum;
        switch(classnum){
            case 1:
                    classname = "Warrior";
                    classchosen = true;
                    break;
            case 2:
                    classname = "Mage";
                    classchosen = true;
                    break;
            case 3:
                    classname = "Paladin";
                    classchosen = true;
                    break;
            case 4:
                    classname = "Monk";
                    classchosen = true;
                    break;
            default:
                    cout << "\nWrong choice, you have to enter a number between 1 and 4.\n" << endl;
                    break;
        }
    }
    cout << "\nSo you are a " << classname << " ? Well, tell me something more about you...\n";
    cin >> nothing;
    return 0;
}

```

Now, when I run it and input a string (for example "fjdfhdk") when it asks about the class number, the program loops infinitely instead of going in the default statement, writing again the question and letting me choose another class. Why?