Compare commits

...

13 Commits

Author SHA1 Message Date
Костя 6c9afefa9c add new value = 2025-06-30 18:43:45 +03:00
Костя f3dfc3ba25 add new version code improve result 2025-06-30 14:17:36 +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 96 additions and 116 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,120 +1,46 @@
interface People { //Обучение ЦИКЛАМ
name: string;
age: number | undefined; //lesson 1.3 ANOTHER TRIANGLE
function DrawLine(count: number, countP: number){
const minimalString = '*';
const minimalP = ' ';
let result = minimalP.repeat(countP) + minimalString.repeat(count) //с начала рисуем пробелы (countP) а потом зведочки
console.log(result);
}
let chisloN: number = 3; //эмуляция вводу а с клавиатуры числа N
for(let index = 1; index <= chisloN; ){
//тут нарисовал статично, как должен рисоваться треугольник
//DrawLine(1 , 3);
//DrawLine(3 , 2);
//DrawLine(5 , 1);
DrawLine(index * 2 - 1, chisloN - index);
//DrawLine(1, 2); 1 * 2 - 1
//DrawLine(3, 1); 2 * 2 - 1
//DrawLine(5, 0); 3 * 2 - 1
index = index +1;
} }
let people01: People = { console.log(`===================`);
name: "Kostya",
age: undefined
};
let people02: People = { // ***** ПРИМЕРЫ кода ******
name: "Yura", //chisloN = chisloN -1 // запись каждый раз уменьшает число пробелов (начиная с макс значения N)
age: 32 // let index = 1;
} // while(index <= chisloN) {
// DrawLine(index, chisloN - index);
// // console.log(`*: ${index}, space: ${chisloN - index}`);
// index = index + 1;
// }
people01.age = 60; //let probel: number = 1;
// 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'}`);
interface PeopleLocation extends People { //i++ => i = i + 1
location: string; //i-- => i = i - 1
} //--i => i = i - 1
let peopleLocation01: PeopleLocation = {
name: "djdf",
age: 42342,
location: "dafdf"
}
class ProcessingPeoples implements PeopleLocation {
name: string;
age: number | undefined;
location: string = '';
constructor(name: string){
this.name = name;
}
}
class ProcessingPeoplesExt extends ProcessingPeoples {
isActive: boolean = false;
constructor(name: string, isActive: boolean){
super(name);
if(isActive) {
this.location = 'Gorkyi street';
}
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");
}
}
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'
}
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
];
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);
// for(let i = 0; i < count; i++){
// str = str + '*' // i = 0 => str = '*' // i == 1 => '**' // i = 2 => '***'
// }*/

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. */ "strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
/* Completeness */ /* 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