Home > Back-end >  Multiple file programming error redefine, agghh for help
Multiple file programming error redefine, agghh for help

Time:09-27

Is such a program, have been an error that redefine, and each function redefinition, I very strange
 
//register.
c#include
#include
#include
#include
#include
#include
Int MIMA=111;
Int Register_main ();
Int Checkkname (char pattern []);
Void admain_system ();
Void verification_Code ();
Void verification_Code2 ();
Void log1 (char name [], char password []);
Void reg (char name [], char password []);
Int Seekname (char pattern []);
Int Judge_aa (int j);
Int assemble1 (char name [], char password []);
Void New_file ();

Int Register_main ()
{
New_file ();
Admain_system ();
Gongnengxuanze ();
system("pause");
return 0;
}

Void admain_system ()//the user's system
{
The static char name [20], "[20].
Char a, [100].

Printf (" new user? Yes, please enter 1; No, enter any key \ n ");
gets(a);

If (STRCMP (a, "1")==0)//registered
{
Reg (name, password);
}
The else//login
{
Log1 (name, password);
}
}
Void reg (char name [], char password [])//registered
{

The FILE * fp.

Int flag=1, n=0;
Temp2 char temp1 [20], [20], ch [3], temp3 [100], temp4 [200]="@ @";
Printf (" -- -- -- -- -- -- -- -- -- -- you to register, please -- -- -- -- -- -- -- -- -- -- - \ n ");
While (flag)
{
flag=0;
Printf (" \ n username (length) within 10: ");
Gets (name);
While (Checkkname (name))
{
Printf (" the user name (length) within 10: \ n ");
Gets (name);
}

Printf (" \ n password (length) within 10: ");
Gets (temp1);

Printf (" \ n please retype password: ");
Gets (temp2);
If (STRCMP (temp1, temp2)==0)
Strcpy (password, temp1);
The else
flag=1;

}
Strcat (name, "$$");
Strcat (password, "@ @");

Fp=fopen (" C: \ \ \ \ account information the lost and found. TXT ", "a +");
If (fp==0)
{
Printf (" file open failed \ n ");
exit(1);
}
The fputs (name, fp);

fclose(fp);
Fp=fopen (" C: \ \ \ \ account information the lost and found. TXT ", "a +");
If (fp==0)
{
Printf (" file open failed \ n ");
exit(1);
}
The fputs (password, fp);
rewind(fp);
If (STRCMP (the fgets (ch 3, fp), "@ @")!=0)
{
rewind(fp);
The fgets (temp3, 100, fp);
fclose(fp);

Fp=fopen (" C: \ \ \ \ account information the lost and found. TXT ", "w +");
If (fp==0)
{
Printf (" file open failed \ n ");
exit(1);
}
Strcat (temp4, temp3);
The fputs (temp4, fp);
fclose(fp);
}
The else
fclose(fp);

Printf (" congratulations you registered success! \n");
Log1 (name, password);
}
Void log1 (char name [], char password [])//login
{

The FILE * fp.
Int flag=1, flag2=1, I=0, n, and judge;
Temp2 char temp1 [20], [20], ch.
Printf (" -- -- -- -- -- -- -- -- -- welcome login -- -- -- -- -- -- -- -- -- -- - \ n ");
While (flag)
{
flag=0;

Printf (" user name: ");//type in user name
Gets (temp1);

N=strlen (temp1);
Do {
Fp=fopen (" C: \ \ \ \ account information the lost and found. TXT ", "a +");
If (fp==0)
{
Printf (" file open failed \ n ");
exit(1);
}
rewind(fp);
Printf (" \ n password: ");//type in passwords
Gets (temp2);
for(i=0; (ch=fgetc (fp))!='@'; I++)//password entry password
"[I]=ch;
fclose(fp);
Judge=assemble1 (temp1, temp2);//judging function
} while (judge);
}
//database import
return;
}


Int assemble1 (char name [], char password [])//file user name password authentication module: Judge_aa, Seekname, judge_passage
{
Int judge=0, x, a=1;
X=Seekname (name);
If (x> 0)//determine whether perform
Judge=judge_passage (x, password);
If (judge)
{
Printf (" landing successful \ n ");
return 0;
}
The else
{
Printf (" please enter again \ n ");
return 1;
}
}
Int Judge_aa (int j)//double @ determine
{
The FILE * fp.
Char ch;
Int I=0, flag=0, flag2;
Fp=fopen (" C: \ \ \ \ account information the lost and found. TXT ", "r");
If (fp==0)
{
Printf (" file open failed ");
exit(1);
}
The fseek (fp, j + 2, 0);
while(! Flag)
{

While ((ch=fgetc (fp))! )
='@'{

i++;
}
If (ch=='@')
{
i++;
If ((ch=fgetc (fp))=='@')
{
flag=1;
- I;
}
}


}
fclose(fp);
return i;
}

Int Seekname (char pattern [])//violence find user name
{
The FILE * fp.
Int k=0, j=0, I, sign=0, flag=0;
Char text [100000], * p=text;
Sign=strlen (pattern);
Fp=fopen (" C: \ \ \ \ account information the lost and found. TXT ", "r");
If (fp==0)
{
Printf (" file open failed \ n ");
exit(1);
}
The fgets (text, 10000, fp);//read the form content
fclose(fp);

While (j<=(strlen (text) - strlen (pattern)))
{
for(i=0; iIf (I==sign& & (text [1]=='@') & amp; & (text [j - 2]=='@') & amp; & Text [I + j]=='$' & amp; & Text [I + j + 1)=='$')
{
flag=1;
break;
}
The else
+ + j;
}
If (flag==1)
{
//printf (" with the user name ");

Return j + I;
}
The else
{
Printf (" username error \ n ");
return 0;
}
}
Int Checkkname (char pattern [])//check if there is a repeated username
{
The FILE * fp.
Int k=0, j=0, I, sign=0, flag=0;
Char ch, text [100000], * p=text;
Sign=strlen (pattern);

Fp=fopen (" C: \ \ \ \ account information the lost and found. TXT ", "a +");
If (fp==0)
{
Printf (" file open failed \ n ");
exit(1);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related