C++入门经典-例2.15-逗号表达式的应用

1:代码如下:

// 2.15.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"
#include<iostream>
using namespace std;
void main()
{
    int a=4,b=6,c=8,res1,res2;
    res1=a,res2=b+c;
    for(int i=0,j=0;i<2;i++)
    {
        printf("y=%d,x=%d
",res1,res2);
    }
}
View Code

运行结果:

原文地址:https://www.cnblogs.com/lovemi93/p/7506438.html