9-tajriba ishi Omonov Sardorbek


Download 0.93 Mb.
Sana23.12.2022
Hajmi0.93 Mb.
#1049036
Bog'liq
1 4931781594466747091


9-tajriba ishi Omonov Sardorbek
Har bir talaba 4 tadan misol ishlashi kerak!

  1. Navbat o„rtasiga '+' belgi joylashtirilsin.

  2. Navbat eng kichik elementi topilsin va undan keyin 0 joylashtirilsin.

  3. Navbat eng katta elementi topilsin va undan keyin 0 joylashtirilsin.

  4. Navbat eng kichik elementi o„chirilsin.

1)
#include
#include
using namespace std;
void showq(queue gq){
queue g = gq;
int h=g.size();

while (!g.empty()) {
if(h==gq.size()/2) cout<<"+ ";
h--;
cout< g.pop();
}
}
int main()
{
queue gquiz;
int n, x; cin>>n;
for(int i=0; i cin>>x;
gquiz.push(x);
}
showq(gquiz);
return 0;
}



2)
#include
#include
using namespace std;
void showq(queue gq){
queue g = gq;
while (!g.empty()) {
cout< g.pop();
}
cout<}
int main()
{
queue gquiz;
int n, x; cin>>n;
int y, in, kich=1000;
for(int i=0; i cin>>x;
if(x gquiz.push(x);
}
queue help;
for(int i=1; i<=n+1; i++){
if(i==in+1) {help.push(0);}
else {
help.push(gquiz.front());
gquiz.pop();
}
}
showq(help);
return 0;
}



3)
#include


#include
using namespace std;
void showq(queue gq){
queue g = gq;
while (!g.empty()) {
cout< g.pop();
}
cout<}
int main()
{
queue gquiz;
int n, x; cin>>n;
int y, in, kich=-1000;
for(int i=0; i cin>>x;
if(x>kich) {kich=x;in=i+1;}
gquiz.push(x);
}
queue help;
for(int i=1; i<=n+1; i++){
if(i==in+1) {help.push(0);}
else {
help.push(gquiz.front());
gquiz.pop();
}
}
showq(help);
return 0;

}



4)
#include
#include
using namespace std;
void showq(queue gq){
queue g = gq;
while (!g.empty()) {
cout< g.pop();
}
cout<}
int main()
{
queue gquiz;
int n, x; cin>>n;
int y, in, kich=1000;
for(int i=0; i cin>>x;
if(x gquiz.push(x);
}
queue help;
for(int i=1; i<=n; i++){
if(i==in) { gquiz.pop();}
else {
help.push(gquiz.front());
gquiz.pop();
}
}
showq(help);
return 0;
}

Download 0.93 Mb.

Do'stlaringiz bilan baham:




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