C++ :用字符画圣诞树

三天前是2022年的圣诞节~~

但是我阳了~~

三天后我好了~~

想起圣诞节~~

我就用字符画了一棵圣诞树~~


C++代码:

#include 
#include 
using namespace std;
void color(int x)
{
	switch(x)
	  {
	    case  1:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED  );break;
	  	case  2:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE );break;
	    case  3:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN);break;
		case  4:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED  |FOREGROUND_BLUE );break;
		case  5:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_RED  |FOREGROUND_GREEN);break;
		case  6:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_BLUE |FOREGROUND_GREEN);break;
	    case  7:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN|FOREGROUND_BLUE |FOREGROUND_RED);break;
	  }
}
void cls()
{
	system ("cls");
}
void xy(int y,int x) 
{
    COORD  coord;    
    coord.X=x;         
    coord.Y=y;
    HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(a,coord);
}
void out(string n)
{
	for (int i=0;i<=n.size();i++)
	{
		color (5);
		cout <

非常的好看!!


你可能感兴趣的:(C++,c++,开发语言)