#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
string a;
vector<string> b;
vector< vector<string> > s;
while(cin>>a) {
b.push_back(a);
s.push_back(b);
cout<<s.size()<<endl;//A1
cout<<s[s.size()-1]<<endl;//A2
}
return 0;
}
Any problems with this? If line A2 is deleleted,the program can run.So I think s does exist,but when I add line A2 hoping to see the last element of vector of s ,Cannot run! My IDE:codeblocks(svn build rev 4977 (2008-03-29 18:01:31) gcc 4.2.1 Windows/unicode)
Somebody give a hand? Thanks.