الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

عندي مشكلة بمعالجة كود بلغة السي

Featured Replies

بتاريخ:

مسالخير

عندي مشكلة بمعالجة كود بلغة السي وهو كود ترتيب عناصر المكدس سويت البرنامج  بكامل المتطلبات بس في خطا  في الكود الخاص بالترتيب

هذا البرنامج:

#include<constream.h>
#include<stdlib.h>
const size=5;
int full_stack(int top)
{if(top==size-1)
return 0;
else
return 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;
else
return 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";
else
cout<<"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;
else
push(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";
  else
cout<<"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);}
  }}

اتمنى تساعدوني

بتاريخ:

المنتدى خاص بتطبيقات أوراكل أو جافا ..لن تجدي عما سألتي عنه

إن شاء الله التوفيق لحضرتك  

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.