Advertisement
Sparrow_66

Recursion Students (name, age, Birthdate, Town)

Mar 22nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. class StudentsPu
  2. {
  3. public string Name { get; set; }
  4. public int Age { get; set; }
  5. public DateTime Birthdate { get; set; }
  6. public string Town { get; set; }
  7. }
  8. class Program
  9. {
  10. static void Main()
  11. {
  12. StudentsPu[] students = new StudentsPu[2];
  13. InputStudents(students);
  14. }
  15.  
  16. static void InputStudents(StudentsPu[] students)
  17. {
  18. for (int i = 0; i < students.Length; i++)
  19.  
  20.  
  21. {
  22.  
  23. StudentsPu student = new StudentsPu();
  24. Console.WriteLine("Please, enter a name for a student {0} : ", i);
  25. student.Name = Console.ReadLine();
  26. Console.WriteLine("Please, enter an age for a student {0} : ", i);
  27. student.Age = int.Parse(Console.ReadLine());
  28. Console.WriteLine("Please, enter a birth date for a student {0} : ", i);
  29. student.Birthdate = DateTime.Parse(Console.ReadLine());
  30. Console.WriteLine("Please, enter a town for a student {0} : ", i);
  31. student.Town = Console.ReadLine();
  32.  
  33. students[i] = student;
  34.  
  35.  
  36. }
  37.  
  38.  
  39.  
  40. }
  41.  
  42.  
  43.  
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement