#include
#include<math.h>
using namespace std;
int main()
{
double S,e,c,b,a,t;
t=1,a=1,S=0;
cin>>e;
for(a=1;;a=a+4)
{
b=1/a*t;
S=S+b;
t=-t;
c=fabs(b);
if(c<=e)
{
cout<<S;
break;
}
}
system("pause");
return 0;
}
你要先计算c,后累加呀
都说了小于e的那一项不加
你先加了再判断c,已经加完了呀