Advertisement
SnowPhoenix347

Untitled

Nov 5th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FifthProject
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.CursorVisible = false;
  10.             int userY = 1;
  11.             int userX = 1;
  12.             int mapSizeX = 0;
  13.             int mapSizeY = 0;
  14.             char[,] map = new char[0,0];
  15.            
  16.             SettingMap(ref userX, ref userY);
  17.             GenerateMap(ref map, mapSizeX, mapSizeY);
  18.         }
  19.  
  20.         static int UserInputInt()
  21.         {
  22.             int output;
  23.             bool enterIsCorrect = false;
  24.             do
  25.             {
  26.                 string input = Console.ReadLine();
  27.                 enterIsCorrect = int.TryParse(input, out output);
  28.                 if (!enterIsCorrect)
  29.                 {
  30.                     Console.WriteLine("Error enter. Try again");
  31.                 }
  32.             } while (!enterIsCorrect);
  33.  
  34.             return output;
  35.         }
  36.  
  37.         static void SettingMap(ref int x,ref int y)
  38.         {
  39.             Console.WriteLine("Введите ширину карты");
  40.             x = UserInputInt();
  41.             Console.WriteLine("Введите высоту карты");
  42.             y = UserInputInt();
  43.         }
  44.  
  45.         static void GenerateMap(ref char[,] map, int x, int y)
  46.         {
  47.             char[,] tempMap = new char[x, y];
  48.             map = tempMap;
  49.         }
  50.        
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement