也许我误写了一个病毒?

时间:2013-04-16 18:42:20

标签: c windows

当我在代码下运行时,它一直工作到简单游戏的3次迭代,但是在第3次迭代之后CPU使用率下降到90%并立即崩溃。甚至控制台终止,但在Windows任务列表中可以看到程序exe以下。我必须手动删除它为Windows CPU返回3%的水平。 你知道是什么原因造成的吗? (我在Windows 7 64位机器上使用Dev-C ++)

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void game(void);
int main(void) {
    srand(time(NULL));
    game();
    return 0;
}
void game(void) {
    int choice = 1;
    while (choice != 0) {
        int number1, number2, resultStudent, result;
        number1 = 1 + rand() % 9;
        number2 = 1 + rand() % 9;
        result = number1 * number2;
        printf("How much is %d times %d ?", number1, number2);
        scanf("%d", & resultStudent);
        while (resultStudent != result) {
            printf("No. Please try again.");
            scanf("%d", &resultStudent);
        }
        printf("Very Good\n");
        printf("Do you wanna play again?(0 for Exit):  ");
        scanf(" %d", &choice);
        printf("Hmm you wanna play again...\n");
    }
    printf("Program is terminated.");
}

0 个答案:

没有答案