Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Learning
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Welcome. The purpose of this application is to show how I code!");
- Console.WriteLine("Please enter your name:");
- string personName = Console.ReadLine();
- Console.WriteLine("Hello, " + personName + ". Press enter to continue");
- Console.ReadLine();
- bool allowedAccess = verificationCheck();
- Console.ReadLine();
- }
- public static bool verificationCheck()
- {
- string logonPW = "Test123";
- bool logonSuccess = false;
- int logonAttempt = 0;
- Console.WriteLine("Please enter the password:");
- string pwPovided = Console.ReadLine();
- while (logonSuccess == false)
- {
- if (pwPovided == logonPW)
- {
- Console.WriteLine("Correct, Welcome to the app");
- logonSuccess = true;
- return true;
- }
- else
- {
- Console.WriteLine("Incorrect. Access Denied. Try again!");
- logonAttempt++;
- Console.WriteLine("You have used " + logonAttempt + " out of 5 attempts!");
- logonSuccess = false;
- }
- return false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement