#include<stdio.h>
typedef struct {
int blood;
char* type;
int sleep;
}Fist;
Fist f[] = {
{1, "ç´æ³", 1},
{3, "å¾æ³", 2},
{5, "ææ³", 2},
{8,"éæ³", 5},
};
#define BLOOD (100)
#define TIME (80)
int main()
{
int t = TIME;
int b = BLOOD;
srand(time(NULL));
while (t > 0) {
int c = rand() % (sizeof(f)/sizeof(Fist));
int r = rand() % 3;
printf("ä¸è®°%sè¿å", f[c].type);
if (r == 2) {
printf("éªå¼äº\n");
}
else {
printf("æ失è¡ç²¾%dç¹\n", f[c].blood);
b -= f[c].blood;
if (b <= 0) break;
}
//sleep(f[c].sleep*10);
t -= f[c].sleep;
}
if (b > 0) {
printf("è±éæ°æ¦ä»æç²¾å%dç¹\n", b);
}
else {
printf("继ç»æç»ï¼ä½ åæäº%dç§\n", TIME - t);
}
return 0;
}
温馨提示:答案为网友推荐,仅供参考