gameloop.c

来自「The art and science of c_source code!」· C语言 代码 · 共 43 行

C
43
字号
/* * File: gameloop.c * ---------------- * This program is used as an illustration of the * StringEqual function. */#include <stdio.h>#include "genlib.h"#include "simpio.h"#include "strlib.h"/* Function prototypes */void PlayOneGame(void);/* Main program */main(){    string answer;    while (TRUE) {        PlayOneGame();        printf("Would you like to play again? ");        answer = GetLine();        if (StringEqual(answer, "no")) break;    }}/* * Function: PlayOneGame * Usage: PlayOneGame(); * --------------------- * This is a dummy function that could be replaced by * any game-playing program. */void PlayOneGame(){    printf(". . . play the game . . .\n");}

⌨️ 快捷键说明

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