qfedu-cpp-level/day1/d11.cpp

14 lines
309 B
C++
Raw Normal View History

// c 中三目运算表达式返回的是 变量的值 (对照 d11.c)
// c++ 中三目运算表达式返回的是 变量
#include <iostream>
using namespace std;
int main()
{
int a = 10, b = 20;
(a > b ? a : b) = 100;
cout << "a = " << a << endl;
cout << "b = " << b << endl;
return 0;
}