Facebook
From Scorching Baboon, 5 Years ago, written in Plain Text.
This paste is a reply to Untitled from Funky Porcupine - go back
Embed
Viewing differences between Untitled and Re: Untitled
dasda/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include 

using namespace std;

int * stos;
int rozmiar;
int rozmiarAktualny;
int licznik=0;


void na_stos(int a){
    if(licznik>0 && rozmiar>0 && licznik==rozmiar){
        int * temp;
        temp = new int[licznik+1];
        temp = stos;
        delete stos;
        stos = new int[licznik];
        stos = temp;
        rozmiarAktualny = licznik;
        rozmiar = licznik;
        licznik++;
    }
    else{
    stos[licznik]=a;
    licznik++;
    }
}

void ze_stosu(){
    rozmiarAktualny--;
}

void tworz_stos(int a){
    stos = new int[a];
    rozmiarAktualny = a;
    rozmiar = a;
}

void czyt_stos(){
    for(int i = 0; i< rozmiarAktualny;++i){
        cout <     }
}

void usun_stos(){
    delete stos;
}
int main()
{
    tworz_stos(1);
    na_stos(5);
    
    czyt_stos();
    cout << endl;
    na_stos(5);
    czyt_stos();
    ze_stosu();
    cout << endl;
    czyt_stos();
    return 0;
}