[c/c++]unsigned和int的比较会默认强制转换为unsigned

/ 1评论 / 266阅读 / 0点赞

无符号整形(unsigned) 和 有符号整形(int) 的比较会默认强制转换为 无符号类型(unsigned)

#include <iostream>
using namespace std;

int main()
{
	int a = -1;
	unsigned int b = 77;
	if (a > b)	//a > b  = true
		cout << "a > b" << endl;
	else
		cout << "a < b" << endl;
	cout << " a = " << a << endl;
	cout << " b = " << b << endl;
}
  1. granithiknbik1984说道:

    Proven online casino https://biamo.bet/ that pays. Prompt payouts, pay any way you like. Giant selection of different online games. Huge selection of sports betting, online streaming, working all over the world. Come on in and win with us

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注