610-21- guruh talabasi Toshturdiyev Shahzod
Stekning juft o‘rinda turgan elementlari o‘chirilsin.
#include
#include
#include
using namespace std;
int main()
{
deque dq;
deque newdq;
int k = 0, n, j;
cout<<"Navbat elementlar sonini kirirting: ";
cin>>n;
for(int i = 0; i < n; i++){
cout<cin>>j;
dq.push_back(j);
}
cout << "\nNavbat elementlari: ";
for(auto it = dq.cbegin();it!=dq.cend();it++)
{
cout << *it << " ";
}
for(auto it = dq.cbegin();it!=dq.cend();it++){
if(k%2 == 0){
newdq.push_back(*it);
}
k++;
}
cout<<"\nQolgan elementlar: ";
for(auto it = newdq.cbegin();it!=newdq.cend();it++)
{
cout << *it << " ";
}
return 0;
}
Do'stlaringiz bilan baham: |