谁给我改一下,这是什么错误?
:\Documents and Settings\Administrator\桌面\Cpp1.cpp(14) : error C2018: unknown character '0xa3'C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(14) : error C2018: unknown character '0xac'
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(14) : error C2143: syntax error : missing ';' before '*'
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(14) : error C2065: 'q' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(14) : error C2100: illegal indirection
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(22) : error C2440: '=' : cannot convert from 'struct student *' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(67) : error C2059: syntax error : 'delete'
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(68) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(68) : error C2447: missing function header (old-style formal list?)
执行 cl.exe 时出错.
Cpp1.exe - 1 error(s), 0 warning(s)
#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
#include<string.h>
typedef struct student
{
int num;
struct student *link;
}stud;
stud* creat(int n)
{
stud *h,*p;
int i;
h=(stud *)malloc(sizeof(stud));
if(h==NULL)
{
printf("not enough memory!");
return(0);
}
h=NULL;
for(i=0;i<=n;i++)
{
if((p=(struct student *)malloc(sizeof(stud)))==NULL)
{
printf("内存不足!");
return(0);
}
scanf("%d",&p->num);
p->link=h;
h=p;
}
return(h);
}
void search(stud *h)
{
stud *p;
int m;
printf("请输入需查找数据!");
scanf("%d",&m);
p=h;
while(p!=NULL)
{
if(m==p->num)
{printf("%d\n",m);
break;
}
else
p=p->link;
}
}
stud *delete(stud *h)
{
stud *q,*p;
p=h;
int n;
q=h->link;
printf("请输入要删除的数字!");
scanf("%d",&n);
while(p!=NULL&&q!=NULL)
{
p=p->link;
q=q->link;
if(n==q->num)
p->link=q->link;
else if
(n==p->num)
q=h;
printf("删除成功!");
free(p);
}
return(h);
}
void print(stud *h)
{
stud *p;
p=h;
while(p!=NULL)
{
printf("%d",p->num);
p=p->link;
}
}
void main()
{
struct student *h;
h=(struct student *)creat(3);
search(h);
delete(h);
print(h);
}