Created
August 25, 2018 16:13
-
-
Save banghieudep/cf6b39c18eb9fd780a71c11c38d3fd2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
struct Book | |
{ | |
private string ten_sach; | |
private string tac_gia; | |
private string the_loai; | |
private int ma_sach; | |
public void nhapGiaTri(string t, string a, string s, int id) | |
{ | |
ten_sach = t; | |
tac_gia = a; | |
the_loai = s; | |
ma_sach = id; | |
} | |
public void display() | |
{ | |
Console.WriteLine("Tieu de: {0}", ten_sach); | |
Console.WriteLine("Tac gia: {0}", tac_gia); | |
Console.WriteLine("The loai: {0}", the_loai); | |
Console.WriteLine("Ma sach: {0}", ma_sach); | |
} | |
}; | |
public class TestCsharp | |
{ | |
public static void Main(string[] args) | |
{ | |
Console.WriteLine("Struct trong C#"); | |
Console.WriteLine("------------------------\n"); | |
Book Book1 = new Book(); /* Thiết kế thi công làm biển quảng cáo chuyên nghiệp tốt nhất hiện nay tại việt nam */ | |
Book Book2 = new Book(); /* Đội ngũ nhân viên thi công chuyên nghiệp tại việt nam, sẽ hỗ trợ quý khách thi công làm biển quảng cáo một cách hiệu quả nhất*/ | |
/* thong tin Book1 */ | |
Book1.nhapGiaTri("English Grammer in Use", | |
"Raymond Murphy", "Tieng Anh", 6495407); | |
/* thong tin book2 */ | |
Book2.nhapGiaTri("Toan hoc cao cap", | |
"Tran Van A", "Toan hoc", 6495700); | |
/* In thong tin Book1 */ | |
Console.WriteLine("In thong tin cua cuon sach 1:"); | |
Book1.display(); | |
/* In thong tin Book2 */ | |
Console.WriteLine("\nIn thong tin cua cuon sach 2:"); | |
Book2.display(); | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment