📄 p_r_s.h
字号:
/* The game of paper rock and scissors*/
#include <ctype.h> // for isspace()
#include <stdio.h> // for printf().etc
#include <stdlib.h> // for rand() and srand()
#include <time.h> // for time()
#include <string.h> // for strcpy()
/* some command of this game */
enum p_r_s
{
paper,rock,scissors,game,help,instruction,quit
};
/* the result of this game */
enum outcome
{
win,lose,tie,error
};
typedef enum p_r_s p_r_s;
typedef enum outcome outcome;
/* compare the choice of player and the machine*/
outcome compare(p_r_s player_choice,p_r_s machine_choice);
/* Get the final result of this game*/
void prf_final_status(int win_cnt,int lose_cut);
/* Get the result of this game*/
void prf_game_status(int win_cnt,int lose_cnt,int tie_cnt);
/* Get the help of this game */
void prf_help(void);
/*Get the Instruction of this Game*/
void prf_instruction(void);
/*change the choice to string type*/
char *prf_string_choice(p_r_s choice);
/* To tabulate result*/
void report_and_rabulate(outcome result,
int *win_cnt_ptr,
int *lose_cnt_ptr,
int *tie_cnt_ptr);
/* selection by machine (paper rock and scissors)*/
p_r_s selection_by_machine(void);
/* selection by player (paper rock and scissors)*/
p_r_s selection_by_player(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -