When the user enters a correct ISO setting , he is told that but the program then continues and states that an incorrect value was entered .
What should Iuse for it to break out of the loop back to the main menu .Code:
case '2':
fprintf(output,"%s please enter the ISO\n\n" ,name );
fgets(ISO,10,stdin); //Prompt the user for the ISO
p = strchr(ISO, '\n'); // This serves to remove the enter character which fgets registers . It eliminates the effect of \n.
if ( p )
*p = 0;
for(j=0;j<32;j++) // This loop will go through the 12 array elements.
{
if(strcmp(ISO_VALID[j], ISO)==0)
// The strcmp will do a comparison of the string entered with allowed string values stored in the array)
{
fprintf(output,"\n\n This ISO is on the list of possible values !\n\n");
ISO_done=1;
ISONumber = atof(&ISO[0]);
getchar();
break;
}
}
fprintf(output," \n\n Incorrect ISO value entered . Please try again !");
fprintf(output, "The program will now return to main menu");
break;