The goal of the program is to scan a sequence of X, 1, 2 depending on how the user put them together and then show how many X he put in.
For some reason after the 8 X/1/2 I put (pressing ENTER 8 times since I put them one by one) It shows me the number 15 no matter how I put the numbers in.
My question why does it stop after 8 ENTERs when the for is set for i=1; i<=TOTOSIZE; i++
TOTOSIZE = 15
And why does it show the numebr 15 all the time instead of what its supposed to do.
#include <stdio.h>
#define TOTOSIZE 15
int main()
{
int d = 0, i;
char score;
for (i = 1; i <= TOTOSIZE; i++)
{
scanf_s("%c", &score);
if (score == 'X');
{
d++;
}
_flushall();
}
printf("%d", d);
return 0;
}