C++ 趣图

一、心形

 http://mathworld.wolfram.com/HeartCurve.html

#include<stdio.h>
using namespace std;
int main()
{
	for (float y=1.5;y>-1.5;y-=0.1) //行 
	{
	    for(float x=-1.5;x<1.5;x+=0.05) //列 
	    {
		    float a=x*x+y*y-1;
	        putchar(a*a*a-x*x*y*y*y<=0.0?'*':' ');
	    }
	    putchar('\n');
    }
} 

对上面第二个公式的画图。

  

猜你喜欢

转载自www.cnblogs.com/ruo-li-suo-yi/p/9115444.html