#include <stdio.h>
#include <malloc.h>
#include <string.h>
typedef struct node{
int data;
struct node *next;
}Node;
void creatt(Node *head)
{
int k=0;
scanf("%d",&k);
while(1)
{
if(k == -1)
break;
Node *b=(Node *)malloc(sizeof(Node));
b->next=head->next;
head->next=b;
b->data=k;
scanf("%d",&k);
}
}
void printt(Node *head)
{
Node *p;
p=head->next;
while(p!=NULL)
{
printf("%d\n",p->data);
p=p->next;
}
}
int main(){
//freopen("D:\\in.txt","r",stdin);
Node * head=(Node *)malloc(sizeof(Node));
head->next=NULL;
creatt(head);
printt(head);
}
/**************************************************************
Problem: 1511
User: lhcc1115
Language: C
Result: Accepted
Time:90 ms
Memory:3948 kb
****************************************************************/
九度代码1511
最新推荐文章于 2022-02-23 15:02:25 发布