https://www.schooltube.com/channel/Tenet+-+FULL+NEW+MOVIE+%5B2020%5D/179397992 https://www.schooltube.com/channel/Tenet+%5B2020%5D+-+FULL+NEW+MOVIE/179398002 https://www.schooltube.com/channel/Tenet+%5B2020%5D+-+NEW+FULL+MOVIE/179398012 https://www.schooltube.com/channel/Tenet+%5B2020%5D+%7C+FULL+Movie+HD/179398022 https://www.schooltube.com/channel/Download+Tenet+%5B2020%5D+%7C+FULL+Movie+HD/179398042 https://www.schooltube.com/channel/Free+Download+Tenet+%5B2020%5D+%7C+FULL+Movie+HD/179398052 https://www.schooltube.com/channel/Watch+Tenet+%5B2020%5D+%7C+FULL+Movie+HD/179398062 https://www.schooltube.com/channel/Free+Watch+Tenet+%5B2020%5D+%7C+FULL+Movie+HD/179398102 https://www.schooltube.com/channel/Streaming+Tenet+%5B2020%5D+%7C+FULL+Movie+HD/179398112 https://www.schooltube.com/channel/Free+Streaming+Tenet+%5B2020%5D+%7C+FULL+Movie+HD/179398152
using System;
internal class Program {
private static void Main() {
Console.WriteLine("Введите минимум для счетчика");
var min = int.Parse(Console.ReadLine() ?? throw new ());
Console.WriteLine("Введите максимум для счетчика");
var max = int.Parse(Console.ReadLine() ?? throw new ());
Console.WriteLine("Введите значение для счетчика");
var v = int.Parse(Console.ReadLine() ?? throw new ());
var counter = new Counter(max, min, v);
Console.WriteLine("Введите + для увеличение и - для уменьшения, иное для выхода");
do {
var c = Console.ReadKey();
if (c.KeyChar == '+') counter.Increase();
else if (c.KeyChar == '-') counter.Decrease();
else break;
Console.WriteLine($" => {counter.Value}");
} while (true);
Console.ReadKey();
}
}
public class Counter {
public readonly int Maximum;
public readonly int Minimum;
public int Value { private set; get; }
public Counter(int maximum, int minimum, int counter) {
this.Maximum = maximum;
this.Minimum = minimum;
counter = Math.Min(this.Maximum, counter);
counter = Math.Max(this.Minimum, counter);
this.Value = counter;
}
private Counter() {
this.Maximum = 10;
this.Minimum = 0;
this.Value = 5;
}
public void Increase() {
var value = this.Value + 1;
if (value > this.Maximum || value < this.Minimum)
return;
this.Value++;
}
public void Decrease() {
var value = this.Value - 1;
if (value > this.Maximum || value < this.Minimum)
return;
this.Value--;
}
}