i trying to read a line of users input and store that information. My problem is that when the data is being read it has a problem with the spaces.
ive tried to use a buffer (tmp[100]) to store the data like this..Code:struct link_list { char info[100]; struct link_list *next; struct link_list *pre; }; typedef struct link_list link; int count=0; class ll { link *first,*list,*temp,*pointer; public: ll() { first=list; } int isempty(void); void creat(void); void append(void); void del(void); void insbeg(void); void ins(void); void display(void); void inv(void); void find(char x[100]); }; int ll::isempty() { if(first==list) return(1); return(0); } void ll::creat() { if(first==list) count=0; else count=1; if(count!=0) { cout << endl <<"THE LIST ALREADY EXISTS!"; return; } char ch; char tmp[100]; list=new link; first=list; while(1) { cout<<"Enter Info:"; // cin >> list->info; cout<<"Do you want to continue:(y/n)"; cin >> ch; if(ch=='n') break; list->next=new link; list->next->pre=list; list=list->next; } list->next=first; first->pre=list; }
Code:cout<<"Enter Info:"; cin >> tmp; **now how can i get tmp into list->info**



LinkBack URL
About LinkBacks


