بتاريخ: 12 أبريل 201510 سنة comment_261666 مسالخير عندي مشكلة بمعالجة كود بلغة السي وهو كود ترتيب عناصر المكدس سويت البرنامج بكامل المتطلبات بس في خطا في الكود الخاص بالترتيب هذا البرنامج: #include<constream.h>#include<stdlib.h>const size=5;int full_stack(int top){if(top==size-1)return 0;elsereturn 1;}void push(int s[],int &top,int x){top++;s[top]=x;}int pop(int s[],int &top){int x;x=s[top];top--;return x;}int empty_stack(int top){if(top==-1)return 0;elsereturn 1;}void print(int s[],int top){while(top!=-1)cout<<pop(s,top)<<" ";}void search(int s[],int top,int s1){int flay=0;while(top!=-1&&flay!=1)if(s1==pop(s,top))flay=1;if(flay==0)cout<<"Not found\n";elsecout<<"found";}void rev(int s[],int top){int s1,top1=-1, s2,top2=-1;while(top!=-1)push(s1,top1,pop(s,top));while(top1!=-1)push(s2,top2,pop(s1,top1));while(top2!=-1)push(s,top,pop(s2,top2));//return pop(s,top);print(s,top);//}void order(int s[],int top){int m,n;while(empty_stack(top)!=0){m=s[top];pop(s,top);while(empty_stack(top)!=0){n=s[top];pop(s,top);if(m<n){push(s1,gop1,m);m=n;elsepush(s1,top1,n);}push(s2,top2,m);while(empty_stack(top)!=0){push(s,top,s1[top1]pop(s1,top1);}}while(empty_stack(top2)!=0){push(s,top,s2[top2]);pop(s2,top2);}}while(empty_stack(top)!=0){cout<<s[top]<<" ";pop(s1,top);}}main(){ clrscr();int op,s,top=-1;int s1,s2;int top1,top2;while(1){ cout<<endl;cout<<"1-push\n 2-pop\n 3-print\n 4-search\n 5-rev\n 6-order\n 7-exit(0)";cout<<"\n***************************";cout<<"\nenter the number:";cin>>op;switch(op) {case 1:clrscr();if(full_stack(top)==0) cout<<"full_stack"; else{ int x; cout<<"Enter to stack\n"; cin>>x; push(s,top,x);}cout<<"\n***************************"; break; case 2:clrscr();if(empty_stack(top)==0) cout<<"empty_stack"; elsecout<<"pop vulue="<<pop(s,top);cout<<"\n***************************"; break; case 3:clrscr();cout<<"the print is:"; print(s,top); cout<<"\n***************************"; break; case 4:clrscr(); int s1; cout<<"enter the number search:"; cin>>s1; search(s,top,s1); cout<<"\n***************************"; break; case 5:clrscr(); rev(s,top); cout<<"\n***************************"; break; case 6:clrscr();cout<<"the order"<<pop(s,top); cout<<"\n***************************"; break; case 7:exit(0);} }} اتمنى تساعدوني تقديم بلاغ
بتاريخ: 13 أبريل 201510 سنة comment_261678 المنتدى خاص بتطبيقات أوراكل أو جافا ..لن تجدي عما سألتي عنه إن شاء الله التوفيق لحضرتك تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.