您的位置:首页 > 移动开发 > IOS开发

绘制余弦曲线——在屏幕上用“*”显示0~360度的余弦函数cos(x)曲线

2009-08-08 12:53 477 查看
#include "iostream"
#include "math.h"
using namespace std;

void main()
{
 double y,m;
 int x;
 for (y=1;y>-1;y=y-0.1)
 {
  m = acos(y)*10;
  for (x=0;x<m;x++)
  {
   cout<<" ";
  }
  cout<<"*";
  for (x=(int)m;x<62-m;x++)
  {
   cout<<" ";
  }
  cout<<"*"<<endl;
 }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  360 iostream math.h include