简易打字测试

功能:(1)三种LEVEL;(2)根据LEVEL选择计时;(3)随机选择文章;(4)显示打字能力,并判断是否通关

待解决问题:提前打完了怎么办?

//打字游戏

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

int choose(char passage[][1000]);//随机选文函数
int counttime(int t);//计时函数
int piont(char *passage,char *answer,int t,int *letter,int *speed,int *correct,int *total);//统分函数

int main(void)
{
    char passage[3][1000]={"  Once when I was six years old I saw a magnificent picture in a book, called True Stories from Nature, about the primeval forest. It was a picture of a boa constrictor in the act of swallowing an animal. Here is a copy of the drawing. In the book it said, Boa constrictors swallow their prey whole, without chewing it.",
        "  My drawing was not a picture of a hat. It was a picture of a boa constrictor digesting an elephant. But since the grown-ups were not able to understand it, I made another drawing: I drew the inside of the boa constrictor, so that the grown-ups could see it clearly. They always need to have things explained. My Drawing Number Two looked like this: The grown-ups response, this time was to advise me to lay aside my drawings of boa constrictors, whether from the inside or the outside, and devote myself instead to geography, history, arithmetic and grammar.",
        "  That is why, at the age of six, I gave up what might have been a magnificent career as a painter. I had been disheartened by the failure of my Drawing Number One and my Drawing Number Two. Grown-ups never understand anything by themselves, and it is tiresome for children to be always and forever explaining things to them."
    };
    char answer[500];
    int total,letter,speed,correct,level,which,t[3]={180,120,60};
//    total文章总字数,letter输入的总字数,speed输词速度(只计算准确的量),correct正确字数,level选择级别,which抽中文章,t总计时
    printf("Easy1, Medium2, Hard3?\n");
    scanf("%d",&level);
    
    which = choose(passage);
    
    counttime(t[level-1]);
    gets(answer);
    
    piont(passage[which],answer,t[level-1],&letter,&speed,&correct,&total);
    printf("Level %d\n\
In %d seconds, you had printed %d letters, in which %d one are correct.\nYour speed is %d letter/min.\n",level,t[level-1],letter,correct,speed);
    
    if (correct > total*8/10)
    {
        printf("You passed level %d!\n",level);
    }
    else
        printf("Fail the challenge!\n");
    
    return 0;
}

int choose(char passage[][1000])
{
    int i;
    srand((unsigned)time(NULL));
    i = rand()%3;
    
    printf("%s\n",passage[i]);
    printf("\n");
    
    return i;
}

int counttime(int t)
{
    long a,b;
    
    printf("Start now?\n");
    getchar();
    getchar();
    printf("Start!\n");
    
    a = time(NULL);
    while (1)
    {
        b = time(NULL);
        if ((b-a)>=t)
        {
            printf("\n%d seconds off!\n",t);
            break;
        }
    }

    return 0;
}

int piont(char *passage,char *answer,int t,int *letter,int *speed,int *correct,int *total)
{
    int i;
    *correct = 0;
    
    for (i=0; passage[i] != '\0'; i++)
    {
        ;
    }
    *total = i;
    
    for (i=0; answer[i] != 0; i++)
    {
        if (passage[i] == answer[i])
        {
            (*correct)++;
        }
    }
    *letter = i;
    
    *speed = (*correct)*60/t;
    
    return 0;
}


选文摘自The Little Prince

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
打字测试在线swf是一种在线打字测试工具,它通过swf(Shockwave Flash)格式的文件提供打字练习和测试的功能。SWF是一种用于嵌入式网页动画和应用程序的多媒体格式。 使用打字测试在线swf,用户可以通过键入屏幕上显示的文字来提高他们的打字技能和速度。swf文件会显示一系列文字或句子,用户需要迅速准确地将它们键入。测试的结果会显示用户打字速度,错误次数以及可以评估的准确性。这个工具可以帮助用户测试和改进他们的打字水平,并促进他们在各种场景下的打字技能。 打字测试在线swf具有以下优点: 1. 提供了一个方便的在线打字测试工具,让用户可以随时随地进行练习和测试。 2. 通过实时评估用户打字速度和准确性,帮助用户了解自己的打字水平,并提供改进的机会。 3. 可以根据用户需要调整测试的难度和持续时间,以满足不同用户的需求。 4. 通过视觉和听觉反馈,用户可以了解自己的打字进展,并实时纠正错误。 5. 提供了一种有趣和刺激的方式来学习和练习打字技能,激发用户保持长时间的兴趣和动力。 6. 由于swf格式的特性,它可以在大多数现代浏览器上流畅运行,并且不需要用户安装额外的插件或软件。 综上所述,打字测试在线swf是一种非常有用的工具,它可以帮助用户提高打字速度和准确性,同时提供了一个有趣和方便的方式来测试和改进打字技能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值