生手 求解到底哪错了(create处报错)
新手 求解到底哪错了(create处报错)
------解决方案--------------------
create处出现什么错误?
#include <iostream>
using namespace std;
typedef struct node
{
char data;
node * next;
}NODE,*PNODE;
PNODE create();
void showList(PNODE pHead);
int main()
{
PNODE head;
head = create();
showList(head);
return 0;
}
PNODE create()
{
PNODE head=NULL;
PNODE pEnd = head;
PNODE ps;
char temp;
cout<<"Please input a string end with '#' :"<<endl;
do {
cin>>temp;
if(temp != '#')
{
ps=new node;
ps->data=temp;
ps->next=NULL;
if(head == NULL)
{
head = ps;
}
else
{
pEnd->next = ps;
}
pEnd=ps;
}
} while (temp != '#');
return head;
}
void showList(PNODE head)
{
PNODE pRead = head;
cout<<"The data of the link list are: "<<endl;
while(pRead != NULL)
{
cout<<pRead->data;
pRead=pRead->next;
}
cout<<endl;
}
Thread 1
breakpoint
------解决方案--------------------
create处出现什么错误?