有一段时间痴迷于cmd命令行的字体颜色
相比黑底白字而言,如果我们的输出是五颜六色的那一定会逼格很多~
我们系统也提供了这样的命令 COLOR
比如说 COLOR 01
如果想达到闪变的效果,我们就不断的递归调用这个指令就好了
void f(int i){char c=i>9?i+55:i+48;char s[20];sprintf(s,"COLOR 0%c",c);system(s);if(i==15)f(0);elsef(i+1);}
我们可以在网上找一些好看的图形公式神马的,比如说心形
#include<stdio.h>#include<math.h>#include<stdlib.h>void f(int i){system("cls");char c=i>9?i+55:i+48;char s[20];sprintf(s,"COLOR 0%c",c);system(s); double x,y;int H=3;for(y=-4;y<=0;y+=0.3){for(x=-4;x<=4;x+=0.2)if(fabs(sqrt(x*x+y*y)-H*sin(2*atan(y/x)))<=1||fabs(sqrt(x*x+y*y)-H*sin(2*atan(-y/x)))<=1)printf("*");elseprintf(" ");printf("\n");}for(y=-1;y<=0;y+=0.2){for(x=-4;x<=4;x+=0.2)if(fabs(y)-0.65*x*x>=0.2)printf("*");elseprintf(" ");printf("\n");}if(i==15)f(0);elsef(i+1);return;}int main(){f(0); return 0; }
(闪亮画面自行脑部)
加入随机x,y坐标
#include<stdio.h>#include<math.h>#include<stdlib.h>#include<windows.h>void f(int i){system("cls");char c=i>9?i+55:i+48;char s[20];sprintf(s,"COLOR 0%c",c);system(s); double x,y;int H=3;int j;int rd_m=rand()%30;int rd_n=rand()%100;//rd_m=rd_n=0;for(j=0;j<rd_m;j++)printf("\n");for(y=-4;y<=0;y+=0.3){for(j=0;j<rd_n;j++)printf(" "); for(x=-4;x<=4;x+=0.2)if(fabs(sqrt(x*x+y*y)-H*sin(2*atan(y/x)))<=1||fabs(sqrt(x*x+y*y)-H*sin(2*atan(-y/x)))<=1)printf("*");elseprintf(" ");printf("\n");}for(y=-1;y<=0;y+=0.2){for(j=0;j<rd_n;j++) printf(" ");for(x=-4;x<=4;x+=0.2)if(fabs(y)-0.65*x*x>=0.2)printf("*");elseprintf(" ");printf("\n");}Sleep(10);if(i==15)f(0);elsef(i+1);return;}int main(){system("mode con cols=160 lines=50");f(0); return 0; }
(闪亮画面自行脑部)
然后~~~~大家请试试这个!
#include<stdio.h>#include<math.h>#include<stdlib.h>#include<windows.h>void f(int i){system("cls");char c=i>9?i+55:i+48;char s[20];sprintf(s,"COLOR 0%c",c);system(s); double x,y;int H=3;int j;int rd_m=rand()%30;int rd_n=rand()%130;//rd_m=rd_n=0;for(j=0;j<rd_m;j++)printf("\n");for(j=0;j<rd_n;j++)printf(" ");printf(" * ******* \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * * * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" ******* * * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * * ******* \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * * * * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * * * * * \n");for(j=0;j<rd_n;j++)printf(" ");printf("* ***** ******* \n");for(j=0;j<rd_n;j++)printf(" ");printf(" \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" ******* *** **** \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * * * * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * *** **** \n");for(j=0;j<rd_n;j++)printf(" ");printf(" ***** *** * * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * *** * * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * * **** \n");for(j=0;j<rd_n;j++)printf(" ");printf("********* *** * * \n");for(j=0;j<rd_n;j++)printf(" ");printf(" * * * \n"); Sleep(30);if(i==15)f(0);elsef(i+1);return;}int main(){system("mode con cols=160 lines=50");f(0); return 0; }
(闪亮画面自行脑部)