赞
踩
定义窗口大小
system("mode con cols=100 lines=50");
system("color f4");
爱心结构(实心)
for(i=20;i>=-16;i--)
{
for(j=-20;j<=20;j++)
{
y=i/15;
x=j/15;
if(pow(x*x+y*y-1,3)-x*x*y*y*y<=0)
{
cout<<"██";
}
else cout<<" ";
}
cout<<endl;
}
爱心结构(可变内容)
for(i=20;i>=-20;i--)
{
for(j=-20;j<=20;j++)
{
y=i/15;
x=j/15;
if(pow(x*x+y*y-1,3)-x*x*y*y*y<=0)
{
cout<<"爱";
}
else cout<<" ";
}
cout<<endl;
}
更复杂的爱心结构
for(i=20;i>=-20;i--)
{
for(j=-20;j<=20;j++)
{
y=i/15;
x=j/15;
if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.8)
cout<<"康";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.6)
cout<<"喜";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.48)
cout<<"吉";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.32)
cout<<"寿";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.18)
cout<<"顺";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.1)
cout<<"安";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.06)
cout<<"乐";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.03)
cout<<"贵";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=0)
cout<<"福";
else cout<<" ";
}
cout<<endl;
}
直接上代码
#include<bits/stdc++.h>
#include<windows.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
using namespace std;
double q,w,e,r,t,u,o,p,s,d,f,g,h,j,l,z,c,v,b,n,m,i;
double k,x,y;
long long a[1000][1000];
int main()
{
system("mode con cols=100 lines=50");
system("color f4");
for(i=20;i>=-16;i--)
{
for(j=-20;j<=20;j++)
{
y=i/15;
x=j/15;
if(pow(x*x+y*y-1,3)-x*x*y*y*y<=0)
{
cout<<"██";
}
else cout<<" ";
}
cout<<endl;
}
Sleep(5000);
system("cls");
for(i=20;i>=-20;i--)
{
for(j=-20;j<=20;j++)
{
y=i/15;
x=j/15;
if(pow(x*x+y*y-1,3)-x*x*y*y*y<=0)
{
cout<<"爱";
}
else cout<<" ";
}
cout<<endl;
}
Sleep(5000);
system("cls");
for(i=20;i>=-20;i--)
{
for(j=-20;j<=20;j++)
{
y=i/15;
x=j/15;
if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.8)
cout<<"康";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.6)
cout<<"喜";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.48)
cout<<"吉";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.32)
cout<<"寿";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.18)
cout<<"顺";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.1)
cout<<"安";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.06)
cout<<"乐";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=-0.03)
cout<<"贵";
else if(pow(x*x+y*y-1,3)-x*x*y*y*y<=0)
cout<<"福";
else cout<<" ";
}
cout<<endl;
}
return 0;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。