Code:#include <iostream> #include <cstdio> using namespace std; void disp(char *str[5]) { int choice=0; for(;;) { cout<<"Choose statement to read. (1-5) Other to exit."<<endl; cin>>choice; if((choice<1)||(choice>5)) break; cout<<"Statement "<<choice<<" is \""<<str[choice-1]<<"\"."<<endl; } return; } int main() { char *str[5]={"","","","",""}, *input; cout<<"Please enter 5 strings to be stored."<<endl; for(int i=0;i<5;i++) { gets(str[i]); //I think the problem is here but i dunno what it is if(i<4) cout<<"Please enter next string."<<endl; } disp(str); cin.ignore(); cin.ignore(); return 0; }
Thanks alot