السلام عليكم ورحمة الله وبركاته
أخواني كتبت أكواد لبرنامج عن الطابور queue
بس عليه اضافات الداله اللي راح تضيف للطابور فيها شرطين إذا كانت تحقق شرط عدم امتلاء الطابور يدخل ويختبر شرط اخر هل توفرت شروط التسجيل إذا نعم
يتم ادخال العنصر للطابور ولكن المشكله عندي انه يكتب لايوجد مقاعد شاغره على طول بالرغم انه انا لحد الان مادخلت ولا طالب (( طبعا فكرة البرنامج عن الابتعاث الخارجي))
شي ثاني كيف اقدر ادخل العناصر للطابور عن طريق دوارة يعني يدخل المستخدم عدد من المرات وبعدين تتم طباعة الطابور جربتها ولكن صار مايعرض الا اخر ادخال فقط
أكوادي جاهزه ومافيها اي خطا بس ياريت تساعدوني ليه تطلع النتيجه غلط والسؤال الثاني
جزى الله من يجاوب كل الخير
#include<iostream.h>
#include<conio.h>
#define MAXSIZE 5
struct sc{
int front,rear;
int queue[MAXSIZE];
}s;
void information();
int check();
int requirements();
void registration();
void comp();
void accepted();
void cancel();
void accepted();
void main(){
information();
check();
requirements();
registration();
comp();
accepted();
cancel();
accepted();
getch();}
void information(){
cout<<"Hello to you in program of Custodian Scholarship"<<endl<<endl;
cout<<"the most important service in our program"<<endl<<endl;
cout<<" 1.basic monthly salary for the student"<<endl<<endl;
cout<<" 2.allowance for wife"<<endl<<endl;
cout<<" 3.allowance for children"<<endl<<endl;
cout<<"if you want to know more information please visit the following website"<<endl<<endl;
cout<<"www.mohe.gov.sa/ar/studyaboard/kingabdulla-hstages"<<endl<<endl;
}
int check(){
int pa;
cout<<"please enter apassword"<<endl;
cin>>pa;
if(pa==1231)return(1);
else return(0);}
int full(){
if (s.rear==MAXSIZE-1) return(1);
else return(0);}
int empty(){
if (s.front==s.rear+1)
return(1);
else
return(0);
}
int requirements(){
char name[10],nat[10];
int m,dl,fe,se,t,y;
cout<<"enter name"<<endl;
cin>>name;
cout<<"what is your nationality?"<<endl;
cin>>nat;
cout<<"are you afull time study and without ajob(1.yes or 2.no)"<<endl;
cin>>m;
cout<<"what is your degree in high school?"<<endl;
cin>>dl;
cout<<"what is the degree of general capacity test?"<<endl;
cin>>fe;
cout<<"what is the degree of achievement test?"<<endl;
cin>>se;
cout<<"How long have you graduate from secondary?"<<endl;
cin>>t;
cout<<"how old are you?"<<endl;
cin>>y;
if(nat=="saudi" && m==1 && dl>=90 && fe>=70 && se>=77 && t<=3 && y<=22)return (1);
else return(0);
}
void registration(){
if(full==0){
if(requirements()==1){
cout<<"enter your passport number"<<endl;
s.rear=s.rear+1;
cin>>s.queue[s.rear];}
else{
cout<<"Can not be registered for not meet the conditions"<<endl;}
}
else{
cout<<"Can not be registered no seats currently vacant"<<endl;}
}
void comp(){
int single,children,total,convert;
cout<<"Are you married or single(1.single or 2.married)"<<endl;
cin>>single;
if(single==1){
total=1840;
cout<<"Will be paid an amount of"<<" "<<total<<"dolars"<<endl;
convert=3.75*1840;
cout<<"in saudi reals ="<<convert<<"reals"<<endl;}
else{
cout<<"how many children do you have"<<endl;
cout<<"If you do not have children write (0)"<<endl;
cin>>children;
total=1840+600+(children)*350;
cout<<"Will be paid an amount of"<<" "<<total<<"dolars"<<endl;
convert=3.75*total;
cout<<"in saudi reals ="<<convert<<"reals"<<endl;
}}
void cancel(){
if(empty()==1){
cout<<"No requests for cancellation"<<endl;}
else{
cout<<"\n"<<s.queue[s.front]<<"has been canceled"<<endl;
s.front=s.front+1;}
}
void accepted(){
int i;
if(empty()==1){
cout<<"No students are accepted"<<endl;
}
else{
cout<<"anumber of accepted student is"<<endl;
for(i=s.front;i<=s.rear;i++){
cout<<i<<" "<<s.queue<<endl;}
}
}