error C2664: 'strcmp' : cannot convert parameter 2 from 'char' to 'const char *'这个错误怎么改求打救
voidsearch_name(){structsalary_lists;charname[50];structsalary_listsalary[50];charnam...
void search_name()
{
struct salary_list s;
char name[50];
struct salary_list salary[50];
char name1[10];
int i,t;
int m=load();
printf("请输入要查找的姓名:\n");
scanf("%s",name1);
for(i=0;i<m;i++)
if(strcmp(name1,s.name[i])==0)
{
printf("\n已找到此人,其记录为:\n");
printf("\n工号 \t姓名 \t年龄\t 职位\t基本工资\t奖金\t保险 \t总工资\n");
printf("\n%s %s %d %s %d %lf %lf %lf %lf\n",
s.name[i],
s.num[i],
s.age,
s.career[i],
s.month,
s.base,
s.bonus,
s.insurance,
s.total);
break;
}
if(i==m)
printf("\n对不起,查无此人\n");
printf("\n");
printf("返回查询函数请按1,继续查询职工号请按2\n");
scanf("%d",&t);
switch(t)
{
case 1:
search_salary(salary,name);
break;
case 2:
break;
default:
break;
}
} 展开
{
struct salary_list s;
char name[50];
struct salary_list salary[50];
char name1[10];
int i,t;
int m=load();
printf("请输入要查找的姓名:\n");
scanf("%s",name1);
for(i=0;i<m;i++)
if(strcmp(name1,s.name[i])==0)
{
printf("\n已找到此人,其记录为:\n");
printf("\n工号 \t姓名 \t年龄\t 职位\t基本工资\t奖金\t保险 \t总工资\n");
printf("\n%s %s %d %s %d %lf %lf %lf %lf\n",
s.name[i],
s.num[i],
s.age,
s.career[i],
s.month,
s.base,
s.bonus,
s.insurance,
s.total);
break;
}
if(i==m)
printf("\n对不起,查无此人\n");
printf("\n");
printf("返回查询函数请按1,继续查询职工号请按2\n");
scanf("%d",&t);
switch(t)
{
case 1:
search_salary(salary,name);
break;
case 2:
break;
default:
break;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询