|
Guruh talabasi Toshturdiyev Shahzod
|
tarix | 15.12.2022 | ölçüsü | 337,26 Kb. | | #75130 |
| 1670262320 (2)
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;
}
Dostları ilə paylaş: |
|
|