谢谢。有点明白你的意思
[C] 纯文本查看 复制代码 #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char *argv[])
{
srand(time(NULL));
int array[] = {
0, 1, 2, 3, 4,
5, 6, 0, 1, 2,
0, 1, 2,
};
int random_num = rand()%14;
fprintf(stdout, "array[%d] = %d\n", random_num, array[random_num]);
switch (array[random_num]) {
case 0:
fprintf(stdout, "大吉\n");
break;
case 1:
fprintf(stdout, "中吉\n");
break;
case 2:
fprintf(stdout, "小吉\n");
break;
case 3:
fprintf(stdout, "吉\n");
break;
case 4:
fprintf(stdout, "末吉\n");
break;
case 5:
fprintf(stdout, "凶\n");
break;
case 6:
fprintf(stdout, "大凶\n");
break;
}
return 0;
} |