C 中的图形函数

Graphical functions in C

为什么我 运行 我的代码什么也看不到? 我用的是 DOSBox.

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include <bios.h>
#include <ctype.h>
#include <math.h>

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.