有趣的C程序代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

1.#includestdio.hintmain(void){longinti;while(i=100000000){printf(我##你);i--;}return0;}2.#includestdio.hintmain(){while(1)//我对你的爱藏在我的注释里return0;}3.无限循环才有下雨的效果#includestdio.hintmain(){inti;chara=',',b='/';for(i=0;i=0;i++){printf(%c%c%c,a,a,b);if(i%170==0)printf(我爱你);}}4.笑脸程序(小)#includeconio.h#includestdio.hf();intmain(void){printf(%c,1);f();return0;}intf(void){return0;printf(IloveYou\n);}5.爱心图(要重新排版的)#includestdio.h#includewindows.h#defineLOVE1intmain(){intnum=1314;charlove[13][17]={{'0','0','0','1','1','1','1','0','0','0','1','1','1','1','0','0','0'},{'0','0','1','0','0','0','0','1','0','1','0','0','0','0','1','0','0'},{'0','1','0','0','0','0','0','0','1','0','0','0','0','0','0','1','0'},{'1','0','0','1','1','1','1','1','1','1','1','1','1','1','0','0','1'},{'1','0','0','1','0','0','0','0','0','0','0','0','0','1','0','0','1'},{'1','0','0','1','I','L','o','v','e','Y','o','u','0','1','0','0','1'},//5row{'0','1','0','1','1','1','1','1','1','1','1','1','1','1','0','1','0'},{'0','0','1','0','0','0','0','0','0','0','0','0','0','0','1','0','0'},{'0','0','0','1','0','0','0','0','0','0','0','0','0','1','0','0','0'},{'0','0','0','0','1','0','0','0','0','0','0','0','1','0','0','0','0'},{'0','0','0','0','0','1','0','0','0','0','0','1','0','0','0','0','0'},{'0','0','0','0','0','0','1','0','0','0','1','0','0','0','0','0','0'},{'0','0','0','0','0','0','0','1','1','1','0','0','0','0','0','0','0'}};intn=1;while(num){for(inti=0;i13;i++){for(intj=0;j17;j++){if('1'==love[i][j]){printf(*);}elseif('0'==love[i][j]){printf();}else{printf(%c,love[i][j]);}}printf(\n);}switch(n){case1:love[5][4]='L';love[5][5]='o';love[5][6]='v';love[5][7]='e';love[5][8]='Y';love[5][9]='o';love[5][10]='u';love[5][11]='0';system(color1a);break;//case2:love[5][4]='o';love[5][5]='v';love[5][6]='e';love[5][7]='Y';love[5][8]='o';love[5][9]='u';love[5][10]='0';love[5][10]='0';love[5][11]='0';system(color2a);break;//case3:love[5][4]='v';love[5][5]='e';love[5][6]='Y';love[5][7]='o';love[5][8]='u';love[5][9]='0';love[5][10]='0';love[5][11]='0';system(color3a);break;//case4:love[5][4]='e';love[5][5]='Y';love[5][6]='o';love[5][7]='u';love[5][8]='0';love[5][9]='0';love[5][10]='0';love[5][11]='0';system(color4a);break;//case5:love[5][4]='Y';love[5][5]='o';love[5][6]='u';love[5][7]='0';love[5][8]='0';love[5][9]='0';love[5][10]='0';love[5][11]='0';system(color5a);break;//case6:love[5][4]='o';love[5][5]='u';love[5][6]='0';love[5][7]='0';love[5][8]='0';love[5][9]='0';love[5][10]='0';love[5][11]='0';system(color6a);break;//case7:love[5][4]='u';love[5][5]='0';love[5][6]='0';love[5][7]='0';love[5][8]='0';love[5][9]='0';love[5][10]='0';love[5][11]='0';system(color4f);break;//case8:love[5][4]='0';love[5][5]='0';love[5][6]='0';love[5][7]='0';love[5][8]='0';love[5][9]='0';love[5][10]='0';love[5][11]='I';system(color1b);break;//case9:love[5][4]='0';love[5][5]='0';love[5][6]='0';love[5][7]='0';love[5][8]='0';love[5][9]='0';love[5][10]='I';love[5][11]='L';system(color2b);break;//case10:love[5][4]='0';love[5][5]='0';love[5][6]='0';love[5][7]='0';love[5][8]='0';love[5][9]='I';love[5][10]='L';love[5][11]='o';system(color3b);break;//case11:love[5][4]='0';love[5][5]='0';love[5][6]='0';love[5][7]='0';love[5][8]='I';love[5][9]='L';love[5][10]='o';love[5][11]='v';system(color4b);break;//case12:love[5][4]='0';love[5][5]='0';love[5][6]='0';love[5][7]='I';love[5][8]='L';love[5][9]='o';love[5][10]='v';love[5][11]='e';system(color5b);break;//case13:love[5][4]='0';love[5][5]='0';love[5][6]='I';love[5][7]='L';love[5][8]='o';love[5][9]='v';love[5][10]='e';love[5][11]='Y';system(color6b);break;//case14:love[5][4]='0';love[5][5]='I';love[5][6]='L';love[5][7]='o';love[5][8]='v';love[5][9]='e';love[5][10]='Y';love[5][11]='o';system(color4d);break;//case15:love[5][4]='I';love[5][5]='L';love[5][6]='o';love[5][7]='v';love[5][8]='e';love[5][9]='Y';love[5][10]='o';love[5][11]='u';system(color1c);break;//}++n;if(15==n){n=1;}Sleep(1000);system(cls);}returnLOVE;}6.**有用的程序(爱心,可以改造)#includestdio.h#includemath.h#includewindows.h#definer10#defineR172intmain(void){FILE*fp;intn;inti,j,e;//变量定义一定要放在开头,许多编译器还不支持C99标准inta;if((fp=fopen(LOVE.txt,w))==NULL){printf(Fileopenerror!\n);exit(0);}for(i=1,a=r;ir/2;i++,a--){for(j=(int)(r-sqrt((r*r-(a-i)*(a-i))));j0;j--){printf();fprintf(fp,%s,);}for(e=1;e=2*sqrt((r*r-(a-i)*(a-i)));e++){printf(\3);fprintf(fp,%s,*);}for(j=(int)(2*(r-sqrt((r*r-(a-i)*(a-i)))));j0;j--){printf();fprintf(fp,%s,);}for(e=1;e=2*sqrt((r*r-(a-i)*(a-i)));e++){printf(\3);fprintf(fp,%s,*);}printf(\n);fprintf(fp,%s,\n);}for(i=1;i40;i++){if(i==6){printf((∩_∩)ILOVEMYPOGE(∩_∩));i+=30;}printf(\3);fprintf(fp,%s,*);}printf(\n);for(i=1;i=R/2;i++){if(i%2||i%3)continue;for(j=(int)(R-sqrt((double)(R*R-i*i)));j0;j--){printf();fprintf(fp,%s,);}for(e=1;e=2*(sqrt((double)(R*R-i*i))-(R-2*r));e++){printf(\3);fprintf(fp,%s,*);}printf(\n);}printf(请选着播放形式:\n自动播放:按1,控制播放:按0\n);printf(按完数字后请按enter键\n);scanf(%d,&n);if(n==0){while(1){system(colora);system(pause);system(colorb);system(pause);system(

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功