-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhatescale.c
More file actions
67 lines (57 loc) · 929 Bytes
/
hatescale.c
File metadata and controls
67 lines (57 loc) · 929 Bytes
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* how much does matt hate me right now */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
char read_char(char *);
int main(void)
{
char x;
while(1)
{
x=read_char("Is it the weekend? ");
if(tolower(x)=='y')
{
printf("He hates you alot\n");
break;
}
else if (tolower(x)=='n')
{
while(1)
{
x=read_char("Is it early morning? ");
if(tolower(x)=='y')
{
printf("He probably wants to kill you\n");
exit(0);
}
else if (tolower(x)=='n')
{
printf("Doesn't matter, he still hates you!\n");
exit(0);
}
else
{
printf("Please respond with Y or N\n");
break;
}
}
}
else if(tolower(x)=='q')
{
exit(0);
}
else
{
printf("Please respond with Y or N\n");
}
}
}
char read_char (char * message)
{
char ch;
printf("%s ", message);
scanf("%c", &ch);
while(fgetc(stdin)!='\n')
{}
return ch;
}