Izzy the Iguana Challenge in C
Hi. It worked for all of the tests but one and I cannot figure out what is the problem. Can you help me? Here is my code: #include <stdio.h> #include <string.h> int main () { char str [200]; int snack = 0; scanf ("%[^\n]*c", str); char *ptr = strtok(str, " "); while (ptr != NULL) { if (strcmp(ptr, "Letuce")==0) { snack += 5; } else if (strcmp(ptr, "Carrot")==0) { snack += 4; } else if (strcmp(ptr, "Mango")==0) { snack += 9; } else if (strcmp(ptr, "Cheeseburger")==0) { snack += 0; } ptr = strtok (NULL, " "); } if (snack >= 10) { printf ("Come on down!"); } else { printf ("Time to wait"); } return 0; }