一个关于c语言的错误提示问题:Type mismatch in redeclaration of 'xxx'

[复制链接]
查看11 | 回复2 | 2008-6-16 21:42:28 | 显示全部楼层 |阅读模式
错误提示上一:1.Type mismatch in parameter parameter in call to function 2.Type mismatch in redeclaration of identifier
不明白什么意思~~~~~~~~
#include
struct bank{char id[10];
char password[10];
double money;
}message;
int login_scan(char s[])
{FILE *fp;char str1[30];char str2[10];
int n=1;
if((fp=fopen("f:/data.txt","r"))==NULL)

{printf("sorry,system error\n");

exit(1);

}

fread(str1,sizeof(message.id),1,fp);

fread(str2,sizeof(message.password),1,fp);

strcat(str1,str2);
while(!feof(fp))
{ if(!strcmp(str1,s))

return n;

rewind(fp);

fseek(fp,n*sizeof(struct bank),1);

fread(str1,sizeof(message.id),1,fp);

fread(str2,sizeof(message.password),1,fp);

strcat(str1,str2);

n++;
}
fclose(fp);
return 0;
}
int login(void)//登录函数
{ FILE *fp;char s[30];int flat;int n=3;char str[100];

if((fp=fopen("f:/data.txt","r"))==NULL)

{printf("sorry,system error\n");

exit(1);

}

printf("input your use_name");

scanf("%s",message.id);

printf("iput your password\n");

scanf("%s",message.password);

strcpy(str,message.id);

strcat(str,message.password);//是否会在后面自动补\0?

flat=login_scan(str);

if(flat)

{ printf("login achieve\n");

fclose(fp);

return flat;

}

else

{ printf("you use name or password error!\n");

while(n>0)

{ printf("you have %d chancese input your use name and password:\n ",n);

printf("input your use_name");

scanf("%s",message.id);

printf("iput your password\n");

scanf("%s",message.password);

strcpy(str,message.id);

strcat(str,message.password);

flat=login_scan(message.id);

if(flat)

{ printf("login achieve\n");

fclose(fp);

return flat;

}

printf("you use name or password error!\n");

n--;

}

printf("input error");

fclose(fp);

return 0;

}
}
baidu 限制字数,所以接着发余下的程序,不好意思,是remove的错了
接着上面的程序
int remove(int n)
{

FILE *fp;

double money;

double origin;

if((fp=fopen("f:/data.txt","r+"))==NULL)

{

printf("sorry,system error\n");

exit(1);

}

if(n==0)
printf("error\n");

else

{

fseek(fp,n*sizeof(struct bank)-sizeof(double),0);

printf("input your remove money\n");

scanf("%lf",&money);

if((origin >= money))

{

origin=origin-money;

if(origin>=0)

printf("Your balance is %lf yuan!\n",origin);

}

else

{ origin=origin-money;

printf("Your balance is not enough!you Overdraft %lf yuan\n",-origin);

}

fwrite(&origin,sizeof(double),1,fp);

}

fclose(fp);

return 1;
}
main()
{int x;
x=login();
if(x)
{
remove(x);
}

return 1;
}

回复

使用道具 举报

千问 | 2008-6-16 21:42:28 | 显示全部楼层
#include #include要用exit() 加上 #includelogin()函数中s[]没用remove()函数中origin没初始化
回复

使用道具 举报

千问 | 2008-6-16 21:42:28 | 显示全部楼层
你的排版好差劲啊!到底是哪个函数的参数调用出错呢?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行