C語(yǔ)言猜拳游戲代碼及分析
● 設(shè)計(jì)思路:包括軟件的整體架構(gòu)、功能塊的設(shè)計(jì)思路、函數(shù)封裝等等;
● 功能實(shí)現(xiàn):從用戶的角度,使用上發(fā)現(xiàn)與眾不同的地方;
● 其它方面;
c語(yǔ)言程序代碼:
/*
func:猜拳游戲
auth:肖喬
date:2014.02.22
*/
#include
#include
#include
#include
#define TRUE 1
typedef struct {
charname[30]; //用戶名長(zhǎng)度最長(zhǎng)28
charpassword[30]; //密碼長(zhǎng)度最長(zhǎng)28
doublemoney;
inttimes;
intwin;
}game_t;
//清空緩存
void fflush_in();
//登錄菜單函數(shù)
void log_menu();
//功能菜單函數(shù)
void ctrl_menu();
//登錄函數(shù)
int log_in(game_t *p,int *count,int *my);
//注冊(cè)函數(shù)
int add_user(game_t *p,int *count);
//登錄控制函數(shù)
void log_ctrl(game_t *p,int *count,int*my);
//功能控制函數(shù)
void ctrl(game_t *p,int *count,int *my);
//查看函數(shù)
void look(game_t *p,int *count,int *my);
//查看菜單
void look_menu();
//查看所有
void look_all(game_t *p,int *count);
//查看個(gè)人
void look_my(game_t *p,int *my);
//初始化函數(shù)
int log_start(game_t *p,int *count);
//保存函數(shù)
int exit_save(game_t *p,int *count);
//充值函數(shù)
int pay(game_t *p,int *my);
//修改函數(shù)
void alter(game_t *p,int *count,int *my);
//修改菜單
void alter_menu();
//修改密碼
int alter_pass(game_t *p,int *my);
//注銷用戶
int del(game_t *p,int *count,int *my);
//游戲控制函數(shù)
void game_ctrl(game_t *p,int *my);
//游戲菜單
void game_menu();
//下注
int game_pay(game_t *p,int *my,double*mon);
//游戲函數(shù)
void game_play(game_t *p,int *my,double*mon);
//游戲
int game();
//排序控制函數(shù)
void cmp(game_t *p,int *count);
//排序菜單
void cmp_menu();
//按金額排序函數(shù)
int cmp_money(const void *px,const void*py);
//勝率函數(shù)
void win_times(game_t *p,int *count);
//按勝率排序函數(shù)
int cmp_win(const void *px,const void *py);
int main(){
game_tstu[100]={"