Ming3000 Ming3000
关注数: 14 粉丝数: 16 发帖数: 1,374 关注贴吧数: 16
新手求助,程序执行时有部分代码未执行,是怎么回事? 一下是源代码,刚开始自己做的,但一直出现问题(无报错),所以直接复制的答案,然后用gcc -std=c99 -O3 -Wall进行编译,但问题依旧,所以只能向高手求助了。这是一个猜数字的游戏,开始时,游戏会输出2个随机数字,停留1秒,然后删除,等待用户输入正确数字。 /* Program 4.12 Simple Simon */ #include <stdio.h>                      /* For input and output    */ #include <ctype.h>                      /* For toupper() function */ #include <stdbool.h>                    /* For bool, true, false   */ #include <stdlib.h>                     /* For rand() and srand() */ #include <time.h>                       /* For time() and clock() */ int main(void) {    char another_game = 'Y';    int correct = false;    int counter = 0;    int sequence_length = 0;      /* Number of digits in a sequence         */    time_t seed = 0;              /* Seed value for random number sequence */    int number = 0;               /* Stores an input digit                  */    time_t now = 0;             /* Stores current time - seed for random values   */    int time_taken = 0;         /* Time taken for game in seconds                 */    printf("\nTo play Simple Simon, ");    printf("watch the screen for a sequence of digits.");    printf("\nWatch carefully, as the digits are only displayed"                                                  " for a second! ");    printf("\nThe computer will remove them, and then prompt you ");    printf("to enter the same sequence.");    printf("\nWhen you do, you must put spaces between the digits. \n");    printf("\nGood Luck!\nPress Enter to play\n");
首页 1 2 3 4 下一页