/*
3. Use the function to implement the login function (three chances), and then judge the function based on the called result.
Login successful or not.
*/
# Include <string. h>
Int numb (char use [], char password [])
{
If (strcmp (use, "Zhouyi") = 0) & (strcmp (password, "Nb") = 0 ))
{
Return 1;
}
Else
{
Return 0;
}
}
# Include <stdio. h>
Void main ()
{
Char name [100] = "0 ";
Char Mima [100] = "0 ";
Int I;
For (I = 0; I <3; I ++)
{
Printf ("Enter the User name: \ n ");
Scanf ("% s", name );
Printf ("enter the password \ n ");
Scanf ("% s", Mima );
Numb (name, Mima );
If (numb (name, Mima) = 1)
{
Printf ("Login successful \ n ");
Break;
}
Else if (I <2)
{
Printf ("verification error, please input \ n" again ");
}
}
}
Use the function to implement the login function (three chances), and then use the main function to determine whether the login is successful or not based on the call results.