![]() |
#2
peach54602013-02-19 08:19
|

#include<iostream>
#include<string>
#include<vector>
using namespace::std;
int main(){
vector<string*>vec;
string str;
cout<<"Enter some string ,"<<endl;
while(cin>>str){
string *st= new string;
*st=str;
vec.push_back(st);
}
vector<string*>::iterator iter=vec.begin();
while(iter!=vec.end()){
cout<<**iter++<<" "<<(**iter++).size()<<endl;
;
}
while(iter!=vec.end()){
delete *iter++;
}
return 0;
}
#include<string>
#include<vector>
using namespace::std;
int main(){
vector<string*>vec;
string str;
cout<<"Enter some string ,"<<endl;
while(cin>>str){
string *st= new string;
*st=str;
vec.push_back(st);
}
vector<string*>::iterator iter=vec.begin();
while(iter!=vec.end()){
cout<<**iter++<<" "<<(**iter++).size()<<endl;
;
}
while(iter!=vec.end()){
delete *iter++;
}
return 0;
}