-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeb1_easy.cpp
More file actions
56 lines (43 loc) · 976 Bytes
/
Copy pathcodeb1_easy.cpp
File metadata and controls
56 lines (43 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <iostream>
#include <string>
std::string code_land_user_name_validation_letter(std::string str) {
int len;
len = str.length();
if (len < 4 || len > 25) {
return "false";
}
if (!isalpha(str[0])) {
return "false";
}
for(int i = 0; i < len; i++) {
}
return str;
}
std::string code_land_user_name_validation(std::string str) {
int len = str.length();
std::cout<< "len is: " << len << std::endl;
if (len >= 4 && len <= 7) {
int i = 0;
while (true) {
if (i == 0) {
if (str[i] == '_') {
std::cout << "No inicia con letra" << std::endl;
break;
}
}
i++;
}
}
else {
std::cout << "Ingresa una cadena mas pequeña" << std::endl;
}
return str;
}
int main() {
std::string str_;
str_ = "_hhlla";
// keep this function call here
std::cout << str_ << std::endl;
std::cout << code_land_user_name_validation(str_) << std::endl;
return 0;
}