很久以前写的一个小项目,有兴趣的可以进来看看。
这个小项目主要包含以下信息和功能:
1、玩家信息--->(结构体)包含名字,密码,赢的场数, 总的场数,胜利比率
2、创建玩家
3、销毁玩家
4、创建游戏菜单
5、电脑载入(出拳时动态显示)
6、显示出拳的信息
7、电脑出拳的核心函数(随机函数)
8、退出时显示排行榜
#define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
//宏定义
//#define 宏名 宏定义;
#define NAME_SIZE 20
#define PASSWD_SIZE 20
#define NAME "zhangsan"
#define PASSWD "123456"
#define TRUE 1
#define MFLUSH {int ch = 0; \
while ((ch = getchar()) != '\n' \
&& ch != EOF); }
//{
//char ch = 0;
//ch = getchar();
//while ( '\n' != ch && ch != EOF)
//{
//ch = getchar();
//}
//}
#define CONTINUE(X) {printf("%s", X); getchar();}
//{
//char str = "按回车键继续";
//printf("%s", "按回车键继续"/*tr*/);
//getchar();
//}
#define CONTINUE(X) {printf("%s", X); getchar();}
//玩家结构体
typedef struct player
{
char name[NAME_SIZE];
char passwd[PASSWD_SIZE];
int total;
int victory;
} player_t;
player_t* player;
/************************************************************************/
/*函数功能:创建玩家
/* 函数参数:无
/* 返 回 值:成功-返回堆内存首地址
/* 失败-返回NULL
/*******************************************