if statements always execute

c++, if-statement, visual-c++

Solution

Your semicolons need to be removed, they are terminating the if statement.

if(Choice == 1)
{
std::cout << "Blah Blah\n";
}
if(Choice == 2)
{
std::cout << "Blah Blah\n";
}
if(Choice == 3)
{
std::cout << "Blah Blah\n"
}
if(Choice == 4)
{
std::cout << "Blah Blah\n";
}

You could use else ifs as well to clean up your code.

Problem

I'm having issues with my `if` statements running into each other. Here is my code: ``` std::cout << "1) Option 1\n"; std::cout << "2) Option 2\n"; std::cout << "3) Option 3\n"; std::cout << "4) Option 4\n"; std::cout << "Type your choice and hit ENTER \n"; std::cin >> Choice; if(Choice == 1); { std::cout << "Blah Blah\n"; } if(Choice == 2); { std::cout << "Blah Blah\n"; } if(Choice == 3); { std::cout << "Blah Blah\n"; } if(Choice == 4); { std::cout << "Blah Blah\n"; } ``` By running into each other I mean: it will just ignore my `if` statements and run all of my code so it would just print out: ``` Blah Blah Blah Blah Blah Blah Blah Blah ``` What is my mistake?

Original source