push
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
*.a
|
||||
*.lib
|
||||
*.o
|
||||
*.obj
|
||||
*.out
|
||||
|
||||
.idea/
|
||||
*~
|
||||
*.DotSettings.user
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
π π£π΄
|
||||
πΌ
|
||||
π£π΄ = 6 m/s πΌ Β° π = 200 g π = 10 m/s
|
||||
2
|
||||
.
|
||||
π = 0,2 N
|
||||
π
|
||||
π π
|
||||
π = ππ
π
|
||||
π£π΄
|
||||
π = 0,1 kg π = 10 m/s
|
||||
2
|
||||
π = 1,6 m π£πΆ = π£π΄ = 3 m/s π Β° π΅πΆ = 2 m
|
||||
A B
|
||||
C
|
||||
Ξ±
|
||||
β
|
||||
β = π(1 β cos π)
|
||||
π£π΅ π π π£π΄ π
|
||||
π π π π΅πΆ
|
||||
β
|
||||
A
|
||||
O
|
||||
B C
|
||||
π
|
||||
π
|
||||
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
#include "calculator.h"
|
||||
|
||||
int calculator(int a, int b, enum operation op)
|
||||
{
|
||||
(void)a;
|
||||
(void)b;
|
||||
(void)op;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef CALCULATOR_H
|
||||
#define CALCULATOR_H
|
||||
|
||||
typedef int (*operator)(int, int);
|
||||
|
||||
enum operation
|
||||
{
|
||||
ADD,
|
||||
SUB,
|
||||
MUL,
|
||||
DIV,
|
||||
MOD,
|
||||
};
|
||||
|
||||
int calculator(int a, int b, enum operation op);
|
||||
|
||||
#endif /* ! CALCULATOR_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "crepe_stream.h"
|
||||
|
||||
#include "toolbox.h"
|
||||
|
||||
struct array *sort_by_prices(struct array *arr)
|
||||
{
|
||||
(void)arr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct array *names(struct array *arr)
|
||||
{
|
||||
(void)arr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct array *vegetarian(struct array *arr)
|
||||
{
|
||||
(void)arr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int total_price(struct array *arr)
|
||||
{
|
||||
(void)arr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_menu(struct array *arr)
|
||||
{
|
||||
(void)arr;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef CREPE_STREAM_H
|
||||
#define CREPE_STREAM_H
|
||||
|
||||
#include "toolbox.h"
|
||||
|
||||
enum dough
|
||||
{
|
||||
WHEAT,
|
||||
BUCKWHEAT,
|
||||
};
|
||||
|
||||
enum topping
|
||||
{
|
||||
NOTHING,
|
||||
|
||||
// Sweet
|
||||
SUGAR,
|
||||
CHOCOLATE,
|
||||
WHIPPED_CREAM,
|
||||
|
||||
// Savory
|
||||
CHEESE,
|
||||
MEAT,
|
||||
EGG,
|
||||
};
|
||||
|
||||
struct crepe
|
||||
{
|
||||
char *name;
|
||||
enum dough dough;
|
||||
enum topping inside;
|
||||
enum topping outside;
|
||||
int price;
|
||||
};
|
||||
|
||||
struct array *sort_by_prices(struct array *arr);
|
||||
struct array *names(struct array *arr);
|
||||
struct array *vegetarian(struct array *arr);
|
||||
int total_price(struct array *arr);
|
||||
void print_menu(struct array *arr);
|
||||
|
||||
#endif /* ! CREPE_STREAM_H */
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef INTRO_H
|
||||
#define INTRO_H
|
||||
|
||||
int compute(int input, int (*executor)(int));
|
||||
void (*greet(char *name))(void);
|
||||
|
||||
#endif /* ! INTRO_H */
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
#include "toolbox.h"
|
||||
|
||||
struct array *sort(struct array *arr, comparator f)
|
||||
{
|
||||
(void)arr;
|
||||
(void)f;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct array *map(struct array *arr, size_t output_size, mapper f)
|
||||
{
|
||||
(void)arr;
|
||||
(void)f;
|
||||
(void)output_size;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct array *filter(struct array *arr, predicate f)
|
||||
{
|
||||
(void)arr;
|
||||
(void)f;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *reduce(struct array *arr, void *start_value, reducer f)
|
||||
{
|
||||
(void)arr;
|
||||
(void)f;
|
||||
(void)start_value;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void foreach(struct array *arr, acceptor f)
|
||||
{
|
||||
(void)arr;
|
||||
(void)f;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef TOOLBOX_H
|
||||
#define TOOLBOX_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef int (*comparator)(void *, void *);
|
||||
typedef void (*mapper)(void *, void *);
|
||||
typedef int (*predicate)(void *);
|
||||
typedef void *(*reducer)(void *, void *);
|
||||
typedef void (*acceptor)(void *);
|
||||
|
||||
struct array
|
||||
{
|
||||
void *data;
|
||||
size_t len;
|
||||
size_t elem_size;
|
||||
};
|
||||
|
||||
struct array *sort(struct array *arr, comparator f);
|
||||
struct array *map(struct array *arr, size_t output_size, mapper f);
|
||||
struct array *filter(struct array *arr, predicate f);
|
||||
void *reduce(struct array *arr, void *start_value, reducer f);
|
||||
void foreach(struct array *arr, acceptor f);
|
||||
|
||||
#endif /* ! TOOLBOX_H */
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "list.h"
|
||||
|
||||
void push_front(struct list **l, void *data, acceptor p, acceptor f)
|
||||
{
|
||||
(void)l;
|
||||
(void)data;
|
||||
(void)p;
|
||||
(void)f;
|
||||
}
|
||||
|
||||
void pop_front(struct list **l)
|
||||
{
|
||||
(void)l;
|
||||
}
|
||||
|
||||
void print_list(struct list *l)
|
||||
{
|
||||
(void)l;
|
||||
}
|
||||
|
||||
void destroy_list(struct list **l)
|
||||
{
|
||||
(void)l;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef LIST_H
|
||||
#define LIST_H
|
||||
|
||||
typedef void (*acceptor)(void*);
|
||||
|
||||
struct list
|
||||
{
|
||||
void *data;
|
||||
struct list *next;
|
||||
acceptor print;
|
||||
acceptor free;
|
||||
};
|
||||
|
||||
void push_front(struct list **l, void *data, acceptor p, acceptor f);
|
||||
void pop_front(struct list **l);
|
||||
void print_list(struct list *l);
|
||||
void destroy_list(struct list **l);
|
||||
|
||||
#endif /* ! LIST_H */
|
||||
@@ -0,0 +1,22 @@
|
||||
#include "visitor.h"
|
||||
|
||||
void visit(struct ast_node *node, visitor v)
|
||||
{
|
||||
(void)node;
|
||||
(void)v;
|
||||
}
|
||||
|
||||
void print_prefix(struct ast_node *node)
|
||||
{
|
||||
(void)node;
|
||||
}
|
||||
|
||||
void print_infix(struct ast_node *node)
|
||||
{
|
||||
(void)node;
|
||||
}
|
||||
|
||||
void print_suffix(struct ast_node *node)
|
||||
{
|
||||
(void)node;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef VISITOR_H
|
||||
#define VISITOR_H
|
||||
|
||||
enum node_type
|
||||
{
|
||||
// 0 operand
|
||||
NUM,
|
||||
|
||||
// 1 operand
|
||||
POS,
|
||||
NEG,
|
||||
|
||||
// 2 operands
|
||||
ADD,
|
||||
SUB,
|
||||
MUL,
|
||||
DIV,
|
||||
MOD,
|
||||
};
|
||||
|
||||
struct ast_node
|
||||
{
|
||||
int value;
|
||||
enum node_type type;
|
||||
struct ast_node *children;
|
||||
};
|
||||
|
||||
typedef void(*visitor)(struct ast_node *);
|
||||
|
||||
void visit(struct ast_node *node, visitor v);
|
||||
|
||||
void print_prefix(struct ast_node *node);
|
||||
void print_infix(struct ast_node *node);
|
||||
void print_suffix(struct ast_node *node);
|
||||
|
||||
#endif /* ! VISITOR_H */
|
||||
Reference in New Issue
Block a user