I am currently messing about on the exercises in the articles section, and i am getting some strange results from the while (user == gullible) task.
I ran it through the debugger, and the int values were not met, but still the choice == 5 & count == 5 statements still printed. Could anyone shed some light on this?
#include <iostream>
int main()
{
int choice = 0;
int count = 0;
std::cout << "Enter any integer, except 5! Don't you dare touch 5!" << std::endl;
while (choice != 5 && count != 10)
{
count += 1;
std::cin >> choice;
}
if (count == 10);
std::cout << "Hey, you are more patient then me! Congrats!" << std::endl;
if (choice == 5);
std::cout << "Hey, you weren't suppose to enter 5!" << std::endl;
}
if (count == 10);
std::cout << "Hey, you are more patient then me! Congrats!" << std::endl;
if (choice == 5);
std::cout << "Hey, you weren't suppose to enter 5!" << std::endl;