O’g’li (sirtqi) guruh


Download 42.58 Kb.
bet4/4
Sana17.06.2023
Hajmi42.58 Kb.
#1549315
1   2   3   4
Bog'liq
O’g’li (sirtqi) guruh

Dastur kodi:
#include
#include
#include
using namespace std;
int main() {

list list1 = {1, 5, 6, 8, 15, 17, 10, 4, 19};


list list2 = {10, 11, 2, 8, 15, 16, 17, 25, 8};
list list3;
list list4;
list :: iterator it = list1.begin();
list :: iterator iter = list2.begin();
list3 = list1;
list4 = list2;

cout<<"Berilgan to`plam : \n";

for (it = list1.begin(); it != list1.end(); it++) {
cout << *it << " ";
};
cout<<"\n\n2-to`plam : \n";

for (iter = list2.begin(); iter != list2.end(); iter++) {


cout << *iter << " ";
};
cout<<"\n";
for (it = list1.begin(); it != list1.end(); it++) {
int k = *it;

if(k % 2 == 0) {
int c = 0;
for (iter = list2.begin(); iter != list2.end(); iter++) {
int a = *iter;
if(a == k) c++;
}
if(c>=1) cout<<"\nBerilgan to`plamdagi "< }
};
for (it = list3.begin(); it != list3.end(); it++) {
int k = *it;
list2.remove(k);
}
for (it = list4.begin(); it != list4.end(); it++) {
int k = *it;
list1.remove(k);
}

cout<<"\nSaralangan 1-to`plam : \n";

for (it = list1.begin(); it != list1.end(); it++) {
cout << *it << " ";
};
cout<<"\n\nSaralangan 2-to`plam : \n";

for (iter = list2.begin(); iter != list2.end(); iter++) {


cout << *iter << " ";
};
return 0;
}
Dastur natijasi:


1 Дастур Visual C++ муҳитида тузилган.

Download 42.58 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




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