vector<int> a(10,0); for(vector<int>::iterator itor=a.begin();itor!=a.end();itor++) *itor=1; /* *itor can't changed */ for(vector<int>::const_iterator itor=a.begin();itor!=a.end();itor++) cout<<*itor; /* itor itself can't changed,but *itor is changeable */ const vector<int>::iterator itor; bool singal; cin>>singal;
计算数组长度
unsigned a[]={1,2,3,4,5,6,7,8,9,0}; cout<<sizeof(a)/sizeof(unsigned);