Q:

structure Program using C# Language

0

This Program is used to display the student details using structure concept

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;

struct Books

{

private string title;

private string author;

private string subject;

private int book_id;

public void getValues(string t,string a,string s,int id)

{

      title = t;

      author = a;

      subject = s;

      book_id = id;

}

public void display()

{

Console.WriteLine("\n");

Console.WriteLine("\nTitle      : {0}", title);

Console.WriteLine("\nAuthor     : {0}", author);

Console.WriteLine("\nSubject    : {0}", subject);

Console.WriteLine("\nBook_id    : {0}",book_id);

}

};

public class testStructure

{

public static void Main()

{

Books Book1=new Books();

Books Book2=new Books();

Book1.getValues("C# and .NET Framework","J.Liberty","Programming in C#",6221407);

Book2.getValues("C# and .NET Framework","Herbert Schildt","The Complete Reference",6221410);

Book1.display();    Book2.display();

} 

}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now