   A problem about vector?
  Here is my code.//Read a set of integers into a vector. Calculate and print the sum of each pair of adjacent elements in the vector. #include<iostream>#include<vector>using namespace std;  int main(){vector <int> ivec;int ival;cout<<"Enter numbers(Ctrl +Z to end): "<<endl;while (cin>>ival)    ivec.push_back(ival);if(ivec.size()==0){cout<<"NO element "<<endl;return -1;} cout<<"Sum of each pair of adjacent element in the vector "<<endl; vector<int>::size_type cnt=0;    vector <int>::size_type first,last;  //look herefor ( first=0, last=ivec.size()-1;first<last; --last,++first){cout<<ivec[first]+ivec[last]<<"\t";++cnt;if(cnt%6 ==0) cout<<endl;}if (first==last)  //the error cout<<endl    <<"The center element is not been summed and its value is "<<ivec[first]<<endl;system("pause");return 0;}If I chnage "vector<int>::size_type first,last" to "for(vector<int>::size_type first=0,last=ivec.size()-1),  then "if(first==last)" become a error.Can you tell me WHY? Thanks   
  Thats because if you define first and last inside the for statement, the compiler can only 'see' them inside the for loop. When your programm goes out of scope (i.e. leaves the loop), first and last don't exist any more (try searching for "scope c++" on the web for more information.   