100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > c语言实现程序只执行一次 请问大家 为什么我调用我定义的函数俩次 但是程序只执行

c语言实现程序只执行一次 请问大家 为什么我调用我定义的函数俩次 但是程序只执行

时间:2023-09-06 10:48:26

相关推荐

c语言实现程序只执行一次 请问大家 为什么我调用我定义的函数俩次 但是程序只执行

该楼层疑似违规已被系统折叠隐藏此楼查看此楼

#include

#include

#include

void gotoxy(int y,int x)

{

COORD scrn;

HANDLE hOuput=GetStdHandle(STD_OUTPUT_HANDLE);

scrn.X=x;scrn.Y=y;

SetConsoleCursorPosition(hOuput,scrn);

}

void put(int n,char ch)

{

for(int i=0;i

printf("%c",ch);

}

int height=20;int width=60;

void face()

{

gotoxy(5,5);

put(width,'*');

for(int j=0;j

{

gotoxy(6+j,5);

printf("*");

}

gotoxy((height+5),5);

put(width,'*');

for(int n=0;n

{

gotoxy(6+n,width+4);

printf("*\n");

}

}

void ball(int x,int y,int xp,int yp)

{

while(1)

{

gotoxy(y,x);

printf("o");

Sleep(200);

gotoxy(y,x);

printf(" ");

x+=xp;

y+=yp;

if(x>width+2||x<7)

xp=-xp;

if(y>height+3||y<7)

yp=-yp;

if(x>=width+2)

x=width+2;

if(y>height+4)

y=height+4;

if(x<=7)

x=7;

if(y<6)

y=6;

}

}

main()

{

face();

ball(8,13,2,3);

ball(12,10,4,1);

}

c语言实现程序只执行一次 请问大家 为什么我调用我定义的函数俩次 但是程序只执行一次...

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。