c#结构

结构:一次性声明多个变量

struct Books
{
   public string title;
   public string author;
   public string subject;
   public int book_id;
};



public class StructTest
{
   public static void Main(string[] args)
   {
      Books Book1;
      Books Book2;

      Book1.title = "c#从入门到放弃";
      Book1.author = "hollis"; 
      Book1.subject = "C# Programming Tutorial";
      Book1.book_id = 12345;

      Book2.title = "c++从入门到放弃";
      Book2.author = "hollis";
      Book2.subject =  "C++ Billing Tutorial";
      Book2.book_id = 54321;
   }

 

posted @ 2019-04-17 20:08  _Huang95  阅读(141)  评论(0编辑  收藏  举报