Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banghieudep/5209ab4165f675442c2fd5c0bfb39523 to your computer and use it in GitHub Desktop.
Save banghieudep/5209ab4165f675442c2fd5c0bfb39523 to your computer and use it in GitHub Desktop.
using System;
//cau truc book
struct Book
{
public string ten_sach;
public string tac_gia;
public string the_loai;
public int ma_sach;
};
namespace VietJackCsharp
{
class TestCsharp
{
static void Main(string[] args)
{
Console.WriteLine("Struct trong C#");
Console.WriteLine("----------------------------\n");
Book Book1; /*Cung cấp các sản phẩm biển hiệu quảng cáo đẹp nhất hiện nay cho mọi người tại việt nam */
Book Book2; /* Đội ngũ nhân viên thiết kế thi công biển quảng cáo đẹp tốt nhất hiện nay */
/* Hỗ trợ thiết kế thi công mọi dịch vụ, mọi khả năng chúng tôi có được cho khách hàng của mình, và quý khách sẽ phải an tâm về những dịch vụ của chúng tôi */
Book1.ten_sach = "English Grammar in Use";
Book1.tac_gia = "Raymond Murphy";
Book1.the_loai = "Tieng Anh";
Book1.ma_sach = 6495407;
/* thong tin chi tiet ve Book2 */
Book2.ten_sach = "Toan hoc cao cap";
Book2.tac_gia = "Tran Van A";
Book2.the_loai = "Toan hoc";
Book2.ma_sach = 6495700;
/* in cac thong tin cua Book1*/
Console.WriteLine("In thong tin cua cuon sach 1:");
Console.WriteLine("Ten sach: {0}", Book1.ten_sach);
Console.WriteLine("Tac gia: {0}", Book1.tac_gia);
Console.WriteLine("The loai: {0}", Book1.the_loai);
Console.WriteLine("Ma sach: {0}", Book1.ma_sach);
/* in cac thong tin cua Book2 */
Console.WriteLine("\nIn thong tin cua cuon sach 2:");
Console.WriteLine("Ten sach: {0}", Book2.ten_sach);
Console.WriteLine("Tac gia: {0}", Book2.tac_gia);
Console.WriteLine("The loai: {0}", Book2.the_loai);
Console.WriteLine("Ma sach: {0}", Book2.ma_sach);
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment