vc的一段代码帮忙修改一下,我想让屏幕中闪烁的#有很多个,为什么一直就只能显示一个
#include<stdio.h>#include<tc.h>#defineMIN_X0#defineMAX_X75#defineMIN_Y0#defineMAX_Y20...
#include <stdio.h>
#include <tc.h>
#define MIN_X 0
#define MAX_X 75
#define MIN_Y 0
#define MAX_Y 20
void print_box();
void print_dot(int x,int y,char ch);
int main()
{
int x=10,y=10;
int xv=1,yv=1;
gotoxy(0,0);
printf(" ");
print_box();
while(1)
{
print_dot(x,y,' ');
if(x <= MIN_X || x >= MAX_X)
xv *= -1;
if(y <= MIN_Y || y >= MAX_Y)
yv *= -1;
x += xv;
y += yv;
print_dot(x,y,'*');
delay(50);
}
return 0;
}
void print_box()
{
int i,j;
for(i=MIN_X; i <= MAX_X; i++)
for(j=MIN_Y; j <= MAX_Y; j++)
{
if(i == MIN_X || i == MAX_X
|| j == MIN_Y || j == MAX_Y)
{
gotoxy(i,j);
printf("#");
}
}
}
void print_dot(int x,int y,char ch)
{
gotoxy(x,y);
printf("%c",ch);
} 展开
#include <tc.h>
#define MIN_X 0
#define MAX_X 75
#define MIN_Y 0
#define MAX_Y 20
void print_box();
void print_dot(int x,int y,char ch);
int main()
{
int x=10,y=10;
int xv=1,yv=1;
gotoxy(0,0);
printf(" ");
print_box();
while(1)
{
print_dot(x,y,' ');
if(x <= MIN_X || x >= MAX_X)
xv *= -1;
if(y <= MIN_Y || y >= MAX_Y)
yv *= -1;
x += xv;
y += yv;
print_dot(x,y,'*');
delay(50);
}
return 0;
}
void print_box()
{
int i,j;
for(i=MIN_X; i <= MAX_X; i++)
for(j=MIN_Y; j <= MAX_Y; j++)
{
if(i == MIN_X || i == MAX_X
|| j == MIN_Y || j == MAX_Y)
{
gotoxy(i,j);
printf("#");
}
}
}
void print_dot(int x,int y,char ch)
{
gotoxy(x,y);
printf("%c",ch);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询