Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class stack{
- char *symbols;
- int pnt;
- public:
- stack( );
- void push();
- void print();
- };
- stack::stack( ){
- char *symbols = new char[];
- pnt = 0;
- };
- void stack::push(){
- char value;
- cout << "Enter a symbol: "; cin >> value;
- *(symbols+pnt) = value;
- pnt++;
- };
- void stack::print(){
- for (int ix = pnt - 1; ix > 0; ix--)
- {
- cout << symbols [ix];
- }
- };
- int main(){
- int num;
- stack a;
- cout << "Enter a number of elements";
- cin >> num;
- a.push;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment