I was wondering how I would go about checking a character array for a specific character that keeps changing.
What I want to do is compare the User input to the string. If the user does not pick one of the 6 letters, then they are prompted to do so again.
I was thinking about using something like strchr, but my program ended up not doing anything. I don't know if it applies to this situation since I am comparing a character array, not really a string. This is probably really easy, but I am stuck on it.Code:int i, j; char Scenario[6]= {'A','B','C','D','E','F'}; char UserScenario='Z'; while(UserScenario!=TGnScenario[i]) /*Obviously not right, but basically what I need, but how would I go about doing this?*/ { printf("TGn scenario (A to F)?\t"); scanf("%c", &UserScenario); }



LinkBack URL
About LinkBacks



