[ create a new paste ] login | about

k06a

Name: k06a
Email:
Site/Blog: http://k06a.blogspot.com/
Location: Russia::Moscow
Default language: C++
Favorite languages: C/C++ (+Qt), Java, Pascal, ASM, C#
About:

Saved pastes by k06a:

C++, pasted on Dec 17:
1
2
3
4
int main()
{
    printf("%d", (32 << 26) >> 26);
}
view (4 lines, 1 line of output)
C++, pasted on Jan 26:
1
2
3
4
5
#include <iostream>

int g(int n)
{
    return (n == 0) ? 0 : g(n-1)+n+n-1;
...
view (13 lines, 3 lines of output)
C++, pasted on Jan 26:
1
2
3
4
5
#include <iostream>

int f(int n)
{
    return (n == 1) ? n : n+f(n-2);
...
view (18 lines, 3 lines of output)
C, pasted on Aug 18:
1
2
3
4
5
// Copyright 2013 (c) Anton Bukov - https://github.com/k06a
// Inspired by http://graphics.stanford.edu/~seander/bithacks.html

#define P0(a) (a)
#define P1(a) (((P0(a) & 0x55555555) <<  1) | ((P0(a) & 0xAAAAAAAA) >>  1))
...
view (20 lines, 1 line of output)
C++, pasted on Apr 4:
1
2
3
4
#include <map>
#include <string>
#include <vector>
#include <iostream>
...
view (22 lines, 4 lines of output)
C, pasted on Apr 20:
1
2
3
4
5
int main()
{
    double (*arr)[5248] = malloc(sizeof(*arr) * 5248);
    arr[0][0] = 1;
}
view (5 lines, 1 line of output)
C++, pasted on Nov 30:
1
2
3
4
5
template<typename R, typename F> 
class WhereRange
{
    WhereRange(R r, F & f)
        : r(r), f(f)
...
view (41 lines)
C++, pasted on Nov 12:
1
2
3
4
5
#include <map>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
...
view (55 lines, 20 lines of output)
C++, pasted on Nov 12:
1
2
3
4
5
#include <map>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
...
view (52 lines, 9 lines of output)
C++, pasted on Nov 12:
1
2
3
4
5
#include <map>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
...
view (51 lines, 87 lines of output)
C++, pasted on Oct 13:
1
2
3
4
#include <iostream>
#include <vector>

using namespace std;
...
view (31 lines, 12 lines of output)
Plain Text, pasted on Jun 16:
1
2
3
4
5
; Swirl by k06a
; Dedicated to my wife 9ka
org   100h
; [106h] == 0

...
view (205 lines)
C++, pasted on Jun 16:
1
2
3
4
// Karatsuba multiplication LE+BE (+undef) (only 3 mul!)

#include <stdlib.h>
#include <iostream>
...
view (138 lines, 1 line of output)
C++, pasted on Jun 16:
1
2
3
4
// Karatsuba multiplication example (+undef)

#include <stdlib.h>
#include <iostream>
...
view (85 lines, 1 line of output)
C++, pasted on Jun 16:
1
2
3
4
// Karatsuba multiplication LE+BE (+undef)

#include <stdlib.h>
#include <iostream>
...
view (132 lines, 1 line of output)
C++, pasted on Jun 16:
1
2
3
4
// Karatsuba multiplication example (+undef)

#include <stdlib.h>
#include <iostream>
...
view (82 lines, 1 line of output)
C++, pasted on Jun 15:
1
2
3
4
// Karatsuba multiplication example

#include <stdlib.h>
#include <iostream>
...
view (131 lines, 1 line of output)
C++, pasted on Jun 15:
1
2
3
4
// Karatsuba multiplication example

#include <stdlib.h>
#include <iostream>
...
view (81 lines, 1 line of output)
C, pasted on Jun 15:
1
2
3
4
5
@rem BatChat
@echo off
cls
pushd "%~dp0"
echo Current DIR: "%CD%"
...
view (81 lines, 40 comments)
C++, pasted on Jun 15:
1
2
3
4
5
// Bit_iterator demonstration fixed

#include <iostream>
#include <fstream>
#include <iterator>
...
view (71 lines, 1 line of output)
C++, pasted on Jun 14:
1
2
3
4
5
// LittleBigEndian.h fixed for 64-bits added union
//

#ifndef LITTLEBIGENDIAN_H
#define LITTLEBIGENDIAN_H
...
view (251 lines, 2 lines of output, 1 comment)
C++, pasted on Jun 14:
1
2
3
4
5
// Bit_iterator demonstration

#include <iostream>
#include <fstream>
#include <iterator>
...
view (56 lines, 1 line of output)
C++, pasted on Jun 14:
1
2
3
4
5
// LittleBigEndian.h fixed for 64-bits added union
//

#ifndef LITTLEBIGENDIAN_H
#define LITTLEBIGENDIAN_H
...
view (258 lines, 2 lines of output)
C++, pasted on Jun 14:
1
2
3
4
// LittleBigEndian time-test

#include <stdint.h>
//#include <netinet/in.h>
...
view (143 lines, 3 lines of output)
C++, pasted on Jun 14:
1
2
3
4
5
// LittleBigEndian.h fixed for 64-bits
//

#ifndef LITTLEBIGENDIAN_H
#define LITTLEBIGENDIAN_H
...
view (252 lines, 2 lines of output)
C++, pasted on Jun 14:
1
2
3
4
// LittleBigEndianNames.h
//

#include "LittleBigEndian.h"
...
view (60 lines)
C++, pasted on Jun 14:
1
2
3
4
5
// LittleBigEndian.h
//

#ifndef LITTLEBIGENDIAN_H
#define LITTLEBIGENDIAN_H
...
view (252 lines)
C++, pasted on Jun 14:
1
2
3
4
// Desorting with lambda

#include <vector>
#include <algorithm>
...
view (39 lines)
C++, pasted on Jun 14:
1
2
3
4
// Desorting with static member and operator

#include <vector>
#include <algorithm>
...
view (43 lines)
C++, pasted on Jun 14:
1
2
3
4
// Desorting with static member and functor

#include <vector>
#include <algorithm>
...
view (43 lines)
C++, pasted on Jun 13:
1
2
3
4
5
//
// Interfaces grouping (with combinations) concept demonstration
// 

// ------------------------------------------------
...
view (171 lines, 3 lines of output)
C++, pasted on Jun 11:
1
2
3
4
5
//
// Interfaces grouping concept demonstration
// 

// ------------------------------------------------
...
view (135 lines, 3 lines of output)
C++, pasted on May 15:
1
2
3
4
#include <iostream>
#include <algorithm>

using namespace std;
...
view (63 lines, 1 line of output)
C++, pasted on May 14:
1
2
3
4
5
#include <iostream>
#include <fstream>
#include <iterator>

using namespace std;
...
view (53 lines, 1 line of output)
C++, pasted on Apr 26:
1
2
3
4
5
#include <iostream>

using namespace std;

bool isValidHorseMove(const char * m) // "A1-B3"
...
view (70 lines, 3 lines of output)
C++, pasted on Apr 26:
1
2
3
4
5
#include <iostream>

using namespace std;

bool isValidHorseMove(const char * m) // "A1-B3"
...
view (59 lines, 2 lines of output)
C++, pasted on Apr 21:
1
2
3
4
5
int main()
{
   printf("0x%x\n", (unsigned int)"hello 1");
   printf("0x%x\n", (unsigned int)"hello 2");
   printf("0x%x\n", (unsigned int)"hello 1");
...
view (7 lines, 4 lines of output, 1 comment)
C++, pasted on Apr 16:
1
2
3
4
5
////////////////////////////////

class A
{
public:
...
view (93 lines)
C++, pasted on Apr 16:
1
2
3
4
5
class A
{
public:
    virtual ~A() {}
    virtual void funcA1() = 0;
...
view (73 lines, 1 comment)
C++, pasted on Mar 27:
1
2
3
4
5
#include <memory>

class A;
class B;
typedef std::tr1::shared_ptr<A> APtr;
...
view (22 lines, 2 lines of output, 2 comments)
C++, pasted on Nov 8:
1
2
3
4
#ifndef NETTYPES_H
#define NETTYPES_H

#include <stdint.h>
...
view (217 lines)
C++, pasted on Nov 8:
1
2
3
4
5
#ifndef NETTYPES_H
#define NETTYPES_H

namespace netheader
{
...
view (132 lines)
C++, pasted on Nov 4:
1
2
3
4
5
template<typename T>
struct param
{
   T n;
   param(T t) : n(t) {}
...
view (30 lines)
C++, pasted on Oct 13:
1
2
3
4
5
void MainWindow::on_pushButton_options_clicked()
{
   if (ui->groupBox_options->isVisible())
   {
      ui->groupBox_options->setVisible(false);
...
view (10 lines, 2 comments)
C++, pasted on Jul 6:
1
2
3
4
5
#include <iostream>

using namespace std;

// ------------------------------------------------
...
view (73 lines)
C++, pasted on Jul 4:
1
2
3
4
5
#include <iostream>

using namespace std;

// ------------------------------------------------
...
view (66 lines, 5 lines of output, 2 comments)
C++, pasted on Jun 6:
1
2
3
4
5
#include <stdio.h>

// C(k,n)
int func(int k, int n)
{
...
view (15 lines, 1 line of output)
C++, pasted on May 17:
1
2
3
4
5
#include <windows.h>
#include <iostream>

const int ARRAY_LENGTH = 10;
const int NUM_OF_THREADS = 10;
...
view (50 lines)
C++, pasted on Apr 27:
1
2
3
4
5
// C#
// search array "item" in array "buffer"
private int findSubArray(byte[] buffer, byte[] str)
{
	for (int i = 0; i < buffer.Length; i++)
...
view (16 lines)
C++, pasted on Apr 20:
1
2
3
4
5
ip_addr getStructByIp(QString value)
{
   QStringList list = value.split(".", QString::SkipEmptyParts);

   ip_addr ip;
...
view (24 lines)
C++, pasted on Apr 20:
1
2
3
4
5
ip_addr getStructByIp(QString value)
{
   QStringList list = value.split(".", QString::SkipEmptyParts);

   ip_addr ip;
...
view (15 lines)
C, pasted on Apr 4:
1
2
3
4
int main()
{
   // Указатель на начало пакета
   char *ptr = "227 Entering Passive Mode (195,114,128,23,255,127)";
...
view (32 lines, 1 line of output, 1 comment)
C++, pasted on Mar 17:
1
2
3
4
#include <iostream>

// Generate first value
#define generateFirstValue(n,k) ( ((1 << k) - 1) << (n - k) )
...
view (73 lines, 15 lines of output)
Plain Text, pasted on Nov 30:
1
2
3
4
5
; В регистр DX необходимо положить
; эквивалент расстояния до точки.
; Вычисляем: (ax*ax)+(cx*cx)
push ax
push bx
...
view (18 lines, 10 comments)
C++, pasted on Nov 25:
1
2
3
4
5
// Задание 2.1
#include <stdio.h>

int CycleShift(int a, int b)
{
...
view (122 lines, 2 lines of output)