1 #include<iostream> 2 using namespace std; 3 4 int main() 5 { 6 //cout << 3+5 << endl; 7 cout << (1>2?3+5:"hello") << endl; 8 return 0; 9 } 10 /* 11 codeblocks:报错:条件运算符.cpp|7|error: operands to ?: have different types 'int' and 'const char*'| 12 13 1:”1″不是同一类型 14 :前后必须是同一类型or能隐式转换的类型 15 */