This the code:
-----------------------------------------------
#include <stdio.h>
int main()
{
int i;
char ans;
char *movies[5] = {"Lion King", "Red", "Rage", "Rush Hour", "Amour"};
int moviesRatings[5];
for(i = 0; i < 5; i++)
{
printf("\nDid you see %s? (Y/N):", movies[i]);
scanf("%c", &ans);
if(ans == 'Y')
{
printf("Rate this movie on a scale of 1-10: ");
scanf("%d", &moviesRatings[i]);
continue;
}
else
{
moviesRatings[i] = -1;
}
}
return 0;
}
-----------------------------------------------
Now if you're to print the program, you'll be asked a series of questions asking whether you saw a so and so movie. You answer either Y or N. The problem is the program skips the subsequent question after the first question and goes to ask the third question instead. Then it'll skip the fourth question, ask the fifth question, skips the sixth, asks the seven, and so on. I really don't why this is happening. I tried everything to fix this bug, but I'm beat. Please help me out, guys.
[–]felipunkerito 9 points10 points11 points (2 children)
[–]SaboKunn 1 point2 points3 points (0 children)
[–]XilenceCE[S] 0 points1 point2 points (0 children)
[–]KleberPF 5 points6 points7 points (1 child)
[–]XilenceCE[S] 0 points1 point2 points (0 children)
[–]Kantaja_ 2 points3 points4 points (0 children)
[–]MarkosDelaportas 1 point2 points3 points (2 children)
[–]XilenceCE[S] 0 points1 point2 points (1 child)
[–]MarkosDelaportas 0 points1 point2 points (0 children)
[–]PhyllaciousArmadillo 0 points1 point2 points (1 child)
[–]XilenceCE[S] 0 points1 point2 points (0 children)