简单的C语言问题,高手进!

帮忙调试一下下面的程序,谢谢!

#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;
}

第1个回答  2007-12-22
#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;
}
小伙也姓刘吧。
第2个回答  2007-12-19
#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;
}

在TC下面的话就是这样,另外delay函数在不同的机子上面延时不同,还要改大一点
第3个回答  2007-12-19
#include <graphics.h>
#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;
}

貌似没什么再可改的了,你算法有无问题?
第4个回答  2008-01-09
#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;
}
调试顺利通过本回答被提问者采纳
第5个回答  2008-01-08
#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;
}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网