写了一段小代码。当你不知道干什么的时候就随机一个事件吧。
首次发帖 。请多关照
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
static const char act[2][7][20]={{{"上网"},{"吃零食"},{"玩游戏"},{"去你妈的"},{"打电话"},{"发短信"},{"自杀"}},
{{"学英语"},{"学数学"},{"去图书馆"},{"看小说"},{"上课"},{"实验室"},{"同学交流"}}};
void randome();
int main()
{
int st=1;
while(st!=27)
{
randome();
printf("任意键继续.ESC退出\n");
st=getch();
}
return 1;
}
void randome()
{
int i,j;
srand(time(0));
j=rand()%4;
printf("娱乐按0 学习按1\n");
scanf("%d",&i);
while ((i!=0)&&(i!=1))
{
printf("输入有误,请重新输入\n");
scanf("%d",&i);
fflush(stdin);
}
printf("%s\n\n",act[i][j]);
}
[解决办法]