Sha256: 1e48ffdf3d6134625d761c1ddffeb94ba5f19c59873f2305d71d4d3a376c0785
Contents?: true
Size: 777 Bytes
Versions: 323
Compression:
Stored size: 777 Bytes
Contents
#include <string.h> #include <stdbool.h> #include <stdio.h> char *hey_bob(char *greeting) { bool all_blank = true; bool all_shouty = true; bool any_letters = false; char final_char = '.'; int i = 0; char ch = greeting[i]; while (ch != 0) { if (all_blank) all_blank = ch == ' '; if (all_shouty) all_shouty = !(ch >= 'a' && ch <= 'z'); if (!any_letters) any_letters = (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); if (ch != ' ') final_char = ch; i++; ch = greeting[i]; } if (all_blank) return "Fine. Be that way!"; if (any_letters && all_shouty) return "Whoa, chill out!"; if (final_char == '?') return "Sure."; return "Whatever."; }
Version data entries
323 entries across 323 versions & 1 rubygems