sinx的函数一直输不出来为啥?输入3 sin3无法输出 注释sinx的函数后 cosx函数能运行。

/*sinx,cosx*/
#include<iostream>
#include<cmath>
using namespace std;
double tsin(double x)
{
    double t=x,g=0,n=1;
    do
    {g+=t;
    n++;
    t=-t*x*x*(2*n-1)/(2*n-2);
    }
    while(fabs(t)>=1e-10);
    return g;

}
double tcos(double x)
{
   double t=1,g=0,n=1;
   do
   {
       g+=t;
       n++;
       t=-t*x*x/(2*n-2)/(2*n-3);}
   while(fabs(t)>=1e-10);
    return g;
}
int main()
{
    double a;
    cin>>a;
    cout<<tsin(a)<<" "<<tcos(a)<<endl;
}

#include <iostream>
#include <cmath>

using namespace std;

double tsin(double x)
{
    double t = x, g = 0, n = 1;
    do
    {
        g += t;
        t = -t * x * x / (2 * n * (2 * n + 1));
        n++;
    } while (fabs(t) >= 1e-10);
    return g;
}

double tcos(double x)
{
    double t = 1, g = 0, n = 1;
    do
    {
        g += t;
        t = -t * x * x / ((2 * n - 1) * (2 * n));
        n++;
    } while (fabs(t) >= 1e-10);
    return g;
}

int main()
{
    double a;
    cin >> a;
    cout << tsin(a) << " " << tcos(a) << endl;
    return 0;
}
$ g++ -Wall main.cpp
$ ./a.out
1
0.841471 0.540302

你怎么输入的?