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
--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 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
#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
#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> | |
#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 */ |
NewerOlder