Posted By


returic on 11/15/10

Tagged


Statistics


Viewed 487 times
Favorited by 0 user(s)

Zaglavlje za simulaciju (stog_polje.h)


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. struct tauta {
  2. int serijski_broj,godina;
  3. char proizvodac [40], model[20];
  4. };
  5. typedef tauta element;
  6.  
  7. struct tstog{
  8. element A[1000];
  9. int vrh;
  10. };
  11. int b = 1000;
  12. typedef struct tstog stog;
  13.  
  14. int IsEmptyS(stog *S){
  15. if(S->vrh == b - 1) return 1;
  16. else return 0;
  17. };
  18.  
  19. element TopS(stog *S){
  20. if (!(S->vrh == b-1)) return S->A[S->vrh+1];
  21. else exit(1);
  22. };
  23.  
  24. void PushS(element x, stog *S){
  25. S->A[S->vrh] = x;
  26. S->vrh--;
  27. };
  28.  
  29. void PopS(stog *S){
  30. if(!(S->vrh== b-1)) S->vrh++;
  31. else return;
  32. };
  33.  
  34. stog *InitS(){
  35. stog *S = new stog;
  36. S->vrh = b-1;
  37. return S;
  38. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.