请解答谢谢,输出那里那个括号是有取最大值的运算吗?不知道为什么输出四个数字,而不是四个括号那种
(a+=3,a+b)的结果只有第二值输出(逗号情况输出最后一个值)。
考虑改为cout<<"("<<(a+=3)<<","<<(a+b)<<")"<<" ";
源程序:
#include <iostream>
using namespace std;
#define N 5
void func()
{
static int a;
int b=2;
// cout<<(a+=3,a+b)<<" ";
cout<<"("<<(a+=3)<<","<<(a+b)<<")"<<" ";
}
int main()
{
for(int i=1;i<N;i++) func();
cout<<endl;
}