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
// utils.jsx: | |
export function add(a, b) { return a + b; } | |
export function subtract(a, b) { return a - b; } | |
export const PI = 3.14; | |
// another file | |
import { add } from './utils'; // импортируем только add | |
import { add, subtract, PI } from './utils'; // импортируем всё | |
// именованные экспорты — лучший выбор по умолчанию. |
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> | |
#include <windows.h> | |
#include <string> | |
using namespace std; | |
// структура товарів | |
struct Product { | |
int id; | |
char name[50]; | |
float price; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<h1>Демонстрация работы с массивами</h1> | |
<p id="output"></p> | |
<p id="output2"></p> |
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
Задание 1 | |
Создать массив из 10 случайных чисел и написать несколько функций для работы с ним. | |
Функция принимает массив и выводит его на экран. | |
Функция принимает массив и выводит только четные элементы. | |
Функция принимает массив и возвращает сумму всех элементов массива. | |
Функция принимает массив и возвращает его максимальный элемент. | |
Функция добавления нового элемента в массив по указанному индексу. | |
Функция удаления элемента из массива по указанному индексу. |
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
// Task 1 | |
// Создать объект, описывающий прямоугольник (хранит координаты левой верхней и правой нижней точек), | |
// и написать следующие функции, для работы с таким объектом. | |
// 1. Функция принимает объект-прямоугольник и выводит информацию о нем (где какая точка расположена). | |
// 2. Функция принимает объект-прямоугольник и возвращает его ширину. | |
// 3. Функция принимает объект-прямоугольник и возвращает его высоту. | |
// 4. Функция принимает объект-прямоугольник и возвращает его площадь. | |
// 5. Функция изменения ширины прямоугольника. Она принимает объект-прямоугольник и на сколько единиц изменить ширину. | |
let rectangle = { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<script> | |
// Task 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" href="public/style.css"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>WS playground</title> | |
<link rel="stylesheet" href="/style.css"> | |
</head> | |
<body> |
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
/* | |
ПРАКТИЧНИЙ ПРОЄКТ (чернетка) | |
з дисципліни "Програмування з використанням мови C++" | |
(процедурна частина) | |
Двовимірна гра "ТЕТРІС" | |
Виконав студент гр. СПР411 |
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; | |
void delete_element_at_the_end_of_array(int** ar, int* size) { | |
int* temp = new int[*size - 1]; | |
for (int i = 0; i < *size - 1; i++) | |
temp[i] = (*ar)[i]; | |
delete[] *ar; | |
*ar = temp; | |
--(*size); |
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
Написать функцию, которая принимает 2 числа и возвращает -1, если первое меньше чем второе, 1 — если первое больше чем второе и 0 — если числа равны. | |
const number = function (a,b) | |
{ | |
if(a<b) return -1; | |
if(a>b) return 1; | |
return 0; | |
} | |
console.log(number(1,2)); |