#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貢獻(xiàn)45條經(jīng)驗(yàn) 獲得超12個(gè)贊
#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 關(guān)注
- 1468 瀏覽
添加回答
舉報(bào)
0/150
提交
取消