6.Last 【潜心创作·特别篇】圣诞节快乐

这篇博客展示了如何使用C++编写一个圣诞树代码特效,包括输入自定义大小的圣诞树,以及在底部显示祝福语"Merry Christmas ^_^ !"。通过随机颜色和字符变化,为屏幕带来动态的视觉效果。
摘要由CSDN通过智能技术生成

圣诞树代码特效如下:

#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
HWND hwnd=GetForegroundWindow();
using namespace std;

int len;
struct Dot {
    int x;
    int y;
    char c;
}a[10000000];
int vis[10000000];
char c[5] = {35, 36, 37, 38, 79};
string s = "/\\";
int n;
string word1 = "Merry Christmas ^_^ !";
string word2 = "From H.N. Magnolia_tree";

void getcur(short int x,short int y)//移动光标函数 
{
    COORD pos = (COORD){x,y};//定义一个屏幕上的座标 
    HANDLE handle = GetStdHandle( STD_OUTPUT_HANDLE );
    SetConsoleCursorPosition( handle,pos );;
}

void goprint(int x,int y, char c) {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), rand()%16);
    getcur(x,y); printf("%c", c); //getcur(0,row);//消除

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值