第三章 3.6 多维数组
来源:互联网 发布:数据库的完整性是指 编辑:程序博客网 时间:2024/06/05 18:14
3.43
#include <iostream>#include <string>using namespace std;int main(){ const size_t rowCnt = 3, colCnt = 4; size_t cnt = 0; int ia[rowCnt][colCnt]; for (auto &row : ia) { for (auto &col : row) { col = cnt; ++cnt; } } for (int (&row)[4] : ia) { for (int col : row) { cout << col << " "; } cout << endl; } for (size_t i = 0; i != rowCnt; ++i) { for (size_t j = 0; j != colCnt; j++) { cout << ia[i][j] << " "; } cout << endl; } for (int (*p)[4] = ia; p != ia + 3;++p) { for (int *q = *p; q != *p + 4; ++q) { cout << *q << " "; } cout << endl; } return 0;}
3.44
#include <iostream>#include <string>using namespace std;int main(){ using int_array = int[4]; typedef int int_array[4]; const size_t rowCnt = 3, colCnt = 4; size_t cnt = 0; int ia[rowCnt][colCnt]; for (auto &row : ia) { for (auto &col : row) { col = cnt; ++cnt; } } for (int_array &row : ia) { for (int col : row) { cout << col << " "; } cout << endl; } for (size_t i = 0; i != rowCnt; ++i) { for (size_t j = 0; j != colCnt; j++) { cout << ia[i][j] << " "; } cout << endl; } for (int_array *p = ia; p != ia + 3;++p) { for (int *q = *p; q != *p + 4; ++q) { cout << *q << " "; } cout << endl; } return 0;}
3.37
#include <iostream>#include <string>using namespace std;int main(){ const size_t rowCnt = 3, colCnt = 4; size_t cnt = 0; int ia[rowCnt][colCnt]; for (auto &row : ia) { for (auto &col : row) { col = cnt; ++cnt; } } for (auto &row : ia) { for (int col : row) { cout << col << " "; } cout << endl; } for (size_t i = 0; i != rowCnt; ++i) { for (size_t j = 0; j != colCnt; j++) { cout << ia[i][j] << " "; } cout << endl; } for (auto *p = ia; p != ia + 3;++p) { for (int *q = *p; q != *p + 4; ++q) { cout << *q << " "; } cout << endl; } return 0;}
0 0
- 第三章 3.6 多维数组
- 《C++ Primer》读书笔记第三章-4-数组 And 多维数组
- 《C++ Primer》读书笔记-第三章 06 多维数组
- c++ primer第五版(中文)习题答案 第三章第六节-多维数组
- 第三章 多维随机变量及其分布
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 多维数组
- 开发一个Android应用之前,应该做点什么?
- 算法分析及实例解析(三)——回溯法
- struts2中自定义拦截器的配置
- 初步认识ajax
- ios-UI高级 GCD的相关设置
- 第三章 3.6 多维数组
- vim实用配置
- 转载:程序员入门必读:编程语言争霸 霸主是他
- 单链表的参考1
- 最常用的排序——快速排序
- try catch finally 用法 博客分类: Java http://hi.baidu.com/vincentwen/blog/item/b92d0923f1e4c64793580757
- smplayer-16.7.0源码 32位Debug版编译、运行、调试
- poj 2388 Who's in the Middle
- 顺序栈参考