Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public struct Book
- {
- public string name;
- public string field;
- public int year;
- }
- public class Program
- {
- public static void Main()
- {
- Book[] library = new Book[6];
- //....some other code....
- Console.WriteLine("Hello World!");
- }
- public int TotalCount(Book[] books, int n, string field)
- {
- int count = 0;
- for(int i =0; i<n; i++)
- if(books[i].field==field)
- count++;
- return count;
- }
- public Book FindOldest(Book[] books, int n)
- {
- Book oldest = books[0];
- for(int i =1; i<n; i++)
- if(books[i].year<oldest.year)
- oldest = books[i];
- return oldest;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement