相关疑难解决方法(0)

C++运算符中的隐式类型转换规则

我想知道什么时候应该投出更好.在添加,乘法等时,C++中的隐式类型转换规则是什么.例如,

int + float = ?
int * float = ?
float * int = ?
int / float = ?
float / int = ?
int / int = ?
int ^ float = ?
Run Code Online (Sandbox Code Playgroud)

等等...

表达式是否总是被评估为更精确的类型?Java的规则有所不同吗?如果我不准确地说出这个问题,请纠正我.

c++ casting implicit

156
推荐指数
5
解决办法
9万
查看次数

整数蓝色,短+ +短问题

C#中的程序:

short a, b;
a = 10;
b = 10;
a = a + b; // Error : Cannot implicitly convert type 'int' to 'short'.

// we can also write this code by using Arithmetic Assignment Operator as given below

a += b; // But this is running successfully, why?

Console.Write(a);
Run Code Online (Sandbox Code Playgroud)

c# int types short

68
推荐指数
4
解决办法
1万
查看次数

标签 统计

c# ×1

c++ ×1

casting ×1

implicit ×1

int ×1

short ×1

types ×1