码迷,mamicode.com
首页 > 其他好文 > 详细

编写3个不同版本的程序,令其均能输出ia的元素

时间:2014-08-04 13:25:17      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   for   2014   

#include<iostream>
#include<vector>
#include<string>
using  namespace std;

int main()
{
    int ia[3][4]={
    {0,1,2,3},
    {4,5,6,7},
    {8,9,10,11}
    };
    for(int (*p)[4]=ia;p!=ia+3;++p)
        for(int *q=(*p);q!=*p+4;++q)
        cout<<*q<< ;
    cout<<endl;
    for(int i=0;i<3;i++)
        for(int j=0;j<4;++j)
        cout<<ia[i][j]<< ;
    cout<<endl;
    for(int (&i)[4]:ia)
        for(int &j:i)
        cout<<j<< ;
    cout<<endl;
    return 0;
}

运行结果:

bubuko.com,布布扣

编写3个不同版本的程序,令其均能输出ia的元素,布布扣,bubuko.com

编写3个不同版本的程序,令其均能输出ia的元素

标签:style   blog   http   color   os   io   for   2014   

原文地址:http://www.cnblogs.com/wuchanming/p/3889611.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!