-
Notifications
You must be signed in to change notification settings - Fork 0
/
asobi.c~
65 lines (58 loc) · 1.6 KB
/
asobi.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
//グローバル関数
int player,enemy,m,d;
char x[3];
//乱数関数
int randam(int r){
int s,t,u,v;
srand(time(NULL));
s = 1 + rand()%3;
u = r;
for(t = 1;t =< player ;t++){
u = player * u;
}
v = (u^s) % 15;
return v;
}
//メイン関数
int main(void){
printf("明日の天気予報\n");
wait(3000);
printf("今日は○月△日です。\n○と△に数字を入力して下さい\n");
printf("○=%d\n",m);
fgets(x,sizeof(x),stdin);
if (x[strlen(x)-1] != '\n')
while (getchar() != '\n');
m = atoi(x);
printf("△=%d\n",d);
fgets(x,sizeof(x),stdin);
if (x[strlen(x)-1] != '\n')
while (getchar() != '\n');
d = atoi(x);
player = m + d;
enemy = randam(player);
printf("loading…\n");
wait(1000);
printf("明日は\n");
switch(enemy){
case 0 : preintf("???\n"); break;
case 1 : printf("晴れ\n"); break;
case 2 : printf("雨\n"); break;
case 3 : printf("曇り\n"); break;
case 4 : printf("晴れのち雨\n"); break;
case 5 : printf("曇り時々雨\n"); break;
case 6 : printf("雨時々晴れ\n"); break;
case 7 : printf("あられ\n"); break;
case 8 : printf("雨時々飴\n"); break;
case 9 : printf("雹のち豹\n"); break;
case 10 : printf("晴れのち曇り\n"); break;
case 11 : printf("濃霧\n"); break;
case 12 : printf("親方ァ!空から女の子が!\n"); break;
case 13 : printf("快晴\n"); break;
case 14 : printf("みぞれ混じりの雨\n"); break;
case 15 : printf("晴れ時々雷雨\n"); break;
}
printf("の模様です。\n");
}