圣诞祝福树

  1 #include<iostream>
  2 #include<windows.h>
  3 using namespace std;
  4 int main()
  5 {
  6 
  7     int i, k, count = 0, count1 = 0;
  8     while(count1<30)
  9     {   
 10         if(count1 % 4 == 0)
 11             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|BACKGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE);
 12         if(count1 % 4 == 1)
 13             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE);
 14         if(count1 % 4 == 2)
 15             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE);
 16         if(count1 % 4 == 3)
 17             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|BACKGROUND_INTENSITY|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_BLUE);
 18         if(count1 > 28)
 19             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_RED);
 20         int count2 = 0;
 21         system("CLS");
 22         count = 0;
 23         while( count < 3)
 24         {        
 25         
 26             for( i = 1; i < 6 + count; i++)
 27                 {
 28                     int count3 = 0;
 29                     count2 = 0;
 30                     cout<<"		";
 31                     if(count > 0)
 32                     {
 33                         if(i == 1)
 34                         {    
 35                             if(count==1)  cout<<" ";
 36                             cout<<"|";   count3 = 1; }
 37                         else if(i == 2)
 38                         {    
 39                             if(count==1)  cout<<" ";
 40                             cout<<"*";    count3 = 1; 
 41                         }
 42                     }
 43                     for(char j = i; j < 7; j++)
 44                     {
 45                         if(count3 == 1 || (count3 == 2 && count == 1) )
 46                         { count3++;  continue;}
 47                         cout<<" ";
 48                     }
 49                     for(char k = 0; k < (2*i-1);k++)
 50                     {
 51                         cout<<"*";
 52                         if(count1 == 0 || count1 == 29)  Sleep(60);
 53                     }
 54 
 55                     for( j = i; j < 4 + count; j++)
 56                             cout<<" ";
 57                     if(count > 0)
 58                     {
 59                         if(i == 1)
 60                             cout<<"|";
 61                         else if(i == 2)
 62                             cout<<"*";
 63                         else
 64                             cout<<" ";
 65                     }
 66 
 67                     if(count1 > 0 && count1 < 29 )
 68                         for(char n = 0; n < 2; n++ )
 69                         {
 70                             count2++;
 71                             for(char m = 0; m < i - count1+ 20 + n * 2 ; m++)
 72                                 cout<<" ";
 73                             if(count1 < 3)
 74                                 cout<<"*";
 75                             else if(count1 < 7 && i > 2)
 76                                 cout<<" *  *";
 77                             else if(count1 >= 13 && count1 <= 20 && i > 4)
 78                                 cout<<"  *";
 79                             else if(i>6)
 80                                 cout<<" *";
 81                         }
 82                     if(count1 == 29)
 83                     {
 84                         if(count == 1 && i == 1)
 85                             cout<<"				Merry Christmas !";    
 86                         if(count == 2 && i == 1)
 87                             cout<<"					Best wish to you!";    
 88                     }
 89                     cout<<endl;
 90                 }
 91             count ++;
 92         }
 93         count2 = 0;    
 94             for(i = 0; i < 5; i++)
 95             {   
 96                 if(count1 == 0 || count1 == 29)  Sleep(200);
 97                 cout<<"	       ";
 98                 if(i==0) cout<<"|     ";
 99                 else if(i==1) cout<<"*     ";
100                 else cout<<"      ";
101                 cout<<"|||";
102                 if(i==0) cout<<"     |";
103                 else if(i==1) cout<<"     *";
104                 else cout<<"      ";
105                 if( count1 > 0 && count1 < 29 )
106                 {
107                     for(char m = 0; m < count1 - i + count2 * 2 ; m++)
108                         cout<<" ";
109                     if(count1 < 6)
110                            cout<<"* ";
111                     else if(count1 < 13 && i > 2)
112                         cout<<" *  ";
113                     else if(count1 >= 15 && count <= 21 && i > 3)
114                         cout<<"    *";
115                     else if(i>4)
116                         cout<<"*";        
117                 }
118                 count2++;    
119                 cout<<endl;
120             }
121         for( k = 0; k < 208; k++ )
122         {
123             if(count1 == 0 || count1 == 29)  Sleep(30);
124             cout<<"=";
125         }
126         if(count1 == 28) Sleep(1000);
127         Sleep(600);
128         if(count1 == 0)
129         {
130             Sleep(1000);
131             system("COLOR 03")    ;
132             Sleep(1000);
133             system("COLOR f2");
134             Sleep(1000);
135         }
136         cout<<endl;
137         count1++;    
138     }
139     Sleep(3000);
140     system("CLS");152     return 0;
153 }
原文地址:https://www.cnblogs.com/a1982467767/p/8894130.html