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> | |
#define MAX_SIZE 1024 | |
int main() | |
{ |
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 <unistd.h> | |
#include "malloc.v3.h" | |
// Установка охранника в начало пока пустой кучи | |
// | |
MemoryAllocator::MemoryAllocator() | |
{ | |
oldBrk = sbrk(0); // сохраняем первоначальную позицию границы | |
start = (MemoryBlock*) sbrk(sizeof(MemoryBlock)); // двигаем границу секции .data (статики) на размер охранника |
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
// author: Roman Tereshin | |
// email: [email protected] | |
// hw 05, task 02 | |
// По содержимому памяти вывести значение типа float в экспоненциальной | |
// форме: | |
// sm*q^(Sp), где s -- знак мантиссы, m -- мантисса, q -- основание системы | |
// счисления, S -- знак порядка, p -- порядок числа. |
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
// Реализация не-inline методов класса. Для обращения к внутреннему пространству имен класса необходимо | |
// использовать оператор разрешения области видимости имен :: с предваряющим его именем | |
// класса. | |
#include "intarray.h" | |
IntArray::IntArray(int n) : | |
m_size(n), // Инициализация полей класса методом прямого | |
m_array(new int[n]) // ... вызова конструкторов этих полей (встроенные | |
{ // ... типы в C++ тоже имеют свои конструкторы) |
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
SOURCES += \ | |
main.cpp | |
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
/* Это второй листинг из серии. Первый смотрите здесь: https://gist.github.com/1322950 */ | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <stdexcept> | |
#include "polish_tree.h" | |
using namespace std; |
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; | |
int main(void) | |
{ | |
return 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 <stdio.h> | |
void printFibb(int counter, unsigned long long prevFibb, unsigned long long prevPrevFibb) | |
{ | |
if (prevFibb == 1) | |
{ | |
printf("1 1 "); | |
counter = counter - 2; | |
} |
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> | |
void printFibb(int counter, int prevFibb, int prevPrevFibb) | |
{ | |
if (prevFibb == 1) | |
{ | |
printf("1 1 "); | |
counter = counter - 2; | |
} |
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 <cstdio> | |
const int n = 1024; | |
void qsort(int *array, int begin, int end) | |
{ | |
int middle = (begin + end) / 2; // Расчет опорного элемента как арифметического среднего | |
int base = (array[begin] + array[middle] + array[end]) / 3; // ... первого, центрального и последнего элементов | |
int left = begin; // истинные границы отрезка массива нужно помнить для продолжения работы при нестолкновении |
OlderNewer