array it needs a constant value

const int seq_size = 18;
int pell_seql[seql_size];
//defined a constant value: seq_size = 18

As vector,First, we need to include Head file of vector: #include<vector>

vector is a template,So we need to add curly braces <Type> Size don't need to be a Constant value here

#include<vector>
vector<int> pell_seql(seq_size);//Attention! Size don't need to be a constant value here

whether array or vector,we can appoint Location,by []

pell_seql[0] = 1;//The first element is 1
pell_seql[1] = 2;//The second element is 2

initialization

array

int elem_seq[seql_size] = {,,,};//cant over size

vector

First Merhod(Troublesome)

vector<int>elem_seq(seql_size);
elem_seq[0] = 1;
elem_seq[1] = 2;
............etc

The second Method

int elem_vals[seq_size] = {1,2,3,4,5,6,7,8,9};

vector<int>elem_seq(elem_vals,elem_vals + seq_size)//the two values here refer to location,They identify Initialized element range

There is a difference between Array and Vector: Vector know its size

最新文章

  1. MFC的定时器OnTimer
  2. 反射,System.Type类
  3. Spring.Net实现IOC和DI
  4. Windows Server 2012 GUI与Core的切换
  5. RGPJS 教程之八 创造场景
  6. java 对excel操作导入excel数据到数据库
  7. 【hbase】使用thrift with python 访问HBase
  8. AT-FragmentPagerAdapter
  9. Android学习手记(3) Activity间传递数据
  10. 知识点1-3:MVC设计模式
  11. Mybatis第二篇【CRUD、分页】
  12. hdu 1052 Tian Ji -- The Horse Racing【田忌赛马】
  13. container and Injection
  14. python大法好——面向对象
  15. Java并发——线程中断学习
  16. 02-里氏替换原则(LSP)
  17. [原创] 浅谈ETL系统架构如何测试?
  18. Webpack 性能优化 (一)(使用别名做重定向)
  19. ubuntu(14.04) sphinx安装
  20. JAVA-JSP内置对象之application对象获得服务器版本

热门文章

  1. 2022i春秋-冬季赛nan’s analysis
  2. Sql Server中order by对varchar类型排序结果不对
  3. [编程基础] C++多线程入门4-数据共享和资源竞争
  4. [OpenCV实战]3 透明斗篷
  5. 一问读懂Web3 架构
  6. Java反射获取方法参数名 IDEA配置 Maven
  7. C#/VB.NET 在Excel中添加水印
  8. 基于 VScode 搭建 STM32 运行环境
  9. python正则查找
  10. GIT安装及IDEA配置(GIT)