help
#include "stdafx.h"
#include"iostream.h"
#define Null 0
#define LEN sizeof(struct student)
struct student
{
int num;
int score;
struct student *next;
};
int n;
int main()
{
int num;
int score;
creat();
//print();
return 0;
}
struct student *creat(void)
{
struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%d,%d",&p1->num,&p1->score);
}
p2->next=NULL;
return(head);
}
/*void print(struct student *head)
{
struct student *p;
printf("\n Now,These %d records are:\n",n);
p=head;
if(head!=NULL)
do
{
printf("%ld %5.1f\n",p->num,p->score);
p=p->next;
}
while(p!=NULL);
}*/
--------------------Configuration: jianlilianbiao - Win32 Debug--------------------
Compiling...
jianlilianbiao.cpp
F:\temp\jianlilianbiao\jianlilianbiao.cpp(19) : error C2065: 'creat' : undeclared identifier
F:\temp\jianlilianbiao\jianlilianbiao.cpp(27) : error C2373: 'creat' : redefinition; different type modifiers
F:\temp\jianlilianbiao\jianlilianbiao.cpp(31) : error C2065: 'malloc' : undeclared identifier
执行 cl.exe 时出错.
jianlilianbiao.exe - 1 error(s), 0 warning(s)