日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

简易打字测试

發布時間:2023/12/8 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 简易打字测试 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

功能:(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);}elseprintf("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

?

?

?

總結

以上是生活随笔為你收集整理的简易打字测试的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。