This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| /* | |
| Створити масив на 10 елементів | |
| Заповнити його випадковими значеннями в діапазоні [-20;20] | |
| Вивести масив у консоль | |
| Порахувати суму елементів масива та вивести у консоль |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| /* | |
| 1) Створити масив на N(константа) елементів типа int | |
| Нагенерувати в нього значення, діапазон[-10, 10]. | |
| Порахувати та вивести у консоль : | |
| a) Кількість парних елементів | |
| b) Кількість елементів менше 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| /* | |
| Створити масив одновимірний статичний на 10 елементів | |
| Заповнити його випадковими значеннями з діапазону [-100, 100] | |
| 1) Вивести його елементи у консоль | |
| 2) Вивести його у зворотньому порядку |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| /* | |
| Task 1. Ввести цілочисельний масив, що складається з 10 елементів. | |
| Визначити суму та кількість елементів, розташованих до першого від'ємного числа | |
| Task 2. Ввести цілочисельний масив, що складається з 10 елементів. Порахувати суму | |
| всіх парних за значенням елементів та замінити цією сумою всі елементи зі значенням 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| /* | |
| 1) Напишіть програму, яка виконує поелементну суму двох масивів і результат заносить у третій масив. Розмір масиву 10 елементів | |
| Елементи масивів можна згенерувати в довільному діапазоні. | |
| 2) Написати програму, що копіює послідовно елементи одного масиву розміром 10 елементів у 2 масиви розміром 5 елементів кожен. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| /* | |
| Тема: Алгоритми сортування. | |
| Сформуйте масив на 15 елементів, рандомно треба заповнити його значеннями в діапазоні [-30, 30] | |
| Перевірте чи є він відсортованим, якщо ні відсортуйте масив у порядку спадіння алгоритмом бульбашкового сортування. | |
| Виведіть максимальний та мінамальний елемент цього масиву |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| /* | |
| Тема: Алгоритми сортування. | |
| Створити масив arrTotal на 12 елементів типа int та нагенеруйте у нього випадкові значення у діапазоні [-10,10], | |
| Створити два масива по 6 елементів - arrAsc, arrDesc (без значень). | |
| Відсортуйте першу половину першого масива у порядку зростання та запишіть його у відповідні елементи масива arrAsc, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| /* | |
| Тема: Бінарний пошук. | |
| Створити масив на 12 елементів типа int, який відсортований у порядку спадіння (від більшого до меньшого) | |
| Реалізувати бінарний пошук значення search (запитати у користувача) у даному масиві | |
| */ | |
| int main() { | |
| const int SIZE = 12; | |
| int arr[SIZE] = { 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 5, 0 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| /* | |
| Тема: Алгоритми сортування. | |
| Сформуйте масив на 1000 елементів, рандомно треба заповнити його значеннями в діапазоні [-30, 30] | |
| Посортувати його трьома алгоритмами сортування: | |
| 1) Stupid Sort | |
| 2) Gnome Sort | |
| 3) Bubble Sort | |
| Вивести статистику у консоль: за скільки ітерації було здійснено сортування цими різними алгоритмами |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream>; | |
| using namespace std; | |
| int main() | |
| { | |
| int const SIZE = 9; | |
| int arr[SIZE] = {}; | |
| cout << "Enter the first number of arr: "; | |
| cin >> arr[0]; | |
| for (int i = 1; i < SIZE; i++) | |
| { |