blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 117 | path stringlengths 3 268 | src_encoding stringclasses 34
values | length_bytes int64 6 4.23M | score float64 2.52 5.19 | int_score int64 3 5 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | text stringlengths 13 4.23M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
088c2673dde6a0317c2daa3434b79f8519227f57 | C++ | wagnerhsu/packt-CPP-Templates-Up-and-Running | /Chapter_3/non_type_ptr.cpp | UTF-8 | 279 | 3.015625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <string.h>
#include <malloc.h>
char *ptr;
template<char * str>
void print_str()
{
std::cout << str << std::endl;
}
int main()
{
ptr = (char *) malloc(256 * sizeof(char));
strcpy(ptr, "Hello World");
print_str<ptr>();
return 0;
}
| true |
ac4079c0587d6220b80bea742134bcfcb307a5ab | C++ | han-s/SW_TEST | /beakjoon/10875.cpp | UTF-8 | 1,554 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<queue>
#include<vector>
int direction[4] = { 0, 1, 2, 3 };
int dx[4] = { 0, -1, 0, 1};
int dy[4] = { -1, 0, 1, 0};
using namespace std;
typedef struct snake
{
int y,x;
char dir;
}snake;
int main(void)
{
long long result =0;
int L, v_temp=0;
queue<snake> q;
cin >> L;
int size = L*2 +... | true |
1bfe359448b07506497438e9ff95423763fda5a4 | C++ | KkukYang/CodingTestStudy | /Project1/Project1/main.cpp | UHC | 31,622 | 3.46875 | 3 | [] | no_license |
/*
//̳ʺ dfs bfs
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
vector<string> solution(vector<vector<string>> tickets) {
vector<string> answer;
sort(tickets.begin(), tickets.end(), greater<vector<string>>());
unordered_map<string, vect... | true |
e8052dd1e9bb022afb91d9d943ddef2f2e1230bc | C++ | ibioesc/Arduino | /arduino/pruebas/motorpaso/motorpaso.ino | UTF-8 | 2,258 | 3 | 3 | [] | no_license | #define VELOCIDAD 2000 //velocidad de giro del motor, cuanto menos valor + velocidad
int pasos = 26; //definimos como «entero» pin digital 13 para dar los pasos al servo
int direccion = 27; //definimos como «entero» pin digital 9 para dar el sentido... | true |
975b73586d1c2cea8da47f8bdf5c87c4a5081162 | C++ | redevilsss/leetcode | /201-250/211 添加与搜索单词.cpp | GB18030 | 2,432 | 3.890625 | 4 | [] | no_license | #include<iostream>
#include<vector>
#include<list>
#include<queue>
using namespace std;
//211
/*
һֲ֧ݽṹ
void addWord(word)
bool search(word)
search(word) ֻʽַַֻĸ . a-z . Աʾκһĸ
ʾ:
addWord("bad")
addWord("dad")
addWord("mad")
search("pad") -> false
search("bad") -> true
search(".ad") -> true
search... | true |
efb33b71973bb7816f0c930c1b2af92980304090 | C++ | finem50/lab8 | /lab8postlab.cpp | UTF-8 | 2,830 | 4.21875 | 4 | [] | no_license | //Rules for calculation will be:
// a/b + c/d = (a*d + b*c) / (b*d)
// a/b - c/d = (a*d - b*c) / (b*d)
// (a/b) * (c/d) = (a*c) / (b*d)
// (a/b) / (c/d) = (a*d) * (c*b)
#include <iostream>
#include <cmath>
using namespace std;
class Rational{
public:
Rational();
Rational(int a, int b, int c, int d); //Four vari... | true |
91cbdc892f45ffc22c2de9d33964bd01eb782954 | C++ | goryanski/cpp | /Completed_tasks/OOP/02/lesson_2.2/lesson_2.2/Array.cpp | UTF-8 | 1,705 | 3.578125 | 4 | [] | no_license | #include "Array.h"
#include<iostream>
using std::cout;
using std::cin;
Array::Array()
{
size = 0;
arr = nullptr;
}
Array::Array(int size)
{
arr = new int[size];
this->size = size;
}
Array::Array(const Array& obj)
{
setArray(obj.arr, obj.size);
}
Array::~Array()
{
delete[] arr;
}
void Array::setArray(int* arr,... | true |
e10f8ec83ad29ff9a394693615330c7c5926af5e | C++ | Mikhail-M/Programming_in_university | /TymofeiBryksin/1 semestr/Homework 5/Task 1/main.cpp | UTF-8 | 929 | 3.34375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
const countAlpha = 26;
void nextWord(int &pos, char *text){
int alpha[countAlpha];
int i = 0;
for (int i = 0; i < countAlpha; i++)
alpha[i] = 0;
for(i = pos; i < strlen(text) && text[i] != ' '; i++)
if(!alpha... | true |
53d0d8b0ab7ff0e3a3d32edb98a6a1ed4bbfcac3 | C++ | twj2417/recon | /PETScanner/DodePET.hh | UTF-8 | 3,017 | 2.875 | 3 | [] | no_license | #ifndef DODEPET_HH
#define DODEPET_HH
/*
* @brief:
* However, this general model will cost much time when given a point and find which crystal it belongs to.
* Thus, the specific scanner (SpherePET, DodePET) are devoloped to sort the crystals in the list according
* to their spatial position. It markablely reduce t... | true |
62411abcafd142890b971eeba01169684e5cdbbe | C++ | detlevVL/MasterThesis | /naminganalysis.cpp | UTF-8 | 1,407 | 2.53125 | 3 | [] | no_license | #include "naminganalysis.h"
NamingAnalysis::NamingAnalysis()
{
}
QMultiHash<QString, QString> NamingAnalysis::analyse(QList<QString> sources, QList<QString> tests, QList<QString> modifiedSources, QList<QString> modifiedTests)
{
QMultiHash<QString, QString> links;
// for each modified source file basename (i... | true |
17bbe2db5fc83c80c394cb1f0e52e76dd7cec056 | C++ | adriaan1539/Bank_data_import | /BankAccountEntry.cpp | UTF-8 | 3,843 | 3.0625 | 3 | [] | no_license | #include "BankAccountEntry.h"
#include "JoinVectorToString.h"
#include <fstream>
#include <iostream>
#include "minicsv.h"
BankAccountEntry::BankAccountEntry()
{
}
BankAccountEntry::BankAccountEntry( unsigned int year,
unsigned int month,
unsigned int day,
std::string nameOrDescription,
... | true |
42f1ab05046a2e07d22a88b7085c11d67b5390b9 | C++ | sergio-eld/simplecs | /include/simplecs/impl/id_pool.h | UTF-8 | 1,001 | 3.234375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <stack>
#include <type_traits>
namespace eld::detail
{
template<typename IdT>
class id_pool
{
public:
using id_type = IdT;
id_type next_available()
{
if (freed_.empty())
return instances_++;
const auto id = freed_... | true |
1693ed2553478338397c531d550f46d3684d79c2 | C++ | hthnguyen/hthnguyen_ws | /WS4/WS4_P1/Saiyan.cpp | UTF-8 | 1,526 | 3 | 3 | [] | no_license | // Student name: Nguyen Hoang Trung Hieu
// Student ID: 142914191
// Section: NBB
// I have done all the coding by myself and only copied the code that my professor provided to complete my workshops and assignments.
#define _CRT_SECURE_NO_WARNINGS
#include "Saiyan.h"
#include<string.h>
#include<iostream>
using ... | true |
cb738bf20522160729ad8159b20dc98651ea8e03 | C++ | alonakorzhnev/sqlink | /C++/String_t/string_main.cpp | UTF-8 | 6,809 | 3.625 | 4 | [] | no_license | #include "string_t.h"
#include <iostream>
#define MAX_LENGTH 64
using namespace std;
void defaultConstructor();
void paramConstructor();
void copyConstructor();
void operatorAssig();
void stringCompare();
void setString();
void toUpper();
void toLower();
void prependObj();
void prependStr();
void plusAssObj();
void pl... | true |
c4b29bffd8bcf163e7de0773baf74435c00d1850 | C++ | tsingke/Homework_Turing | /杨奕帆/Experiment_2/Source Code/四(6).cpp | UTF-8 | 258 | 2.9375 | 3 | [] | no_license | #include<iostream>
using namespace std;
void fun(int a, int &b)
{
a+= b;
b += a;
}
int main()
{
int x = 5, y = 10;
fun(x, y);
cout << "x=" << x << ",y=" << y << endl;
fun(y, x);
cout << "x=" << x << ",y=" << y << endl;
system("pause");
return 0;
} | true |
1cc339debe47f1b4d138c50c60ee03d5d2944e72 | C++ | bikash-das/cppPrograms | /BeginningC++17/functionTemplates_ch_9/decltype_demo.cpp | UTF-8 | 405 | 3.15625 | 3 | [] | no_license | template <typename T1, typename T2>
auto larger(T1 a, T2 b) -> decltype(a>b ? a:b){
return a > b ? a : b;
}
// the above code can be tedious to write, we can simplify
// using decltype(auto) introduced in c++14
template<typename T1, typename T2, typename T3>
decltype(auto) larger(T1 a, T2 b){
return a > b ? a :... | true |
3104d3955e4f1b8355d174890bf95d032861f30f | C++ | egorodet/MethaneKit | /Tests/Graphics/Types/VolumeTest.cpp | UTF-8 | 8,806 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | /******************************************************************************
Copyright 2021 Evgeny Gorodetskiy
Licensed under the Apache License, Version 2.0 (the "License"),
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses... | true |
1681fa93be91282ae471249ce6513aac6618cfc5 | C++ | tysm/cpsols | /codeforces/contests/round/407-div2/d.cpp | UTF-8 | 727 | 2.65625 | 3 | [
"MIT"
] | permissive | #include <cpplib/stdinc.hpp>
#include <cpplib/math/combinatorics.hpp>
void dfs(int u, vvi &adj, vb &vis){
vis[u] = true;
for(int v:adj[u]){
if(!vis[v])
dfs(v, adj, vis);
}
}
int32_t main(){
desync();
int n, m;
cin >> n >> m;
vvi adj(n+1);
for(int i=0; i<m; ++i){
... | true |
4782feabd8dae43b4cf7a25e3271a97192f247e1 | C++ | dmccloskey/EvoNet | /src/evonet/include/EvoNet/ml/Link.h | UTF-8 | 3,077 | 3.046875 | 3 | [
"MIT"
] | permissive | /**TODO: Add copyright*/
#ifndef EVONET_LINK_H
#define EVONET_LINK_H
#include <tuple>
#include <string>
#include <cereal/cereal.hpp>
namespace EvoNet
{
/**
@brief Directed Network Link
*/
class Link
{
public:
Link(); ///< Default constructor
Link(const Link& other); ///< Copy constructor // [T... | true |
481d4da92c4cf51b299d28322cc2e7afe07ee5b1 | C++ | jessimb/soldiers | /soldiers/clickablelabel.cpp | UTF-8 | 323 | 2.5625 | 3 | [] | no_license | #include "clickablelabel.h"
#include <iostream>
ClickableLabel::ClickableLabel( int row2, int col2, QWidget * parent ) :
QLabel(parent)
{
row = row2;
col = col2;
}
ClickableLabel::~ClickableLabel()
{
}
void ClickableLabel::mousePressEvent ( QMouseEvent * event )
{
(void) event;
emit clicked(row, col);... | true |
d54231bc26464a0e16d76e5a1c11bb51f37d02a0 | C++ | mehoggan/visualization | /lib/camera.cpp | UTF-8 | 382 | 2.515625 | 3 | [] | no_license | #include "com/visualization/camera.h"
namespace com
{
namespace visualization
{
camera::camera() :
pos_(0.0f, 0.0f, 1.0f),
target_pos_(0.0f, 0.0f, 0.0f),
view_matrix_(glm::lookAt(
pos_,
target_pos_,
glm::vec3(0.0f, 1.0f, 0.0f)))
{}
const glm::mat4 &camera::vie... | true |
af6f052ed8fd0ff05f2b0d72f4fee52d7b5c3968 | C++ | ltr01/stroustrup-ppp-1 | /code_snippets/Chapter09/chapter.9.4.1.cpp | UTF-8 | 1,481 | 4.0625 | 4 | [
"MIT"
] | permissive |
//
// This is example code from Chapter 9.4.1 "Struct and functions" of
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
//------------------------------------------------------------------------------
// simple Date (too simple?):
struct Date {
int y; // year
int m; // month in... | true |
5c897c4963c7e5b9373755a1d472283aa0540787 | C++ | ajp4707/Check-Mate | /Check-Mate/Check-Mate/RBTree.h | UTF-8 | 886 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include<string>
#include<iostream>
#define black 0
#define red 1
// Inspiration: Ms. Resch's lecture on Red-Black Trees
// https://gist.github.com/derka6391/7b7463ac36a9fb04bea0668397d41d23
struct RBNode
{
std::string gameStr;
char points;
bool color = black;
RBNode * left;
RBNode * right;
RBNode *... | true |
44b733da51a16d5c38a59681ada362a8d911c1a7 | C++ | shreyakapoor08/CPP_Programs | /random programs/constants.cpp | UTF-8 | 285 | 3.0625 | 3 | [] | no_license | #include<iostream>
#define PI 3.14
#define PRINT cout<<
using namespace std;
int main()
{
cout<<2*PI<<endl;
PRINT "Hello World"<<endl;
///const variables
int x=1.1;
x++;
cout<<x<<endl;
const int y=2.1;
/// y++; created in ROM so cant be updated
cout<<y<<endl;
return 0;
}
| true |
804bbd1b5a512382c8ed3a96ef70eee8a02aa5a1 | C++ | liweiliv/DBStream | /database/indexIterator.h | UTF-8 | 1,824 | 2.859375 | 3 | [] | no_license | #pragma once
#include <stdint.h>
#include <assert.h>
#include "meta/columnType.h"
#include "iterator.h"
namespace DATABASE
{
template<class INDEX_TYPE>
class indexIterator
{
protected:
uint32_t flag;
INDEX_TYPE* index;
META::COLUMN_TYPE type;
const uint32_t* recordIds;
uint32_t idChildCount;
uint32_t in... | true |
9d949e1786f0caf13e75db3cb0131523da11b5ae | C++ | sophiaken/Banking-Distributed-System | /Clock_Synchronization/master2.cpp | UTF-8 | 2,508 | 2.59375 | 3 | [] | no_license | #include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include<cstdlib>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
#include<iostream>
#include<time.h>
#include<fstream>
#include<pthread.h>
using namespace std;
#define MAX_THREADS 100
#define PORT 8090
int main(int argc, char* arg... | true |
e54bb98a5d778c85896ea3a86976538f1b2df3d2 | C++ | lucivpav/bomberman | /src/hostmenu.cpp | UTF-8 | 2,056 | 2.96875 | 3 | [] | no_license | #include "hostmenu.h"
#include "game.h"
#include <fstream>
#include <cassert>
HostMenu::HostMenu(const std::string &levelsPath)
:Menu("Host"), mLevelsPath(levelsPath)
{
/* levels */
addItem( mLevelList = new UI::List("Level") );
for ( int i = 1 ; i <= 10 ; i++ )
{
std::ifstream in(mLevels... | true |
2cc33cf5022c68e90f186b4e40278e1e25353ca5 | C++ | ArinaSanches/LaboratorioProgramacao | /Trabalho1/QuicksortLogN.cpp | UTF-8 | 821 | 2.90625 | 3 | [] | no_license | //
// Created by Arina on 10/04/2019.
//
#include "QuicksortLogN.h"
#include <iostream>
using namespace std;
#include "FuncoesBasicas.h"
FuncoesBasicas funcoes5;
void QuicksortLogN::Quicksort(int *inicio, int *fim){
while (inicio < fim) {
int* pivo = funcoes5.escolherPivo(inicio, fim);
pivo = fu... | true |
d6898d7459b76d6e3f5414931a489c12e82ea0d4 | C++ | Mr-Magnificent/ippc | /leetcode/SortList_148.cpp | UTF-8 | 1,241 | 3.3125 | 3 | [] | no_license | #include "../lib/createList.hpp"
#include <bits/stdc++.h>
using namespace std;
class Solution {
ListNode *findMid(ListNode *node) {
ListNode **slow = &node, *fast = node;
while (fast && fast->next) {
slow = &(*slow)->next;
fast = fast->next->next;
}
ListNode *t = *slow;
*slow = nullp... | true |
0c5ee420455e8e0a96b16992933865490731aa12 | C++ | Nabubabu99/ejercicioslaboratorio | /ejParcial2.cpp | UTF-8 | 1,630 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int largo;
int aux;
int sumatoria = 0;
int sumatoriaDiag = 0;
int sumatoriaDiagInv = 0;
bool esMagico = false;
cout << "Ingrese el largo de la matriz: " << endl;
cin >> largo;
int constMagica = (largo * (largo... | true |
20f4784b5e852e6d7da3206e3515c41d710d6d73 | C++ | SteveBunlon/ProjetLO21 | /Lo21_projets/classes/Tache.h | ISO-8859-1 | 1,465 | 2.859375 | 3 | [] | no_license | #ifndef TACHE_H
#define TACHE_H
#include <iostream>
#include <string>
#include "timing.h"
using namespace TIME;
using namespace std;
class Programmation;
class Projet;
class Tache {
private:
string titre;
Tache** antecedentes;
Date dispo; //date de dbut
Date echeance;
Projet& projet;
pub... | true |
0f8ff73312cd76eaf6acf2404a2fddb87c948b5b | C++ | Martinii89/GameEngine | /SimpleGameEngine_opengl/Mesh.h | UTF-8 | 384 | 2.671875 | 3 | [] | no_license | #pragma once
#include "vertex.h"
#include <vector>
class Mesh
{
private:
void CalcNormals(Vertex* vertices, int vertSize, int* indices, int indexSize);
public:
Mesh();
virtual ~Mesh();
void addVertices(Vertex* vertices, int vertSize, int* indexes, int indexSize, bool calcNormals = true );
void draw() const;
priv... | true |
27d1749fac3654f37f1c75d1d18dadcd2cabc2aa | C++ | dmireckid/CS225 | /mp7/dsets.cpp | UTF-8 | 554 | 2.890625 | 3 | [] | no_license | /* Your code here! */
#include <vector>
#include "dsets.h"
void DisjointSets::addelements(int num){
for(int i=0; i<num; i++){
vec.push_back(-1);
}
}
int DisjointSets::find(int elem){
if(vec[elem] <0){
return elem;
}
else{
return vec[elem] = find(vec[elem]);
}
}
void DisjointSets::setunion(int... | true |
bf86135c190aa770996714ae66b59a97517a91fc | C++ | Maligothez/OpenGL-in-Virtual-Studio | /Graphics week 5/Workshop5_BobcatRampage!/Excavator.cpp | UTF-8 | 4,267 | 3.03125 | 3 | [] | no_license | #include "Excavator.h"
#include <windows.h>
#include <math.h>
Excavator::Excavator() : Entity()
{
}
Excavator::Excavator(float locationX,float locationZ, float movementSpeed,
float altitudeY,float angleToZAxis, float turretAngle,
float upperArmAngle, float lowerArmAngle)
: Entity(locationX,locati... | true |
63b9b6909b8e74b6547221089a7b03cad2342197 | C++ | gstoykow/fmi-se-oop-group3 | /ExF(FinalConsult)_27.06.2019/CentralBank.cpp | UTF-8 | 2,101 | 2.78125 | 3 | [] | no_license | #include "CentralBank.h"
const vector<string> CentralBank::getCurrs() const
{
return this->currs;
}
const vector<double> CentralBank::getRates() const
{
return this->rates;
}
void CentralBank::setCurrs(vector<string> currs)
{
this->currs = currs;
}
void CentralBank::setRates(vector<double> rates... | true |
0becb8551ba9f8d9ed055c5d796c27ffe24f7e6e | C++ | tonykozlovsky/bsu | /programming/c++/lab5/task2.cpp | UTF-8 | 1,229 | 3.234375 | 3 | [] | permissive | //
// Created by Drapegnik on 15.10.14.
//
#include <iostream>
using namespace std;
struct lifo
{
char data;
lifo *next;
};
bool lifo_empty(lifo*& top)
{
if (top==NULL)
return true;
else
return false;
}
char show_top(lifo *&top)
{
return (top->data);
}
... | true |
b48f6c2f2bb83fe829dc88c64d62e1d7ed8be454 | C++ | paumayr/cppexamples | /CppWorkshop/CppWorkshopSamples/Demo_Functions/main.cpp | UTF-8 | 365 | 3.6875 | 4 | [] | no_license | #include <iostream>
int Circumference(int w, int h); // function declaration
int main(int argc, char **argv)
{
int w = 10;
int h = 20;
int circumFerence = Circumference(w, h);
std::cout << "circumference = " << circumFerence << std::endl;
return 0;
}
int Circumference(int w, int h) // functio... | true |
21482ec50198a95cd62a5d3c55332ca491b3ca29 | C++ | Bookfan97/Cpp_GameProgramming | /Thomas Was Late/Thomas_Was_Late/ParticleSystem.cpp | UTF-8 | 1,281 | 3.109375 | 3 | [] | no_license | #include "ParticleSystem.h"
void ParticleSystem::draw(RenderTarget& target, RenderStates states) const
{
target.draw(m_Vertices, states);
}
void ParticleSystem::init(int numParticles)
{
m_Vertices.setPrimitiveType(Points);
m_Vertices.resize(numParticles);
for (int i = 0; i < numParticles; i++)
{
srand(time(0) ... | true |
74d90ad9eb4051c07d50710a0458835b428b2751 | C++ | mrfikri-ai/Phase_Gradient | /Arduino/test_follower_alwayslookingtest.ino | UTF-8 | 4,062 | 2.671875 | 3 | [
"MIT"
] | permissive | #include<math.h>
//This code is running in 8pino microcontroller
// Global Constant //
const int SENSOR = 0;
const int PWM_pin = 1; //pin 1 in 8pino is PWM pin
const int S1 = 3; // sensing number 1 pin
const int S2 = 4; // sensing number 2 pin
const int time_L = 30;... | true |
a040ced3c915a145442071f47e35b52c63e0c184 | C++ | hash-zhu/data_structure | /data_structure/PAT/Sort.cpp | UTF-8 | 1,158 | 3.765625 | 4 | [] | no_license | //
// Created by 少年与梦 on 2021-07-07.
//
#include "stdio.h"
//选择排序
//每趟选出待排序部分[i,n]中最小的元素,将其与arr[i]交换,总复杂度为O(n^2)
void selectSort(int arr[],int n) {
for (int i = 0; i < n-1; ++i) {//进行n趟操作
int k = i;
for (int j = i+1; j < n; ++j) {//选出[i,n]中最小的元素,下标为k
if (arr[j] < arr[k]) {
... | true |
533528f472d1c311d2b8f7955a6bb9e490233a83 | C++ | silenke/my-leetcode | /problems/56. 合并区间/1.cc | UTF-8 | 485 | 2.671875 | 3 | [] | no_license | #include "..\..\leetcode.h"
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
sort(intervals.begin(), intervals.end());
vector<vector<int>> res;
for (const auto& i : intervals) {
if (res.empty() || i[0] > res.back()[1]) {
res.e... | true |
22b976b5ec164ba4e47d54d53288553a0687ecd2 | C++ | JECHUser/Electronica-Digital-2 | /Mini_Proyecto_2/ESP32 - Arduino code/pubsub_adafruitio/pubsub_adafruitio.ino | UTF-8 | 3,437 | 2.59375 | 3 | [] | no_license | // Adafruit IO Publish & Subscribe Example
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016 Adafruit Industries
// Licensed un... | true |
2d18bacbecd4d33a05e12fea8def7d01cadc7832 | C++ | imaycen/Sumatorias | /main.cpp | UTF-8 | 1,626 | 3.34375 | 3 | [] | no_license | // Author : Ivan de Jesus May-Cen
// Email : imaycen@hotmail.com, imay@itsprogreso.edu.mx
// Language : C++
// Environment : Linux
// Compiler : g++
// Revisions :
// Initial : 09.02.2017
// Last :
// Este programa compila en la consola de linux mediante la orde
/... | true |
27028910b07294bb8f1b0ecaa19c652ff9caa983 | C++ | yichuanma95/leetcode-solns | /cpp/reverseInt.cpp | UTF-8 | 965 | 3.984375 | 4 | [] | no_license | /*
Problem 7: Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer.
Example 1:
Input: 123
Output: 321
Example 2:
Input: -123
Output: -321
Example 3:
Input: 120
Output: 21
Note: Assume we are dealing with an environment which could only store integers within the 32-bit
signed integer range: [... | true |
4f26538bdc7a9cb119b3dee24d0d629df8fe454a | C++ | MuggleWei/data_structure_and_algorithm | /test/avl_tree_iter/unittest_avl_tree_iter.cpp | UTF-8 | 1,908 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "gtest/gtest.h"
#include "dsaa/dsaa.h"
#include "test_utils/test_utils.h"
#define TEST_AVL_TREE_ITER_LEN 64
class AvlTreeIterFixture : public ::testing::Test
{
public:
void SetUp()
{
muggle_debug_memory_leak_start(&mem_state_);
bool ret;
ret = avl_tree_init(&tree_, test_utils_cmp_int, 0);
ASSERT_... | true |
92f275268388931fdc7d73a7086bd96a7eee0d8d | C++ | thufish/Mingliang.Liu-algorithm | /cc150/1.3.cpp | UTF-8 | 1,749 | 3.734375 | 4 | [] | no_license | #include <string>
#include <vector>
#include <iostream>
using namespace std;
/** The naive sort and compare one. O(NlgN) */
bool is_permutation1(string &str1, string &str2) {
/** trivial cases first */
if (str1.length() != str2.length())
return false;
sort(str1.begin(), str1.end());
sort(... | true |
c09b990671dc51a8fd8161f4a243834f8a8426e9 | C++ | utec-computer-science/cs2100-list-Oteranga | /Doubly_List.h | UTF-8 | 8,716 | 3.578125 | 4 | [] | no_license | //
// Created by Alejandro Otero on 2020-04-24.
//
#pragma once
#include "Node.h"
namespace Dlist {
template<typename T>
class Iterator {
protected:
typedef DoublyListNode<T> node_t;
node_t *pointer;
public:
Iterator() : pointer(nullptr) {}
Iterator(node_t *_point... | true |
56effa62579ff8228d4c0b816c48a4c690f56418 | C++ | deepakgupta1313/My-Codes | /Miscellaneous/Permutation/Permutation Mapping/Permutation Mapping.cpp | UTF-8 | 1,719 | 2.625 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include <complex>
#include <iostream>
#include <valarray>
#include<cstring>
#include<queue>
using namespace std;
#define PB push_back
#define i64 long long
#define FOR(i,a,b) for(i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
... | true |
f9ac9deee17ef57bdae3e68079bc3ce05f59ac39 | C++ | Flare-k/Algorithm | /자료구조/괄호의값_자료구조_2504.cpp | UTF-8 | 1,177 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stack>
using namespace std;
string ch;
long long answer;
void run() {
stack<char> st;
int len = ch.length();
int num = 1;
bool impossible = false;
for (int i = 0; i < len; i++) {
if (ch[i] == '(') {
num *= 2;
st.push(... | true |
c729aed50ba43a12419bd8c4b89e6b74a224dd5f | C++ | GrenderG/mmo | /src/mmo_client/console_var.h | UTF-8 | 6,461 | 3.203125 | 3 | [] | no_license | // Copyright (C) 2019, Robin Klimonow. All rights reserved.
#pragma once
#include "base/typedefs.h"
#include "base/non_copyable.h"
#include "base/macros.h" // For ASSERT
#include "base/signal.h"
#include <string>
namespace mmo
{
/// Enumerates possible console variable flags.
enum ConsoleVarFlags
{
/// Defau... | true |
b1d25567f863b84cfaefa4bad39c6aee8b7711de | C++ | Abigael/Multi-Component-Music-Synthesizer | /Music Synthesizer/Synthie/NoiseGate.cpp | UTF-8 | 2,027 | 2.84375 | 3 | [] | no_license | #include "stdafx.h"
#include "NoiseGate.h"
CNoiseGate::CNoiseGate()
{
m_left = m_right = 1;
m_dry = m_wet = m_dry = 0.0;
m_threshold = 50; //default value
m_wet = 1;
}
CNoiseGate::~CNoiseGate()
{
}
/*Noise gate lets signal pass through only when it is above set thresholf- gate is open
* if below, no signal is... | true |
9ff7b5a5d0c3a82d76acb145f7fc98742c8c632b | C++ | newbie960828/AILearning | /MOPAlgorithm/Algorithm/MOP_Algorithm.cpp | UTF-8 | 3,758 | 2.75 | 3 | [] | no_license | #include "MOP_Algorithm.h"
#include <QDebug>
int problemNum = 1;
MOP_Algorithm::MOP_Algorithm(QObject *parent)
: QObject(parent)
{
this->InitParameter();
shouldStop = false;
isBegin = false;
problemNum = 1;
}
MOP_Algorithm::~MOP_Algorithm()
{
}
void MOP_Algorithm::InitParameter()
{
numObject... | true |
483477aa0c3a10047a19fcacf43101a4e66af54b | C++ | frenchie4111/Life | /src/Grid.cpp | UTF-8 | 1,943 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_gfxPrimitives.h>
#include "Grid.h"
using namespace std;
Grid::Grid() {
cout << "Grid" << endl;
for( int i = 0; i < 10; i++ ) {
vector< Pixel * > *temp = new vector< Pixel * >;
for( int j = 0; j < 10; j++ )... | true |
37ce65a815bd7be0b691fdff8bce35ca96c922b3 | C++ | Assimilater/CS1400 | /Assignment4/Assignment4/Package.cpp | UTF-8 | 551 | 2.703125 | 3 | [] | no_license | #include "Package.h"
using namespace std;
//---------------------------------------------------------------------------------+
// Constructors |
// Manage the inital values |
//--------------------... | true |
e1fa6eb89f2c69ae1f8229a1f511f15f036d5129 | C++ | aayushakrrana/Competitive-programming | /CodeChef/Root & Square_ROOTSQR.cpp | UTF-8 | 1,523 | 3.78125 | 4 | [] | no_license | /*
Root & Square Problem Code: ROOTSQR
Add problem to Todo list
Raju has created a program to find the square root of a number. But his program can store only integers. Being a newbie, he didn't know about rounding the numbers. Hence his program returns the absolute value of the result if possible. For example, sqrt(3... | true |
3fe9e82e27360604c06fe9baadc592d76bf9199c | C++ | andyleejordan/uidaho-cs472-project1 | /src/main.cpp | UTF-8 | 6,532 | 2.65625 | 3 | [
"MIT"
] | permissive | /* Copyright 2014 Andrew Schwartzmeyer
*
* University of Idaho - CS 472: Evolutionary Computation by Terry Soule
*
* Project #1 Genetic Algorithm
*
* This program uses C++11 extensions (array template, range-based for
* loop, random library)
*/
#include <algorithm>
#include <cassert>
#include <cstdlib>
#includ... | true |
09c932559294e1e6c44d0bd20a9a4627d5ff327c | C++ | XUqilian/Cproject | /cpp primer plus/chapterfourteen/example/prstu/head.h | UTF-8 | 2,132 | 3.28125 | 3 | [] | no_license | #ifndef HEAD_H
#define HEAD_H
// has-a
#include<iostream>
#include<string>
#include<valarray>
using std::string;
using std::valarray;
using std::istream;
using std::ostream;
using std::endl;
using std::cout;
using std::cin;
class Stu
:private string , valarray<double>
// 私有继承 继承类模块而非类 会生成无名类对象 所以不用类内声明对象
// 但好像只能... | true |
426479587df0f69b0de37d50999c0b7211c1363d | C++ | toddxue/todd-algorithm | /play/shuffle/in-shuffle.play.cpp | UTF-8 | 1,255 | 2.53125 | 3 | [] | no_license | #include "shuffle.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "timed.h"
int main(int argc, char* argv[]) {
bool benchmark = false;
bool use_primitive_root = false;
int n = argc - 1;
if (0 == strcmp(argv[1], "benchmark")) {
--n;
benchmark = true;
if (0 ... | true |
2f6b65e0587fde6d0610ecffd445f3c8923583fe | C++ | eteran/PcapPlusPlus | /Examples/DnsSpoofing/main.cpp | UTF-8 | 11,517 | 2.546875 | 3 | [
"Unlicense"
] | permissive | /**
* DNS spoofing example application
* ================================
* This application does simple DNS spoofing. It's provided with interface name or IP and starts capturing DNS requests on that
* interface. Each DNS request that matches is edited and turned into a DNS response with a user-provided IPv4 a... | true |
ea09b9658ac7876f020b0627a0ab2c18032f3cfd | C++ | samikib/DieHardWaterJug | /main.cpp | UTF-8 | 401 | 3.21875 | 3 | [] | no_license | #include "Jug.h"
void test1()
{
string solution;
Jug head(3, 5, 4, 1, 2, 3, 4, 5, 6);
if (head.solve(solution) != 1) {
cout << "Error 3" << endl;
}
cout << solution << endl << endl;
}
void test2()
{
string solution;
Jug head(3, 5, 4, 1, 1, 1, 1, 1, 2);
if (head.solve(solution) != 1) {
cout << "Error 3" << endl;... | true |
d2bbdea87ef4eef0d790a42d2f078f069a8f3214 | C++ | tjohanne/PCA | /src/include/timelogger.h | UTF-8 | 1,002 | 2.75 | 3 | [] | no_license | #pragma once
#include <chrono>
#include <string>
#include <vector>
class TimeLogger {
public:
struct timeLog {
int features;
int samples;
int n_components;
double time_ms;
std::string name;
std::chrono::high_resolution_clock::time_point start_time;
std... | true |
a16b6148915fded71084057a30b7cae62b1e9546 | C++ | brextonpham/Beginner-s-All-purpose-Symbolic-Instruction-Code | /program.cpp | UTF-8 | 5,574 | 3.515625 | 4 | [] | no_license | /*
* File: program.cpp
* -----------------
*/
#include <string>
#include "program.h"
#include "statement.h"
using namespace std;
Program::Program() {
}
Program::~Program() {
clear();
}
/*
* Method: clear
* Usage: program.clear();
* -----------------------
* Removes all lines from the program.
*/
void Pr... | true |
429b10d10ca0093acbfc73848493b95982cea103 | C++ | eqy/pyramid | /populatingnextrightpointersineachnodeii.cpp | UTF-8 | 1,727 | 3.765625 | 4 | [] | no_license | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | true |
3f06b9a5dc7c06c288f20b05925384cd4069a21a | C++ | whymeen/TestFramework | /dhUtilityLib/dhPrinter.cpp | UTF-8 | 2,156 | 2.890625 | 3 | [] | no_license | // dhPrinter.cpp: implementation of the dhPrinter class.
//
//////////////////////////////////////////////////////////////////////
#include "dhPrinter.h"
#include <stdarg.h>
dhPrinter* dhPrinter::m_printer = NULL ;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
/... | true |
f76ff1144ae2c73d5154f89422c353e8aede6972 | C++ | mkltaneja/Interview-Prep-Questions | /Recursion_and_Backtracking/Sudoku.cpp | UTF-8 | 1,452 | 3.015625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#define vi vector<int>
#define vvi vector<vi>
using namespace std;
void display(vvi &arr)
{
for(int i=0; i<9; i++)
{
for(int j=0; j<9; j++)
cout<<arr[i][j]<<" ";
cout<<endl;
}
}
void solve_sudoku(int idx, vvi &arr, vi &row, vi &col, vvi &sub,... | true |
288450a8d9a8e13581615050661e9e5fb2c4da1a | C++ | Vinayak-14/LVCPPMay2021 | /June/23rdJuneLecture12/WavePrint.cpp | UTF-8 | 949 | 3.8125 | 4 | [] | no_license | /*
Given an integer matrix 'mat' of dimensions m x n, write a program that prints
the matrix in wave form.
Example :
Input : mat[][] = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
Output : 1 4 7 8 5 2 3 6 9
*/
#include<iostream>
using namespace std;
int main() {
#ifndef IO
freopen("input.txt", "r", st... | true |
82a379d2a9c6610d6c6a29bd396ce21f093b1e4c | C++ | RequiemSouls/Mini3D | /src/geometry.cc | UTF-8 | 1,109 | 2.609375 | 3 | [] | no_license | #include "geometry.h"
MINI_NS_BEGIN
// const F32 identity[] = {1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f,
// 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f};
// const Vec2 Vec2::ZERO = Vec2();
// const Vector Vector::ZERO = Vector();
const Color Color::ZERO = Color();
const Color Color::WHITE = Color(25... | true |
b39b141f944ad37c57ab5925bee590b9b4b86d1e | C++ | kciwsolb/ecs_game_engine | /2DSDLGameEngine/GameObject.h | UTF-8 | 366 | 2.6875 | 3 | [] | no_license | #pragma once
#include "EntityManager.h"
#include <iostream>
class GameObject {
public:
virtual void Update() {}
virtual ~GameObject() { EntityManager::SharedInstance().RemoveEntity(entity); }
void SetIsDead(bool isDead) { this->isDead = isDead; }
bool GetIsDead() { return isDead; }
protected:
bool isDead = fals... | true |
5a63c0e9b07c62f9197a385737f537ec7f0ce6c0 | C++ | RitchieLab/athena | /tags/1.0.0/src/athena/Terminals.h | UTF-8 | 6,701 | 2.515625 | 3 | [] | no_license | /*
* File: Terminals.h
* Author: dudeksm
*
* Created on November 14, 2008, 4:03 PM
*/
#ifndef _TERMINALS_H
#define _TERMINALS_H
#include "TerminalSymbol.h"
#include <vector>
#include <Individual.h>
using namespace data_manage;
class Constant :public TerminalSymbol{
public:
Constant(std::string symb... | true |
d2af69d262938aad43f4222a179051a4f6f90aa1 | C++ | malzer42/libManagementSys | /libManagementSys/Library.h | UTF-8 | 2,678 | 3.078125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Library.h
* Author: pamulamba
*
* Created on 29 juin 2020, 22 h 21
*/
#ifndef LIBRARY_H
#define LIBRARY_H
#includ... | true |
1e9263488c84ff86463ef636a1a7f25ebc56070e | C++ | rranjik/ideal-octo-barnacle | /775-GlobalAndLocalInversions.cpp | UTF-8 | 852 | 2.921875 | 3 | [] | no_license | class Solution {
public:
using it = vector<int>::iterator;
int msort(it l, it r){
if(r-l>1){
cout<<"here "<<endl;
auto m = l+(r-l)/2;
auto left = msort(l, m);
auto right = msort(m, r);
auto res = 0;
for(auto i = l, j = m; i<m; i++){... | true |
54fc54d7b872183eb3b3d7d00da78488e952b5c8 | C++ | LiangSun1994/cplusplus_primer | /chapter_08/chapter_08_11_swap.cpp | UTF-8 | 281 | 3.6875 | 4 | [] | no_license | #include <iostream>
/*
template <typename T>
void swap(T& a, T& b);
int main(){
int a = 1;
int b = 2;
swap(a,b);
std::cout<<"a:"<<a<<std::endl;
std::cout<<"b:"<<b<<std::endl;
}
template <typename T>
void swap(T& a, T& b){
T temp;
temp = a;
a = b;
b = temp;
}
*/ | true |
23e0fa2aec18f5167753f5d00f5769a2e2c6d7fc | C++ | EALH/paralela | /OpenMp/sumVec.cpp | UTF-8 | 596 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <omp.h>
using namespace std;
int main(int argc, char* argv[])
{
int n = atoi(argv[1]);
double* x, y;
x = new double [n];
for(int i = 0; i < n; i++)
{
x[i] = (double) (i + 2);
}
y = new double [n];
for(int i = 0; i < n; i++)
{
y[i] ... | true |
2eb457353c359b839599e862f0bde54b73437118 | C++ | AdityaGattu/Imp-Coding | /Graphs/Strongly Connected Components (Kosaraju's Algo) .cpp | UTF-8 | 1,567 | 2.984375 | 3 | [] | no_license | public:
/* Function to find the number of strongly connected components
* using Kosaraju's algorithm
* V: number of vertices
* adj[]: array of vectors to represent graph
*/
stack<int>s;
void dfs(int node,vector<bool> &vis,vector<int> adj[])
{
vis[node]=true;
for(au... | true |
450bdaa3f88673a747a44f9a0cf42519b60167bd | C++ | HelgiThomas/Verklegt31 | /gui/add/addcomp.cpp | UTF-8 | 4,664 | 2.96875 | 3 | [] | no_license | #include "addcomp.h"
#include "ui_addcomp.h"
addcomp::addcomp(QWidget *parent) :
QDialog(parent),
ui(new Ui::addcomp)
{
ui->setupUi(this);
for(int i = 2016; i > 0; i--)
{
ui->combobox_buildYear->addItem(QString::number(i));
}
}
addcomp::~addcomp()
{
delete ui;
}
/**
* @brief ... | true |
1a2a3beec80ff649f18ebfbf5ffe69550f1b9395 | C++ | Liam0205/leetcode | /algorithm/0680-valid-palindrome-II/ver2.cc | UTF-8 | 1,099 | 2.953125 | 3 | [] | no_license | #pragma GCC optimise ("Ofast")
static const auto io_sync_off = []() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
return nullptr;
}();
class Solution {
public:
bool validPalindrome(const std::string& s) {
if (isPalindrome(s)) {
return true;
} else {
... | true |
3aa2a7a8c4501eba0bde107d26f55b155f74e005 | C++ | KimHyoungChul/FFmpegAndroid | /jni/effect/echo.cpp | UTF-8 | 2,458 | 2.78125 | 3 | [] | no_license | #include "echo.h"
// "回音" 音效增强器
#define MAX_DELAY 1000
static echo_t *echo = 0;
int min(int a, int b) {
return a < b ? a : b;
}
int max(int a, int b) {
return a > b ? a : b;
}
int clamp(int x, int low, int high) {
return min(max(x, low), high);
}
int chsign(int x, int s) {
return (x < 0) ^ (s < 0) ... | true |
e8cce4365fc9967605a3b70ccdd6e91094f868fd | C++ | zainmehdi/manual_pos_graph_slam | /manipulatedframesetconstraint.h | UTF-8 | 2,329 | 2.78125 | 3 | [] | no_license | #ifndef MANIPULATEDFRAMESETCONSTRAINT_H
#define MANIPULATEDFRAMESETCONSTRAINT_H
#include <QGLViewer/constraint.h>
#include <QGLViewer/frame.h>
#include <QSet>
class ManipulatedFrameSet{
public:
void clear(){
frames.clear();
}
void add(qglviewer::Frame* frame){
frames.insert(frame);
}
p... | true |
18b8b4f009eade52f6632030e4a2c8e6c6ae2b9b | C++ | Nurullah1313/C-Temel | /Bölüm 4 [Diziler ve Katarlar]/Katar7.cpp | UTF-8 | 329 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
char katar1[50]="selam", katar2[50]="millet";
strcpy(katar1, "Turkiye");
strcpy(katar2, " Cumhuriyeti");
strcat(katar1, katar2);
for(int i=0; katar1[i]; i++)
cout<<katar1[i]<<endl;
cout<<"Katar1 uzunlugu:"<<strlen(katar1)<<endl;
return 0... | true |
0c0c3fa6583d949465fff1511f5d73b9b4ce790e | C++ | rollschild/MyAlgorithms | /BucketSort.cpp | UTF-8 | 1,228 | 3.890625 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <list>
#include "InsertionSort.h"
using namespace std;
void Print(vector<float>& vec);
void InsertionSort(vector<float>& float_vec) {
int size = float_vec.size();
for(int j = 1; j < size; ++j) {
int i = j - 1;
float key = float_vec[j];
while(i >= 0 && fl... | true |
43e5bc58aae862c52bc680501ad98fef4f6e4eb2 | C++ | NiklaasC/moth | /proximity.cpp | UTF-8 | 1,484 | 3.3125 | 3 | [] | no_license | // IR Proximity Sensor
#include "proximity.h"
// Constructor
// Sets the pin used to communicate with the IR Proximity Sensor
Proximity::Proximity(int setPin) {
pin = setPin;
// Initialise all the data to 0
for (int index = 0; index < dataSize; index++) {
data[index] = 0;
differential[index] = 0;
... | true |
35b1084169f60c1485766a1ed7127bdc71e215c2 | C++ | IgnacioAstorga/Caveman-Ninja | /CavemanNinja/WeaponPickup.cpp | WINDOWS-1250 | 1,193 | 2.78125 | 3 | [] | no_license | #include "WeaponPickup.h"
#include "SpriteRendererComponent.h"
#include "BasicAnimation.h"
#include "CircleColliderComponent.h"
#include "ColliderTypes.h"
#include "OnWeaponPickUpComponent.h"
#include "EntityLifetimeComponent.h"
#define PICKUP_LIFETIME 20.0f
WeaponPickup::WeaponPickup(WeaponPickupType type, string na... | true |
94a85b97267b5645a06ac015e714cc75b2a28188 | C++ | mewa/mesh_optimizer | /mesh_optimizer/MeshDecimator.cpp | UTF-8 | 2,677 | 2.59375 | 3 | [] | no_license | #include "MeshDecimator.h"
#include <map>
#include "Graph.h"
using namespace mewa;
using namespace mewa::decimator;
MeshDecimator::MeshDecimator()
{
}
MeshDecimator::~MeshDecimator()
{
if (mGraph)
delete mGraph;
}
void MeshDecimator::constructGraph(Mesh* mesh) {
if (mGraph) {
delete mGraph;
mGraph = NULL;
... | true |
09cd026316755758ef6d4e07c4c4f9d5d464d6e4 | C++ | ckrisgarrett/minesweeper | /main_window.cpp | UTF-8 | 1,783 | 2.546875 | 3 | [] | no_license | #include "main_window.h"
#include "mine_widget.h"
#include "game_logic.h"
#include <QPushButton>
#include <QGridLayout>
#include <QLCDNumber>
#include <QLabel>
static QLabel *s_bombs_label;
static Mine_Widget *s_mine_widget;
static QPushButton *s_reset_button;
Main_Window::Main_Window()
{
QVBoxLayout... | true |
2c459f48a28d5e2d06910a003f6ff1072fd9cf90 | C++ | grncbg/ANSL-NetworkSimulator | /source/Random.cpp | UTF-8 | 967 | 3.078125 | 3 | [
"MIT"
] | permissive | #include "Random.hpp"
#include <boost/random.hpp>
#include <boost/random/random_device.hpp>
//
// class Random
//
template <class T>
Random<T>::Random() {
boost::random::random_device seed_gen;
this->engine = new boost::random::mt19937_64(seed_gen());
}
template <class T>
Random<T>::~Random() {
delet... | true |
4c21b0d13c3231cb7fe6e7d2fa9e841becce2b77 | C++ | brianwesthoven/Variadic | /variadic.h | UTF-8 | 4,242 | 3.375 | 3 | [] | no_license | #pragma once
#include <type_traits>
/*
*
*/
namespace ns
{
namespace mp
{
/* index_of:
* returns the index of the first equal type found to the first template parameter in the list.
* examples:
* 1) index_of<A, A, B, C, D>() //0
* 2) index_of<A, B... | true |
8ca9491ee6d70a2723c93a0a744b8c5d0255afd1 | C++ | JonnyKong/UCLA-CS130-Software-Engineering | /Assignment7_Multhreading/bigbear/src/http_request.cc | UTF-8 | 8,151 | 3.015625 | 3 | [] | no_license | #include "http_request.h"
#include <queue>
#include <iostream>
#include <boost/log/trivial.hpp>
#include <boost/algorithm/string.hpp>
bool HttpRequest::setMethod(std::string method)
{
if (method.empty())
{
// handle null pointer exception
}
// TODO: implement function
if (method.compare("GET... | true |
f7c36caccf7f5fd0606447561d714ee9ee32ad7d | C++ | QuantumComputingLab/qpixlpp | /test/frqi/sfwht_gray.cpp | UTF-8 | 4,681 | 2.53125 | 3 | [
"BSD-3-Clause-LBNL"
] | permissive | // (C) Copyright Daan Camps, Mercy Amankwah, E. Wes Bethel, Talita Perciano and
// Roel Van Beeumen
#include "qpixl/frqi/util.hpp"
#include <chrono>
#include <random>
#include <cstring>
#ifdef _OPENMP
#include <omp.h>
#endif
using TP = std::chrono::time_point< std::chrono::high_resolution_clock > ;
voi... | true |
96e574eea4975fcc48b60ed0c440b38041aa94bd | C++ | danbalarin/Cpp_Skola | /Zkouseni/23-4-Test/mainwindow.cpp | UTF-8 | 1,479 | 2.546875 | 3 | [] | no_license | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qstring.h"
#include "qmessagebox.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
double ... | true |
4f25224c22f5c8f3e5c7bbdc2a86beaa9cea87a1 | C++ | sshyran/Computational-Agroecology | /environment/plant_builder.cc | UTF-8 | 1,337 | 2.5625 | 3 | [] | no_license | #include "plant_builder.h"
#include "environment/meteorology.h"
#include "environment/plant.h"
namespace environment {
bool PlantBuilder::RegisterPlant(const std::string &model_name,
const PlantGenerator &generator) {
if (!models_.count(model_name)) {
models_[model_name] = gene... | true |
f8067ad1ead31a4a1790dc0944ce0dd48002bf60 | C++ | ZzQhXdH/Pizza-MCU | /User/Driver/Motor.h | UTF-8 | 1,314 | 2.640625 | 3 | [] | no_license | #ifndef __MOTOR_H
#define __MOTOR_H
#include "Driver/PositionSwitch.h"
#include <rtx_os.h>
class Motor
{
public:
enum Dir {
CW = 0x01,
CCW = 0x02,
Brake = 0x03,
};
enum Error {
TimeOut = 0x81, // 超时
Locked = 0x82, // 堵转
Ok = 0x83, // OK
};
public:
static void vInit(void);
priva... | true |
81342ca0a8260d30e0472bcbc791bd6cfbd69fac | C++ | GrimshawA/librazer | /src/razer/frontend/Parser/TokenParser.h | UTF-8 | 796 | 2.78125 | 3 | [] | no_license | #ifndef RZTOKENS_H__
#define RZTOKENS_H__
#include <string>
#include <vector>
#include <razer/frontend/Parser/Token.h>
/**
\class RzTokenParser
\brief Generates a stream of token from a source program so it can be parsed meaningfully
*/
class RzTokenParser
{
public:
RzTokenParser();
/// Get the list... | true |
6c3ce38751e3f942045150d0a7fc7372ddc3a84b | C++ | KFlaga/FlagRTS | /GameCore/IEventGenerator.h | UTF-8 | 2,448 | 3.265625 | 3 | [] | no_license | #pragma once
namespace ORTS
{
// Common interface for classes that provides events for rest of game
// ( like input observer, camera observer, units observer )
// Each EventGenerator have TypeId which identifies event family
// EventGenerators get notify requests for objects that want action to
// be done when ... | true |
0808f1810c93fcd8164bc948c722a6effbd3a40d | C++ | PenguinBoyTC/DataStructure_C | /Lab06/DoubleHashing.hpp | UTF-8 | 2,591 | 3.59375 | 4 | [] | no_license |
template <typename T>
DoubleHashing<T>::DoubleHashing(int m, int k, int p)//constructor
{
m_m = m;
m_k = k;
m_p = p;
numOfEle = 0;
m_hashtable = new Bucket<T> [m_m];
}
template <typename T>
DoubleHashing<T>::DoubleHashing()//constructor
{
m_m = 53;
m_k = 10;
m_p = 13;
numOfEle = 0;
m_... | true |
081738a2522cbc1a6406232f0fcb0c6ecb05c71b | C++ | Denhonator/TextAdventure | /TextAdventure/Game.h | UTF-8 | 638 | 2.53125 | 3 | [] | no_license | #pragma once
#include "Util.h"
#include "Resources.h"
class Game
{
public:
Game();
~Game();
std::string ProcessCommand(std::string input, int player=0);
void AddPlayer(std::string name, std::string newname = "");
private:
unsigned int players = 0;
unsigned int curPlayer = 0;
unsigned int progress = 0;
Encount... | true |
02d5d169cd596c45742f9bc0638ded0d4a3eb821 | C++ | GISjingjie/DataStruct | /DataStruct/P40_5_前半部分小于表头节点_后半部分大于表头.cpp | UTF-8 | 684 | 3.140625 | 3 | [] | no_license | #include <Stdio.h>
#include <Stdlib.h>
void Adjust(int a[],int len,int i)
{
int tmp=a[i];
for(int son=i*2+1;son<len;son=son*2+1)
{
if(son+1<len&&a[son+1]>a[son])
{
son++;
}
if(a[son]>tmp)
{
a[i]=a[son];
i=son;
}else
{
break;
}
}
a[i]=tmp;
}
void heapsort(int a[],int len)
{
for(int ... | true |
33b8971daff09cbf08e4d8d353af52e4f85a714d | C++ | Shota190718/Racing | /Racing/Engine/Audio.h | SHIFT_JIS | 1,427 | 2.84375 | 3 | [] | no_license | #pragma once
#pragma once
#include <vector>
#include <string>
#include "Global.h"
#include "Sound.h"
//-----------------------------------------------------------
//ʉǗ
//-----------------------------------------------------------
namespace Audio
{
//ЂƂ̃TEh̏
struct AudioData
{
//t@C
std::string fileName;
... | true |
983ab77b3eb61af8185e78df0177d6071e92c079 | C++ | caixiaomo/leetcode-ans1 | /leetcode C++/hash_map/3sum_Closest/answer.cpp | UTF-8 | 1,442 | 3.609375 | 4 | [] | no_license | /*
3Sum Closest Total Accepted: 5563 Total Submissions: 20789 My Submissions
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
For example, given arra... | true |
bff95485b576e4a9c5e3dcbab9812db0c28c22e6 | C++ | ebadusb/Trima_12.4 | /gui/predict_wait_state.hpp | UTF-8 | 8,909 | 2.546875 | 3 | [] | no_license | #ifndef PREDICT_WAIT_STATES
#define PREDICT_WAIT_STATES
#include "trimamessages.h"
#include "datalog.h"
namespace PredictWaitStates
{
using GuiPredictSequenceValues::DVITALS_ACK; // sent to predict to identify
// responses to DVitalsFromGui events
/////////////////////... | true |
b3567188fabc376e24a3ca3d93c347e24b5d11ab | C++ | LinBochi/LinBochi_48102 | /Hmwk/Assignment6/Gaddis_8thEd_Chap7_Prob6_Number Analysis Program/main.cpp | UTF-8 | 1,476 | 3.671875 | 4 | [] | no_license | /*
* File: main.cpp
* Author: Bochi Lin
* Created on November 18, 2016, 8:42 AM
* Purpose: Find the total, average, smallest, and the largest number in the file
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char** argv) {
//Declare variables
ifstr... | true |