Stack pop push

 //stack

//push

//pop


#include<iostream.h>

class stack

{

private:

enum{max=100};

int st[max];

int cnt;

int var;


public:

stack()

{

cnt=0;

}


void push(int x)

{

st[cnt++]=x;

}

int pop()

{

return st[--cnt];

}

};

int main(int argc, char *argv[])

{

stack s;

s.push(6);

s.push(67);

cout<<s.pop()<<endl;

cout<<s.pop()<<endl;

}

Comments

Popular posts from this blog

serial to parallel test with 74c595 and pic mcu

ဆိုလာ စနစ္ရွိ BATTERY AMPACITY အား design ထုတ္တြက္ခ်က္ၿခင္း (1) watt hour ရယူၿခင္း

INTERRUPT_ON_CHANGE_18f4550