#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
clrscr();
/* request auto detection */
int gdriver = (DETECT)/3, gmode, errorcode;
int midx, midy;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "C:/TURBOC3/BGI/");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
line(midx, midy, midx/2,midy/2);
/* clean up */
getch();
closegraph();
return 0;
}
可能是什么解决方案?我只是C的初学者...对不起,如果我不能让你清楚......
我还附上了我得到的错误图片,..
答案 0 :(得分:2)
使用像DosBox这样的模拟器 - http://www.dosbox.com/
答案 1 :(得分:2)
Turbo C ++生成16位二进制应用程序,它无法在win7 32/64位环境中运行。使用像DosBox
这样的模拟器答案 2 :(得分:1)
为此目的使用dosbox 按照步骤
1.安装软件DOSBox download
2.下载并提取TC
3.确保DOSBox和TC位于同一目录中,TC.exe应用程序位于文件夹TC&gt;&gt; BIN&gt;&gt; TC.exe中,以便工作。
4.运行DOSBox并在命令提示符下键入以下命令 mount d c:
5.现在您应该收到一条消息:驱动器D作为本地目录安装c: 输入d:进入 d:
6.接下来按照以下命令: cd tc
cd bin
和 tc或tc.exe
7.在Turbo C编辑器中,转到选项&gt;目录&gt;更改目录&gt;将TC的源更改为源目录[D]
8.转到程序文件&gt; DosBox文件夹。&gt; DOSBox 0.74选项&gt;并使用记事本编辑它(移动到文件末尾)
9&gt;。并粘贴代码,如下所示。
mount d c:\
d
cd tc
cd bin
TC.EXE
在此步骤结束时,当您单击DosBox图标时,Turbo C将自动加载。
答案 3 :(得分:0)
如果您不介意重启:Control Panel > Device Manager > Display Adapters
并选择Disable
。