Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication11
- {
- class Book
- {
- string author, title;
- decimal price;
- DateTime data;
- public Book(string _author, string _title, decimal _price, System.DateTime _data)
- {
- author = _author;
- title = _title;
- price = _price;
- data = _data;
- }
- public string Author
- {
- get { return author; }
- set { value = author; }
- }
- public string Title
- {
- get { return title; }
- set { value = title; }
- }
- public decimal Price
- {
- get { return price; }
- set { value = price; }
- }
- public DateTime Data
- {
- get { return data; }
- }
- }
- class MyClass
- {
- Book[] M;
- int count;
- public MyClass(int cap)
- {
- M = new Book[cap];
- }
- public void Add(ConsoleApplication11.Book item)
- {
- M[count] = item;
- count++;
- }
- public int Count
- {
- get { return count; }
- set { value = count; }
- }
- public MyClass Repeat()
- {
- MyClass nc = new MyClass(0);
- for (int i =0; i < M.Length; i++)
- {
- {
- bool f = true;
- for (int j = 0; j < nc.M.Length; j++)
- if (nc.M[j] == M[i])
- {
- f = false;
- break;
- }
- if (f)
- nc.Add(M[i]);
- }
- }
- return nc;
- }
- public System.Collections.IEnumerator GetEnumerator()
- {
- for (int i = 0; i < count; i++)
- yield return M[i];
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement