0

How can I simplify this

#include<stdio.h> #include<string.h> int main(){ char m[50]; fgets (m,50,stdin); char mark[] = "Mark",lucy[] = "Lucy",jadon[] = "Jadon",jessie[] = "Jessie"; int a = strcmp(m, mark); if (a == 0) printf("You are right,game finished"); int b = strcmp(m,lucy); if (b == 0) printf("You are wrong,game over."); int c = strcmp(m,jessie); if (c == 0) printf("You are wrong,game ovet"); int d = strcmp(m,jadon); if (d == 0) printf("Hey,boy.Though you heat me,you are not allowed to trouble the programmer"); else printf("Who's that?"); return 0; }

7th Mar 2020, 1:15 AM
🇨🇳Jadon Chan
🇨🇳Jadon Chan - avatar
1 Odpowiedź
+ 2
Use loop and switch .
7th Mar 2020, 1:19 AM
Prathvi
Prathvi - avatar