回复 18楼 rjsp
就是两者之间为什么速度会不一样
回复 19楼 叶纤
就是unsigned 少用吗 我今天看视频学到了这个就用了下哈哈哈
程序代码: #include <iostream>
int main()
{
unsigned short x{ 65535 }; // largest 16-bit unsigned value 2*8。 16possible
std::cout << "x was: " << x << '\n';
x = 65536; // 65536 is out of our range, so we get wrap-around65536超出了我们的范围,因此我们得到了环绕
std::cout << "x is now: " << x << '\n';0
x = 65537; // 65537 is out of our range, so we get wrap-around65537超出了我们的范围,因此我们得到了环绕。 1
std::cout << "x is now: " << x << '\n';
return 0;
}
程序代码:
避免使用无符号
#include <iostream>
int main()
{
unsigned int x{ 3 };
unsigned int y{ 5 };
std::cout << x - y << '\n';
return 0;
}

[此贴子已经被作者于2020-3-20 11:17编辑过]
