My vector = {1, 2, 3, 4, 5}; // Vectordagi elementlarni tasodifiy tartibda joylashtirish
Download 142.17 Kb.
|
Dashturlash amaliy 16
1.masala #include #include #include int main() { std::vector // Vectordagi elementlarni tasodifiy tartibda joylashtirish std::random_shuffle(my_vector.begin(), my_vector.end()); // Shuffle funksiyasi natijasini ekranga chiqarish for (int i = 0; i < my_vector.size(); i++) { std::cout << my_vector[i] << " "; } std::cout << std::endl; return 0; } 2.masala #include #include #include int main() { std::deque // Dequedagi elementlarni tasodifiy tartibda joylashtirish std::random_shuffle(my_deque.begin(), my_deque.end()); // Shuffle funksiyasi natijasini ekranga chiqarish for (int i = 0; i < my_deque.size(); i++) { std::cout << my_deque[i] << " "; } std::cout << std::endl; return 0; } 3.masala
#include #include int main() { std::deque // Dequedagi elementlarni tasodifiy tartibda joylashtirish std::random_shuffle(my_deque.begin(), my_deque.end()); // Shuffle funksiyasi natijasini ekranga chiqarish std::deque for (it = my_deque.begin(); it != my_deque.end(); ++it) { std::cout << *it << " "; } std::cout << std::endl; return 0; } Download 142.17 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling