栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

移动书写位置练习C++

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

移动书写位置练习C++

#include 
#include 
#include 
#include 
#include       
#include          
#include 
using namespace std;
void gotoxyzimu(int x, int y) {//位置函数(行为x 列为y)字母
	COORD pos;
	pos.X=y;
	pos.Y=x;
	SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE),pos);
}
void gotoxyhanzi(int x, int y) {//位置函数(行为x 列为y)汉字(兼容字母但有空格偏位)
	COORD pos;
	pos.X=y*2;
	pos.Y=x;
	SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE),pos);
}
int main()
{
    cout<<"##########n";
    cout<<"##########n";
    cout<<"##########n";
    cout<<"##########n";
    cout<<"##########n";
    cout<<"##########n";
    cout<<"##########n";
    for (int i = 1; i <= 3; i++) {
        gotoxyzimu(1,i);
        cout<<"h";
        Sleep(1000);
        gotoxyzimu(2,i);
        cout<<"e";
        Sleep(1000);
        gotoxyzimu(3,i);
        cout<<"l";
        Sleep(1000);
        gotoxyzimu(4,i);
        cout<<"l";
        Sleep(1000);
        gotoxyzimu(5,i);
        cout<<"o";
        Sleep(1000);
        gotoxyhanzi(1,i);
        cout<<"哈";
        Sleep(1000);
        gotoxyhanzi(2,i);
        cout<<"喽";
        Sleep(1000);
        gotoxyhanzi(3,i);
        cout<<"啊";
        Sleep(1000);
        gotoxyhanzi(4,i);
        cout<<"喽";
        Sleep(1000);
        gotoxyhanzi(5,i);
        cout<<"哈";
        Sleep(1000);
    }
    Sleep(10000);
    return 0;
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/957758.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号