Home > Back-end >  Bosses help small white, the user name validation problem c language
Bosses help small white, the user name validation problem c language

Time:12-05

Topic: the user name and password authentication procedure 3? Assume that there are three user, user name, respectively. A, b, c, password is 111222333, respectively? Please write a program to enter the user name first, if the user name error, please output "user does not exist!" , the program ends, if the user name is correct, prompt for the corresponding password, the password correctly output "welcome!" Password, the password error output "error!
Welfare

CodePudding user response:

Bosses help small white let me see

CodePudding user response:

Look on welfare (mainly the code is not long) for the sake of
 
#include
#include

Int main ()
{
Char user [20]={0};
Char pass [20]={0};

Printf (" please enter the user name: \ n ");
The scanf (" % s ", the user);

If ((STRCMP (user, "a")==0) | | (STRCMP (user, "b")==0) | | (STRCMP (user, "c")==0))
{
Printf (" please enter the password: \ n ");
The scanf (" % s ", pass);
If ((STRCMP (user, "a")==0) & amp; & (STRCMP (pass, "111")==0) | |
(STRCMP (user, "b")==0) & amp; & (STRCMP (pass, "222")==0) | |
(STRCMP (user, "c")==0) & amp; & (STRCMP (pass, "333")==0))
Printf (" welcome! \n");
The else
Printf (" password error! \n");

}
The else
{
Printf (" the user does not exist! \n");
return;
}

return 0;
}

CodePudding user response:

Emmm + 1

CodePudding user response:

So soon finished, came late

CodePudding user response:

The forehead! This topic, ok this is not a medical professional BBS
  • Related