控制台实现 字符打印正弦曲线

来源:互联网 发布:千牛卖家版mac不能用 编辑:程序博客网 时间:2024/05/01 20:28

#include <iostream>
#include <cmath>
using namespace std;
const float Zero = 0.05f;
void show()
{
float x = 0,y = 0;
for(y = 1;y>=-1;y= y-0.1)
{
for (x = 0;x<=6.28;x = x+0.1)
{
if (y-sin(x)<Zero && y-sin(x)>-Zero)
{
cout<<"*";
}
else cout<<" ";
}
cout<<endl;
}
}
int main()
{
show();
cin.get();
return 0;
}
1 0
原创粉丝点击