Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace GameMoreAndLess
- {
- class Controller
- {
- public Model TinyModel;
- public Controller(){
- TinyModel = new Model();
- }
- public void ReadBound() {
- string strToRead;
- string[] numbers;
- int _a, _b;
- strToRead = Console.ReadLine();
- while (Regex.IsMatch(strToRead, "([\\+\\-]?[0-9]+\\W[\\+\\-]?[0-9]+") == false)
- {
- View.WriteErrors("Неправильнный ввод. Повторите ввод чисел. Чисел должно быть два. Первое должно быть меньше второго.");
- strToRead = Console.ReadLine();
- }
- numbers = strToRead.Split(' ');
- _a = Int32.Parse(numbers[0]);
- _b = Int32.Parse(numbers[1]);
- if (_a > _b) View.WriteErrors("Ошибочный диапазон! Первое число должно быть меньше второго!");
- TinyModel.a=_a;
- TinyModel.b=_b;
- }
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace GameMoreAndLess
- {
- class View
- {
- static void Main(string[] args)
- {
- Controller controller = new Controller();
- WriteMessage("Введите границы диапазона. Таким образом чтобы крайние числа были включены.");
- controller.ReadBound();
- controller.GuessNumber();
- }
- public static void WriteMessage(string textMessage)
- {
- Console.WriteLine(textMessage);
- }
- public static void WriteErrors(string textError) {
- Console.WriteLine("Error: "+textError);
- }
- public void GuessNumber()
- {
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace GameMoreAndLess
- {
- class Model
- {
- public int a;
- public int b;
- public int x;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement