düşünmek kolaydır ama yapmak zordur, hayatta en zor olan şey düşünüleni yapmaktır.
#include int strcmptrk(const char *s1, const char *s2); int main() { char s1[100], s2[100]; int result; printf("1. yaziyi girin : "); gets(s1); printf("2. yaziyi girin : "); gets(s2); //printf("%s\n", s1); result = strcmptrk(s1, s2); if (result > 0) printf("s1 > s2\n"); else if (result < 0) printf("s1 < s2\n"); else printf("s1 == s2\n"); return 0; } int strcmptrk(const char *s1, const char *s2) { while (*s1 == *s2) { if (*s1 == '\0') return 0; ++s1; ++s2; } return *s1 > *s2 ? 1 : -1; }
Thursday, July 13, 2006