This program in the first ten lines, I set is first of all determine whether a value greater than 1, the value is directly output a as b, or you do it again, or whether a value greater than or equal to 0, the value of the output is the inverse of a as b, otherwise the output is the opposite of a as b value, as shown in figure, the input x=1, y=10, the computation of a value should be 0.4 & lt; 1, the output should be the inverse of a, b is 2.5, but why when debugging b the value of direct output value, rather than a bottom?
CodePudding user response:
Can copy paste up your code?
I got 2.5
CodePudding user response:
The
reference 1 floor? Victor.?? Response: can copy paste up your code? I got 2.5 #include #include #include Int main () { Double x, y, a, b; Printf (" Input the value of x, y: "); Lf lf scanf_s (" % % ", & amp; X, & amp; Y); A=(x * 2 + 2)/y; B=(a & gt;=1? A: (a & gt;=0 & amp; & A. & lt; 1? 1/a: - 1) * a); Printf (" % lf ", b); system("pause"); return 0; } CodePudding user response:
Strange I used your code or 2.5 B=(a & gt;=1? A: (a & gt;=0 & amp; & A. & lt; 1? 1/a: - 1) * a); Change B=(a & gt;=1? A: (((a & gt;=0) & amp; & (a & lt; 1))? (1/a) : (a) - 1 *)); Have a try? CodePudding user response:
The reference 5 floor? Victor.?? Response: strange I used your code or 2.5 B=(a & gt;=1? A: (a & gt;=0 & amp; & A. & lt; 1? 1/a: - 1) * a); Change B=(a & gt;=1? A: (((a & gt;=0) & amp; & (a & lt; 1))? (1/a) : (a) - 1 *)); Try? Or not, maybe is the compiler issues? CodePudding user response:
The refer to 6th floor Clancey P.M.R.S. Yu reply: Quote: refer to 5 floor? Victor.?? Response: Strange I used your code or 2.5 B=(a & gt;=1? A: (a & gt;=0 & amp; & A. & lt; 1? 1/a: - 1) * a); Change B=(a & gt;=1? A: (((a & gt;=0) & amp; & (a & lt; 1))? (1/a) : (a) - 1 *)); Try? Or not, maybe is the compiler issues? V, me too. 2017 Arguably impossible CodePudding user response:
A. & lt; 1 this condition can be removed CodePudding user response:
The reference 7 floor? Victor.?? Response: Quote: refer to the sixth floor Clancey P.M.R.S. Yu reply: The Quote: 5 reference building? Victor.?? Response: Strange I used your code or 2.5 B=(a & gt;=1? A: (a & gt;=0 & amp; & A. & lt; 1? 1/a: - 1) * a); Change B=(a & gt;=1? A: (((a & gt;=0) & amp; & (a & lt; 1))? (1/a) : (a) - 1 *)); Try? Or not, maybe is the compiler issues? V, me too. 2017 Arguably impossible! This, indeed as expected compiler has a problem, I run XP in a virtual machine, use vc + + 6.0 finally got 2.5... VS2019 characteristics of may be a little change, I don't know, I know CodePudding user response:
refer to the eighth floor early play big play nuclear war reply: a. & lt; 1 this condition can be removed This can also! To understand the VS2019 or 0.4, how to change all not line, I guess there is something wrong with the compiler Vc + + 6.0 is no problem, the output of 2.5 I bring a<1 is mainly due to avoid, and the front a> 1 overlap,