Guest User

C# code public string

a guest
May 18th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. using System;  //It's a really simple code
  2.  
  3. namespace Project{
  4.  
  5.     public static class Password {
  6.    
  7.         public static void Main() {
  8.    
  9.             Console.WriteLine("Please enter your new password");
  10.  
  11.             string password = Console.ReadLine(); //I want to make this one public and then use it in the other class..
  12.             Console.WriteLine("Are you sure you want to change your password to: " + password + "? (Yes/No)");
  13.             string input = Console.ReadLine();
  14.            
  15.             if(input.ToLower() == "yes")
  16.             {
  17.                 Console.WriteLine("Your password has been changed to " + password + "!");
  18.                 Console.WriteLine("Press any key to continue..");
  19.                 Console.ReadKey();
  20.                 Console.Clear();
  21.                 Username.Name ();
  22.                
  23.             }
  24.             else if(input.ToLower() == "no")
  25.             {
  26.             Console.WriteLine(password + " will not be saved as your password");
  27.             Console.WriteLine("Press any key to restart");
  28.             Console.ReadKey();
  29.             Console.Clear();
  30.             Main();
  31.             //System.Environment.Exit(0);
  32.            
  33.             }
  34.            
  35.             else
  36.             {
  37.             Console.WriteLine("ERROR! Press any key to restart");
  38.             Console.ReadKey();
  39.             Console.Clear();
  40.             Main ();
  41.             }
  42.         }
  43.        
  44.        
  45.  
  46.        
  47.     }
  48.     public static class Username
  49.     {
  50.         public static void Name ()
  51.         {                               //And that is here.
  52.         Console.WriteLine("Please enter a username you would like");
  53.         Console.ReadLine();
  54.         }
  55.  
  56.  
  57.  
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment