vector问题求助
#include<iostream>#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef vector<double>::size_type vec_sz;
int main(){
vector<string> passage;
vector<double> numble;
string x;
cout<<"Please input one passage:"<<endl;
cin>>x;
while(x!="0"){
passage.push_back(x);
cin>>x;
}
vec_sz count,size=passage.size();
cout<<"The original passage is:"<<endl;
for(count=0;count!=size;count++){
cout<<passage[count];
}
/*for(count=0;count!=size;count++)
numble[count]=passage[count].size();*/
for(count=0;count!=size;count++)
cout<<numble[count];
sort(numble.begin(),numble.end());
for(count=0;passage[count].size()==numble[0];count++)
cout<<"The shortest words are:"<<passage[count]<<endl;
for(count=0;passage[count].size()==numble[size-1];count++)
cout<<"The longest words are:"<<passage[count]<<endl;
return 0;
}
return 0;
}
为什么编译可以通过 但是一运行就错误,觉得/* 之间那句有问题,但是考虑后面要对字符长度进行排序,不这样不好办,请各位高手指点,非常感谢。