Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
using namespace std;
void findMinMax(int arr[], int size) {
int minVal = arr[0], maxVal = arr[0];
int minIndex = 0, maxIndex = 0;
for (int i = 1; i < size; i++) {
#include <iostream>
#include <map>
using namespace std;
enum Menu {
EXIT = 0,
PLUS = 101,
MINUS,
DIVIDE,
#include <iostream>
#include <limits>
using namespace std;
int max_value(int a, int b) {
return (a > b) ? a : b;
}
int max_value(int a, int b, int c) {
#include <iostream>
using namespace std;
void shuffleArray(int arr[], int size)
{
for (int i = size - 1; i > 0; i--)
{
int j = rand() % (i + 1);
int temp = arr[i];
arr[i] = arr[j];
#include <iostream>
#include <cmath>
// 1. Функція my_increment
void my_increment(int* ptr, int n = 1) {
if (ptr) {
*ptr += n;
}
}
1)
#include <iostream>
void calculateSumAndProduct(int* arr, int size, int* sum, int* product) {
*sum = 0;
*product = 1;
for (int i = 0; i < size; ++i) {
*sum += arr[i];
*product *= arr[i];
1)
#include <iostream>
using namespace std;
double add(double a, double b) { return a + b; }
double subtract(double a, double b) { return a - b; }
double multiply(double a, double b) { return a * b; }
double divide(double a, double b) { return b != 0 ? a / b : 0; }
int main() {
1)
#include <iostream>
using namespace std;
int* createArray(int size) {
return new int[size];
}
void fillArray(int* arr, int size) {
cout << "Введіть " << size << " елементів:\n";
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
// Порахувати кількість цифр у рядку
int countDigits(const char* str) {
int count = 0;
while (*str) {
1)
#include <iostream>
int main() {
char arr[11];
std::cout << "Введіть рядок з 10 латинських маленьких літер: ";
std::cin >> arr;
int length = 0;