Dastur natijasi:
n=5
1-talabaning fio=fam1
adres=Toshkent
2-talabaning fio=fam2
adres=TTJ
3-talabaning fio=fam3
adres=ijarada
4-talabaning fio=fam4
adres=uchastkada
5-talabaning fio=fam5
adres=TTJ
fam2 TTJ
fam5 TTJ
fam1 Toshkent
fam3 ijarada
fam4 uchastkada
qidirilayotgan el 1-orinda turubdi va 2 ta solishtirishda topildi
fam2 TTJ
fam5 TTJ
#include
using namespace std;
int main(){
queue que, que1;
int n, x, min;
cout << "Elementlar sonini kiriting: "; cin >> n;
for(int i = 0; i < n; i++){
cin >> x;
que.push(x);
}
min = que.front();
que1.push(que.front());
while(!que.empty()){
que1.push(que.front());
if(min > que.front())
min = que.front();
que.pop();
}
cout << "Hosil bo'lgan navbat: \n";
while(!que1.empty()){
if(min == que1.front()){
que1.pop();
continue;
}
cout << que1.front() << ' ';
que1.pop();
}
}
Do'stlaringiz bilan baham: |