c++程序—三目运算符

#include<iostream>
using namespace std;
#include<string>

int main()
{
    //三目运算符
    int a = 10;
    int b = 20;
    int c = 0;

    c = (a > b ? a : b);
    cout << "c=" << c << endl;

    
    (a > b ? a : b) = 100;
    cout << "a=" << a << endl;
    cout << "b=" << b << endl;


    
    system("pause");
    return 0;

}

 

posted @ 2020-02-28 09:21  Jackie_Wang  阅读(1503)  评论(0编辑  收藏  举报