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\n",res1,res2);
    }
}
View Code

运行结果:

posted @ 2017-09-11 18:59  一串字符串  阅读(256)  评论(0编辑  收藏  举报