一个很困扰的问题,求解答
程序代码:
#include <iostream> #include <stdlib.h> using namespace std; int myfunc(int a,int b) { return (++a)<b ? a:b; } int main() { int a = 1; int b = 3; int c = myfunc(++a,b); //输出结果是 2 3 3 为什么a的值为2 而不是3??求解答 cout << "a=" << a << endl; cout << "b=" << b << endl; cout << "c=" << c << endl; //cout << "d=" << d << endl; cout << "Hello world!" << endl; system("pause"); return 0; }