Skip to content

Instantly share code, notes, and snippets.

@taefreeze
Created March 7, 2021 01:40
Show Gist options
  • Save taefreeze/4264b7f319da706ccf9b3824a194b8c5 to your computer and use it in GitHub Desktop.
Save taefreeze/4264b7f319da706ccf9b3824a194b8c5 to your computer and use it in GitHub Desktop.
struct & array .net console
struct Books
{
public string title;
public string author;
public string subject;
public int book_id;
};
Books[] arr = new Books[4];
for(int i = 0; i < 4; i++)
{
Console.WriteLine("Please enter title");
arr[i].title= Console.ReadLine();
Console.WriteLine("Please enter author");
arr[i].author = Console.ReadLine();
Console.WriteLine("Please enter subject");
arr[i].subject = Console.ReadLine();
Console.WriteLine("Please enter book id");
arr[i].book_id = int.Parse(Console.ReadLine());
Console.Clear();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment