Advertisement
Guest User

Untitled

a guest
Aug 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.21 KB | None | 0 0
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6.  
  7. namespace Code_for_Billy
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             /* Helping Billy code in C#. Here's my recommendations on the best way to code your program, much more elegant.
  15.             if you need anymore help, message me on xfire or something, currently working on C# Project myself to pass the time */
  16.  
  17.             Console.WriteLine("Welcome to the derpingson derpton. What do they call you by?");
  18.             string name = Console.ReadLine();
  19.             Console.WriteLine("Sup " + name + ".");
  20.             System.Threading.Thread.Sleep(1000);    // You didn't notice this on the video, but you didn't include a pause here, and immediately cleared the screen, so this was never visible.
  21.             Console.Clear();
  22.             Console.WriteLine("Riddle me this:");
  23.            
  24.             QuestionTimeMotherFucker(name); // Sends the program to the QuestionTimeMotherFucker procedure below and passes the variable "name"
  25.  
  26.            
  27.            
  28.         }
  29.  
  30.         static void QuestionTimeMotherFucker(string name)
  31.         {
  32.  
  33.             Console.WriteLine("How much wood would a woodchuck chuck, if a woodchuck could chuck wood?");
  34.             System.Threading.Thread.Sleep(1500);
  35.             Console.WriteLine("1. One piece of wood");
  36.             System.Threading.Thread.Sleep(300);              // Pause for nicer formatting
  37.             Console.WriteLine("2. Two pieces of wood");
  38.             System.Threading.Thread.Sleep(300);              // Again, pause for nicer formatting
  39.             Console.WriteLine("3. Bare wood bruv");
  40.  
  41.             string response = Console.ReadLine();
  42.  
  43.             if (response == "1" || response == "2") // If the response is 1 or 2       -  || = OR
  44.             {
  45.                 Console.WriteLine("");   // New line, just nicer formatting
  46.                 Console.WriteLine("Lmao, " + name + " you fucking retard, try again.");
  47.                 System.Threading.Thread.Sleep(1000);
  48.             }
  49.  
  50.             else if (response == "3")
  51.             {
  52.                 Console.WriteLine("");
  53.                 Console.WriteLine("Correct, " + name + "! The program will now exit, as there is nothing else to be done :)");
  54.                 System.Threading.Thread.Sleep(4000);  
  55.                 Environment.Exit(0); // If the user enters the correct answer the program closes
  56.             }
  57.  
  58.             else  // Could also use a Try/Catch to deal with any unexpected input, but in this case, because the number of valid inputs is limited, a simple else will suffice
  59.             {
  60.                 Console.WriteLine("");
  61.                 Console.WriteLine("Please enter an integer, either 1, 2 or 3");
  62.                 System.Threading.Thread.Sleep(1000);
  63.             }
  64.  
  65.  
  66.             /* If the user enters an incorrect answer the program then loops back to the start of QuestionTimeMotherFucker
  67.             If the user has entered the correct answer, this part of the code never gets executed anyways */
  68.             Console.Clear();
  69.             System.Threading.Thread.Sleep(1000);
  70.             QuestionTimeMotherFucker(name);
  71.  
  72.         }
  73.     }
  74.  
  75.    
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement