Posted By


returic on 11/15/10

Tagged


Statistics


Viewed 457 times
Favorited by 0 user(s)

Zaglavlje za simulaciju (stog_pokazivac.h)


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



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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.