简体   繁体   English

这个C ++运算子是什么意思?

[英]What is the meaning of this C++ operator?

I have no idea about C++, and I need to change some code to other programming languages. 我对C ++一无所知,我需要将一些代码更改为其他编程语言。 Can someone tell me what the following line of code means? 有人可以告诉我以下代码是什么意思吗?

double a = v(i) / 2. / sigma0 / sqrt(_R(i) / P(i));

Specifically, . / 具体来说, . / . / is not clear to me. . /我不清楚。

It's operator / , . 是运算符/ . is a part of the previous instruction, that means 2.0 . 是上一条指令的一部分,表示2.0

Please notice that: 请注意:

double a = v(i) / 2. / sigma0 / sqrt(_R(i) / P(i));

is different from: 不同于:

double a = v(i) / 2 / sigma0 / sqrt(_R(i) / P(i));

As answered by other answers, / is clearly the division operator. 正如其他答案所回答, /显然是除法运算符。 And 2. means 2.0, adding a '.', as pointed out by comments under the original answer, makes it a floating point literal. 2.表示2.0,在原始答案下的注释中指出,加上“。”使其成为浮点文字。

For more on how c++ handles similar situations, you may check these links: 有关c ++如何处理类似情况的更多信息,请检查以下链接:

http://www.cplusplus.com/doc/tutorial/operators/ http://www.cplusplus.com/doc/tutorial/operators/

http://www.learncpp.com/cpp-tutorial/44-implicit-type-conversion-coercion/ http://www.learncpp.com/cpp-tutorial/44-implicit-type-conversion-coercion/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM