控制台实现 字符打印正弦曲线
时间:2014-03-05 18:11:01
收藏:0
阅读:409
#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;
}
原文:http://blog.csdn.net/wang73ying/article/details/20493073
评论(0)