Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // an old joke which happens that a machine is better at telling it. Happy Eid.
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int strcmp_casei(char const *a, char const *b);
- int main()
- {
- char *left = NULL;
- size_t n;
- do {
- printf("Eid and Saeed went up the mountain."
- "Saeed went down, who is left?\n");
- getline(&left, &n, stdin);
- } while (strcmp_casei(left, "Eid\n") == 0);
- return 0;
- }
- int strcmp_casei(char const *a, char const *b)
- {
- for (;; a++, b++) {
- int d = tolower(*a) - tolower(*b);
- if (d != 0 || !*a)
- return d;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement