心型

 1 #include <iostream>
 2 #include<windows.h>
 3 using namespace std;
 4 
 5 int main() {
 6 for(int i=1;i<10000;i++){
 7     Sleep(100);
 8     if(i%7==0)
 9         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
10     else if(i%7==1)
11         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
12     else if(i%7==2)
13         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
14     else if(i%7==3)
15         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
16     else if(i%7==4)
17         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_GREEN);
18     else if(i%7==5)
19         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED |FOREGROUND_BLUE);
20     else
21         SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN |FOREGROUND_BLUE);
22     cout<<endl;
23     cout<<"                                       *************   *************"<<endl;
24     cout<<"                                     *********************************"<<endl;
25     cout<<"                                   *************************************"<<endl;
26     cout<<"                                   *************************************"<<endl;
27     cout<<"                                   *************************************"<<endl;
28     cout<<"                                   *************************************"<<endl;
29     cout<<"                                   *************************************"<<endl;
30     cout<<"                                   *************************************"<<endl;
31     cout<<"                                    ***********************************"<<endl;
32     cout<<"                                     *********************************"<<endl;
33     cout<<"                                       *****************************"<<endl;
34     cout<<"                                        ***************************"<<endl;
35     cout<<"                                          ***********************"<<endl;
36     cout<<"                                             *****************"<<endl;
37     cout<<"                                               *************"<<endl;
38     cout<<"                                                   *****"<<endl;
39     cout<<"                                                     *"<<endl;
40     Sleep(1000);
41     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
42     system("cls");
43 }
44     return 0;
45 }

 

posted @ 2018-10-06 22:31  gzu_zb  阅读(472)  评论(0编辑  收藏  举报