C⼀C++的程序,编译过程没有提示存在错误,但是在执行时却无法正常运行,请大家帮忙看看是什么问题??

2024-11-29 19:32:28
推荐回答(1个)
回答1:

#include "iostream.h" struct node { char date; struct node *next; }; struct node *create(int n) { struct node *head,*newnode; int i; char x; head = new node; head->next = NULL; for(i=0;i>x; newnode=new node; newnode->date = x; newnode->next=head; head=newnode; } return head; } void main() { struct node *p,*head; int n,s=0; cin>>n; head=create(n); p=head; while(p->next !=NULL) { cout<date<<'\t'; if('A'<=(p->date) && (p->date)<='Z') s++; p=p->next; } cout<