#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double y; //纵坐标
int i, x, tmpX;
for (y = 1; y >= -1; y -= 0.1)
{
tmpX = abs(asin(y)) * 10;//放大10倍
if (y >= 0)
{//前半周期
for (x = 0; x < tmpX; x++)
cout << " ";
cout << "*";
for (; x < 31-tmpX; x++)
cout << " ";
cout << "*" << endl;
}
else
{
for (x = 0; x <= 31+tmpX; x++)//后半周期
cout << " ";
cout << "*";
for (; x <= 62-tmpX; x++)
cout << " ";
cout << "*" << endl;
}
}
system("pause");
return 0;
}
时间: 2024-10-30 12:50:30