运行出现错误
请教,哪里错了。
#include<iostream>
#include<string>
using namespace std;
int main(){
string text;
const string sep=",.\"\n ";
const int max_word=100;
string word[max_word]={0};
cout<<"请输入一段话(以#结束):";
getline(cin,text,'#');
int start=text.find_first_not_of (sep);
int end=0;
int word_count=0;
while(start!=string::npos&&word_count<max_word)
{
end=text.find_first_of(sep,start+1);
if(end==string::npos)
end=text.length();
word[word_count]=text.substr(start,end-start);
start=text.find_first_not_of(sep,end+1);
word_count++;
}
for(int i=0;i<=word_count;i++)
cout<<word[i]<<endl;
return 0;
}