I’m trying to make an if statement that can take in if (input == "Cell" || "cell") so i don’t have to worry about the user typing it with a capital or not. But in the console, it seems to skip over the input command and go right past the if statement. I included a small snippet of where it goes wrong. Right when it gets to the first getline, it skips everything and goes to the else statement: “You are in the cell”. Sorry if this doesnt make any sense, i dont know how else to describe it.

    while (gameRunning)//loop that keeps game running
    {
        std::getline(cin, input);//input which room the player wants to go to as input variable
        hud();

        if (input == "Cell" || "cell")//if statement controls all of room 1
        {
            inRoom1 = true;
            while (inRoom1 = true)
            {
                location = "Cell";
                hud();
                if (level >= 1)//executes if player has been in this room before
                {
                    typeText("*You don't find anything useful in the cell*n");
                    location = "Main Hall";
                    inRoom1 = false;
                    hud();
                }
                else//executes if player has not been in this room before
                {
                    typeText("*You are in the cell*n");

If I change the || into && then it doesnt skip past it. So im not really sure what is going wrong. I’m pretty new to coding so if you could give any tips it would be much appreciated.

New contributor

Stuwie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

13