获得程序输出(无错误),但程序.exe在使用 graphics.h 时不起作用

Program output obtained(no error) but program.exe not working while using graphics.h

本文关键字:程序 graphics 不起作用 exe 输出 无错误      更新时间:2023-10-16

我已经有 graphics.h(以及 MinGW 中的相关文件),但程序无法正常工作,因为在构建并运行后,我在输出窗口中获得所需的文本输出,但没有相应的图形因为program_name.exe停止工作。我已经在网上搜索了所有内容,StackOverflow是我最后的希望。我一直在用 c+ + 进行竞争性编程,只是试图在代码块中使用 c++ 进入图形。

#include <graphics.h>
#include <iostream>
using namespace std;
int main()
{  cout<<"a";
int gd= DETECT,gm ;
char driver[] = "";
initgraph(&gd, &gm, driver);
//initgraph(&gd,&gm," ");
circle (100,100,100) ;
getch();
closegraph();
return 0;
}
这是

非常复古的。 为了使它接近工作,你需要在VirtualBox下创建一个MSDOS虚拟机,安装DOS 6.2或类似版本,安装Borland BGI,Borland C++ 5.02,然后你可能会让它工作。 如果做不到这一点,你可以找到一台旧的IBM PC并在上面安装DOS以及上面的其他所有东西。玩得愉快!