这里重点介绍?:

 

#include <iostream>
using namespace std;

int main(void)
{
	int a = 2;
	int b = 3;

	a > b ? a++ : b++;

	cout << a << endl;
	cout << b << endl;
	return 0;
}

 

 

输出:

2

4

这里a>b为假,则直接执行b++,不执行a++.

相关文章:

  • 2022-01-04
  • 2021-06-09
  • 2022-12-23
  • 2021-11-01
  • 2021-05-29
  • 2021-04-27
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2021-07-03
  • 2022-01-23
  • 2021-07-09
  • 2021-08-21
  • 2021-05-02
相关资源
相似解决方案