After running the following two statements,“int c1 = 1,c2=2,c3; c3=1.0/c2*c1; ”,the value of variable c3 is _________.5 为什么?

来源:学生作业帮助网 编辑:作业帮 时间:2024/10/04 20:16:47
After running the following two statements,“int c1 = 1,c2=2,c3; c3=1.0/c2*c1; ”,the value of variable c3 is _________.5 为什么?
xQN0}^Kl+~كX 0v jb$+dž.[mB IsFs$A(iHHe3l= %$D\˝(1@E1`gx&#t\N) D2#PHv2e4GVq 8\jj̦!bM2.#2n0W {x:ހyou;dդ3*u]Ȫe?/6cdTDh3h&={p>S6U\ѩ"]!r왉7vhn=ռx^~c&cNzix9^=7SHA U:Y> jg9B+gdo*Z绥 v/@kEi r 1|

After running the following two statements,“int c1 = 1,c2=2,c3; c3=1.0/c2*c1; ”,the value of variable c3 is _________.5 为什么?
After running the following two statements,“int c1 = 1,c2=2,c3; c3=1.0/c2*c1; ”,the value of variable c3 is _________.
5 为什么?

After running the following two statements,“int c1 = 1,c2=2,c3; c3=1.0/c2*c1; ”,the value of variable c3 is _________.5 为什么?
C3是1除以C2又乘以C1
1除以C2等于0.5,0.5再乘以C1也就是乘以1,结果还是0.5
这样就得到0.5了啊
这个题是也算是个小经典了,不考虑类型的话答案就是0.5,弱类型的语言应该得出这个结果
如果是像C,C++这种比较严格的强类型语言,是不允许随便转换类型的,结果就会是0