Console Application using Structures (struct keyword) in C# 1.1 and 2.0 (Dot Net)

Google+ Pinterest LinkedIn Tumblr +

// Console Application using Structures (struct keyword) in C# 1.1 and 2.0 (Dot Net)

using System;

namespace struc

{

class struc

{

static void Main()

{

student s=new student();

s.show1();

s.name=Console.ReadLine();

s.roll=int.Parse(Console.ReadLine());

s.fees=int.Parse(Console.ReadLine());

            s.show();

Console.WriteLine(“Name :{0}\nRoll No. :{1}\nFees :{2}”,s.name,s.roll,s.fees);

Console.ReadLine();

}

}

struct student

{

public string name;

public float fees;

public int roll;

public void show()

{

Console.WriteLine(“Student’s Detail”);

}

public void show1()

{

Console.WriteLine(“Enter Name, Roll no. ,fees of the Student”);

}

}

}

 

Share.

About Author

Leave A Reply