-
Notifications
You must be signed in to change notification settings - Fork 0
/
crazy.c
45 lines (37 loc) · 1020 Bytes
/
crazy.c
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
#include <unistd.h>
void printWithTypewriterEffect(const char *message, const char *emoji, int time) {
for (const char *c = message; *c != '\0'; c++) {
putchar(*c);
fflush(stdout);
usleep(100000); // Sleep for 100,000 microseconds (0.1 seconds) between characters for the typing effect
}
printf(" %s\n", emoji);
sleep(time);
}
int main() {
const char *messages[] = {
"Crazy?",
"I Was Crazy Once.",
"They Locked Me In A Room.",
"A Rubber Room.",
"A Rubber Room With Rats.",
"And Rats Make Me Crazy."
};
const char *emojis[] = {
"😜",
"😵",
"🔒",
"🏥",
"🐀",
"🤡"
};
int numMessages = sizeof(messages) / sizeof(messages[0]);
while (1) {
for (int i = 0; i < numMessages; i++) {
printWithTypewriterEffect(messages[i], emojis[i], (i == 0) ? 2 : 1);
}
printf("\n\n");
}
return 0;
}