I'm not sure what my title should be. But, I was trying to get a nice validation for my code. Below are the only codes allowed to go in my function: c0001, c0002, c0003, c0004, c0005, C0001, C0002, C0003, C0004, C0005. So, other than these 10 codes, it should not accept it and keep promoting the user for a correct code.
if (strlen(meal_choice) == 5 && (meal_choice[0] == 'C' || meal_choice[0] =='c') && meal_choice[1] == '0' && meal_choice[2] == '0' && meal_choice[3] == '0' && (meal_choice[4] == '1' || meal_choice[4] == '2' || meal_choice[4] == '3' || meal_choice[4] == '4' || meal_choice[4] == '5'))
As you can see from my code above, it's way too long. Any idea how I can shorten my code? Thanks!