网站关键词百度首页消失,在线制作简历的网站,百度网站优化,怎么把自己做的网站发布出去Problem Description 输入多个整数#xff0c;以-1作为结束标志#xff0c;顺序建立一个带头结点的单链表#xff0c;之后对该单链表的数据进行逆置#xff0c;并输出逆置后的单链表数据。Input 输入多个整数#xff0c;以-1作为结束标志。Output 输出逆置后的单链表数据。… Problem Description 输入多个整数以-1作为结束标志顺序建立一个带头结点的单链表之后对该单链表的数据进行逆置并输出逆置后的单链表数据。Input 输入多个整数以-1作为结束标志。Output 输出逆置后的单链表数据。Example Input 12 56 4 6 55 15 33 62 -1 Example Output 62 33 15 55 6 4 56 12 #include stdio.h #include stdlib.h struct node { int data; struct node *next; }*head,*p; int main() { int i,j0; head(struct node *)malloc(sizeof(struct node)); head-nextNULL; while(j!-1) { p(struct node *)malloc(sizeof(struct node)); p-nextNULL; scanf(%d,p-data); if(p-data-1) break; p-nexthead-next; head-nextp; } phead-next; while(p!NULL) { if(p-next!NULL) printf(%d ,p-data); else printf(%d\n,p-data); pp-next; } return 0; } #include stdio.h #include stdlib.h struct node { int data; struct node *next; }*p,*q,*head,*tail; void print(struct node *head) { // struct node *p; phead-next; while(p!NULL) { if(p-next!NULL) printf(%d ,p-data); else printf(%d\n,p-data); pp-next; } } struct node *create() { // struct node *tail,*head,*p; int d; head(struct node *)malloc(sizeof(struct node)); head-nextNULL; tailhead; while(~scanf(%d,d)(d!-1)) { p(struct node *)malloc(sizeof(struct node)); p-nextNULL; p-datad; tail-nextp; tailp; } return head; } void reverse(struct node *head) { //struct node *p,*q; phead-next; head-nextNULL; qp-next; while(p!NULL) { p-nexthead-next; head-nextp; pq; if(q) qq-next; } } int main() { struct node *h; hcreate(); reverse(h); print(h); return 0; }