Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Review
- {
- class Program
- {
- static void Main(string[] args)
- {
- /* use this space to write your own short program!
- Here's what you learned:
- BOOL TYPE: bool variableName
- COMPARISON OPERATORS: ==, <, >, <=, >=
- LOGICAL OPERATORS: &&, ||, !
- Good luck! */
- Console.Write("Please enter your password: ");
- string password = Console.ReadLine();
- int upcaseCount = 0;
- int symbolCount = 0;
- for (int i = 0; i < password.Length; i++)
- {
- if (char.IsUpper(password[i])) upcaseCount++;
- if (char.IsLetterOrDigit(password[i])) symbolCount++;
- }
- if (symbolCount > 0) Console.WriteLine("Password has symbols!");
- else Console.WriteLine("Password has no symbols!");
- if (upcaseCount > 0) Console.WriteLine("Password has uppercase!");
- else Console.WriteLine("Password has no uppercase!");
- bool passwordValidification = ((symbolCount = 0) && (upcaseCount = 0)); // <<<[CS0019] Operator '&&' cannot be applied to operands of type 'int' and 'int'
- if (passwordValidification = true) Console.WriteLine("Your password is valid");
- else Console.WriteLine("Your password is invalid");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement