brislin

test

Mar 4th, 2021
792
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Test
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("***** Basic Console I/O *****");
  10.             GetUserData();
  11.             Console.WriteLine("Press enter key to exit");
  12.             Console.ReadLine();
  13.         }
  14.  
  15.         private static void GetUserData()
  16.         {
  17.             //Get name and age
  18.             Console.Write("Please enter you name: ");
  19.             string userName = Console.ReadLine();
  20.             Console.Write("Please enter you age: ");
  21.             string userAge = Console.ReadLine();
  22.            
  23.             //Change echo color, just for fun
  24.             ConsoleColor prevColor = Console.ForegroundColor;
  25.             Console.ForegroundColor = ConsoleColor.Yellow;
  26.            
  27.             //Echo to the console
  28.             Console.WriteLine("Hello {0}! You are {1} years old.", userName, userAge);
  29.            
  30.             //restore previous color
  31.             Console.ForegroundColor = prevColor;
  32.         }
  33.     }
  34. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×