initial commit

This commit is contained in:
2026-02-25 18:09:22 +03:00
commit c8f7782552
16 changed files with 622 additions and 0 deletions

11
include/LAB1.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef LAB1_H
#define LAB1_H
#include "shared.h"
double y(double x);
double z(double v, double w);
void lab_1();
#endif

8
include/LAB2.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef LAB2_H
#define LAB2_H
#include "shared.h"
void lab_2();
#endif

24
include/LAB3.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef LAB3_H
#define LAB3_H
#include <stdint.h>
#include "shared.h"
typedef struct
{
double x;
} Context;
typedef double (IterFn)(double, uint32_t);
typedef double (LoopFn)(Context* ctx, uint32_t, uint32_t max, IterFn* iter_fn);
double iter_fn(double x, uint32_t i);
double for_fn(Context* ctx, uint32_t min, uint32_t max, IterFn* iter_fn);
double while_fn(Context* ctx, uint32_t min, uint32_t max, IterFn* fiter_fn);
double do_while_fn(Context* ctx, uint32_t min, uint32_t max, IterFn* iter_fn);
void lab_3();
#endif

8
include/LAB4.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef LAB4_H
#define LAB4_H
#include "shared.h"
void lab_4();
#endif

8
include/LAB5.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef LAB5_H
#define LAB5_H
#include "shared.h"
void lab_5();
#endif

30
include/LAB6.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef LAB6_H
#define LAB6_H
#include <stddef.h>
#include <stdint.h>
#include "shared.h"
typedef struct {
char* name;
int32_t* ptr;
size_t size;
} ArrayI32;
void read_array(ArrayI32* a);
void print_array(ArrayI32* a);
void swap_indices(ArrayI32* array, size_t a, size_t b);
void swap_sign(ArrayI32* a);
size_t positive_count(ArrayI32* a);
size_t min_element_index(ArrayI32* a);
size_t max_element_index(ArrayI32* a);
ArrayI32 make_an_array(char* name, size_t size);
void lab_6();
#endif

11
include/shared.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef SHARED_H
#define SHARED_H
#define READ_EXACT(t, out) do { \
if (scanf((t), &(out)) == 1) break; \
printf("Incorrect input for " #out ", try again: "); \
while (getchar() != '\n'); \
} \
while (1) \
#endif