+ 12

CHALLENGE🔥🔥🔥: Sam wants to select a username to register on a website. The rules for selecting username:

1. The minimum length of the username must be 5 characters and the maximum may be 10. 2. It should contain at least one letter from A-Z 3. It should have at least one digit from 0-9 4. It should have at least one character from amongst @#*= 5. It should not have any spaces Write a program which accepts 4 usernames (one username per line) as input and checks whether each of them satisfy the above mentioned conditions. If it does, the program should print PASS (in uppercase) else print FAIL Happy Coding😉

23rd Dec 2017, 7:38 PM
George Victor Uche
George Victor Uche - avatar
18 Antworten
24th Dec 2017, 10:14 AM
Ipang
+ 9
@Ipang both uppercases(A) and lowercase(a) can be used and 1_B@# should be a PASS since it an underscore(_) not a space( ) Thanks for the correction. Happy Coding 😉
24th Dec 2017, 6:23 AM
George Victor Uche
George Victor Uche - avatar
+ 8
@lpang yeah only the four characters are required for instance: Suppose the following usernames are supplied to the program: 1234@a ABC3a#@ 1Ac@ ABC 3a#@ 1_B@# Then the output should be: PASS PASS FAIL FAIL FAIL
23rd Dec 2017, 9:13 PM
George Victor Uche
George Victor Uche - avatar
+ 5
Hi @George Victor, I just need to confirm about point 4, are those four the only characters needed to be checked for existence? how about hyphen, underscore, tilde or period? are they not valid to be in a username? Thanks : )
23rd Dec 2017, 8:51 PM
Ipang
24th Dec 2017, 5:07 AM
Dick Tracy
Dick Tracy - avatar
+ 4
@George, I am sorry I need to ask again, does alphabet letter case matter? I mean, if there exists only lowercase, and no uppercase, is that valid for name or no? also for that last one, why it failed the test? 1Ac@ <- FAILED - too short ABC 3a#@ <- FAILED - contains space 1_B@# <- Why FAILED? it has letter, number, both @ and # Thanks
24th Dec 2017, 3:48 AM
Ipang
+ 4
@George thanks for the confirmation, I will try to do this and get back to you later : )
24th Dec 2017, 6:34 AM
Ipang
+ 4
hey @Ipang what is that npos (std::string::npos) can u explain it to me ^_^
26th Dec 2017, 10:24 AM
Light
Light - avatar
+ 3
Hey, George ! My pythonism : https://code.sololearn.com/cdZav9g946Ir/#py
23rd Dec 2017, 11:17 PM
Cépagrave
Cépagrave - avatar
+ 3
@George rules are. 1 lower 1 upper 1 number 1 special "@#*=" 5 or more. my code works. tested both comp and phone.
24th Dec 2017, 6:46 AM
Dick Tracy
Dick Tracy - avatar
+ 3
Not the first C++ attempt, but whatever. https://code.sololearn.com/cjz32jBFzt5j/?ref=app Just made a password generator! https://code.sololearn.com/cU9cOjFDP6GA/?ref=app
26th Dec 2017, 2:11 PM
Lil Taco
Lil Taco - avatar
+ 2
https://code.sololearn.com/c0B3Erq75q39/?ref=app
24th Dec 2017, 8:07 AM
Kodirbek Makharov
Kodirbek Makharov - avatar
+ 2
Had a go at this, and made as much sense of the rules as I could: https://code.sololearn.com/cv2aCbGw5uD0
25th Dec 2017, 2:24 AM
Ben Smylie (he/him)
Ben Smylie (he/him) - avatar
+ 2
Hey @CuRSeD, it is a constant that we can use to verify whether or not the character we want to find exists in some string where we search for the character. The string class' find() method returns that constant when the character is not found in the string. [Find method of string class] http://en.cppreference.com/w/cpp/string/basic_string/find [About the npos constant] http://en.cppreference.com/w/cpp/string/basic_string/npos P.S. Sorry I forgot to set the code public, you could've commented on it instead writing in here if I had : ) Hth, cmiiw
26th Dec 2017, 11:17 AM
Ipang
23rd Dec 2017, 8:21 PM
Sabin Shrestha
Sabin Shrestha - avatar
+ 1
Sam wants to select a username in order to register on a website. 2 The rules for selecting a username are: 4 5 m ON 8 9 10 1. The minimum length of the username must be 5 characters and the maximum may be 10. 2. It should contain at least one letter from A-Z 3. It should contain at least one digit from 0-9 4. It should contain at least one character from amongst @#*= 5. It should not contain any spaces 11 13 14. 15 16 17 Write a program which accepts 4 usernames (one username per line) as input and checks whether each of them satisfy the above mentioned conditions 19
4th Oct 2021, 12:12 PM
Bhavya Reddy
Bhavya Reddy - avatar
0
An7*#0y
24th Dec 2017, 12:43 PM
Alone Boy
Alone Boy - avatar
0
jo63*×y
24th Dec 2017, 12:44 PM
Alone Boy
Alone Boy - avatar