单链表 赋值与显示 (类)

#include #include using namespace std; struct sLinkNode { char data; sLinkNode* next; }; class CLinkNode { string str; sLinkNode *sln; public: CLinkNode(string s) { str = s; list(); } void list(); void show() { for (sLinkNode *t=sln;t;t=t->next) { cout<data<<" "; } cout<data = str[i]; pi->next =pi; sln = pi; } else { sLinkNode *temp = new sLinkNode; temp->data =str[i]; pi->next =temp; pi = temp; } } pi->next = NULL; } int main() { string s; //cin string int sc; //s count cin>>s; sc = s.length(); cout<<"string count num : "<data = s[i]; //cout<data<next =pi; //pi = pe; } else { sLinkNode *temp = new sLinkNode; temp->data =s[i]; //cout<data<next =temp; pi = temp; } //pi->next = NULL; } pi->next = NULL; sLinkNode *ps; ps = pe; cout<<"1:"<data<<" "; pe=pe->next; } cout<next = NULL; for(sLinkNode* s = ps;s;s=s->next) { cout<data<<" "; } cout<

你可能感兴趣的:(单链表 赋值与显示 (类))