卐结果如下图所示卐
-------------------------------------俺是分割线-------------------------------------------
*
| *
| *
| *
| *
| *
| *
| *
| *
| *
| *
*
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
*
请按任意键继续. . .
-------------------------------------俺是分割线-------------------------------------------
代码如下:
-------------------------------------俺是分割线-------------------------------------------
#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;
}
-------------------------------------俺是分割线-------------------------------------------