p_r_s.h

来自「石头剪子布的游戏」· C头文件 代码 · 共 27 行

H
27
字号
/* The game of paper, rock, scissors. */

#include <ctype.h>		/* for isspace() */
#include <stdio.h>		/*for printf(), etc */
#include <stdlib.h>		/* for rand() and srand() */
#include <time.h>		/* for time() */

enum p_r_s {paper, rock, scissors,
game, help, instructions, quit};


enum outcome {win, lose, tie, error};

typedef	enum p_r_s		p_r_s;
typedef	enum outcome	outcome;

outcome	compare(p_r_s player_choice, p_r_s machine_choice);
void	prn_final_status(int win_cnt, int lose_cnt);
void	prn_game_status(int win_cnt,
						int lose_cnt, int tie_cnt);

void	prn_help(void);
void	prn_instructions(void);
void	report(outcome result, int *win_cnt_ptr,
			   int *lose_cnt_ptr, int *tie_cnt_ptr);
p_r_s	selection_by_machine(void);
p_r_s	selection_by_player(void);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?