P. 1
Untitled

Untitled

|Views: 0|Likes:
Published by Viral Shah

More info:

Published by: Viral Shah on Sep 02, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

09/09/2012

pdf

text

original

#include <iostream> #define bottom -1 using namespace std; int s[10]; int top = bottom; void push(int a){ if (top

== 9) cout<<"Stack overflow"; else s[++top] = a; return; } int pop(){ if (top== -1) { cout<<"stack empty"; return -1; } else return s[top--]; }

int main(){ push(5); push(3); push(10); push(5); push(3); push(10); cout<<pop()<<'\n'; cout<<pop()<<'\n'; system("pause"); return 0; }

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->