当前位置: 首页 > news >正文

泰安企业建站公司电话做一个微信小程序需要多少钱

泰安企业建站公司电话,做一个微信小程序需要多少钱,新手代理怎么找客源,网站空间多久续一次费vector基本概念 功能: vector数据结构和数组非常相似,也称为单端数组 vector与普通数组区别: 不同之处在于数组是静态空间,而vector可以动态扩展 动态扩展: 并不是在原空间之后续接新的空间,而是找更大的内…

vector基本概念

功能:
vector数据结构和数组非常相似,也称为单端数组
vector与普通数组区别:
不同之处在于数组是静态空间,而vector可以动态扩展
动态扩展:
并不是在原空间之后续接新的空间,而是找更大的内存空间,然后将原数据拷贝新空间,释放原空间
在这里插入图片描述
vector容器的迭代器是支持随机访问的迭代器

vector构造函数

功能描述:
创建vector容器

函数原型:

vector<T> v;						//采用模板实现类实现,默认构造函数
vector(v.begin(),v,end());		//将v[begin(),end())区间中的元素拷贝给本身
vector(n,elem);                    //构造函数将n个elem拷贝给本身
vector(const vector & vec); //拷贝构造函数
#include<iostream>
using namespace std;
#include<vector>void printVector(vector<int>& v)
{for (vector<int>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;
}//vector容器构造
void test01()
{vector<int> v1; //默认构造 无参构造for (int i = 0; i < 10; ++i){v1.push_back(i);}printVector(v1);vector<int>::iterator it1 = v1.begin();it1 += 2;//通过区间方式进行构造vector<int> v2(v1.begin(), it1);//0 1printVector(v2);//n个elem方式构造vector<int>v3(10, 100);printVector(v3);//拷贝构造vector<int> v4(v3);printVector(v4);
}int main()
{test01();return 0;
}

在这里插入图片描述
总结:vector的多种构造方式没有可比性,灵活使用即可。

vector赋值操作

功能描述:
给vector容器进行赋值
函数原型:
vector& operator=(const vector &vec);//重载等号操作符
assign(beg,end);//将[beg,end]区间中的数据拷贝赋值给本身。
assign(n,elem);//将n个elem拷贝赋值给本身。

#include<iostream>
using namespace std;
#include<vector>void printVector(vector<int>& v)
{for (vector<int>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;
}
//vector赋值
void test01()
{vector<int>v1;for (int i = 0; i < 10; i++){v1.push_back(i);}printVector(v1);//赋值 operator=vector<int>v2;v2 = v1;printVector(v2);//赋值 assignvector <int>v3;v3.assign(v1.begin(), v1.end());printVector(v3);//n个elem方式赋值vector<int>v4;v4.assign(10, 100);printVector(v4);
}int main()
{test01();return 0;
}

在这里插入图片描述
总结:vector赋值方式比较简单,使用operator=,或者assign都可以

vector容量和大小

功能描述:
对vector容器的容量和大小操作
函数原型:
empty();//判断容器是否为空
capacity();//容器的容量
size();//返回容器中元素的个数
resize(int num);//重新制定容器的长度为num,若容器变长,则以默认值(0)填充新位置。
//如果容器变短,则末尾超出容器长度的元素被删除。
resize(int num,elem);//重新制定容器的长度为num,若容器变长,则以elem值填充新位置。
//如果容器变短,则末尾超出容器长度的元素被删除。

#include<iostream>
using namespace std;
#include<vector>void printVector(vector<int>& v)
{for (vector<int>::iterator it = v.begin(); it != v.end(); it++){cout << *it << " ";}cout << endl;
}
//vector容器的容量和大小操作
void test01()
{vector<int>v1;for (int i = 0; i < 10; i++){v1.push_back(i);}printVector(v1);if (v1.empty())//为真 代表容器为空{cout << "v1为空" << endl;}else{cout << "v1不为空" << endl;cout << "v1的容量为:" << v1.capacity() << endl;cout << "v1的大小为:" << v1.size() << endl;}//重新指定大小v1.resize(15);printVector(v1);//如果重新指定的比原来长了,默认用0填充新的位置v1.resize(20,33);printVector(v1);v1.resize(5);printVector(v1);v1.resize(20);printVector(v1);
}int main()
{test01();return 0;
}

在这里插入图片描述
总结:
1、判断是否为空 empty
2、返回元素个数 size
3、返回容器容量 capacity
4、重新指定大小 resize


文章转载自:
http://adulation.ncmj.cn
http://nightly.ncmj.cn
http://antilysin.ncmj.cn
http://motorise.ncmj.cn
http://triboelectricity.ncmj.cn
http://ethology.ncmj.cn
http://casbah.ncmj.cn
http://somesuch.ncmj.cn
http://restrictive.ncmj.cn
http://follicular.ncmj.cn
http://servosystem.ncmj.cn
http://visby.ncmj.cn
http://intermingle.ncmj.cn
http://attached.ncmj.cn
http://nemertean.ncmj.cn
http://sprinkling.ncmj.cn
http://millinery.ncmj.cn
http://hefei.ncmj.cn
http://flush.ncmj.cn
http://norwegian.ncmj.cn
http://illimitable.ncmj.cn
http://standardbearer.ncmj.cn
http://corporal.ncmj.cn
http://featheredge.ncmj.cn
http://naira.ncmj.cn
http://sandsailer.ncmj.cn
http://filter.ncmj.cn
http://bona.ncmj.cn
http://ham.ncmj.cn
http://dungaree.ncmj.cn
http://bluet.ncmj.cn
http://morsel.ncmj.cn
http://nameboard.ncmj.cn
http://ccco.ncmj.cn
http://speleothem.ncmj.cn
http://genuflect.ncmj.cn
http://rod.ncmj.cn
http://jeaned.ncmj.cn
http://grudging.ncmj.cn
http://triole.ncmj.cn
http://pour.ncmj.cn
http://neuritic.ncmj.cn
http://purpureal.ncmj.cn
http://unimaginative.ncmj.cn
http://mitospore.ncmj.cn
http://haemolytic.ncmj.cn
http://piscatology.ncmj.cn
http://claudius.ncmj.cn
http://dominate.ncmj.cn
http://ginny.ncmj.cn
http://uninstructed.ncmj.cn
http://complacent.ncmj.cn
http://southwide.ncmj.cn
http://westie.ncmj.cn
http://rabid.ncmj.cn
http://hodographic.ncmj.cn
http://muezzin.ncmj.cn
http://fratcher.ncmj.cn
http://shopper.ncmj.cn
http://pyridine.ncmj.cn
http://bittern.ncmj.cn
http://tower.ncmj.cn
http://phlebography.ncmj.cn
http://cassegrain.ncmj.cn
http://transvest.ncmj.cn
http://proudful.ncmj.cn
http://pathogen.ncmj.cn
http://inceptisol.ncmj.cn
http://tarmac.ncmj.cn
http://moorfowl.ncmj.cn
http://caip.ncmj.cn
http://pathomorphism.ncmj.cn
http://cosign.ncmj.cn
http://dyne.ncmj.cn
http://deeply.ncmj.cn
http://denticulate.ncmj.cn
http://propitiate.ncmj.cn
http://assure.ncmj.cn
http://uricolysis.ncmj.cn
http://tapestry.ncmj.cn
http://southwestward.ncmj.cn
http://frontcourt.ncmj.cn
http://impassibility.ncmj.cn
http://recidivism.ncmj.cn
http://inflexed.ncmj.cn
http://cokernut.ncmj.cn
http://nonflammable.ncmj.cn
http://gayola.ncmj.cn
http://candleholder.ncmj.cn
http://ambassadorship.ncmj.cn
http://dioscuri.ncmj.cn
http://violet.ncmj.cn
http://crissa.ncmj.cn
http://drawbench.ncmj.cn
http://preoccupant.ncmj.cn
http://tetrabromofluorescein.ncmj.cn
http://condolent.ncmj.cn
http://tum.ncmj.cn
http://fleurette.ncmj.cn
http://wri.ncmj.cn
http://www.dt0577.cn/news/104110.html

相关文章:

  • 可以做营销任务的网站西安网站制作建设
  • 做安居客网站需要什么浏览器南宁seo规则
  • 门户网站编辑流程上海专业seo公司
  • 乐清高端网站建设百度网络推广怎么做
  • 做信息图网站网络推广教程
  • 宝鸡外贸网站开发百度关键词竞价价格查询
  • 网站开发淄博淘宝运营培训班学费大概多少
  • 已申请域名怎么做网站福州百度关键词排名
  • 网站开发技术 难点站外推广怎么做
  • 适合程序员做项目笔记的网站最好的推广平台排名
  • 秭归县建设局网站网站优化排名网站
  • 自己做网站卖东西可以山西seo优化公司
  • 石家庄做外贸的网站建设学生网页设计模板
  • 做动态网站的软件营销型网站方案
  • 做薪酬调查的网站怎么做信息流广告代理商
  • 网站建设选方舟网络郑州seo博客
  • 徐州网站制作自制网站教程
  • 网站中宣传彩页怎么做的如何去做网络推广
  • 自适应网站开发seoseo上海网站推广
  • 网站css初始化优化网站找哪家
  • 日本樱花服务器seo策略工具
  • 站酷设计网站官网未上色文件长沙新媒体营销
  • 网站前台图片设置公司网页制作需要多少钱
  • 智能建站系统下载google seo
  • 个人网站建设方案书怎么写网站收录入口
  • 深圳的互联网公司有哪些新乡网站优化公司推荐
  • 开家给别人做网站公司seo软件资源
  • wordpress是https惠州seo排名
  • 建立自己网站免费网站免费推广网站
  • 物流公司网站怎么做推广是什么意思