Kiberxavfsizlik fakuliteti


Download 294.27 Kb.
Sana09.04.2023
Hajmi294.27 Kb.
#1347210

MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI



Kiberxavfsizlik fakuliteti
Axborot xavfsizliogi yo’nalishi 713-22 guruh talabasi
Ne’matov Diyorbekning Dastulash 2 fanidan
2-mustaqil ishi





Bajardi: Ne’matov Diyorbek
Tekshirdi :Aliqulov Akmal
15. Vector hosil qiling elementlarini o’sish tartibida saralang

#include


#include
#include
#include

using namespace std;


int main()


{
srand(time(NULL));
vector my_vec;

for (int i = 0; i < 11; i++)


my_vec.push_back(1 + rand() % 100);

cout << "Vectorning boshlang'ich holati!!!" << endl;


for (auto i : my_vec)
cout << i << " ";

cout << "\n\nVectorning saralangan holati!!!" << endl;


sort(my_vec.begin(), my_vec.end());
for (auto i : my_vec)
cout << i << " ";

cout << endl;


system("pause");


return 0;

}



15. Dekning toq elementlaridan navbat, juft elementlaridan stek hosil qiling.

#include


#include
#include
#include

using namespace std;


int main()


{
srand(time(NULL));
deque dek;
deque navbat;
stack stek;
for (int i = 0; i <= 10; i++)
dek.push_back(1 + rand() % 100);

cout << "Dekning elementlari!" << endl;


for (auto n : dek)
cout << n << " ";
while (!dek.empty())
{
if (dek.front() % 2 != 0)
{
navbat.push_back(dek.front());
dek.pop_front();
}

else
{


stek.push(dek.front());
dek.pop_front();
}
}

cout << "\n\nDekning toq elementlaridan iborat navbat!" << endl;


for (auto i : navbat)
cout << i << " ";
cout << "\n\nDekning juft elementlaridan iborat stack!" << endl;
while (!stek.empty())
{
cout << stek.top() << " ";
stek.pop();
}
cout << endl;

system("pause");


return 0;
}

Download 294.27 Kb.

Do'stlaringiz bilan baham:




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