Created
March 7, 2021 01:40
-
-
Save taefreeze/4264b7f319da706ccf9b3824a194b8c5 to your computer and use it in GitHub Desktop.
struct & array .net console
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
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