Home > Back-end >  q
q

Time:09-30

O 1 + 1/3 + 1/9 + 1/11-1/5-1/7 -... Until the last item on the absolute value of less than 10 - six times the power how to use c + + programming so far

CodePudding user response:

Oneself for loop good
In addition, the two are, the law of the two negative cycle? Or a plus or minus alternate rule a slip of the pen?

CodePudding user response:

Direct write debugging
 

Double a=1, s=a, t=1/(a +=2); Int j=0;
While (t> E - 10 6)
{
S +=(+ + j> 2? - t, t);
If (j> J=0=4);
T=1/(a +=2);
}

CodePudding user response:

Add and subtract items to adjust: j=0; j=1; J=2; J=3;




CodePudding user response:

reference 3 floor wise men know already should good karma response:
don't write directly debugging
 

Double a=1, s=a, t=1/(a +=2); Int j=0;
While (t> E - 10 6)
{
S +=(+ + j> 2? - t, t);
If (j> J=0=4);
T=1/(a +=2);
}

should be positive in negative negative into a positive number
Perfect avoided each correct data

There is a lower mistake you want to deal with add and subtract alternating with the parity of the j is written j and 2 more
His run once so difficult?
2 days down the wrong a 5 or 6 times
Are you guys or traps

CodePudding user response:

Oh I even with even less is wrong topic
That's my wrong can indeed compared to 2
But the code is still wrong
T the first cycle is a third time + yes
At this time of the next cycle t is 1/5 or + should be wrong this time -
Boundary value processing is too weak

CodePudding user response:

10-6 power is 1 e -
Not 10 e - 6