打字测试程序代码(C语言)

其中头文件"key.h"内容见文章最后部分

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <malloc.h>

#include <time.h>

#include <math.h>

#include <bios.h>

#include <dir.h>

#include "key.h"



typedef struct TEXE

{

	unsigned char ch;

	unsigned char attr;

}Text;

typedef struct 

{

char name[25];

float sco;

}record;

int score[6]={0};

int key,myscore=0;

int right=0,wrong=0,last;

double RightRate=1.0,speed=0.0;

struct ffblk ffblk;

time_t StartTime,LeftTime;

void Main_menu();

void Start_test();

void Type_test(char*s);

void End_test();

void Print_score();

void Get_time(char*);

void Manager_paper();

void Edit_paper();

void Score_list();

void texte(char *str);

int main()

{

	Main_menu();

	return 0;

}

void Main_menu()

{

	textmode(C80);

	textbackground(WHITE);

	clrscr();

	window(6,3,75,23);

	textbackground(BLACK);

	textcolor(WHITE);

	clrscr();

	gotoxy(20,3);

	printf("Welcome To XXX Typing Test ");

	gotoxy(27,6);

	printf("Main Menu");

	gotoxy(24,8);

	printf("1 Typing    Text ");

	gotoxy(24,10);

	printf("2 High    Scores");

	gotoxy(24,12);

	printf("3 Edit Text Yourself ");

	gotoxy(24,14);

	printf("4 Exit Test");

	gotoxy(24,16);

	printf("Please press 1,2,3or4:");

	gotoxy(22,18);

	cprintf(" CopyRight(c) 2008 XXX");

	gotoxy(46,16);

	switch(getch())

	{

		case'1':

		{

			Start_test();

			break;

		}

		case'2':

		{

			Score_list();

			break;

		}

		case'3':

		{

			Manager_paper();

			break;

		}

		case'4':

		{

			exit(0);

		}

		default:

		Main_menu();

	}

	

}

void Start_test()

{

	char str[][20]={"test1.txt","test2.txt","test3.txt","test4.txt"};

	FILE *fp;

	textmode(C80);

	textbackground(WHITE);

	clrscr();

	window(6,4,75,22);

	textbackground(BLACK);

        textcolor(WHITE);

	clrscr();

	gotoxy(20,5);

	printf("Choose One Test ");

	gotoxy(20,7); 

	printf("1  1.txt");

	gotoxy(20,9); 

	printf("2  2.txt");

	gotoxy(20,11); 

	printf("3  3.txt");

	gotoxy(20,13);

	printf("4  4.txt");

        gotoxy(20,15);

        printf("Choose The Test:");

    while(1)

    {

    switch(getch())

    {

    	case '1': {Type_test(str[0]);break;}



        cas
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值