Omonov Sardorbek Deque


Download 81.32 Kb.
Sana20.12.2022
Hajmi81.32 Kb.
#1034776
Bog'liq
10-tajriba ishi MTA


941-21 Omonov Sardorbek
Deque
1) Dekdagi manfiy sonlarni o„chiring.
Dastur kodi:
#include
#include
using namespace std;
void showdq(deque g){
deque::iterator it;
for (it = g.begin(); it != g.end(); ++it)
cout<<*it<<" ";
cout<}

int main()


{
deque gquiz;
int n, x; cin>>n;
for(int i=1; i<=n/2; i++){
cin>>x;
gquiz.push_back(x);
cin>>x;
gquiz.push_front(x);
}
deque positive;
deque::iterator it;
for(it = gquiz.begin(); it != gquiz.end(); ++it){
if(*it>=0) positive.push_back(*it);

}
cout << "The deque gquiz is : ";
showdq(gquiz);
cout << "The deque positive is : ";
showdq(positive);
return 0;

}



2)Berilgan so’zning unli harflarini dekning chap tomonidan, undoshlarini o’ng tomondan kiriting.
#include
#include
using namespace std;
void showdq(deque g){
deque::iterator it;
for (it = g.begin(); it != g.end(); ++it)
cout<<*it<<" ";
cout<}
int main(){
string s; cin>>s;
deque gquiz;
for(int i=0; i int y=s[i];
if(y==65 || y==69 || y==73 || y==79 || y==85 || y==97 || y==101 || y==105 || y==111 || y==117) gquiz.push_back(s[i]);
else gquiz.push_front(s[i]);

}
cout << "The deque gquiz is : ";
showdq(gquiz);
return 0;
}


Download 81.32 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling