這個程序目的是回顯之前輸入的內容,包括空格。比如This is a book.回顯內容就應該也是This is a book.但我寫出來的程序回顯的是Thisisabook.該怎么改呢?#include<iostream.h#include<malloc.htypedef struct node{ char data; struct node *next;}node,*Lstring; //結構體定義void creat(Lstring &s){ node *p1,*p2; s=(Lstring)malloc(sizeof(node)); //新建頭結點 cout<<" 請輸入字符串:"; p2=s; p1=p2; while(p1-data!='.') //建立鏈表 { p1=(Lstring)malloc(sizeof(node)); //新建首元結點 cinp1-data; p2-next=p1; p2=p2-next; } p1-next=NULL;}void main(){ struct node *p; Lstring a; creat(a); cout<<" 結果是:"; p=a-next; while(p!=NULL) { cout<data; p=p-next; } cout<<endl;}