1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> #define SOL "apple" int main(void) { char s[100] = SOL; char ans[100]; int i, len; len = strlen(s); for (i = 0; i<len; i++) { int pos1 = rand() % len; int pos2 = rand() % len; char tmp = s[pos1]; s[pos1] = s[pos2]; s[pos2] = tmp; } do { printf("%sÀÇ ¿ø·¡´Ü¾î¸¦ ¸ÂÃ纸¼¼¿ä: ", s); scanf("%s", ans); } while (strcmp(ans, SOL) != 0); printf("ÃàÇÏÇÕ´Ï´Ù. \n"); return 0; } | cs |