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
//Reverse characters in a string: | |
void reverse(char* s) | |
{ | |
int i; | |
char temp; | |
size_t l = strlen(s); | |
for (i = 0; i < (l/2); ++i) { | |
temp = s[i]; | |
s[i] = s[l - i]; |
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 <stdio.h> | |
#include <stdlib.h> | |
struct DoubleLinkedListItem //item of linked list | |
{ | |
int field; | |
struct DoubleLinkedListItem *p_prev; | |
struct DoubleLinkedListItem *p_next; | |
}; |
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 <stdio.h> | |
typedef void (*func_handler)(int *p_arr_item); //typedef for user defined function | |
void func_for_processing_array(int arr[], size_t arr_size, func_handler h); | |
void do_something_with_item(int *p_item); | |
int main(int argc, char **argv) | |
{ | |
int test_arr[] = {23, 32, 43, 54, 2, 86, 90}; |
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
Queries for create all needed tables: | |
create table if not exists customers(customer_id integer primary key, customer_login text, customer_name text, unique(customer_login)) | |
create table if not exists goods(good_id integer, good_description text, unique(good_id)) | |
create table if not exists orders(order_id integer primary key, customer_id integer, good_id integer, unique(order_id, customer_id, good_id)) | |
Queries to populate tables: | |
insert into customers(customer_login, customer_name) values("user_login1", "customer_name1") | |
insert into customers(customer_login, customer_name) values("user_login2", "customer_name2") |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define ALIAS_QUANTITY 10 | |
struct aliasID | |
{ | |
char* alias; /* '\0'-terminated C string */ | |
int specific_id; |
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; | |
// 1. "lowest common denom" | |
class Widget | |
{ | |
public: | |
virtual void draw() = 0; | |
}; |
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
class Subject | |
{ | |
public: | |
virtual void execute() = 0; | |
}; | |
class RealSubject: public Subject | |
{ | |
string str; | |
public: |
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 <vector> | |
using namespace std; | |
class Component | |
{ | |
public: | |
virtual void traverse() = 0; | |
}; |
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 <string.h> | |
class Thousand; | |
class Hundred; | |
class Ten; | |
class One; | |
class RNInterpreter | |
{ |
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; | |
class Base | |
{ | |
void a() | |
{ | |
cout << "a "; | |
} | |
void c() |