Posted By

nisever on 11/14/10


Tagged

stack


Versions (?)

stog polje


 / Published in: C++
 

  1. //stog_polje.h
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. struct tautomobil {
  7. int ser_broj;
  8. char proizvodac[40];
  9. char model[40];
  10. int god_proizvodnje;
  11. };
  12. struct tautomobili {
  13. tautomobil automobil[100];
  14. int top;
  15. };
  16.  
  17. tautomobili *pom = new tautomobili;
  18.  
  19. void InitS (tautomobili *stog) {
  20. stog->top = 99;
  21. }
  22.  
  23. void PushS(tautomobil x, tautomobili *stog) {
  24. stog->automobil[stog->top]=x;
  25. stog->top--;
  26.  
  27. }
  28.  
  29.  
  30. void PopS(tautomobili *stog) {
  31. stog->top++;
  32. }
  33.  
  34.  
  35. bool IsEmptyS(tautomobili *stog) {
  36. if (stog->top==99)
  37. return true;
  38. else
  39. return false;
  40. }
  41.  
  42. tautomobil TopS(tautomobili *stog){
  43. return(stog->automobil[stog->top+1]);
  44. }

Report this snippet  

You need to login to post a comment.