Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include "StackModul.h"
- using namespace std;
- int push_m(int n,int stos[]){
- if(n>0){
- n++;
- for(int i=n; i>=0;i--){
- swap(stos[i],stos[i-1]);
- }
- cout<<"PODAJ NOWY ELEMENT STOSU: ";
- cin>>stos[0];
- }
- else{ cout<<"PODAJ NOWY ELEMENT STOSU: ";
- cin>>stos[0];
- n++;
- }
- }
- int pop_m(int n,int stos[]){
- if(n>0){
- for(int i=0;i<n;i++){
- swap(stos[i],stos[i-1]);
- }
- n--;}
- else {cout<<"stos jest pusty"<<endl;}
- }
- int top_m(int n, int stos[]){
- cout << stos[0]<<endl;
- }
- int size_m(int n){
- cout<<n<<endl;
- }
- int empty_m(int n){
- if(n==0){cout<<"Stos jest pusty"<<endl;
- }
- else{cout<<"Stos nie jest pusty"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement