عکسهای عاشقانه و دیدنی و اطلاعات عمومی-music-sms-jok

برنامه stack

#include #include #include #include class stack{ //daryaft adad az vorodi private: //va namayesh makos adaad fard vared shode int c,top; float *elem; public: stack(int d=5):c(d),top(-1),elem(new float[d]){} ~stack(){delete []elem; } int isfull(){ return top==(c-1); } int isempty(){ return top==-1; } void push(int x) { if(isfull()) { cerr<<"stack is full."; exit(1); } elem[++top]=x; } int pop( ) { if(isempty()) { cerr<<"stack is empty."; exit(2); } return elem[top--]; } }; void main () { int n,i,h; clrscr(); cout<<"enter number "; cin>>h; stack so(h); for(i=0;i>n; if(n % 2 ==1) so.push(n); } cout<<"odd namber is reversa order is:\n"; while(!so.isempty()) cout<

+   فرهاد ; ٦:۳۳ ‎ب.ظ ; ۱۳۸٧/٤/٢۱

design by macromediax ; Powered by PersianBlog.ir