幸運之星遊戲C語言

2021-08-16 05:29:35 字數 1402 閱讀 1058

後來才找到題目,所以沒有完全按照題目中來寫,不過寫了有八成吧,大致上還是一樣的,主體**本來挺簡單的,到了輸出排行榜的時候,想練練寫鍊錶的**,結果這個函式寫了一大堆。

//幸運星

#include#include#include#includestruct person;

struct award;

struct awardperson;

typedef struct person person;

typedef struct award award;

typedef struct awardperson awardperson;

void initaward();

void initcircle();

void playgame();

void gameover();

void showbestxingyunlist();

int m;//獎品數

int n;//人數

person* c=null;//人圍成的圈

award* a=null;//獎品池

awardperson* aphead=null;//獲獎名單

file* fp=null;

int main()

printf("\n\n輸入0開始新的一輪,"

"輸入1結束遊戲\n");

scanf("%d",&choices);

} fclose(fp);

showbestxingyunlist();

return 0;

} void initaward()

a=(award*)malloc(sizeof(award)*m);

int j;

printf("請輸入%d件獎品資訊(格式為:名稱 **):\n",m);

for(j=0;jnextawardperson=null;

while(fscanf(fp,"%d%s%s%d",&newperson->id,newperson->personname,

newperson->awardname,&newperson->price)!=eof)elseelseelse

} if(current==null)}}

newperson=(awardperson*)malloc(sizeof(awardperson));

newperson->nextawardperson=null;

} current=aphead;

previous=null;

while(current!=null)

fclose(fp);

}else

}

C語言遊戲

背景字型顏色 include includeint mian 退出當前程式 include includeint main 檔案ini的寫入和獲得getprivateprofilestring p1.username,hp game player property hp,player.ini 獲得當...

C語言小遊戲 生命遊戲

使用的是microsoft visual studio 2017開發環境 lifegame.cpp 定義控制台應用程式的入口點。include stdafx.h include include include include define high 25 define width 50 全域性變數 ...

C語言 掃雷遊戲

標頭檔案 ifndef mine h define mine h define line 10 define list 10 define rows 6 define cows 6 int game char userboard line 2 list 2 char playerboard line...