标签: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; }
运行结果:
编写3个不同版本的程序,令其均能输出ia的元素,布布扣,bubuko.com
标签:style blog http color os io for 2014
原文地址:http://www.cnblogs.com/wuchanming/p/3889611.html