1、首先,打开dev c++并新建一个源代码。
2、接着输入以下代码:#include<iostream>#include<windows.h>using namespace std;void gotoxy(int x,int y){ COORD pos; pos.X=2*x; pos.Y=y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);} int main() gotoxy(1,2); cout<<"a"<<endl; }
3、这里需要输入gotoxy函数,需要加入#include<windows.h>才能运行,这里是在2*1,2的位置输出a这个单词。这个函数可以让你的界面更加美观哦。