繁体   English   中英

c程序图形错误

[英]c program graphics error

我用C语言实现了边界填充算法,代码如下:

/* WAP to fill the polygon using boundary fill 4 connected algo */

#include "stdio.h"
#include "conio.h"
#include "graphics.h"
#include "dos.h"

void main()
{

    int gd = DETECT, gm;
    clrscr();

    detectgraph(&gd, &gm);
    initgraph(&gd, &gm , "C:\\TC\\BGI");

    rectangle(60,60,500,500);
    boundary_fill(65,65,4,15);
    getch();
    closegraph();
}

boundary_fill(int x, int y, int fclr, int bclr)
{

    if(getpixel(x,y)!= bclr && getpixel(x,y)!= fclr)
    {
        putpixel(x,y,fclr);
        boundary_fill(x+1,y,fclr,bclr);
        boundary_fill(x-1,y,fclr,bclr);
        boundary_fill(x,y+1,fclr,bclr);
        boundary_fill(x,y-1,fclr,bclr);

    }
}

当我编译它没有错误来。 但是当我运行该程序时窗口关闭,我得到以下错误: - C:\\ TC \\ BIN \\ TC.EXE NTVDM CPU遇到了非法指令..

请帮忙

停止使用turboC。 用DosBox运行你的16位程序(比如TurboC / C ++)。 由于32位COMMAND-PROMPT尝试运行16位程序,因此发生NTVDM错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM