加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 程序设计 > 正文

输出倒置正弦曲线

发布时间:2020-05-29 10:43:21 所属栏目:程序设计 来源:互联网
导读:卐结果如下图所示卐 -------------------------------------俺是分割线------------------------------------------- * | * | * |

卐结果如下图所示卐

-------------------------------------俺是分割线-------------------------------------------


*

| *

| *

| *

| *

| *

| *

| *

| *

| *

| *

*

* |

* |

* |

* |

* |

* |

* |

* |

* |

* |

*

请按任意键继续. . .

-------------------------------------俺是分割线-------------------------------------------

代码如下:

-------------------------------------俺是分割线-------------------------------------------


#include <iostream>

#include <cmath>

#include <cstring>

using namespace std;

int main(void)

{

const double PI=3.141592653;

double A=20.0,B=22.0;

char chleft,chright;

double lpos,rpos;

double y;

double angle=0;

double delta=2*PI/B;

while(angle<=2*PI)

{

y=int(A*sin(angle))+A;

if(y<A)

{

lpos=y; rpos=A;

chleft='*'; chright='|';

}

if(y==A)

{

lpos=rpos=A;

chleft='*'; chright=' ';

}

if(y>A)

{

lpos=A; rpos=y;

chleft='|'; chright='*';

}

for(int i=0;i<lpos;i++)

cout<<" ";

cout<<chleft;

for(int i=0;i<rpos-lpos-1;i++)

cout<<" ";

cout<<chright;

cout<<"/n";

angle+=delta;

}

system("pause");

return 0;

}

-------------------------------------俺是分割线-------------------------------------------

程序运行结果截图: [img]http://p.blog.csdn.net/images/p_blog_csdn_net/lh3325251325/EntryImages/20091023/Snap_2009.10.23 12.41.21_002.jpg[/img]

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读