编程打字(编程打字速度)

2023-11-29 12:45:02 数码极客 bianji01

 

VC编程:一个简单的练习打字程序

#include

#include

#include

#include

#include

#include

intpos;

intlevel=1000;

intcount;

intnum;

intscore;

intDown;

intintst;

intisRun;

intisOver;

intisRight;

intisFull;

intmap[11][11];

intBuild_char()

intres;

res=rand()%2?(65+rand()%26):(97+rand()%26);

returnres;

intBuild_Pos()

intres;

res=rand()%10;

returnres;

voidListener(PVOIDpvoid)//监视输入的线程函数

chartemp;

while(1)

while(!kbhit());

temp=getchar();

if(temp==num)

score+=10;

isRight=1;

if(score==100)

isFull=1;

temp=0;

if(temp==1)

isRun=1-isRun;

if(temp==0)

isOver=1;

return;

voidRepaint(PVOIDpvoid)//重画

inti,j;

while(1)

if(isOver)break;

while(!isRun);

system("cls");

printf("time:%dscore:%d1---pause,0---exit\n--------------------------------------------------------\n",time(0)-intst,score);

for(i=0;i<=10;i++)

for(j=0;j<=10;j++)

if(map[i][j])printf("%c",map[i][j]);

printf("");

printf("\n");

voidCalculate()

memset(map,0,sizeof(map));

map[count][pos]=num;

voidRun()

intflag=1;

intcnt;

while(flag)//出现数字

cnt=Down;

count=1;

pos=Build_Pos();

num=Build_char();

while(cnt&&!isRight)//数字下掉

if(isOver)return;

while(!isRun);

Calculate();

count++;

cnt--;

Sleep(level);

isRight=0;

voidinit()

score=0;

isOver=0;

Down=10;

isFull=0;

isRun=1;

isRight=0;

intst=time(0);

memset(map,0,sizeof(map));

intmain()

init();

_beginthread(Listener,0,NULL);//开线程

_beginthread(Repaint,0,NULL);//开线程

Run();

if(isFull)

printf("CongratuationToYou,YouAreTheWiner\n");

//system("cls");

return0;

本回答由网友推荐

VC编程:一个简单的练习打字程序

在c语言编辑过程中如何输入汉字?

在TC下首先要安装一个中文支持软件

声明:易趣百科所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系315127732@qq.com
广告位招租
横幅广告