Here it is. It's only working for 255 phrases... I know they are pretty much but I need the infinite version of thisCode:#include <iostream> using std::cout; using std::cin; using std::endl; #include <string> const int MAX=255; int main(){ char phrase[MAX]; char phrases[MAX][MAX]; cout<<"Please write all the phrases you want."<<endl; cout<<"To finish write \"END\""<<endl; cout<<endl; int x=0; char terminator[]="END"; char temp[MAX]; for(int i=0;i<MAX;i++){ ++x; cin.getline(phrase,MAX); strcpy(temp,phrase); strcpy(&phrases[i][0],phrase); if (strcmp(temp,terminator)==0) break; } return 0; }




Reply With Quote