ҳ
ǰλ: ҳ > > C/C++̳ >

vectorжϿմ

ʱ:2015-04-20 23:17Դ:Խ̳ѧϰ www.etwiki.cn ༭:admin

жС:v.size()

:v.clear()

ж򷵻1 v.empty()



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

int main()
{
vector<int> v;
for(int i=0;i<10;i++)
{
v.push_back(i);
}
for(vector<int>::iterator it=v.begin();it!=v.end();it++)
{
cout<<*it<<" ";
}
cout<<endl;
//С
cout<<"ǰԪظ"<<v.size()<<endl;
//жǷΪ򷵻1
cout<<"ǷΪ"<<v.empty()<<endl;
//
v.clear();
cout<<"պԪظ"<<v.size()<<endl;
cout<<"ǷΪ"<<v.empty()<<endl;
system("pause");
return 0;
}

 

------ָ----------------------------
ǩ(Tag):C
------ָ----------------------------
Ƽ
  • ʽ﷨ Objective-C̽

    Ϊһ Objective-C ԵʹѾнʱ. ϤеĹ, Obj...

  • WindowsCԳ

    Windowsµı̹ʹ VC 6.0,潲VC 6.0ϽڵHello, world...

  • Visual C++ѡܽ

    Microsoft Visual C++ ΢˾Ƴ Windows µĿӻɱϵͳҲǹ...

  • Luaе

    ˵˵Luaе Luaеtableһֶһμ򵥵Ĵ local t...

  • LuaеЭͬ

    Э̲ͬ߳ҲһִӵԼջֲָָ...

  • C++ģʽģʽ

    ոռӰ˾涨ƽʱӰֻ10ǮIJͲӰֻ...

Ȥ