C语言字符画字符闪画.docx
- 文档编号:29753401
- 上传时间:2023-07-26
- 格式:DOCX
- 页数:48
- 大小:19.44KB
C语言字符画字符闪画.docx
《C语言字符画字符闪画.docx》由会员分享,可在线阅读,更多相关《C语言字符画字符闪画.docx(48页珍藏版)》请在冰豆网上搜索。
C语言字符画字符闪画
星星图
#include<>
#include<>
#definexpow(fabs,3)
#defineypow(fabs(j/apow(20,3)
voidmain()
{
charch[51][51];
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(x+y<=a)
ch[i][j]='*';
else
ch[i][j]='';
}
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)
printf("\n");
printf("%c",ch[i][j]);
}
}
全星图
非二维数组实现
#include<>
#include<>
#definexpow(fabs,3)
#defineypow(fabs,3)
#defineapow(20,3)
voidmain()
{
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)printf("\n");
if(x+y<=a)
printf("*");
else
printf("");
}
}
二维数组实现
#include<>
#include<>
#definexpow(fabs,3)
#defineypow(fabs,3)
#defineapow(20,3)
voidmain()
{
charch[51][51];
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(x+y<=a)
ch[i][j]='*';
else
ch[i][j]='';
}
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)printf("\n");
printf("%c",ch[i][j]);
}
}
变种蝙蝠侠
#include<>
#include<>
#definexpow(fabs,3)
#defineypow(fabs,3)
#defineapow(20,3)
voidmain()
{
charch[51][51];
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(x+y<=a)
ch[i][j]='*';
else
ch[i][j]='';
}
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)
printf("\n");
if(ch[i][j]=='*')printf("%c",ch[i][j]);
elseprintf("%c",ch[i][j]);
}
}
太极图
二维数组实(着色)
#include<>
#include<>
voidsetcolor(unsignedshortForeColor,unsignedshortBackGroundColor)
{
HANDLEhCon=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon,(ForeColor%16)|(BackGroundColor%16*16));
}
voidmain()
{
chara[80][80];
inti,j;
for(i=0;i<80;i++)
for(j=0;j<80;j++)
{
a[i][j]='';
if((3*i-40)*(3*i-40)+(j-40)*(j-40)<=30*30)
{a[i][j]=2;
if(((j-40)*(j-40)+(3*i-25)*(3*i-25)<=15*15)||(j>=40))
if((j-40)*(j-40)+(3*i-55)*(3*i-55)>=15*15)
a[i][j]=1;
else
a[i][j]=2;
}
if((j-40)*(j-40)+(3*i-25)*(3*i-25)<=40)
a[i][j]=2;
if((j-40)*(j-40)+(3*i-55)*(3*i-55)<=40)
a[i][j]=1;
}
for(i=0;i<80;i++)
{printf("");
for(j=0;j<80;j++)
{
if(a[i][j]!
=2)
{
setcolor(7,0);printf("%c",a[i][j]);setcolor(7,0);
}
else
{
setcolor(10,0);printf("%c",a[i][j]);setcolor(7,0);
}
}
printf("\n");
}
}
非二维数组实现(未着色)
#include<>
voidmain()
{
inti,j;
for(i=0;i<80;i++)
for(j=0;j<80;j++)
{
if(j%80==0)printf("\n");
if((3*i-40)*(3*i-40)+(j-40)*(j-40)<=30*30)
{
if(((j-40)*(j-40)+(3*i-25)*(3*i-25)<=15*15)||(j>=40))
if((j-40)*(j-40)+(3*i-55)*(3*i-55)>=15*15)
if((j-40)*(j-40)+(3*i-25)*(3*i-25)<=40)
printf("%c",2);
else
printf("%c",1);
else
if((j-40)*(j-40)+(3*i-55)*(3*i-55)<=40)
printf("%c",1);
else
printf("%c",2);
else
if((j-40)*(j-40)+(3*i-55)*(3*i-55)<=40)
printf("%c",1);
else
printf("%c",2);
}
else
printf("");
}
}
帽子
#include<>
#include<>
#definep(*+*)
#definea20
voidmain()
{
charch[51][51];
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(p*p<=(3*a*p*i-4*a*i*i*i))
ch[i][j]='*';
else
ch[i][j]='';
}
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)
printf("\n");
printf("%c",ch[i][j]);
}
}
*******
*****************
***********************
***************************
********
三夜玫瑰
#include<>
#definex(*2)
#definey
#definep((x*x+y*y))
#definea25
voidmain()
{
charch[51][51];
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(p*p<=(3*a*p*x-4*a*x*x*x))
ch[i][j]='*';
else
ch[i][j]='';
}
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)
printf("\n");
printf("%c",ch[i][j]);
}
}
*****
*******
*********
*********
*********
*********
*********
*******
*******
*****
*****
***
*
********************
****************************
****************************
****************************
**************************
********************
****
心型图
#include<>
#include<>
#definex()
#definey
voidmain()
{
charch[51][51];
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(pow((x*x+y*y)-200,<=-30*x*x*x*y*y)
ch[i][j]='*';
else
ch[i][j]='0';
}
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)
printf("\n");
if(ch[i][j]=='*'&&ch[i][j]!
='*')printf("%c",ch[i][j]);
elseprintf("%c",ch[i][j]);
}
}
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
00000000000******0000000000000******0000000000000
000000000***********0000000***********00000000000
00000000*************00000*************0000000000
0000000***************000***************000000000
0000000****************0****************000000000
000000***********************************00000000
000000***********************************00000000
000000***********************************00000000
000000***********************************00000000
000000***********************************00000000
000000***********************************00000000
000000***********************************00000000
000000***********************************00000000
0000000*********************************000000000
0000000*********************************000000000
0000000*********************************000000000
00000000*******************************0000000000
00000000*******************************0000000000
000000000*****************************00000000000
000000000*****************************00000000000
0000000000***************************000000000000
00000000000*************************0000000000000
000000000000***********************00000000000000
000000000000***********************00000000000000
0000000000000*********************000000000000000
00000000000000*******************0000000000000000
0000000000000000***************000000000000000000
00000000000000000*************0000000000000000000
000000000000000000***********00000000000000000000
0000000000000000000*********000000000000000000000
000000000000000000000*****00000000000000000000000
0000000000000000000000***000000000000000000000000
00000000000000000000000*0000000000000000000000000
00000000000000000000000*0000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000
圆圈
二维数组实现
#include<>
#include<>
#definex()
#definey
voidmain()
{
charch[51][51];
inti,j;
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(pow((x*x+y*y)-200,<=fabs(30*x*x*x*y*y))
ch[i][j]='*';
else
ch[i][j]='';
}
for(i=0;i<51;i++)
for(j=0;j<51;j++)
{
if(j%51==0)
printf("\n");
if(ch[i][j]=='*'&&ch[i]
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 字符