Skip to content

Instantly share code, notes, and snippets.

QList<QVector<int> > resultContainter;
QVector<int> Calculate(int begin, int end)
{
QVector<int> localResult(30);
for (int i = begin; i < end; ++i)
{
localResult[aData[i]]++;
}
return localResult;
@ArtyomLazyan
ArtyomLazyan / spiralPrint.cpp
Created February 28, 2018 09:33
SpiraPrint
#include <iostream>
const int N = 5;
int count = 1;
void spiralPrint(int end_row, int end_col, int arr[N][N])
{
int start_row = 0, start_col = 0;
while (start_row < end_row && start_col < end_col)
@ArtyomLazyan
ArtyomLazyan / POLYmorphysm.cpp
Created December 8, 2017 16:40
STATIC POLYmorphysm
/* STATIC POLYmorphysm */
#include <iostream>
template<typename T>
class Base
{
public:
void printName()
{
static_cast<T*>(this)->printName();
@ArtyomLazyan
ArtyomLazyan / binarTree.cpp
Created December 6, 2017 11:40
binarTree.cpp
#include <iostream>
#include <vector>
class BinaryList
{
struct tree_node
{
int value;
tree_node *left;
tree_node *right;
@ArtyomLazyan
ArtyomLazyan / fib&fact.cpp
Created November 24, 2017 16:09
Fibonachi and Factorial
#include <iostream>
/* Factorial template implementation */
template <size_t N> struct fact;
template <> struct fact<0>
{
const static size_t value = 1;
};
@ArtyomLazyan
ArtyomLazyan / stack.cpp
Created November 24, 2017 14:42
Stack with templates
#include <iostream>
#include <exception>
template <typename T>
class Stack
{
public:
Stack() : m_top(NULL), m_size(0) {}
@ArtyomLazyan
ArtyomLazyan / Calculator.cpp
Created September 14, 2017 16:44
String Parser (Calculator)
#include <iostream>
void checkWrongExpression()
{
char ch = std::cin.get();
if (ch == '\n')
{
std::cin.putback(ch);
return;
@ArtyomLazyan
ArtyomLazyan / index.html
Created July 31, 2017 12:19
Facebook Log In
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>FaceBook LogIn</title>
<link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.min.css">
<style media="screen">
#fb-btn {
margin-top: 20px;
}
#include <iostream>
#include <cstring>
class MatricFactory
{
public:
int** createArray(int row, int col, int initial = 0)
{
int **arr = new int* [row];
for (int i = 0; i < row; i++)
@ArtyomLazyan
ArtyomLazyan / cookie.php
Created June 26, 2017 10:02
Work With Cookies