gpt4 book ai didi

c - C 中的图形函数

转载 作者:太空狗 更新时间:2023-10-29 15:41:41 24 4
gpt4 key购买 nike

为什么我在运行代码时什么也看不到?我使用 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。

关于c - C 中的图形函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34219457/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com