新手问题这个C语言程序哪里错了

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了新手问题这个C语言程序哪里错了相关的知识,希望对你有一定的参考价值。

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

/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int stangle = 45, endangle = 135;
int radius = 100;

/* initialize graphics and local variables */

initgraph(&gdriver, &gmode, "");

/* read result of initialization */
errorcode = graphresult();
/* an error occurred */

if (errorcode != grOk)


printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */



midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());

/* draw arc */

arc(midx, midy, stangle, endangle, radius);

/* clean up */

getch();

closegraph();

return 0;

buildexecute后它说this file does not exist。 Do you want to build it?

char *num2str(int i)
char str[30];
sprintf(str, "%d", i);
return 0;

返回了0

printf("%s %s\\n",num2str(num1),
num2str(num2));
这里调用num2str 返回全都是空指针。

ps:num2str不要返回临时变量str
希望对你能有所帮助。追问

我须要怎么做,哪里改一下

参考技术A 你选择编译就是了。build有没有错误,有的话才是语法哪里有错误,没有的话看能不能正常运行。

以上是关于新手问题这个C语言程序哪里错了的主要内容,如果未能解决你的问题,请参考以下文章