Hi guys i input a number between 0-12 but it keeps saying that is wrong .... what is wrong with my validation ? So when i get input and i type in the number between 0-12 i always get
Month error 0 or less or equal to 12 please can someone help me please
Code:unsigned validateMonth(unsigned month, char *prompt)
{
unsigned m;
int flag = FALSE; /* false value*/
do
{
while(flag == TRUE || month<0 || month>12) /* flag 1 for true*/
{
flag = FALSE;
printf("Month error 0 or less or equal to 12 please\n");
getUserInput(prompt);
}
}while(flag !=FALSE);
return m;
}
Code:unsigned getMonth()
{
/*** declare variables*/
unsigned tmpMonth;
int valid = 0;
char *prompt = "Please enter a month between 0 - 12 !\n";
char *month;
unsigned valMonth;
month = getUserInput(prompt);
tmpMonth = validateMonth(valMonth, prompt);
return EXIT_SUCCESS;
}