Advertisement
EddyCZ

ConsoleInOu

Oct 30th, 2018
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. /*
  2.  * The sample for input and output and sort numbers.
  3.  * Author: Eddy^CZ 2018
  4.  */
  5.  
  6. using System;
  7.  
  8. namespace LowesNumber
  9. {
  10.  
  11.  class UserInput
  12.  {
  13.   public int InputNumber = 0;
  14.   public void AskForNumber(out int Output)
  15.   {
  16.    InputNumber++;
  17.    Console.WriteLine(String.Format("Please value for number: {0}",InputNumber));
  18.    string Input = Console.ReadLine();
  19.    int.TryParse(Input,out Output);
  20.   }
  21.  }
  22.  
  23.  class Program
  24.  {
  25.  
  26.   static readonly string ProgramName = "The number sorter : Eddy^CZ 2018\n";
  27.  
  28.   static void Main(string[] args)
  29.   {
  30.    Console.Title = ProgramName;
  31.    Console.WriteLine(ProgramName);
  32.    Console.ForegroundColor = ConsoleColor.Cyan;
  33.  
  34.    var UiInput = new UserInput();
  35.  
  36.    int[] RequiredNumbers = new int[3];
  37.  
  38.    for(int i = 0; i < RequiredNumbers.Length;i++)
  39.    {
  40.     UiInput.AskForNumber(out RequiredNumbers[i]);
  41.    }
  42.    Array.Sort(RequiredNumbers);
  43.  
  44.    Console.WriteLine("Your sorted numbers is here: \n\n");
  45.  
  46.    for (int j = 0; j < RequiredNumbers.Length; j++)
  47.    {
  48.     Console.WriteLine(RequiredNumbers[j]);
  49.    }
  50.  
  51.    Console.ReadKey();
  52.   }
  53.  }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement