69,369
社区成员
发帖
与我相关
我的任务
分享
int main()
{
char c,a[100];
int i=0,j,k;
LNode *head,*node;
head=(LNode *)malloc(sizeof(LNode));
//head=NULL;
head->next = NULL;
while((c=getchar())!='\n')
{
a[i]=c;
i++;
}
for(j=0;j<i;j++)
{
node=(LNode *)malloc(sizeof(LNode));
node->val=a[j];
node->next = head;
head=node;
}
//while(head->next!=NULL)
while(head!=NULL)
{
cout<<head->val;
head=head->next;
}
return 0;
}