Compare commits

..

36 Commits

Author SHA1 Message Date
Костя 76779576ff add new 2025-07-03 18:45:55 +03:00
Костя 6f44e6a0f8 add finale code Less_1_5 2025-07-03 18:03:26 +03:00
Костя dba600406a add deleted no actual code 2025-07-03 16:36:23 +03:00
Костя ef7410dd10 add cycle automation 2025-07-02 19:30:35 +03:00
Костя 6428289c60 add first result 2025-07-02 18:05:35 +03:00
Костя cd986463d6 add massive and cucle for 2025-07-02 16:30:24 +03:00
Костя 31957f0af5 add comment and massive code 2025-07-02 11:44:06 +03:00
Костя 7823885587 add first start function 2025-07-02 11:31:19 +03:00
Костя ca5807d864 add new 2025-07-02 11:17:13 +03:00
Костя 8cd0772025 add fuction 2025-07-02 11:09:30 +03:00
Костя 507e1f5106 add comment 2025-07-02 10:22:01 +03:00
Костя 0773b73f34 adde new code lesson 2025-07-01 12:59:21 +03:00
Костя 450c6d746b commit 1 2025-07-01 12:56:43 +03:00
Костя 499b3c97bc add FINAL Less 1_4 2025-07-01 12:38:42 +03:00
Костя 6e22791d14 add corrected the comment 2025-07-01 12:21:19 +03:00
Костя 56ae848aee add new result with whitespace betwin 1 and 2tw elements 2025-07-01 12:13:43 +03:00
Костя 706feb8bd6 add new result without FIRST element 2025-07-01 12:08:39 +03:00
Костя 1139f8acbd add static result 2025-07-01 11:26:12 +03:00
Костя 30be821446 add console.log(`============`); 2025-07-01 08:08:42 +03:00
Костя d10df6e533 add new experiment 2025-06-30 19:56:25 +03:00
Костя 417acb8e4b add 1 2025-06-30 18:37:33 +03:00
Костя 5bef125273 add start lesson 1_4 2025-06-30 14:33:52 +03:00
Костя 3071bb4746 add commment for lesson 2025-06-30 14:11:54 +03:00
Костя 94e33222b2 add start lesson 1.4 2025-06-30 14:10:02 +03:00
Костя 7e7301b1ab add start 1.4. X-MAS TREE 2025-06-29 10:48:07 +03:00
Костя abc5eecbe6 add 2025-06-29 10:39:01 +03:00
Костя b3d2bbb9da add lesson IPAM .3. ANOTHER TRIANGLE 2025-06-29 10:09:51 +03:00
Костя edfa057838 test 1 2025-06-27 15:02:55 +03:00
Костя 68be4c01bf add 2025-06-27 13:27:09 +03:00
Костя b0eb9c869a add index +1 2025-06-27 13:20:23 +03:00
Костя 03c74d8769 add 2025-06-27 13:15:33 +03:00
DESKTOP-8HAFCLV\Yugr 5509a95a6e added cycle while 2025-06-27 13:58:54 +04:00
DESKTOP-8HAFCLV\Yugr 5293c1ee31 Added debug launch 2025-06-27 13:17:16 +04:00
Костя 7f67cd98ca add new value for chisloP 2025-06-26 20:39:31 +03:00
DESKTOP-8HAFCLV\Yugr 16cc913cad Lesson 1.2 complete 2025-06-26 21:11:50 +04:00
DESKTOP-8HAFCLV\Yugr 4f1310bbcf Added input function 2025-06-26 16:31:26 +04:00
6 changed files with 102 additions and 129 deletions

22
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\src\\index.ts",
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"preLaunchTask": "build_backend"
}
]
}

12
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build_backend",
"type": "npm",
"script": "build",
"path": "/",
"problemMatcher": []
}
]
}

View File

@ -1,137 +1,56 @@
//*****************************************************************
//#################### Обучение ЦИКЛАМ ##########################
// ########################## УЧЕБНЫЙ ТЕКСТ ############################################################
//******************************************************************************************************
interface People {
name: string;
age: number | undefined;
}
//lesson 1.5 SUM OF NUMBERS
let people01: People = {
name: "Kostya",
age: undefined
};
//## ЗАДАЧА ##
//Если выписать все натуральные числа меньше 10, кратные 3, или 5, то получим 3, 5, 6 и 9.
//Сумма этих чисел будет равна 23.
//Напишите программу, которая выводит на экран сумму всех чисел меньше 1000, кратных 3, или 5.
let people02: People = {
name: "Yura",
age: 32
}
//#1 натуральное число от 1 до 10 (числа которые
//#2 Натуральные числа (от лат. naturalis — «естественный») — числа, возникающие естественным образом при счёте. Примеры: 1, 2, 3, 4, 5, 6, 7 и)
//#3 Числа, кратные 3, или 5 — это числа, которые делятся на 3 или на 5 без остатка.
people01.age = 60;
// console.log(people01);
// console.log(JSON.stringify(people01));
// console.log(people01.age);
console.log(`${people01.name} имеет возраст ${people01?.age ?? '40'}`); //Kostya --- 60
console.log(`${people02.name} имеет возраст ${people02?.age ?? '40'}`); //Yura --- 32
console.log(`${people01.name} имеет возраст ${people02?.age ?? '40'}`);
//Реализация
//через условие - if cделать выборку (перебор/фильтр массива) по условию, где будет кратное 3 или 5.
//Создать массив
//Заполнить массив через цикл for числами от 1 до 10.
//Полученные цифры в результате выборки массива сложить и вывести результат сложения на экран.
interface PeopleLocation extends People {
location: string;
}
// && - AND
// || - OR
// !
let peopleLocation01: PeopleLocation = {
name: "djdf",
age: 42342,
location: "dafdf"
}
class ProcessingPeoples implements PeopleLocation {
name: string;
age: number | undefined;
location: string = '';
function analise (chislo: number){
//let funcres = chislo;
//console.log(`предварительное число ${chislo} = ${chislo % 3}`);
//if (chislo / 3 == 1 || chislo / 3 == 2 || chislo / 3 == 3 || chislo / 3 == 4 || chislo / 5 == 1 ){ //пример кода статичный
//if (chislo % 3 ==0 || chislo % 5 ==0){ //условие если переменная chislo делиться на 3 то вывод на экран и в массив
//как нам проверить, или при каком условии мы будет считать, что число кратное тройке???
//Признак делимости на 3: на 3 делятся только те числа, у которых сумма цифр делится на 3.
//Пример: число 81 300 делится на 3, так как сумма его цифр 8 + 1 + 3 + 0 + 0 = 12 делится на 3.
//Например, 15 кратно 3, так как 15 : 3 = 5 (остатка нет).
//let array: number []= [funcres]; //массив
//console.log(array);
//console.log(chislo);
constructor(name: string){
this.name = name;
}
}
let str: string = 'test text';
let proc1 = new ProcessingPeoples(str)
console.log(proc1)
proc1.name = 'new test'
console.log(proc1)
class ProcessingPeoplesExt extends ProcessingPeoples {
isActive: boolean = false;
constructor(name: string, isActive: boolean){
super(name);
if(isActive) {
this.location = 'Gorkyi street';
return chislo % 3 ==0 || chislo % 5 ==0;
}
let p = analise(3);
//console.log(p);
let a = 0;
for(let index = 1; index < 1000; ){
if (analise(index)){
//console.log(index);
a = a + index;
}
else{
this.location = '';
}
}
}
let a: ProcessingPeoples = new ProcessingPeoplesExt("Vasya", true);
class Duck {
type: string = 'Duck';
weight: number = 0;
log(){
console.log("I'm simple duck");
}
}
let Utka: Duck = new Duck();
Utka.log();
interface Eateable {
eat(): void; //пустота, функция ничего не принимает и не возвращает.
}
class GreyDuck extends Duck implements Eateable{ //наследоваться можно от другого класса только один раз, но!! реализация интерфейсов может быть не ограниченно количество раз
constructor() {
super(); // в данном примере, если используется конструктор и при этом этот конструктор наслеедуется от родителя, то мы обязаны вызывать конструктор родителя.
this.type = 'GreyDuck'
}
override log(){
console.log("I'm grey duck");
}
eat(){
console.log("I'm eat");
}
}
class RedDuck extends Duck implements Eateable {
constructor() {
super();
this.type = 'RedDuck'
console.log(`Object created ${this.type}`)
}
eat(): void {
console.log("I'm eat");
}
override log(){
console.log("I'm red duck");
}
}
let duck1 = new RedDuck();
let duck2 = new GreyDuck();
let array: Eateable[] = [
duck1,
duck2
];
let result = array[0]; //мы можем проверить содержание массива с именем array. в квадратных скобках мы указали ноль = это первый эелемент массива.
console.log(`результат содержимого массива${JSON.stringify(result)}`); //вывод на экран
for (let item of array) {
item.eat();
}
let array2: Duck[] = [
duck2,
duck1
];
for (let item of array2) {
item.log();
}
array2.filter(item => "eat" in item); //тестирование не относится к тексту выше
index = index + 1;
break //оператор прерывания цикла (сразуже заканчивает цикл)
}
console.log(`сумма: ${a}`);
//найти формулу (в инете) арифметич. прогрессии и как эту формулу реализовать в коде
// найти как узнать А-n число. "Это число А-n" можно получить циклом в обратной последовательности от 1000 и идти к.

19
src/input.ts Normal file
View File

@ -0,0 +1,19 @@
import readline from 'node:readline';
export function ConsoleInput(text: string): string {
let result: string = '';
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question('Enter something:', value => {
result = value;
rl.close;
});
return result;
}

View File

@ -21,6 +21,7 @@
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
/* Completeness */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
"sourceMap": true
}
}

File diff suppressed because one or more lines are too long