csdn情人节投稿
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
void draw(string str){
system("color fc");
int temp=0;
int minus=0;
for(double y=1.2 ; y>=-1.1; y-=0.12){
for(double x=-1.0 ; x<=1.0 ; x+=0.025){
if(x*x + pow(5.0*y/4.0 - sqrt(fabs(x)),2) -1 <= 0.0){
cout << str.at(temp);
temp = (temp+1)%str.length();
}
else{
for(int i=temp;i>=0;i--){
if( ( (int)str.at(i) ) <0 )
minus++;
else break;
}
if((minus==0)||(minus%2==1)){
cout << " ";
minus = 0;
}
else{
cout << str.at(temp);
temp = (temp+1)%str.length();
minus = 0;
}
}
}
cout << endl;
}
}
int main()
{
string s="";
s=s+(char)(3);
cout<<endl<<endl;
draw(s);
getchar();
return 0;
}