#include <stdio.h>
#include <stdlib.h>
typedef struct Date{
int year;
int month;
int day;
struct Date* next;}date;
void main()
{
int i;
date*head,*p,*p1;
*p=(date*)malloc(sizeof(date));
p1=head=p;
for(;p->next!=NULL;)
{
scanf("%d,%d,%d",&p->year,&p->month,&p->day);
if(p->year==0&&&p->month==0&&p->day==0)
{p->next=NULL;continue;}
*p=*p=(date*)malloc(sizeof(date));
p1->next=p;
p1=p;
}
for(;head->next!=NULL;)
{
printf("%d,%d,%d\n"head->year,head->month,head->day);
}
}
3 回答
DOUBLE_l
TA贡献45条经验 获得超12个赞
#include <stdio.h>
#include <stdlib.h>
typedef struct Date{ int year;
int month;
int day;
struct Date* next;}date;
void main()
{ int i; date*head,*p,*p1;
*p=(date*)malloc(sizeof(date));
p1=head=p;
for(;p->next!=NULL;)
{
scanf("%d,%d,%d",&p->year,&p->month,&p->day);
if(p->year==0&&&p->month==0&&p->day==0) {p->next=NULL;continue;}
*p=*p=(date*)malloc(sizeof(date));
p1->next=p;
p1=p; }
for(;head->next!=NULL;)
{ printf("%d,%d,%d\n"head->year,head->month,head->day);
}
}快看看,
- 3 回答
- 0 关注
- 1417 浏览
添加回答
举报
0/150
提交
取消