using System;
using System.Linq.Expressions;
// Entering the number of employees section .
int countOfEmployees = 0;
for (int i = 0; i == 0;)
{
try
{
Console.Write("Please Enter The Number of Employees :");
countOfEmployees = Convert.ToInt32(Console.ReadLine());
i++;
}
catch (FormatException)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Please Enter Only Number...!");
Console.ResetColor();
}
}
// Employees information entry section
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(".........................................................................");
Console.ResetColor();
string[] names = new string[countOfEmployees];
string[] families = new string[countOfEmployees];
string[] idNumbers = new string[countOfEmployees];
try
{
for (int i = 0; i < countOfEmployees; i++)
{
Console.Write($"Please Enter {i + 1}th Person Name :");
names[i] = Console.ReadLine();
Console.Write($"Please Enter {i + 1}th Person Family :");
families[i] = Console.ReadLine();
Console.Write($"Please Enter {i + 1}th Person Id Number :");
idNumbers[i] = Console.ReadLine();
}
}
catch (FormatException)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Please Enter Correctly information...");
Console.ResetColor();
}
// Employees information printing section
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(".........................................................................");
Console.ResetColor();
for (int i = 0; i < countOfEmployees; i++)
{
Console.WriteLine($"{names[i]} {families[i]} work in this company with id number : {idNumbers[i]}");
}بسیار عالی ، فراتر از انتظارم بود
احسنت
متشکرم استاد