多文件编程报错重定义,求助啊啊啊啊

[复制链接]
查看11 | 回复2 | 2021-1-27 05:21:03 | 显示全部楼层 |阅读模式
就这么个程序,一直报错说重定义,每个函数都重定义,我就很奇怪
//register.c
#include
#include
#include
#include
#include
#include
intMIMA=111;
intRegister_main();
intCheckkname(charpattern[]);
voidadmain_system();
voidverification_Code();
voidverification_Code2();
voidlog1(charname[],charpassword[]);
voidreg(charname[],charpassword[]);
intSeekname(charpattern[]);
intJudge_aa(intj);
intassemble1(charname[],charpassword[]);
voidNew_file();
intRegister_main()
{
New_file();
admain_system();
gongnengxuanze();
system("pause");
return0;
}
voidadmain_system()//用户系统
{
staticcharname[20],password[20];
chara[100];
printf("新用户?是,请输入1;不是,输入任意键\n");
gets(a);
if(strcmp(a,"1")==0)//注册
{
reg(name,password);
}
else//登录
{
log1(name,password);
}
}
voidreg(charname[],charpassword[])//注册
{
FILE*fp;
intflag=1,n=0;
chartemp1[20],temp2[20],ch[3],temp3[100],temp4[200]="@@";
printf("----------请您注册-----------\n");
while(flag)
{
flag=0;
printf("\n用户名(长度在10以内):");
gets(name);
while(Checkkname(name))
{
printf("用户名(长度在10以内):\n");
gets(name);
}
printf("\n密码(长度在10以内):");
gets(temp1);
printf("\n请重新输入密码:");
gets(temp2);
if(strcmp(temp1,temp2)==0)
strcpy(password,temp1);
else
flag=1;
}
strcat(name,"$$");
strcat(password,"@@");
fp=fopen("C:\\失物招领\\账户信息.txt","a+");
if(fp==0)
{
printf("文件打开失败\n");
exit(1);
}
fputs(name,fp);
fclose(fp);
fp=fopen("C:\\失物招领\\账户信息.txt","a+");
if(fp==0)
{
printf("文件打开失败\n");
exit(1);
}
fputs(password,fp);
rewind(fp);
if(strcmp(fgets(ch,3,fp),"@@")!=0)
{
rewind(fp);
fgets(temp3,100,fp);
fclose(fp);
fp=fopen("C:\\失物招领\\账户信息.txt","w+");
if(fp==0)
{
printf("文件打开失败\n");
exit(1);
}
strcat(temp4,temp3);
fputs(temp4,fp);
fclose(fp);
}
else
fclose(fp);
printf("恭喜您注册成功!\n");
log1(name,password);
}
voidlog1(charname[],charpassword[])//登录
{
FILE*fp;
intflag=1,flag2=1,i=0,n,judge;
chartemp1[20],temp2[20],ch;
printf("---------欢迎登录-----------\n");
while(flag)
{
flag=0;
printf("用户名:");//键入用户名
gets(temp1);
n=strlen(temp1);
do{
fp=fopen("C:\\失物招领\\账户信息.txt","a+");
if(fp==0)
{
printf("文件打开失败\n");
exit(1);
}
rewind(fp);
printf("\n密码:");//键入密码
gets(temp2);
for(i=0;(ch=fgetc(fp))!='@';i++)//密码录入password
password=ch;
fclose(fp);
judge=assemble1(temp1,temp2);//判断函数
}while(judge);
}
//数据库导入
return;
}

intassemble1(charname[],charpassword[])//文件用户名密码验证模块:Judge_aa,Seekname,judge_passage
{
intjudge=0,x,a=1;
x=Seekname(name);
if(x>0)//判断是否执行
judge=judge_passage(x,password);
if(judge)
{
printf("登陆成功\n");
return0;
}
else
{
printf("请重新输入\n");
return1;
}
}
intJudge_aa(intj)//双@判定
{
FILE*fp;
charch;
inti=0,flag=0,flag2;
fp=fopen("C:\\失物招领\\账户信息.txt","r");
if(fp==0)
{
printf("文件打开失败");
exit(1);
}
fseek(fp,j+2,0);
while(!flag)
{
while((ch=fgetc(fp))!='@')
{
i++;
}
if(ch=='@')
{
i++;
if((ch=fgetc(fp))=='@')
{
flag=1;
--i;
}
}

}
fclose(fp);
returni;
}
intSeekname(charpattern[])//暴力查找用户名
{
FILE*fp;
intk=0,j=0,i,sign=0,flag=0;
chartext[100000],*p=text;
sign=strlen(pattern);
fp=fopen("C:\\失物招领\\账户信息.txt","r");
if(fp==0)
{
printf("文件打开失败\n");
exit(1);
}
fgets(text,10000,fp);//读入表单内容
fclose(fp);
while(j

//register.h
#ifdefREGISTER
#defineREGISTER
intRegister_main();
intCheckkname(charpattern[]);
voidadmain_system();
voidverification_Code();
voidverification_Code2();
voidlog1(charname[],charpassword[]);
voidreg(charname[],charpassword[]);
intSeekname(charpattern[]);
intJudge_aa(intj);
intassemble1(charname[],charpassword[]);
voidNew_file();
#endif
//main.c
#include
#include
#include
#include
#include//mkdir用
#include
#include"register.h"
#include"data.h"
intmain()
{
Register_main();

return0;
}

分 -->
回复

使用道具 举报

千问 | 2021-1-27 05:21:03 | 显示全部楼层
我把registermain放在程序最后面少了好几个报错
回复

使用道具 举报

千问 | 2021-1-27 05:21:03 | 显示全部楼层
诶我会了哈哈哈哈哈哈哈哈嗝
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行