DEV-C++怎么用gotoxy函数?

如题所述

1.DEV-CPP中没有图形函数GRAPHICS,你可以去下载SDL,专门用于游戏开发和图形设计;
具体这么做: 工具->检查更新->选择第2项检查一下->选择SDL进行更新...
2.给你看段代码参考下:(在dev-cpp4992上运行正常。)
#include
#include
#include
using namespace std;

int main( void )
{
COORD pos = { 10, 15 };
SetConsoleCursorPosition( GetStdHandle(STD_INPUT_HANDLE), pos );
SetConsoleCursorPosition( GetStdHandle(STD_OUTPUT_HANDLE), pos );
SetConsoleCursorPosition( GetStdHandle(STD_ERROR_HANDLE), pos );
cout << "这里就是第10行第15列。" << endl;

system( "pause" );
}
3。如果是4.9.6.0就好办得多.
先找到:菜单 Project-> project Options -> "General "中的 "Linker Options/Optonal Libs or Obeject files ",在下面空白处,输入: "C:\Dev-Cpp_gcc321\Dev-Cpp\lib\conio.o "
C:\Dev-Cpp_gcc321\Dev-Cpp 是我的DEV_CPP的目录,你做适当修改即可,但注意要用引号 " "括起来.
再按 "ok ",
重新编译链接即可.
对于 DEV-c++ 4.9.6.0, conio.o文件在..\lib 目录下, 4.9.7.0中没有这个文件 .
DEV-C++中没有graphics.h这个头文件
4。在dev c++中添加graphics
Dev-C++ User F.A.Q.
看到下面的步骤就可以了

How do I use Borland Graphics Interface (graphics.h)?
For those of you migrating from Borland, you may be wondering where graphics.h is. Unfortunately, graphics.h is a Borland specific library and cannot be used with Dev-C++. Fortunately, a benevolent soul by the name of Michael Main has modified a BGI emulation library for Windows applications to be used under MinGW (and therefore Dev-C++) which he has aptly named WinBGIm.

The files we need are:
graphics.h (download to C:\Dev-Cpp\include)
libbgi.a (download to C:\Dev-Cpp\lib)

将上面这两个文件下载,放入Dev-Cpp的目录,(如上)

After you have downloaded the files to the correct locations, you can now use WinBGIm's graphic.h as you would Borland's graphics.h with a few caveats.

Using library files:
First, you have to tell Dev-C++ where to find the library functions that WinBGIm references--this is done in the "Project Options" dialog box.
Here are instructions on how to do this with a new project:

创建一个工程,选择工程属性-参数,添加以下的几个连接,如图

Follow step 2 and step 3 of "Using Dev-C++".
Go to "Project" menu and choose "Project Options" (or just press ALT+P).
Go to the "Parameters" tab
In the "Linker" field, enter the following text:
-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32

Project Options -> Parameters:

Click "OK".
Follow step 4, step 5 and step 6 of "Using Dev-C++".
BGI and WinBGIm differences:
WinBGIm is a superset of BGI and as such may have functions and features with which you are unfamiliar. See Michael Main's BGI Documentation for more information.

Test code:
Just to make sure you've got everything set up correctly, try this test code in a new Dev-C++ WinBGIm project:

#include

int main()
{
initwindow(400,300); //open a 400x300 graphics window
moveto(0,0);
lineto(50,50);
while(!kbhit()); //wait for user to press a key
closegraph(); //close graphics window
return 0;
}If you've done everything correctly, you should get a simple graphic that closes when the user presses a key.

最后这个是一个测试,看是否成功。
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网