打字练习程序有点问题
我写了个打字程序在输入总是超出边框怎么解决!!代码如下.如果用cputch和cgetch运行则说没定义!!!!红字部分#include<stdio.h>
#include<string.h>
#include<conio.h>
main()
{
int i,count=0,right=0,error=0,x=3,y=13;
char *p="dasdasfdfdfdsfsdgsdagdsasdasdasfdsfeadsfdsgfgfagffadgasdasdsadasdsadsadasdasweasasdawdasd";
char ch;
textbackground(BLUE);
clrscr();
textcolor(6);
gotoxy(2,2);
putch(0xC9);
for(i=3;i<79;i++)
cprintf("%c",0xCD);
cprintf("%c",0xBB);
printf("\n");
for(i=3;i<24;i++)
{
gotoxy(2,i);
putch(0xBA);
gotoxy(79,i);
putch(0xBA);
}
gotoxy(2,24);
putch(0xC8);
for(i=3;i<79;i++)
putch(0xCD);
putch(0xBC);
gotoxy(2,12);
putch(0xCC);
for(i=3;i<79;i++)
putch(0xCD);
putch(0xB9);
gotoxy(2,22);
putch(0xCC);
for(i=3;i<79;i++)
putch(0xCD);
putch(0xB9);
window(3,3,78,11);
textbackground(3);
clrscr();
cputs(p);
window(3,13,78,21);
textbackground(7);
clrscr();
window(3,23,80,25);
printf("count: right: error:");
window(3,13,78,21);
for(i=0;i<1000&&*(p+i)!='\0';i++)
{
ch=getch();/*这里用cgetch*/运行时说未定义 if(ch==*(p+i)) right++;
if(ch!=*(p+i)) error++;
count++;
x++;
putch(ch);/*这里用cputch(ch)*/运行时说未定义
window(3,23,80,25);
printf("count:%d right:%d error:%d",count,right,error);
if(x==76)
{
y++;
x=0;
}
window(x,y,78,21);
}
}