SHARE
TWEET

StackModul

a guest Nov 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include "StackModul.h"
  4. using namespace std;
  5. int push_m(int n,int stos[]){
  6.         if(n>0){
  7.         n++;
  8.         for(int i=n; i>=0;i--){
  9.             swap(stos[i],stos[i-1]);
  10.         }
  11.         cout<<"PODAJ NOWY ELEMENT STOSU: ";
  12.         cin>>stos[0];
  13.     }
  14.         else{ cout<<"PODAJ NOWY ELEMENT STOSU: ";
  15.         cin>>stos[0];
  16.         n++;
  17.        
  18.         }
  19. }
  20. int pop_m(int n,int stos[]){
  21.     if(n>0){
  22.    
  23.         for(int i=0;i<n;i++){
  24.             swap(stos[i],stos[i-1]);
  25.        
  26.     }
  27.     n--;}
  28.    
  29.     else {cout<<"stos jest pusty"<<endl;}
  30.    
  31. }
  32.  
  33.  
  34. int top_m(int n, int stos[]){
  35.     cout << stos[0]<<endl;
  36.    
  37. }
  38. int size_m(int n){
  39.     cout<<n<<endl;
  40. }
  41. int empty_m(int n){
  42.     if(n==0){cout<<"Stos jest pusty"<<endl;
  43.     }
  44.     else{cout<<"Stos nie jest pusty"<<endl;
  45.     }
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top