Advertisement
Fox_McCloud77

CSLight_Name_Output_HW

Feb 14th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CSLight_Name_Output_HW
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.OutputEncoding = Encoding.UTF8;
  14.  
  15.             string name = string.Empty;
  16.             int nameCount;
  17.             char symbol;
  18.  
  19.             Console.Write("Введите ваше имя: ");
  20.             name = Console.ReadLine();
  21.             Console.WriteLine($"\nДлина вашего имени: {name.Length}.\n");
  22.  
  23.             Console.Write("Введите символ: ");
  24.             symbol = Convert.ToChar(Console.ReadLine());
  25.  
  26.             Console.Clear();
  27.  
  28.             for (nameCount = -1; nameCount <= name.Length; nameCount++)
  29.                 Console.Write(symbol);
  30.  
  31.             Console.SetCursorPosition(0, 1);
  32.  
  33.             Console.Write($"{symbol}{name}{symbol}");
  34.  
  35.             Console.SetCursorPosition(0, 2);
  36.  
  37.             for (nameCount = -1; nameCount <= name.Length; nameCount++)
  38.                 Console.Write(symbol);
  39.  
  40.             Console.ReadKey();
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement