可以帮我看看哪里出问题了吗

#include
#include
using namespace std;
int main()
{
double S,e,c,b,a,t;
t=1,a=1,S=0;
cin>>e;
for(a=1;c>e;a+4)
{
b=1/a*t;
S=S+b;
t=-t;
c=fabs(b);
while(c<=e)
{
cout<
break;
}
}
system("pause");
return 0;

}

img

for(a=1;c>e;a=a+4)

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    double S,e,c,b,a,t,mid;
    t=1,a=1,S=0;
    c = 1;//初始化为1,不然fior循环进不去
    cin>>e;
    for(a=1;c>e;a=a+4)
    {
         b=1/a*t;
         S=S+b;
         t=-t;
         c=fabs(b);
         cout << c << endl;
        if(c<=e)//改成if
        {
            cout<<S;
            break;
        }
    }
    system("pause");
    return 0;
}

供参考:

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    double S, e, c, b, a, t;
    t = 1, a = 1, S = 0;
    cin >> e;
    for (a = 1; ; a += 4)  
  //for (a = 1; c > e; a + 4) 修改
    {
        b = 1 / a * t;
        S = S + b;
        t = -t;
        c = fabs(b);
        if (c < e) { //while (c <= e) 修改
            cout << S;
            break;
        }
    }
    return 0;
}