#include"stdlib.h"
#include<iostream>
#include<iomanip>
using namespace std;
double mysin(double);
double myabs(double);
void show_sin_table(int, int);
const double pi = 3.1415926;
int main()
{
show_sin_table(0, 90);
system("pause");
return 0;
}
// 定义 show_sin_table () 函数
void show_sin_table(int iFromAngle, int iToAngle)
{
int x, count = 0;
std::cout << " 到" << iFromAngle << iToAngle << "的三角函数表" << endl;
std::cout << setiosflags(ios::fixed) << setiosflags(ios::right) << setprecision(3);
for (x = 0; x < 3; x++)
std::cout << setw(8) << "角度" << setw(8) << "sin(x)";
std::cout << endl;
// 逐个地方转换并输出
for (x = iFromAngle; x <= iToAngle; x++)
{
cout << setw(8) << x << setw(8);
cout << mysin(x*pi / 180);
if (count % 3 == 2) cou
C++ 利用函数, 制作一个三角函数表
最新推荐文章于 2024-07-10 18:40:13 发布