Validating a character input in C
问题 I have a project where I want to validate a character input in C. I am new to the C language and also not very experienced in programming. I have tried to make a loop for validation but it is not working. #include<stdio.h> void main(){ char input; do { scanf("%c", &input); while ( (input != 'a') && (input != 'b') && (input != 'c') ); printf ("wrong input"); switch(input){ case 'a': break; case 'b': break; case 'c': break; } while ( input != 'c'); 回答1: Taking user input in C, isn't difficult,