I would greatly appreciate if someone could help with the following:
I am attempting to read in a fraction using scanf and store the numerator and denominator as integers. The following code that I have written captures most errors however if for example 1/2/3 is entered then I believed that scanf would not return 3 and therefore be caught. Not the case it still returns 3! Does anyone have any ideas?
Thanks in advance,
printf("\n\nEnter a fraction:> ");
x=scanf(" %i %c %i", &num1, &slash, &denom1);
if (x!=3 || slash!=47)
printf("Input must be of form A/B where A and B are both integers.");
printf("\nDenominator cannot be zero.");