#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
int input;
int coin;
char* result[] = {"","up","down"};
srand(time(NULL));
printf("up is 1, down is 2, if input others then the end.\n");
while(1){
coin = rand()%2 + 1;
printf("result, guess it 1 or 2: ");
scanf("%d", &input);
if(input < 1 || input > 2){
printf("please input the number 1 or 2");
break;
}else{
printf("input: %s the coin's : %s\n", result[input], result[coin]);
printf("%s\n", (input == coin) ? "right" : "wrong");
}
printf("\n");
}
return 0;
}