Dastur kodi
#include
#include
using namespace std;
struct DEQUE
{
int data[50];
int DO,DB;
DEQUE(){DO=DB=24;}
void ADD(int X, bool K=true)
{
if (K)data[--DB]=X;
else data[DO++]=X;
}
void PRINT()
{
for(int i = DB; i<="" i="">
cout << data[i]<<"\t";
cout<
}
int DEL(bool k=true)
{
if (k) return data[DB++];
else return data[--DO];
}
};
int main()
{
int n;
cin>>n;
DEQUE A;
while(n--)
A.ADD(rand()%100+1);
A.PRINT();
cout << A.DEL(false) << endl;
cout << A.DEL(false) << endl;
cout << A.DEL(true) << endl;
cout << A.DEL(true) << endl;
A.PRINT();
return 0;
}
Xulosa
Man bu YARIMSTATIK MALUMOTLAR TUZILMASI mavzusini bajarish asosida yaxshi konikmaga ega boldim va yaxshi darajada organdim va buni misollar yordamida va nazariy savollarga javob berdim
Dostları ilə paylaş: |