CPP
cpp
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
#include <iostream>
#include <string>
/*
Code Challenge: Password Validation. By @Ace
Attempt #1 by Hatsy Rei.
*/
bool checkPass(std::string str, int type)
{
bool hasNum = false;
bool hasAlpha = false;
bool hasSS = false;
bool hasCaps = false;
for (int i = 0; i < str.length(); i++)
{
if (str[i] == ' ' || str[i] == '/' || str[i] == '\\') hasSS = true;
for (int j = 48; j < 123; j++)
{
if (str[i] == static_cast<char>(j))
{
if (j < 58) { hasNum = true; }
else if (j > 64 && j < 91) { hasAlpha = true; hasCaps = true; }
else if (j > 96) { hasAlpha = true; }
Enter to Rename, Shift+Enter to Preview
OUTPUT
Uruchom