You started correctly - now you just need to populate each student
structure in the array:
struct student { public int s_id; public String s_name, c_name, dob; } class Program { static void Main(string[] args) { student[] arr = new student[4]; for(int i = 0; i < 4; i++) { Console.WriteLine("Please enter StudentId, StudentName, CourseName, Date-Of-Birth"); arr[i].s_id = Int32.Parse(Console.ReadLine()); arr[i].s_name = Console.ReadLine(); arr[i].c_name = Console.ReadLine(); arr[i].s_dob = Console.ReadLine(); } } }
Now just try again and write this information to the console. I will let you do this, and I will let you try to make a program to accept any number of students, not just 4.
source share