Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Node
- {
- public int wartosc;
- public Node next;
- }
- class Kolejka
- {
- Node first, last;
- /* dodaje Nodeent na koniec kolejki */
- public void add(int x)
- {
- Node temp = new Node;
- temp.warosc =x;
- if (first == null)
- {
- first = last = temp;
- }
- else
- {
- last.next = temp;
- last = temp;
- }
- }
- /* sciaga z kolejki Nodeent na 1 miejscu */
- public void delete()
- {
- if (first != null)
- {
- if (first.next == null)
- {
- last = null;
- }
- first = first.next;
- }
- else Console.WriteLine("kolejka jest pusta");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement