爱心
复制粘贴运行看看~~~
#include<stdio.h> #include <windows.h> void SetColor(unsigned short ForeColor=5,unsigned short BackGroundColor=2) { HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hCon,ForeColor|BackGroundColor); } int main() { int qq[50][50]={0}; int n;int key=1; int nn=1; printf("按 1 试试~\n"); while(~scanf("%d",&n)&&n) { if(n==1){ if(nn<=15)nn++; else nn+=11; SetColor(nn); int aa=0;int bb=1; for(int i=1;i<=25;i++) { if(i==1){ printf("\n"); } int j; if(i>=2&&i<=5){ for(j=1;j<=6-aa;j++)printf(" "); for(j=7;j<=12+2*aa;j++)printf("%c ",qq[i][j]=3); for(j=13;j<=19-2*aa;j++)printf(" "); for(j=20;j<=25+2*aa;j++)printf("%c ",qq[i][j]=3); printf("\n");aa++; } if(i>=6&&i<=12){ printf(" "); for(j=5;j<=31;j++)printf("%c ",qq[i][j]=3); printf("\n"); } if(i>12&&i<=25){printf(" "); for(j=1;j<=bb;j++)printf(" "); for(j=1+bb;j<=27-bb;j++)printf("%c ",qq[i][j]=3); printf("\n");bb++; } } if(key==1)printf(" 再试试~~~~\n"); if(key==2)printf(" 觉得好玩吗~那就继续^-^\n"); else if(key%2==0) printf(" 加油~~加油~~加油~~加油~~\n"); else if(key%10==0) printf(" 试试按 2 看看~~ ^-^\n"); key++; } else{ SetColor(70); int aa=0;int bb=1; for(int i=1;i<=25;i++) { if(i==1){ printf("\n"); } int j; if(i>=2&&i<=5){ for(j=1;j<=6-aa;j++)printf(" "); for(j=7;j<=12+2*aa;j++)SetColor(rand()%10+70),printf("%c ",qq[i][j]); for(j=13;j<=19-2*aa;j++)printf(" "); for(j=20;j<=25+2*aa;j++)SetColor(rand()%10+70),printf("%c ",qq[i][j]); printf("\n");aa++; } if(i>=6&&i<=12){ printf(" "); for(j=5;j<=31;j++)SetColor(rand()%10+70),printf("%c ",qq[i][j]); printf("\n"); } if(i>12&&i<=25){printf(" "); for(j=1;j<=bb;j++)printf(" "); for(j=1+bb;j<=27-bb;j++)SetColor(rand()%10+70),printf("%c ",qq[i][j]); printf("\n");bb++; } } if(key==1)printf(" 再试试~~~~\n"); if(key==2)printf(" 觉得好玩吗~那就继续^-^\n"); else if(key%2==0) printf(" 加油~~"),SetColor(rand()%10+70),printf("加油~~"),SetColor(rand()%10+70),printf("加油~~\n"); else if(key%10==0) printf(" 试试按 2 看看~~ ^-^\n"); key++; } } return 0; }