static void Main(string[] args)
{
B b = new B(); // Делаю ссылку на класс B
<b>b.newMethod();</b>
Console.WriteLine(b.new_age); // Вывожу в консоль переменную new_age из класса B
Console.ReadKey();
}
namespace TosterApp
{
class Program
{
static void Main(string[] args)
{
int input;
do Console.WriteLine("Enter number between 0 and 5:");
while (!int.TryParse(Console.ReadLine(), out input) || input <= 0 || input > 5);
Console.WriteLine($"You entered {input}");
}
}
}
static void Main()
{
int number_user1 = 0;
while (true)
{
Console.Write("Player 1 write number from 1 to 5: ");
string inputChar = Console.ReadKey().KeyChar.ToString();
if(int.TryParse(inputChar, out number_user1) && number_user1 <= 5 && number_user1 > 0)
{
break;
}
else
{
Console.WriteLine($"\nEnter only NUMBERS from 1 to 5 (you input {inputChar})");
}
}
Console.WriteLine($"\nYou input {number_user1}");
Console.Write("Press any key to close"); Console.ReadKey();
}
else
{
repeat = true;
}
number_user1 = Convert.ToInt32(Console.ReadLine());
try
{
Console.Write("Player 1 write number from 1 to 5: ");
number_user1 = Convert.ToInt32(Console.ReadLine());
if (number_user1 > 5 || number_user1 == 0)
{
Console.Write("ERROR: Player 1 PLEASE write number from 1 to 5: ");
}
}
odd_or_even == "odd" || odd_or_even == "even"
!(odd_or_even == "odd" || odd_or_even == "even")
odd_or_even != "odd" && odd_or_even != "even"
odd_or_even != "odd" || odd_or_even != "even"