1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #define _CRT_SECURE_NO_WARNINGS #include <string.h> #include <stdio.h> int main(void) { char s1[80]; // ù ¹ø° ´Ü¾î¸¦ ÀúÀåÇÒ ¹®ÀÚ¹è¿ char s2[80]; // µÎ ¹ø° ´Ü¾î¸¦ ÀúÀåÇÒ ¹®ÀÚ¹è¿ int result; printf("ù¹ø° ´Ü¾î¸¦ ÀÔ·ÂÇϽÿÀ:"); scanf("%s", s1); printf("µÎ¹ø° ´Ü¾î¸¦ ÀÔ·ÂÇϽÿÀ:"); scanf("%s", s2); result = strcmp(s1, s2); if (result < 0) printf("%s°¡ %sº¸´Ù ¾Õ¿¡ ÀÖ½À´Ï´Ù.\n", s1, s2); else if (result == 0) printf("%s°¡ %s¿Í °°½À´Ï´Ù.\n", s1, s2); else printf("%s°¡ %sº¸´Ù µÚ¿¡ ÀÖ½À´Ï´Ù.\n", s1, s2); return 0; } | cs |