Answers for "c# struct methods"

C#
0

C# struct

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();
       }
    }
}

 student thisStudent;
 Console.WriteLine("Please enter StudentId, StudentName, CourseName, Date-Of-Birth");
 thisStudent.s_id = int.Parse(Console.ReadLine());
 thisStudent.s_name = Console.ReadLine();
 thisStudent.c_name = Console.ReadLine();
 thisStudent.s_dob = Console.ReadLine();
Posted by: Guest on November-14-2021

C# Answers by Framework

Browse Popular Code Answers by Language