心形图

 1 #include <iostream>
 2 #include <cmath>
 3 using namespace std;
 4 
 5 int main()
 6 { string s="傻狗";
 7  for (float y=1.3;y>=-1.1;y-=0.06)
 8  {
 9      int index=0;
10      for(float x=-1.1;x<=1.1;x+=0.025)
11         if(x*x+pow(5.0*y/4.0-sqrt(fabs(x)),2)-1<=0.0)
12         cout<<s[(index++)%s.size()];
13     else cout<<' ';
14     cout<<endl;
15  }
16     return 0;
17 }
原文地址:https://www.cnblogs.com/z-712/p/7324043.html