in c is it true ? what is the problem ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

in c is it true ? what is the problem ?

//think that k can eat s and s can eat g and g can eat k #include <stdio.h> #include <conio.h> int main () { char user_1, user_2; printf(" user 1 choose a charactor betweent K , S, G \n " ); scanf("%c" , &user_1); printf(" user 2 choose a charactor betweent K , S, G \n" ); scanf("%c" , &user_2); if ( user_1 == user_2 ) printf(" ****mosavi**** \n "); else if ( user_1 == 'k' && user_2 == 's' ) printf (" user_1 win \n "); else if (user_1 == 's' && user_2 == 'g' ) printf (" user_1 win \n "); else if (user_1 == 'g' && user_2 == 'k' ) printf (" user_1 win \n"); else{ printf (" user_2 win \n"); } _getch(); return 0;}

17th Nov 2018, 10:26 PM
motahareh
motahareh - avatar
1 Answer
+ 1
Just remove the _getch() and it should work.
17th Nov 2018, 10:31 PM
Ulisses Cruz
Ulisses Cruz - avatar