郁闷,不知道为什么程序不能正常退出!!在线等!解决马上给分!

cenphoenix 2003-04-21 10:29:22
请指教!!
...全文
31 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cenphoenix 2003-04-22
  • 打赏
  • 举报
回复
各位大虾帮帮忙拉。
用户 昵称 2003-04-22
  • 打赏
  • 举报
回复
没有一点注释
cenphoenix 2003-04-21
  • 打赏
  • 举报
回复
没人回答。哎,自己帮自己up!
cenphoenix 2003-04-21
  • 打赏
  • 举报
回复
程序如下:
#include <stdlib.h>
#include <process.h>
#include <dos.h>
#include <conio.h>
#define delay_time 40000
#define dengji 8
struct node
{char val;
int x;
int y;
};
main()
{char key;
long n=0;
int x1,y1;
char character[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
struct node p[dengji];
int i;
int flag=1;
for(i=1;i<=dengji;i++)
{p[i].val=character[random(26)];
p[i].x=random(70);
p[i].y=1;
}
textmode(C80);
textcolor(GREEN);
textbackground(LIGHTBLUE);
clrscr();
while(flag)
{if(kbhit())
{key=getch();
for(i=1;i<=dengji;i++)
{if(key==p[i].val)
{p[i].val=character[random(26)];
p[i].x=random(70);
p[i].y=1;
n++;
}
}
if(key==27)
flag=0;
}
for(i=1;i<=dengji;i++)
{gotoxy(p[i].x,p[i].y);
printf("%c",p[i].val);
p[i].y++;
}
delay(delay_time);
clrscr();
for(i=1;i<=dengji;i++)
{if(p[i].y==25)
{p[i].val=character[random(26)];
p[i].x=random(70);
p[i].y=1;
}
}
x1=wherex();
y1=wherey();
gotoxy(55,1);
printf("%d sec,keydown times %d",clock()/18,n);
gotoxy(x1,y1);
}


}
FiLng 2003-04-21
  • 打赏
  • 举报
回复
ft

70,037

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧