双打和整数 [英] doubles and ints

查看:75
本文介绍了双打和整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是有效的C语法吗?


double = double / int;


我好像在这里遇到麻烦。


比尔

Is this valid C syntax ?

double=double/int;

I seem to be having trouble here.

Bill

推荐答案

7月11日上午10点36分,Bill Cunningham < nos ... @ nspam.comwrote:
On Jul 11, 10:36 am, "Bill Cunningham" <nos...@nspam.comwrote:

这是有效的C语法吗?


double = double / int ;


我好像在这里遇到麻烦。


比尔
Is this valid C syntax ?

double=double/int;

I seem to be having trouble here.

Bill



所以如果有一个双d和一个int i,你会问d = d / i

是否是有效的C语法?我认为这是正确的,但如果它没有得到你想要的
,那么就去改变吧。试验直到愚蠢的电脑给你

你想要什么。将i转换为double,看看会发生什么。试试


d = d /(double)i


希望有用。不能拧紧测试代码。

So if there''s a double d and an int i, you''re asking whether d = d / i
is valid C syntax? I reckon that''s right but if it doesn''t get what
you want, go change it. Experiment till the stupid computer gives you
what you want. Convert i into a double and see what happens. Try

d = d / (double)i

Hope that works. Can''t be screwed testing the code.


在文章< 7Wxdk.858
In article <7Wxdk.858


713.149@trnddc03> ;,

Bill Cunningham< no **** @ nspam.comwrote:
713.149@trnddc03>,
Bill Cunningham <no****@nspam.comwrote:

这是有效的C语法吗?
Is this valid C syntax ?


> double = double / int;
>double=double/int;


>我好像在这里遇到麻烦。
>I seem to be having trouble here.



不,不是。

No it is not.


这篇关于双打和整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆