标题:高手啊。你在那里?
只看楼主
chendazhao
Rank: 1
等 级:新手上路
帖 子:87
专家分:0
注 册:2007-12-5
结帖率:100%
 问题点数:0 回复次数:1 
高手啊。你在那里?
下面是随机输出A---Z之间地7个字母,当没有输入的情况下,字母重复出又消失,如果有输入,当输入这个字母屏幕上也有这个字母,这个字母消失。
怎么输入了,这个字母不消失,
   /*  HELLO.C -- Hello, world */

#include <stdio.h>
#include <graphics.h>
#include <time.h>
#include <stdlib.h>
#include<dos.h>
#include<conio.h>


void init(void);
void draw(void);
void strat();
void time_();
int key;

void main()

{
 init();
 draw();
 strat();
 getch();
 }

void init (void)
{
int gm=0,god=0;
initgraph(&gm,&god,"c;\\tc");

}

void draw()
{
int i;
setcolor(11);
for(i=0;i<=635;i=i+10)
rectangle(i,0,i+10,10);
for(i=0;i<635;i=i+10)
rectangle(i,469,i+10,479);

 for(i=0;i<=479;i=i+10)
rectangle(0,i,10,i+10);
 for(i=0;i<=469;i=i+10)
rectangle(625,i,635,i+10);
}

void strat(void)
{

int m,n,t,key;
  time_t p;

int x[10],y[10],a[10];

srand((unsigned) time(&p));
 for(t=0;t<8;t++)
  {

  x[t]=rand()%80;
  y[t]=rand()%25;
  a[t]=rand()%26+65;

 time_();
   gotoxy(x[t],y[t]);
   setcolor(4);
 printf("%c ",a[t]);
  }
while(1)
{
  while( !kbhit())
  {
 srand((unsigned)time(&p));
t=rand()%8;
  setcolor(0);
  rectangle (x[t],y[t],x[t]+10,y[t]+10);

   srand((unsigned) time(&p));

  x[t]=rand()%350+100;
  y[t]=rand()%540+100;


  srand((unsigned)time(&p));
a[t]=rand()%36+35;
    time_();
   gotoxy(x[t],y[t]);
 printf("%c",a[t]);

   time_();

  }

 key=bioskey(0);

for(t=0;t<8;t++)
{
if(key==a[t])
{setcolor(0);
  rectangle (x[t],y[t],x[t]+10,y[t]+10);

srand((unsigned) time(&p));

  x[t]=rand()%350+100;
  y[t]=rand()%540+100;
  srand((unsigned)time(&p));
a[t]=rand()%36+35;
    time_();
   gotoxy(x[t],y[t]);
 printf("%c",a[t]);
   }
   time_();

}
 }

 }




void time_()
{
int a;
for(a=0;a<10;a++)
delay (100000);

}
搜索更多相关主题的帖子: void include 字母 init 
2008-03-31 22:58
chendazhao
Rank: 1
等 级:新手上路
帖 子:87
专家分:0
注 册:2007-12-5
得分:0 
怎么没人来看我啊
2008-04-01 09:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-206448-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.314163 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved