Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace priprema_za_test
- {
- internal class Program
- {
- enum Genre
- {
- EPSKA_FANTASTIKA,
- NAUCNA_FANTASTIKA,
- KOMEDIJA,
- TRAGEDIJA,
- TRILER,
- ROMANSA,
- DETEKTIVSKI
- }
- class Book
- {
- public string name;
- public string authorName;
- public int yearRealese;
- Genre genre;
- public Book(string name, string author, int year, Genre g)
- {
- this.name = name;
- this.authorName = author;
- this.yearRealese = year;
- this.genre = g;
- }
- }
- static void Main(string[] args)
- {
- Book[] books = new Book[100];
- int index = 0;
- while (true)
- {
- Console.WriteLine("komande");
- Console.WriteLine("****************");
- Console.WriteLine("0 - kraj");
- Console.WriteLine("1 - unos nove knjige");
- Console.WriteLine("2 - ispis knjiga sortiranih po autoru");
- Console.WriteLine("2 - ispis knjiga sortiranih po godini");
- Console.Write("unei komandu: ");
- string command = Console.ReadLine();
- if (command.Equals(1))
- {
- Console.Write("ime: ");
- string name = Console.ReadLine();
- Console.Write("ime autora: ");
- string nameAuthor = Console.ReadLine();
- Console.Write("godina izlaska: ");
- int year = int.Parse(Console.ReadLine());
- Console.Write("zanr: ");
- string genre = Console.ReadLine();
- Genre g = Genre.ROMANSA;
- switch (genre)
- {
- case "EPSKA_FANTASTIKA":
- g = Genre.EPSKA_FANTASTIKA;
- break;
- case "NAUCNA_FANTASTIKA":
- g = Genre.NAUCNA_FANTASTIKA;
- break;
- case "KOMEDIJA":
- g = Genre.KOMEDIJA;
- break;
- case "TRAGEDIJA":
- g = Genre.TRAGEDIJA;
- break;
- case "TRILER":
- g = Genre.TRILER;
- break;
- case "ROMANSA":
- g = Genre.ROMANSA;
- break;
- case "DETEKTIVSKI":
- g = Genre.DETEKTIVSKI;
- break;
- }
- books[index++] = new Book(name, nameAuthor, year, g);
- }
- else if (command.Equals(2))
- {
- BubbleSort(books);
- }
- else if (command.Equals(3))
- {
- }
- else if (command.Equals(0))
- {
- Console.WriteLine("kraj");
- break;
- }
- else
- {
- }
- }
- }
- private static void BubbleSort(Book[] books)
- {
- for (int i = 0; i < books.Length; i++)
- {
- for (int j = i + 1; j < books.Length; j++)
- {
- if (string.Compare(books[i]., books[i+1]))
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment