C 中的图形函数

2024-03-09

为什么我运行代码时什么也看不到? 我用的是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(当前工作目录)到华大基因。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

C 中的图形函数 的相关文章

随机推荐