Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. typedef int Tip;
  5. struct Cvor {
  6.     Tip info;
  7.     Cvor * next;
  8. };
  9. class povezanaReprezentacija {
  10.     Cvor * prvi;
  11. public:
  12.     povezanaReprezentacija() {
  13.         prvi = nullptr;
  14.     }
  15.  
  16.     void Push(Tip novi) {
  17.         if (isFull())
  18.         {
  19.             throw exception("Prazan je niz");
  20.         }
  21.         Cvor * t;
  22.         while (t ->next != nullptr)
  23.         {
  24.             if (novi > t->next->info || novi > prvi->info)
  25.             {
  26.                 dodajPrvi();
  27.             }
  28.             t = t->next;
  29.         }
  30.     }
  31.     char Pop() {
  32.         Cvor * t = prvi;
  33.         Tip x = t->info;
  34.         prvi = prvi->next;
  35.         return x;
  36.     }
  37.     bool isFull() {
  38.        
  39.     }
  40.     void dodajPrvi(Cvor * novi) {
  41.         Cvor * t = new Cvor;
  42.         t = novi;
  43.         prvi = t;
  44.         return;
  45.     }
  46. };
  47.  
  48.  
  49. int main() {
  50.     povezanaReprezentacija * test;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement