Guruh Atanazarov Bobojon vector — dinamik massiv doir misol ishlash


Download 154.58 Kb.
Sana11.03.2023
Hajmi154.58 Kb.
#1261674
Bog'liq
5 lab algoritim


913 -21-guruh
Atanazarov Bobojon

vector dinamik massiv doir misol ishlash

#include


#include
using namespace std;
int main(){
int n; cin>>n;
vectora;
for (int i=0; iint k; cin>>k;
a.push_back(k);
}
int s=0,s1=0; double d;
for (int i=0; is+=a.at(i);
s1++;
}
cout<<((s)*1./s1);

}



list doir misol

#include


using namespace std;
int main()
{
list mylist{ 1, 2, 3, 4, 5 };
for (auto it = mylist.begin(); it !=
mylist.end(); ++it)
cout << ' ' << *it;
return 0;
}


Deque doir misol
#include
using namespace std;
int main()
{
deque elementlar = { 1, 2, 3, 4, 5 };

deque::iterator it = elementlar.begin();


++it;

it =elementlar.insert(it, 10); // 1 10 2 3 4 5

std::cout << "Deque oz ichiga oladi:";
for (it = elementlar.begin(); it != elementlar.end(); ++it)
cout << ' ' << *it;
cout << '\n';

return 0;


}


Set to’plamga doir misol
#include
#include

int main()


{
std::set a;
a.insert('G');
a.insert('F');
a.insert('G');
for(auto& str: a)
{
std::cout << str << ' ';
}
std::cout << '\n';
return 0;
}

Download 154.58 Kb.

Do'stlaringiz bilan baham:




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