为了账号安全,请及时绑定邮箱和手机立即绑定

可以帮忙调试一下下面的程序吗?

可以帮忙调试一下下面的程序吗?

C
繁星coding 2023-04-23 17:13:05
帮忙调试一下下面的程序,谢谢!#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>#include <math.h>main(){int gdriver = DETECT, gmode, errorcode;int a,b;float xm[7][4];initgraph(&gdriver, &gmode, "c:\\tc20\BGI");errorcode = graphresult();if (errorcode != grOk){printf("Graphics error: %s\n", grapherrormsg(errorcode));printf("Press any key to halt:");getch();exit(1);}xm[7][4]={{145,132,155,151},{127,155,177,155},{162,155,127,219},{131,162,172,212},{183,146,184,201},{203,130,203,223},{186,210,203,223},};printf ( "%s \n", "qing shu ru yi dong de ju li" );scanf ( "%d","%d",&a,&b);for (int y=0; y<=10, y++ ){ for (int i=0; i<4; i++ ){for (int j=0; j<7; j++) a[j][i]=+a/10;i++;}for(int i=1; i<4; i++ ){for (int j=0; j<7; j++) xm[j][i]=+b/10;i++;}for (int i=0; i<7;i++) line(xm[i][0],xm[i][1],xm[i][2],xm[i][3]);delay(100);cleardevice();}getch();closegraph();return 0;}
查看完整描述

2 回答

?
慕慕森

TA贡献1856条经验 获得超17个赞

#include <graphics.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <conio.h> 
#include <math.h> 
main() 
{int gdriver = DETECT, gmode, errorcode; 
int a,b; 
float xm[7][4]; 

initgraph(&gdriver, &gmode, "c:\\tc20\BGI"); 

errorcode = graphresult(); 

if (errorcode != grOk) 

printf("Graphics error: %s\n", grapherrormsg(errorcode)); 
printf("Press any key to halt:"); 
getch(); 
exit(1); 

xm[7][4]={{145,132,155,151},{127,155,177,155}, 
{162,155,127,219},{131,162,172,212}, 
{183,146,184,201},{203,130,203,223}, 
{186,210,203,223}, 

}; 
printf ( "%s \n", "qing shu ru yi dong de ju li" ); 
scanf ( "%d","%d",&a,&b); 
for (int y=0; y<=10, y++ ) 
{ for (int i=0; i<4; i++ ) 

for (int j=0; j<7; j++) a[j][i]=+a/10; 
i++; 


for(int i=1; i<4; i++ ) 

for (int j=0; j<7; j++) xm[j][i]=+b/10; 
i++; 


for (int i=0; i<7;i++) line(xm[i][0],xm[i][1],xm[i][2],xm[i][3]); 
delay(100); 
cleardevice(); 

getch(); 
closegraph(); 
return 0; 
}
调试顺利通过

查看完整回答
反对 回复 2023-04-26
?
侃侃尔雅

TA贡献1801条经验 获得超16个赞

#include <graphics.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <conio.h> 
#include <math.h> 
main() 

int gdriver = DETECT, gmode, errorcode; 
int i,j,a,b,y; 
float xm[7][4]={ 
{145,132,155,151},{127,155,177,155}, 
{162,155,127,219},{131,162,172,212}, 
{183,146,184,201},{203,130,203,223}, 
{186,210,203,223} 
}; 

initgraph(&gdriver, &gmode, "c:\\tc20\BGI"); 

errorcode = graphresult(); 

if (errorcode != grOk) 

printf("Graphics error: %s\n", grapherrormsg(errorcode)); 
printf("Press any key to halt:"); 
getch(); 
exit(1); 

printf ( "%s \n", "qing shu ru yi dong de ju li" ); 
scanf ( "%d%d",&a,&b); 
for (y=0; y<=10; y++ ) 

for (i=0; i<4; i++ ) 

for (j=0; j<7; j++) xm[j][i]+=a/10; 
i++; 


for(i=1; i<4; i++ ) 

for (j=0; j<7; j++) xm[j][i]+=b/10; 
i++; 


for (i=0; i<7;i++) line(xm[i][0],xm[i][1],xm[i][2],xm[i][3]); 
delay(100000); 
cleardevice(); 

getch(); 

closegraph(); 
return 0; 
}

 


查看完整回答
反对 回复 2023-04-26
  • 2 回答
  • 0 关注
  • 210 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信