Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CzyPusty(liczba **root)
- {
- if(*root==0){cout<<"Stos pusty";}
- else
- {
- cout<<endl;
- cout<<"Stos nie jest pusty"<<endl;
- cout<<"Czy chcesz wyswietlic ilosc liczb na stosie? 1-tak; 2-nie"<<endl;
- char znak;
- cin>>znak;
- if(znak=='1')
- {
- IleElementow(root);
- }
- }
- }
- void IleElementow(liczba **root)
- {
- vector <int> kontener;
- int ile=0;
- while(*root)
- {
- liczba *temp=*root;
- *root=(*root)->wskaznik;
- kontener.push_back(temp->wartosc);
- delete temp;
- ++ile;
- }
- int i=0;
- cout<<"Liczb na stosie: "<<ile<<endl;
- while(ile!=0)
- {
- liczba *nowa=new liczba;
- nowa->wartosc=kontener[i];
- ++i;
- nowa->wskaznik=*root;
- *root=nowa;
- --ile;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment