C中的图形function

为什么我在运行代码时什么都看不见? 我用DOSBox。

#include  #include  #include  #include  #include  #include  #include  #include  int main() { int gdriver = DETECT,gmode = 0; initgraph(&gdriver,&gmode,"C:\\TC\\BGI"); struct time t; moveto(5,10); outtext("Hello"); moveto(6,11); outtext("World**strong text**"); moveto(1,24); outtext("Press: 1-About_Author, 2-Current_Time,ESC to EXIT"); closegraph(); return 0; } 

你的代码是对的。 问题在于您搜索显示驱动程序文件"C:\\TC\\BGI"的路径。 这通常是因为tc不是已安装驱动器的根目录或您使用的.exe文件路径不是c:\\TC 。 用"..//bgi"替换路径。 这将从bin当前工作目录 )重定向到bgi。