帮忙调试一下下面的程序,谢谢!
#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;
}
#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;
}
小伙也姓刘吧。
#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;
}
在TC下面的话就是这样,另外delay函数在不同的机子上面延时不同,还要改大一点
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
main()
{int gdriver = DETECT, gmode, errorcode;
int a,b;
int j,i,y=0;
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,};
printf ("qing shu ru yi dong de ju li:");
scanf ("%d %d",&a,&b);
initgraph(&gdriver, &gmode, "c:\\XX\XXX\XXX.bgi"); /* 这里格式要输入全 */
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
for (y=0; y<=10; y++ )
{ for (i=0; i<4; i++ )
{
for (j=0; j<7; j++) xm[j][i]=a/10; /*这里不知道你要做什么,给你改成这样了?*/
i++; /* 如果你真要硬再加个1也只这样了。 */
}
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(100);
cleardevice();
}
getch();
closegraph();
return 0;
}
貌似没什么再可改的了,你算法有无问题?
#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;
}
调试顺利通过本回答被提问者采纳
#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;
}