# include
Void main () {
Char mm [20], useful [20], [20] bh, xm [20], xb [1], bj [1], [100] jj, zc [1].
Int xz, fh;
Printf ("==============welcome to student management system=============\ n ");
Pp: printf (" please enter account ");
The scanf (" % s ", & amp; Useful);
Printf (" please enter the password ");
The scanf (" % s ", & amp; Mm);
If (useful=="admin" & amp; & Mm=="admin")
{
Printf (" login success!!!!! ");
system("cls");
Goto gg.
}
The else
{
Printf (" account password mistake, please input again!!!!! \n");
Goto pp;
}
Gg: printf (" welcome to use the student system ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * * ");
Printf (" 1. Query all the students ");
Printf (" 2. Student registration ");
Printf (" 3. Query student details ");
Printf (" 4. Quit ");
Printf (" * * * * * * * * * * * * * * * * * * * * * * * ");
Printf (" please select operation options: ");
The scanf (" % d ", & amp; Xz);
system("cls");
The switch (xz)
{
Case 1:
break;
Case 2:
Printf (" * * * * * * * * * * * student registration * * * * * * * * * ");
Vv: printf (" please input the student number: ");
The scanf (" % s ", & amp; Bh);
Printf (" please enter the student's name: ");
The scanf (" % s ", & amp; Xm);
Printf (" please enter the student sex (male/female) : ");
The scanf (" % s ", & amp; Xb);
Printf (" please enter the student class (class 1:1; Class 2:2; Class 3:3) ");
The scanf (" % s ", & amp; Bj);
Printf (" please enter the student profile: ");
The scanf (" % s ", & amp; Jj);
Printf (" whether to continue the registered student no. : (Y/N) ");
The scanf (" % s ", & amp; Zc);
If (zc=="Y")
{
Goto vv.
} the else
{
Printf (" whether to return to the main page, 1 y/0 n ");
The scanf (" % d ", & amp; Fh);
The switch (fh)
{
Case 0:
Printf (" exit success, welcome next time ");
break;
Case 1:
Goto gg.
break;
}
/* if (fh==1)
{
} the else
{
}
} */
break;
}
}
}
Can help me to look at my code, don't be too formal effect to line, if the admin account password, but is has been the account password mistake

CodePudding user response:
STRCMPC + +==string types can be used to compare two strings,
CodePudding user response:
The if (useful=="admin" & amp; & Mm=="admin")Instead of
If (STRCMP (mm, "admin")==0 & amp; & STRCMP (useful, "admin")==0)
Have a try
CodePudding user response:
Upstairs positive solution, it is easy to confuse the novice, the concept of c language without string data type, character array is used to store strings, operating common use library function STRCMP, strcpy, strlen, STRCHR, strcat, STRCSPN, STRLWR... Such as [/b]