The user is required to enter the filing status as a 2 character array. I am required to error check their entry.
error checking for filing status only works for "S" (single). I am using a switch to check the status. I am NOT allowed to use cin and cout. If I enter anything other than "S", it says have entered an incorrect status.
printf("\nWhat is the filing status? Enter S, MJ, MS, or SH:");
gets(status);
status[0] = toupper(status[0]);
status[1] = toupper(status[1]);
switch(*status)
{
case 'S':
y=1;
sAccum++;
break;
case 'MJ':
y=2;
mjAccum++;
break;
case 'MS':
y=3;
msAccum++;
break;
case 'SH':
y=4;
shAccum++;
break;
default:
{printf("You have entered an incorrect filing status.");
printf("\nWhat is the filing status? Enter S, MJ, MS, or SH:");
gets(status);
status[0] = toupper(status[0]);
status[1] = toupper(status[1]);
}
}//END SWITCH
Thank you!

New Topic/Question
Reply




MultiQuote






|