Ok guys, I've been staring on this code for hours now, and I just can't figure it out. The code isn't finished yet, but I don't want to continue with it until I solved this problem.
The problem is this part
Code: Select all
while(1)
{
cout << "Which cookie do you want to eat? ";
cin >> choice;
if(CookieEaten[choice-1] == true)
{
CookiesEatCount[choice-1]++;
if(CookiesEatCount[choice-1] > 1)
cout << "You can't eat a cookie " << CookiesEatCount[choice-1] << "times\n";
else
cout << "You have already eaten this cookie once\n";
}
else if(CookieEaten[choice-1] == false)
{
CookiesEatCount[choice-1]++;
CookieEaten[choice-1] = true;
cout << "\"" << Cookie[choice-1] << "\"\n";
}
}
It's a "game" where you choose a cookie and it gives you a fortune, and the issue is that when you try to choose a cookie that you already eaten, it gives you "You have already eaten this cookie once", and then if you try again it should give you "You can't eat a cookie X times", but the thing is that for some reason CookiesEatCount[choice-1]++;, only works once, then it stops adding =/ so CookiesEatCount never goes over 1 for some reason..and I can't see the problem with it >_<
I need 2-4 more eyes! xD