c语⾔⼼形告⽩代码实现c语⾔⼼形告⽩代码实现
1.彩⾊告⽩
include<stdio.h>
include<math.h>
include<windows.h>
include<time.h>
define U 0.1
define V 0.053
void SetColor(unsigned short ForeColor,unsigned short BackGroundColor)
{
HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon,(ForeColor%16)|(BackGroundColor%1616));
}
int main()
{
int i,s=0,t,a=10,b=11,c=12,d=13,e=14;
int z[] = {32,32,206,210,207,178,187,182,196,227,33,32,32};
float x,y;
srand(time(NULL));
for(y=1.3;y>=-1.1;y-=U)
{
for(x=-2;x<1.4;x+=V)
{
if((((x x+y y-1)(x x+y y-1)(x x+y y-1)-x x y y y)<=0))
{
if(y>=1.3-10U||y<=1.3-11U)
{
s++;
if(s%41){SetColor(a,0);printf("l");}
if(s%42){SetColor(e,0);printf("o");}
if(s%43){SetColor(c,0);printf("v");}
if(s%40){SetColor(d,0);printf("e");}
}
else
{
for(i = 0;i < 42;i++)
{
if(i<=14||i>=28)表白代码手机
{
s++;
if(s%41){SetColor(a,0);printf("l");}
if(s%42){SetColor(e,0);printf("o");}
if(s%43){SetColor(c,0);printf("v");}
if(s%40){SetColor(d,0);printf("e");}
}
else
{
SetColor(b,0);
printf("%c", z[i-15]);
Sleep(50);
}
break;
}
}
else
printf(" ");
Sleep(1);
}
printf("\n");
}
printf("按任意键继续!");
getchar();
while(1)
{
system("cls");
t=a;a=b;b=c;c=d;d=e;e=t;
for(y=1.3;y>=-1.1;y-=U)
{
for(x=-2;x<1.4;x+=V)
{
if((((x x+y y-1)(x x+y y-1)(x x+y y-1)-x x y y y)<=0)) {
if(y>=1.3-10U||y<=1.3-11*U)
{
s++;
if(s%41){SetColor(a,0);printf("l");}
if(s%42){SetColor(b,0);printf("o");}
if(s%43){SetColor(c,0);printf("v");}
if(s%40){SetColor(d,0);printf("e");}
}
else
{
for(i = 0;i < 42;i++)
{
if(i<=14||i>=28)
{
s++;
if(s%41){SetColor(a,0);printf("l");}
if(s%42){SetColor(b,0);printf("o");}
if(s%43){SetColor(c,0);printf("v");}
if(s%40){SetColor(d,0);printf("e");}
}
else
{
SetColor(e,0);
printf("%c", z[i-15]);
}
}
break;
}
}
else
printf(" ");
}
printf("\n");
}
Sleep(1000);
system("cls");
}
}
2.简单⼼形 #include <math.h> include <stdio.h> int main()
float y, x, a;
for (y = 1.5f;y > -1.5f;y -= 0.1f)
{
for (x = -1.5f;x < 1.5f;x += 0.05f)
{
a = x x + y y - 1;
putchar(a a a - x x y y y <= 0.0f ? '*' : ' '); }
putchar('\n');
}
return 0;
}
3.花纹⼼形
查看原⽂
编程资料
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论