• 1404/09/23

تمرین - گرفتن اطلاعات کارمندان از طریق Class :

Console.Write("Please Enter number os employee :  ");
int empNum = Convert.ToInt32(Console.ReadLine());
empInfo empInformation = new empInfo(empNum);

for (int i = 0; i < empNum; i++)
{
    Console.Write($"Please Enter Employee {i + 1}th name : ");
    empInformation.name[i] = Console.ReadLine();
    Console.Write($"Please Enter Employee {i + 1}th family : ");
    empInformation.family[i] = Console.ReadLine();
    Console.Write($"Please Enter Employee {i + 1}th age : ");
    empInformation.age[i] =Convert.ToInt32( Console.ReadLine());
}
for (int i = 0; i < empNum; i++)
{
    Console.WriteLine($"{i+1}. Name = {empInformation.name[i]} , Family = {empInformation.family[i]} , Age = {empInformation.age[i]}");
}
class empInfo(int empNum)
{
    public string[] name = new string[empNum];
    public string[] family=new string[empNum];
    public int[] age=new int[empNum];
}
  • 1404/09/24
  • ساعت 00:47

سلام 

اون چیزی که من میخواستم نیست و هنوز خیلی مواردی که استفاده کردید را آموزش ندادم 

امیدوارم از هوش مصنوعی استفاده نکرده باشی ،  ولی خوب بود 

 

حل تمرین را قرار دادم


logo-enamadlogo-samandehi