C语言中的图形功能 [英] Graphical functions in C

查看:145
本文介绍了C语言中的图形功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在运行代码时什么也看不到? 我使用DOSBox.

Why I see nothing when I run my code ? I use 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.

Your code is right. The problem is with the path you are giving to search for the display driver files "C:\\TC\\BGI". This generally happen because the tc is not root of the mounted drive or the .exe file path you are using is not c:\\TC. Replace the path with "..//bgi". This will redirect from bin(the current working directory) to bgi.

这篇关于C语言中的图形功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆