Advertisement
Guest User

Untitled

a guest
Jul 1st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication4
  7. {
  8.     class Program
  9.     {
  10.         enum statusPass { OK, NietOK, Onbekend, MaxPogingBerijkt };
  11.        
  12.                  
  13.         static void Main(string[] args)
  14.         {
  15.             string userName;
  16.             string passWordUser;
  17.             statusPass InlogStatus;
  18.             InlogStatus = statusPass.Onbekend;
  19.             int poging = (0);
  20.             int maxPoging = (3);
  21.  
  22.  
  23.                 Console.Write("Console Asks - Please Enter your Name: ");
  24.                 userName = Console.ReadLine();
  25.  
  26.                 Console.WriteLine("");
  27.               do
  28.                 {
  29.                 Console.WriteLine("U heeft nog ({0}/{1}) over", poging, maxPoging);
  30.                 Console.Write("Console Asks - Please Enter your Password: ");
  31.                 passWordUser = Console.ReadLine();
  32.  
  33.                 InlogStatus =  auth (passWordUser);
  34.                 switch (InlogStatus)
  35.                 {
  36.                     case statusPass.OK:
  37.                         Console.WriteLine("Wacht Woord is Okey");
  38.                         //exit while loop
  39.                         break;
  40.                     case statusPass.NietOK:
  41.                         Console.WriteLine("Wacht Woord is niet goed");
  42.                         poging++;
  43.                         break;
  44.                    
  45.                 }
  46.  
  47.             } while (poging < 3);
  48.         }
  49.  
  50.         private static statusPass auth(string passWordUser)
  51.         {
  52.            
  53.             {
  54.                 string passWord = "SHARPSOUND";
  55.                 statusPass InlogStatus;
  56.                 InlogStatus = statusPass.Onbekend;
  57.  
  58.                 if (passWordUser == passWord)
  59.                 {
  60.                     InlogStatus = statusPass.OK;
  61.                 }
  62.                 else
  63.                 {
  64.                     InlogStatus = statusPass.NietOK;
  65.                 }
  66.                 return (InlogStatus);
  67.             }
  68.        }
  69.  
  70.  
  71.         private static void login(statusPass InlogStatus)
  72.         {
  73.             switch (InlogStatus)
  74.             {
  75.                 case statusPass.OK:
  76.                     Console.WriteLine("Wacht Woord is Okey");
  77.                     break;
  78.                 case statusPass.NietOK:
  79.                     Console.WriteLine("Wacht Woord is niet goed");
  80.                     break;
  81.                 case statusPass.MaxPogingBerijkt:
  82.                     Console.WriteLine("Maximum aantal pogingen berijkt neem contact op met uw netwerk administrator");
  83.                     break;
  84.             }
  85.  
  86.         }
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement