nbalive2008费尔顿:请大家帮我看这个c程序啊!!

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 13:58:08
这是用到结构的程序,可是却报了一个让人看不懂的错,请问大虾们,是什么问题啊,谢谢!!
#include<stdio.h>
void adjust(struct employee *p);
void display(struct employee *p);
struct date
{
int year;
int month;
int day;
};
struct employee
{
int employee_id;
char name[10];
double salary;
struct date date1;
};

void main()
{

struct employee emp[10]=
{
{1,"Lili",1500,{1996,6,27}},
{2,"Tom",1600,{1997,4,25}},
{3,"Meimei",2300,{1990,1,6}},
{4,"Lucy",2100,{1996,1,17}},
{5,"Bopy",1700,{2000,5,28}},
{6,"Lilei",3100,{1998,6,18}},
{7,"raul",2700,{1994,6,27}},
{8,"figo",2800,{1989,11,21}},
{9,"henry",1900,{1996,9,7}},
{10,"totty",2300,{1997,5,14}}
};
int c;
printf("请选择要操作的菜单编号:(1或2)");
scanf("%d",&c);
while(c!='\0')
{
if(c==1)
adjust(emp);
if(c==2)
display(emp);
else
{
printf("菜单编号不存在,请重新输入:");
scanf("%d",&c);
}
}

}
void adjust(struct employee *p)
{
for(int i=0;i<10;i++)
{
if((p+i)->salary<=2000)
(p+i)->salary=(p+i)->salary*(1+0.15);
else if((p+i)->salary>2000&&(p+i)->salary<=5000)
(p+i)->salary=(p+i)->salary*(1+0.1);
}
}
void dispaly(struct employee *p)
{
for(int i=0;i<10;i++)
{
if((p+i)->date1.year==1996)
printf("%d %s %f %d %d %d\n",(p+i)->employee_id,(p+i)->name,(p+i)->salary,(p+i)->date1.year,(p+i)->date1.month,(p+i)->date1.day);
}

}
报错的内容是说unresolved external symbol "void __cdecl display(struct employee *)" (?display@@YAXPAUemployee@@@Z)
fatal error LNK1120: 1 unresolved externals

#include<stdio.h>
void adjust(struct employee *p);
void display(struct employee *p);
struct date
{
int year;
int month;
int day;
};
struct employee
{
int employee_id;
char name[10];
double salary;
struct date date1;
};

void main()
{

struct employee emp[10]=
{
{1,"Lili",1500,{1996,6,27}},
{2,"Tom",1600,{1997,4,25}},
{3,"Meimei",2300,{1990,1,6}},
{4,"Lucy",2100,{1996,1,17}},
{5,"Bopy",1700,{2000,5,28}},
{6,"Lilei",3100,{1998,6,18}},
{7,"raul",2700,{1994,6,27}},
{8,"figo",2800,{1989,11,21}},
{9,"henry",1900,{1996,9,7}},
{10,"totty",2300,{1997,5,14}}
};
int c;
printf("请选择要操作的菜单编号:(1或2)");
scanf("%d",&c);
while(c!='\0')
{
if(c==1)
adjust(emp);
else if(c==2)
display(emp);
else
{
printf("菜单编号不存在,请重新输入:");

}
scanf("%d",&c);
}

}
void adjust(struct employee *p)
{
int i;
for(i=0;i<10;i++)
{
if((p+i)->salary<=2000)
(p+i)->salary=(p+i)->salary*(1+0.15);
else if((p+i)->salary>2000&&(p+i)->salary<=5000)
(p+i)->salary=(p+i)->salary*(1+0.1);
}
}
void display(struct employee *p)
{
int i;
for(i=0;i<10;i++)
{
if((p+i)->date1.year==1996)
printf("%d %s %f %d %d %d\n",(p+i)->employee_id,(p+i)->name,(p+i)->salary,(p+i)->date1.year,(p+i)->date1.month,(p+i)->date1.day);
}

}

main()中没有这个struct employee *p啊
应该是在main中先申请指针 或者把struct employee *p都用*emp来代替

我看不懂