error msg instead of the result so far
I'm writing a program that reads in characters.
If the invalid character is in front of the word, it will print the error msg, then flush the rest.
If the invalid character is after a valid character, it will instead print out the result so far instead of an error msg.
How do I "not print" the result so far?
This is my driver:
Code:
main()
{ int number;
int is_invalid;
is_invalid = FALSE;
/* prompt for first roman number entry */
printf("Enter an number in roman numerals(EOF to quit): ");
/* while there are more numbers */
while((number = get_roman()) != EOF)
{
if(number == 0)
{
printf("Invalid entry!\n");
}
else
{printf("The number is %d\n",number);}
FLUSH;
/* prompt for next number */
printf("Enter an number in roman numerals(EOF to quit): ");
}
/* clean up screen */
printf("\n");
}