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 <stdlib.h> | |
#include <alut.h> | |
const unsigned NUM_BUFFERS = 1; | |
const unsigned NUM_SOURCES = 1; | |
int main(int argc, char* argv[]) | |
{ | |
/* Sound buffer variable */ |
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
#inlcude <iostream> | |
#include <fstream> | |
int main(void) | |
{ | |
std::ifstream file; | |
/* Read file */ | |
file.open("file.txt", std::ios::in); | |
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> | |
int main(void) | |
{ | |
int x = rand(); | |
std::cout << "Generated number: " << x << std::endl; | |
/* Count maximal odd divisor */ | |
x /= x & -x; | |
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> | |
int main(void) | |
{ | |
int i; | |
std::cin >> i; // Enter from keyboard e.g. the characters string 'hello' | |
if (std::cin.fail()) | |
{ | |
std::cin.clear(); |
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
--style=allman | |
--indent=spaces=4 | |
--indent-switches | |
--min-conditional-indent=0 | |
--align-pointer=type | |
--align-reference=type | |
--max-code-length=120 | |
--break-blocks | |
--pad-oper | |
--pad-header |
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> | |
int n = 0; | |
int* arr; | |
void swap(int* arr, int a, int b) | |
{ | |
int c = arr[a]; | |
arr[a] = arr[b]; |
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> | |
int n = 0; | |
int m = 0; | |
int* arr; | |
void increse(int index) | |
{ | |
if (!(index < n)) |
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 Str | |
{ | |
public: | |
Str(); | |
Str(const char* src); | |
~Str(); | |
Str(const Str& that); | |
Str& operator= (const Str& that); |
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> | |
#include <functional> | |
template <class T> | |
inline void hash_combined(std::size_t& res, const T& val) | |
{ | |
std::hash<T> h; | |
res ^= h(val) + 0x9e3779b9 + (res << 6) + (res >> 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 <iostream> | |
#include <bitset> | |
struct bitarr | |
{ | |
bitarr(unsigned char v) : val(v) {} | |
void print() | |
{ | |
std::bitset<8 * sizeof(unsigned char)> bits(val); |
OlderNewer