This file contains 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 "Event.h" | |
#include <iostream> | |
namespace events { | |
TargetType Event::getTarget() { | |
return target; | |
} | |
std::string Event::getDescription() { |
This file contains 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 <stdlib.h> | |
int main() | |
{ | |
int order; | |
FILE* file = fopen("sample_input.txt", "r"); | |
if (file != NULL) | |
{ |
This file contains 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
cmake_minimum_required(VERSION 3.10) | |
project(Macro) | |
set(CMAKE_CXX_STANDARD 11) | |
add_executable(Macro main.cpp) | |
target_compile_definitions(Macro PUBLIC PATHTOPYTHONSCRIPT=\"${CMAKE_SOURCE_DIR}/bin/postprocessing/extractlinedata.py\") |
This file contains 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 <vector> | |
#include <string> | |
#include <sstream> | |
#include <iterator> | |
int main() | |
{ | |
size_t number_of_rows; | |
std::cout << "Enter the number of rows: "; |
This file contains 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
Object* read(char* str) | |
{ | |
Object* object = (Object*)malloc(sizeof(*object)); | |
object->identity[0] = 0; | |
int capacity = (100 + 1) - (10); | |
// No allocation here object->name = (char*)malloc(capacity * sizeof(*object->name)); | |
object->value = 0.0; | |
int length = strlen(str); | |
if (length > capacity) |
This file contains 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 <vector> | |
#include <algorithm> | |
#include <fstream> | |
#include <iterator> | |
int main() | |
{ | |
std::string filename; | |
std::cout << "Enter filename: "; |
This file contains 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 <limits.h> | |
// Important note: When reading input, something like 123abc is considered | |
// a valid value, and will be read as 123. The non-numeric input will not be | |
// detected immediately. | |
// This is because of how the scanf function works, and can't be solved with | |
// the current limitations (unless we read as a string and attempt to convert | |
// it to a number manually, either through strtol or with our own function | |
// (the atoi function can't be used, it's prone to the same problem)). |
This file contains 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 <vector> | |
#include <sstream> | |
#include <random> | |
#include <fstream> | |
void save_random_data(); | |
void read_random_data(); | |
int main() |
This file contains 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
// This code is in the public domain. I claim no ownership, but also no responsibility. | |
#ifndef POINTER_CONTAINER_H | |
#define POINTER_CONTAINER_H | |
#include <cstddef> // for std::size_t | |
template<typename T> | |
class pointer_container | |
{ |