头文件和函数声明已略~
int judgecustomer(char *lastname1, char *firstname1, long code1, struct customer customer[60])
{
int j, r, q, w=0, x=0;
char *s1, *s2, *s3, *s4;
for(j=0; j<60; j++)
{
*s1=*customer[j].lastname;
*s2=*lastname1;
*s3=*customer[j].firstname;
*s4=*firstname1;
r=strcmp(s1,s2);
q=strcmp(s3,s4);
if(r==0 && q==0)
{
puts("The name you enter is correct.");
w++;
}
if(code1 == customer[j].code)
{
puts("The code you enter is correct.");
x++;
}
if(w==1 && x==1)
{
puts("Identified successfully");
return 40;
}
else
return 30;
}
}
这个子函数用来判断用户输入的lastname 和 firstname 以及 code 是否正确。编译器不报错,但运行时会出错。
请高手看看代码有何错误。
谢谢~
|