Computer Engineering
前往频道在 Telegram
تمام فایل های مربوط به دروس اینجا گذاشته و ماندگار خواهند بود. گروه @Com_engineering01Gap پی وی @sireh03
显示更多1 967
订阅者
+124 小时
+87 天
+2830 天
帖子存档
1 966
سلام
كسانيكه فعاليت كلاسيشون را هنوز تحويل نداده اند فقط فردا وقت دارند تحويل بدهند
من فردا صبح قبل امتحان از ساعت ٨.١٥ تا ٨.٣٠ در پاركينگ اساتيد در محوطه فعاليتها رو تحويل ميگيرم
1 966
#include <iostream>
using namespace std;
int n=5;
void AddQ(int Q[], int &Rear,int item, int Front){
if(Front==(Rear+1)%n){
cout<<"queue is full!!"<<endl;
}
else{
Q[Rear]=item;
Rear=(Rear+1)%n;
}
}
int DelQ(int Q[], int &Front, int Rear)
{
int item=-1;
if(Rear==Front)
cout<<"Q is empty!!!"<<endl;
else{
item=Q[Front];
Front=(Front+1)%n;
}
return item;
}
void Display(int Q[], int Rear, int Front){
cout<<"front 2 Rear : ";
for(int i=Front;i<Rear;i++){
cout<<Q[i]<<"\t";
}
cout<<"\n";
}
int main()
{
int Front,Rear ;
Front=Rear=0;
int Q[n];
AddQ(Q, Rear, 50, Front);
AddQ(Q, Rear, 10, Front);
AddQ(Q, Rear, 60, Front);
Display(Q, Rear, Front);
int x = DelQ(Q, Front, Rear);
Display(Q, Rear, Front);
return 0;
}
کد مربوط به صف حلقوی
#ساختمان_داده ایوبی
