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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
44350dd4d72d001120700b3837e68f7d2637b10a | C++ | shirataki707/ArduinoRobot | /pbl_main/pbl_main.ino | UTF-8 | 2,083 | 2.875 | 3 | [] | no_license | /* 後期PBL プログラム
*
* created : 2020/12/15
*
* contents : pbl_main.ino メインプログラム
* pbl_walk.ino 歩行プログラム
* pbl_pk.ino PK競技用の関数
*
*/
#include <Servo.h>
#include <Sensor.h>
Servo sv[4][3];
Sensor sensorRight(A0), sensorLeft(A1);
const float THRESHOLD = 60... | true |
19cdda56c78c9ca8c7b1afced8cfe29376f7828a | C++ | yycccccccc/Leetcode | /239.Sliding Window Maximum.cpp | UTF-8 | 2,068 | 3.75 | 4 | [] | no_license | 题意:
在窗口内返回最大值。
方法一:priority_queue
T(n) = nlogn;
思路:
1.因为最大堆的性质,每次能返回最大值,那么所有遍历到的点都放入heap中。
注意heap中的类型是pair,第一个元素是值,第二个元素师坐标位置。
2.如果坐标位置小于当前遍历到的位置-k,说明这个最大值已经不在窗口范围内,那么pop
3.如果遍历到的位置坐标大于k-1,即如果超出了第一个窗口的长度,那么每次都需要返回一个值,返回的就是heap顶的最大值。
class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
... | true |
b7e5999cf1d29123408cfe8da5b91556309ac830 | C++ | vermouth1992/Leetcode | /cpp/1662.check-if-two-string-arrays-are-equivalent.cpp | UTF-8 | 2,592 | 3.453125 | 3 | [
"MIT"
] | permissive | /*
* @lc app=leetcode id=1662 lang=cpp
*
* [1662] Check If Two String Arrays are Equivalent
*
* https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/description/
*
* algorithms
* Easy (82.27%)
* Total Accepted: 232.5K
* Total Submissions: 279.3K
* Testcase Example: '["ab", "c"]\n["a", ... | true |
05367ff04c9c29c8096781ea1ab4529a9c40c001 | C++ | chenzuhai/data-structure | /二叉树的构造.cpp | GB18030 | 1,486 | 3.65625 | 4 | [] | no_license | #include<iostream>
using namespace std;
#define Elemtype char
//ʼ
typedef struct Btree
{
Elemtype data;//ڵ
struct Btree *Lchild;//ָ
struct Btree *Rchild;//ָ
}Btree,*ptrBtree;
//
ptrBtree CreateBtree(char *pre, char*mid, int n)
{
char *p = NULL;
Btree *q = NULL;
if (n <= 0)
return NULL;
q = (Btree*)malloc(size... | true |
6b51043936036246b723049e95cc36406ad13b3f | C++ | PaulGrvd/cpptp4 | /main.cpp | UTF-8 | 9,133 | 2.71875 | 3 | [] | no_license | /*************************************************************************
main - fonction principale de l'application
-------------------
Début : Decembre 2019
Copyright : (C) 2019 par Paul Grévaud, Yohan MEYER (Binôme )
E-mail : yohan.meyer@insa-lyon.fr - paul.grevaud@insa-lyon.fr
**... | true |
b1c9e010261dca2aecfc71d0c07941cbbc99d0df | C++ | Neelabh-Dubey/Construct-O-Bot | /8_travelling_handler/8_travelling_handler.ino | UTF-8 | 4,178 | 2.859375 | 3 | [] | no_license | /*
* Author list: Neelabh Dubey
* Filename:8_travelling_handler
* Theme:Construct-o-bot
* Fuctions: bool is_house(int),bool is_warehouse(int),int get_dir(int), align_bot(int),go(int),go_next_node(int)
* node_right(),node_left(),node_forward(),turn_180(), follow_walls(),follow_zic_zac(),
* go9_... | true |
60c8d605ec2407cd7d8ecb158fb63eb6fac2d760 | C++ | ninfan/Arduino | /03_WebHuminity.ino | UTF-8 | 4,218 | 2.65625 | 3 | [] | no_license |
/*
Web Server
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
Huminity Library von https://github.com/adafruit/DHT-sensor-library
*/
#include <SPI.h>
#include <Ethernet.h>
#include "DHT.h"
#define DHTPIN 2 // DHT Data Pin auf Arduino Pin 2
// Uncomment whatever type you're using!
#define D... | true |
82f1fee896e037b499c37b8a8709dda075d3268a | C++ | MachineMitch21/Things | /Engine/src/Texture2D.h | UTF-8 | 670 | 2.828125 | 3 | [] | no_license | #ifndef TEXTURE2D_H
#define TEXTURE2D_H
#include <GL/glew.h>
#include <string>
class Texture2D
{
public:
Texture2D();
Texture2D(const Texture2D& oldTex2D);
Texture2D(const std::string& file);
~Texture2D();
void Bind(unsigned int unit = 0) const;
void UnBind() const;
inline int GetWidth... | true |
d94ac600156cba26ab097a1bdb791510f63665c6 | C++ | HelloSunyi/Elements-of-Programming-Interviews | /Chapter_21/c21_15.cpp | UTF-8 | 245 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int find_celebrity(const vector<int>& v){
int i = 0;
int j = 1;
while (j < v.size()) {
if (v[i][j]) {
i = j;
j++;
} else {
j++;
}
}
return i;
}
| true |
b6d8176102b0ef9f628c793e7d9f8b5c1f5b3baa | C++ | mosesx/NDInterpolator | /RBFInterpolator/BoxWeight.hpp | UTF-8 | 4,539 | 2.875 | 3 | [] | no_license | /**
* boxWeight.h
*
* Created on: \date Nov 15, 2010
* Author: \author mrehberg
*/
#ifndef BOXWEIGHT_H_
#define BOXWEIGHT_H_
/** \brief Weight function for partition of unity.
*
* Radialised 1-d Polynomial that is 0 on border of domain and 1 in the middle. Twice continously
* differentiable. based on T... | true |
f5ecc7244bacd6feed586e0baa3d70ae7fb066fc | C++ | UESTCzhouyuchuan/Algorithmic | /ACM算法题/befsummer_trainOne2.cpp | WINDOWS-1252 | 1,656 | 2.59375 | 3 | [] | no_license | #include <bits/stdc++.h>
//lazyǩ߶
using namespace std;
#define N 1000001
#define LL long long
#define mid (left+right)/2
#define lson r<<1,left,mid
#define rson r<<1|1,mid+1,right
typedef struct{
int left,right;
LL sum;
}dot;
dot Dot[N*4];
int father[N];
LL lazy[N];
void BuildTreeB(int r,int left,int right);
void Q... | true |
64c30b0335d951dd53a64679e891a2fb6168d2de | C++ | balancedbanana/balancedbanana | /include/database/worker_details.h | UTF-8 | 880 | 2.703125 | 3 | [] | no_license | #pragma once
#include <database/Specs.h>
#include <string>
#include <cstdint>
#include <optional>
namespace balancedbanana {
namespace database {
struct worker_details {
//The id of the Worker.
uint64_t id;
std::string name;
//The specs of the worker.
... | true |
9a220de5bcd5e9b9def5b5b80c6c60b6627943ae | C++ | code-dreamer/CodeSnippets | /cpp/DebugTools.cpp | UTF-8 | 1,076 | 2.65625 | 3 | [] | no_license | #include "stdafx.h"
#include <csignal>
#include "DebugTools.h"
int DebugTools::ShowDebugMessageBox(const wchar_t* expression, const wchar_t* functionName,
const wchar_t* filename, unsigned lineNumber, const wchar_t* errorMessage)
{
wchar_t exeName[MAX_PATH];
GetModuleFileNameW(nullptr, exeName, MAX_PATH)... | true |
38b1adefa520cb45d3378b31c084886802899986 | C++ | michelleferd/CS112-1 | /lab01/Song.h | UTF-8 | 471 | 2.671875 | 3 | [] | no_license | /*
* Song.h
*
* Created on: Sep 10, 2019
* Author: mjs96
*/
#ifndef SONG_H
#define SONG_H
#include <string>
using namespace std;
class Song {
public:
Song();
string getTitle() const;
string getArtist() const;
unsigned getYear() const;
Song(const string& title, const string& artist, unsigned year);
v... | true |
8124f295a59b6382d5eeb30767693e88942985ab | C++ | WhiZTiM/coliru | /Archive/75108322ff3341362f64b04488afdffc-61c3814520a8d4318f681038dc4b4da7/main.cpp | UTF-8 | 3,351 | 3.328125 | 3 | [] | no_license | #include <boost/operators.hpp>
#include <iostream>
#include <tuple>
#include <stdint.h>
template<typename T>
struct DefaultWrap : std::tuple<T> {
DefaultWrap(const T & t = T{}) : std::tuple<T>(t) {}
friend std::ostream& operator<<(std::ostream & os, const DefaultWrap<T> & t) { return os << std::get<0>(t);... | true |
ebbf3ca7ececb21dfd018777cc93f4f30f28d7ed | C++ | danyfang/SourceCode | /cpp/leetcode/NumberOfTeams.cpp | UTF-8 | 812 | 3.34375 | 3 | [
"MIT"
] | permissive | //Leetcode Problem No 1395 Number of Teams
//Solution written by Xuqiang Fang on 4 April, 2020
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
using namespace std;
class Solution {
public:
int numTeam... | true |
60caccb30c503963b2e59f3287c09bda8538d7fa | C++ | RiceReallyGood/LeetCode_Revise | /201-300/211_Add_and_Search_Word - Data_structure_design.h | UTF-8 | 1,439 | 3.890625 | 4 | [] | no_license | #include <string>
#include <memory.h>
using namespace std;
class WordDictionary {
public:
/** Initialize your data structure here. */
WordDictionary() { root = new TrieNode(); }
/** Adds a word into the data structure. */
void addWord(string word) {
TrieNode* node = root;
for(char&... | true |
66410143df233c72a083ce95cbe4014224b9a881 | C++ | bglasber/LogRipper | /src/parse_buffer.h | UTF-8 | 1,097 | 2.921875 | 3 | [] | no_license | #ifndef __PARSE_BUFFER_H__
#define __PARSE_BUFFER_H__
#include "token.h"
#include "config.h"
#include <mutex>
#include <condition_variable>
#include <list>
#include <vector>
#include <memory>
//A buffer of pointers to parsed lines
//Used to pass "units of work" between the components
struct ParseBuffer {
unsigned ... | true |
bd2692d441238e0252066227f70a0d1f02a94faf | C++ | Bargor/tempest | /src/core/time/timer.h | UTF-8 | 2,298 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"LicenseRef-scancode-happy-bunny",
"Zlib",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | // This file is part of Tempest-core project
// Author: Karol Kontny
#pragma once
#include <assert.h>
#include <chrono>
#include <core.h>
#include <cstdint>
#include <platform.h>
#include <ratio>
namespace tst {
namespace core {
using hr_clock = std::chrono::high_resolution_clock;
using sys_clock = std::chr... | true |
527de819d7fd36fd5b22e7cc2dbe65f8a31b73bf | C++ | keptan/frisbee | /src/main.cpp | UTF-8 | 5,380 | 2.640625 | 3 | [] | no_license | #include "hashDB.h"
#include "image.h"
#include "transactional.h"
#include "db_init.h"
#include "utility.h"
#include <cstdlib>
#include <algorithm>
void cutestArtists (Database& db)
{
const auto search = db.SELECT<std::string, double>("artist, (mu - sigma * 3) * min(10, COUNT(*)) as power"
" FROM arti... | true |
0db020d0f4e82817b219f0ed286a5d4b13c351e0 | C++ | Floral/Study | /数据结构与算法/算法笔记/Ch4/4_3/codeup_4_3_A.cpp | UTF-8 | 953 | 3.28125 | 3 | [] | no_license | #include<cstdio>
#include<algorithm>
int N, seq[20];
int sum = 0, count = 0;
void generateP(int n)
{
for (size_t i = 1; i <= 2; i++)
{
if (sum+i < N)
{
seq[n] = i;
sum+=i;
generateP(n+1);
sum-=i;
}else if (sum+i == N)
{
... | true |
df3f23d0ee6113a716093b6096905fd7e7590242 | C++ | 282951387/KFrame | /KFCommon/KFResult.h | UTF-8 | 1,610 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef __KF_RESULT_H__
#define __KF_RESULT_H__
#include "KFInclude.h"
#include "KFEnum.h"
#include "KFUtility/KFMutex.h"
namespace KFrame
{
class KFBaseResult
{
public:
KFBaseResult()
{
_result = KFEnum::Ok;
}
virtual ~KFBaseResult() = default;
inline... | true |
e2a1e891f37cd0853ebbe1d62c73091a248c4602 | C++ | voidloop/krakenapi | /libjson/_internal/Source/JSONNode_Mutex.cpp | UTF-8 | 6,560 | 2.78125 | 3 | [
"BSD-2-Clause",
"MIT"
] | permissive | #include "JSONNode.h"
#include "JSONGlobals.h"
#ifdef JSON_MUTEX_CALLBACKS
json_mutex_callback_t json_lock_callback = 0;
json_mutex_callback_t json_unlock_callback = 0;
void * global_mutex = 0;
void * manager_mutex = 0;
struct AutoLock {
public:
LIBJSON_OBJECT(AutoLock);
AutoLock(void) json_nothrow {
LIBJSON_... | true |
8d75fdbc592fd6705801c2f2f998769e2a5d68a4 | C++ | DotStarMoney/TLG | /dev/src/thread/semaphore.cc | UTF-8 | 1,266 | 2.984375 | 3 | [] | no_license | #include "thread/semaphore.h"
#include <atomic>
#include <condition_variable>
#include <limits>
#include <shared_mutex>
#include "glog/logging.h"
namespace thread {
Semaphore::Semaphore(int32_t init_resource) : r_(init_resource) {
CHECK_GE(init_resource, 0);
}
// Using an atomic resource count here allows us to a... | true |
465b1f318bed68963951ab4b82e577466f49a138 | C++ | siddhantttt/algorithms-ds-leetcode | /Rotate List/Rotate List/main.cpp | UTF-8 | 2,105 | 3.25 | 3 | [] | no_license | //Problem: https://leetcode.com/explore/learn/card/linked-list/213/conclusion/1295/
#include <vector>
#include <iostream>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <unordered_set>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int... | true |
a374a5110b9422509639dceb8575a0b4bed03614 | C++ | kylin0925/online_judge | /acm/c100/acm107.cpp | UTF-8 | 1,029 | 2.640625 | 3 | [] | no_license | /* @JUDGE_ID: 53xxxx 107 C++ */
/* @BEGIN_OF_SOURCE_CODE */
#include <stdio.h>
#include <math.h>
int main()
{
double hinit,lastno,notwork=0,toth=0,k,i,tt;
unsigned long n,t;
while(scanf("%lf %lf",&hinit,&lastno)==2)
{
if(hinit==0 && lastno==0) break;
notwork=0;
t... | true |
ad9885b96864fa911e4e3753de3d416e2aadb8ba | C++ | tgtn/arduino | /06_Robot_ocolire_obstacole/06_Robot_ocolire_obstacole.ino | UTF-8 | 4,664 | 2.75 | 3 | [] | no_license | #include "Arduino.h"
// senzor 1 (dreapta)
int trigPinSenzorDreapta = 9; // pinul pe care dam senzorului comanda de masurare
int echoPinSenzorDreapta = 10; // pinul pe care primim raspunsul
// senzor 2 (stanga)
#define trigPinSenzorStanga 13 // pinul pe care dam senzorului comanda de masurare
#define echoPinSenzorStan... | true |
180bbe66220f87ef9a3af0fd951758a351907cc1 | C++ | rajat-gautam/Spoj-Solutions | /bit_mask/Tricks.cpp | UTF-8 | 1,320 | 2.921875 | 3 | [] | no_license | ALL_BITS is a number with all 1's set corresponding to the elements of domain.
__builtin_ctz
__builtin_clz
__builtin_popcount
returns undefined for an argument of zero.
long largest_power(long N)
{
N = N| (N>>1);
N = N| (N>>2);
N = N| (N>>4);
N = N| (N>>8);
return (N+1)>>1;
}
Notice what x - 1 ... | true |
02223865006e06c2659328eb59cf0834ca4e9016 | C++ | cmu-db/noisepage | /src/include/execution/compiler/operator/update_translator.h | UTF-8 | 5,232 | 2.65625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vector>
#include "execution/ast/identifier.h"
#include "execution/compiler/operator/operator_translator.h"
#include "execution/compiler/pipeline_driver.h"
#include "storage/storage_defs.h"
namespace noisepage::catalog {
class Schema;
} // namespace noisepage::catalog
namespace noisepage::pla... | true |
6b0d3d94d88cba7834af6ef9a559116d4c86f411 | C++ | nihk/Cap-Man | /Cap-Man/ScoreGraphicsComponent.cpp | UTF-8 | 1,212 | 3.171875 | 3 | [] | no_license | #include "ScoreGraphicsComponent.h"
ScoreGraphicsComponent::ScoreGraphicsComponent(std::unordered_map<int, Sprite>&& numberSprites)
: mNumberSprites(numberSprites)
, mScore(-1) {
}
ScoreGraphicsComponent::~ScoreGraphicsComponent() {
}
// state is the current accumulated score
void ScoreGraphicsComponent::upd... | true |
7e653436965943714be4e4437c61c819d5fc5c1e | C++ | pike4/CORE-Dev-Build-1.0 | /CORE/Source/Subsystems/Logging/LogFileStream.cpp | UTF-8 | 480 | 3.015625 | 3 | [
"MIT"
] | permissive | #include "LogFileStream.h"
LogFileStream::LogFileStream(std::string fileName)
{
path = fileName;
}
void LogFileStream::log(std::string output)
{
outputFile << output;
}
void LogFileStream::flush()
{
outputFile.flush();
}
int LogFileStream::open()
{
outputFile.open(path, std::ofstream::out);... | true |
ed4aa44b69b3dad71798af33e702d4b98a266f92 | C++ | 99002630/Genesis | /SET 4/Array/array.cc | UTF-8 | 2,207 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include "array.h"
using namespace std;
template <typename T>
MyArray<T>::MyArray():m_arr(NULL), m_len(0){}
template<typename T>
MyArray<T>::MyArray(int len):m_arr(new int(len)),m_len(len){}
template<typename T>
MyArray<T>::~MyArray(){delete []m_arr;}
template<typename T>
v... | true |
e4d070ea438571a2bc2b7cfa648522511dcb33df | C++ | Matthew-Yorke/Space-Strategy-Game-Prototype | /Space Strategy Game Prototype/Sprite.h | UTF-8 | 4,954 | 2.84375 | 3 | [] | no_license | //***************************************************************************************************************************************************
//
// File Name: Sprite.h
//
// Description:
// TODO: Add file description.
//
// Change History:
// Author Date Description
// Matthew D. York... | true |
306c54fca1cdd7bb4c5545884ebb70c082176817 | C++ | jjbayer/fixi | /src/interpreter.hpp | UTF-8 | 666 | 2.890625 | 3 | [] | no_license | #pragma once
#include "token.hpp"
#include "stack.hpp"
#include "lookup.hpp"
#include <memory>
#include <unordered_map>
class Token;
struct InterpreterError: public std::runtime_error
{
InterpreterError(const std::string & what): std::runtime_error(what) {}
};
struct UndefinedVariable: public InterpreterErro... | true |
07041fd41506b9b20be2b25400d6a6ef77ceb228 | C++ | mohitm15/competitve_solns | /codeforces/Math_problem.cpp | UTF-8 | 2,119 | 2.8125 | 3 | [] | no_license | // contest: Technocup 2020 - Elimination Round 3, problem: (A) Math Problem, Accepted, #
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄░░░░░░
// ░░░░░░█░░▄▀▀▀▀▀▀▀▀▀▀▀▀▄░░█░░░░░
// ░░░░░░█░█░░▀░░░░░░░░▀░░█░█░░░░░
// ░░░░░░█░█░░░▀░░░░░░▀░░░█░█░░░░░
// ░░░░░░█░█░░░░▀░░░░▀░░░░█░█░░░░░
// ░░░░░░█░█▄░░░░▀░░▀... | true |
7f9a6170cf5bc76e5ce5266ced8939a5c0fef5b5 | C++ | kaitorque/ProSolve | /Prosolve-5 2018/Solutions & Test Cases/E. Good Neighbour/solution.cpp | UTF-8 | 1,345 | 3.140625 | 3 | [] | no_license | #include <bits/stdc++.h> // gcc or clang only
using namespace std;
// by default if variable is declared in global scope
// its value will be automatically initialized to zero
bool visited[10];
int dist_mat[10][10];
int H, N;
int tsp(int src, int current_cost, int num_visited)
{
// recursion stopping condition = ... | true |
6b2fd4775d81a6b9121b8a7d4989e2491b3aeb99 | C++ | Dheeraj-cyber/OpenGL-Samples | /Material.h | UTF-8 | 471 | 2.84375 | 3 | [] | no_license | #pragma once
#include<GL/glew.h>
class Material
{
public:
Material();
Material(GLfloat sIntensity, GLfloat shine);
void UseMaterial(GLuint specularIntensityLocation, GLuint shininessLocation); //Specifies the lighting for our texture
~Material();
private:
GLfloat specularIntensity; //Specifies how much l... | true |
91d47f52a93f285a8d0d82340738baeca6e5bcbf | C++ | Gr1dlock/OOP | /LR_4/LR_4/commands/add_model_command.h | UTF-8 | 426 | 2.609375 | 3 | [] | no_license | #ifndef ADD_MODEL_COMMAND_H
#define ADD_MODEL_COMMAND_H
#include <string>
#include "basecommand.h"
namespace commands
{
class AddModelCommand: public BaseCommand
{
public:
explicit AddModelCommand(std::string file_name, std::string model_name);
void execute(std::shared_ptr<mediator::Mediator> mediator) overr... | true |
f420bea5e05e10a7306101b586f4348c69573098 | C++ | tangsancai/algorithm | /PAT-A/1048. Find Coins.cpp | UTF-8 | 508 | 2.59375 | 3 | [] | no_license | #include<stdio.h>
#include<algorithm>
using namespace std;
int coin[100005];
int main()
{
int N;
int payment;
scanf("%d%d",&N,&payment);
for(int i=0;i<N;i++)
{
scanf("%d",&coin[i]);
}
sort(coin,coin+N);
int i=0;
int j=N-1;
while((coin[i]+coin[j])!=payment&&i<j)
{
if((coin[i]+coin[j])<pa... | true |
9f0329ef9ed872f67965f3fecc73bc4a3316717c | C++ | wkurek/Caesar-cipher | /StreamReader.h | UTF-8 | 463 | 2.828125 | 3 | [] | no_license | #ifndef STREAMREADER
#define STREAMREADER
#include <iostream>
#include "Cipher.h"
class StreamReader
{
std::string path;
public:
/// @brief konstruktor
/// @param path ścieżka do pliku z treścią szyfru
StreamReader(std::string path);
/// @brief operator strumienia wejścia
/... | true |
2ca279417ce52f55b430f8e8964e5cf89d268ff6 | C++ | RichW2/GD1P03-2DGPRW | /GD1P03-PaintTool/GD1P03-PaintTool/ToolsCanvas.cpp | UTF-8 | 1,522 | 2.765625 | 3 | [] | no_license | #include "ToolsCanvas.h"
ToolsCanvas::ToolsCanvas(sf::RenderWindow* _window)
{
m_toolsWindow = _window;
}
void ToolsCanvas::AddButton(Button* newButton)
{
allButtons.push_back(newButton);
}
Button* ToolsCanvas::IsMouseOverButton(sf::Vector2i mp)
{
for (int i = 0; i < allButtons.size(); i++) {
Button* currButton... | true |
8fedfed2f8e01563375209b7e492129acc57b606 | C++ | simtb/coding-puzzles | /leetcode-december-challenge/valid_mountain_array.cpp | UTF-8 | 818 | 3.21875 | 3 | [] | no_license | class Solution {
public:
bool validMountainArray(vector<int>& arr) {
int n = arr.size();
if (n < 3 || arr[0] > arr[1]){
return false;
}
bool isMountain = true;
bool increasing = true;
for (int i = 1; i < n; i++){
int... | true |
0e96b6fa84237798cbc6ec7158d17b88a2b977aa | C++ | gtm2654197/School-Projects | /Gravity_Sim/simulation.cpp | UTF-8 | 15,852 | 3.203125 | 3 | [] | no_license | #include "simulation.h"
#include "constants.h"
#include <cstdlib>
#include "math.h"
#include <iostream>
#include <SFML/Window/Mouse.hpp>
using namespace std;
Simulation::Simulation()
{
window.create(sf::VideoMode(SCREEN_WIDTH,SCREEN_HEIGHT), "Gravity Simulator");
window.setFramerateLimit(60);
// zoomX... | true |
77537813483e0a34b3c5514a98b3bdddc1d7c86c | C++ | kbaedal/vzray | /src/shapes/parallelogram.h | UTF-8 | 1,007 | 2.546875 | 3 | [] | no_license | #ifndef __PARALLELOGRAM_H__
#define __PARALLELOGRAM_H__ 1
#include "shape.h"
#include "vec3.h"
#include "point.h"
#include "ray.h"
#include "rgb.h"
class Parallelogram : public Shape
{
public:
Parallelogram(Point a_base, Vec3 a_u, Vec3 a_v, Material *a_material)
{
base = a_base;
u ... | true |
51c417072cb0d5cb92ca1de5d771ec9c5a45c20d | C++ | jsaisagar/cppWork | /binarySearch.cpp | UTF-8 | 832 | 3.640625 | 4 | [] | no_license |
@Author: Sai Sagar Jinka
#include <iostream>
using namespace std;
int binarySearch(int arr[], int first, int last, int x){
if(last > 1)
{
int mid = first + (last - 1)/2;
if(arr[mid] == x)
return mid;
if(arr[mid] > x)
... | true |
4b4d48df9e7755c7458ce22217eff715b44f6cb6 | C++ | kmaragon/cxxmetrics | /cxxmetrics/skiplist.hpp | UTF-8 | 31,619 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #ifndef CXXMETRICS_PQSKIPLIST_HPP
#define CXXMETRICS_PQSKIPLIST_HPP
#include <atomic>
#include <array>
#include <random>
#include "internal/hazard_ptr.hpp"
namespace cxxmetrics
{
namespace internal
{
template<int TSize, int TBase = 2>
struct const_log
{
private:
static constexpr int l = (TSize % TBase) ? TSize ... | true |
65e155c33703f41d2ac1f4ce8855a2e8e0a9f9a3 | C++ | caroriv/divisas | /tarea.cpp | ISO-8859-1 | 1,912 | 4.09375 | 4 | [
"MIT"
] | permissive | /*
-Pedir al usuario el valor que desea realizar el clculo de factorial.
-Cambiar el tipo de dato para poder hacer clculo ms grande.
-Validar la entrada del usuario (que sea un entero positivo), en caso de no cumplir este requerimiento se
debe pedir un valor vlido.
-Una vez terminado el clculo, preguntar al ... | true |
2f1cba41d1e259dd591bf92fe19ac4969a357b33 | C++ | AndreyTokmakov/Design-Patterns | /ChainOfResponsibility.cpp | UTF-8 | 2,608 | 3.265625 | 3 | [] | no_license | //============================================================================
// Name : ChainOfResponsibility.cpp
// Created on : 19.04.2020
// Author : Tokmakov Andrey
// Version : 1.0
// Copyright : Your copyright notice
// Description : Chain of pesponsibility pattern tests
//====================... | true |
6014833ebc0ffbb19aa78cf550afe719c8f6d5fc | C++ | wrosecrans/graph | /include/graph/algorithm/spMatspMat.hpp | UTF-8 | 5,132 | 2.59375 | 3 | [] | no_license | //
// This file is part of Standard Graph Library (SGL)
// (c) Pacific Northwest National Laboratory 2018
//
// Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0
// International License
// https://creativecommons.org/licenses/by-nc-sa/4.0/
//
// Author: Scott McMillan
//
#pragma once
#include ... | true |
2577b4582b2627e6b744495bd1c5438843cc3c05 | C++ | greenfox-zerda-sparta/nagyzsuska | /week5/Day-4/taskmanager.cpp | UTF-8 | 2,003 | 3.25 | 3 | [] | no_license | #include "taskmanager.h"
#include "errorhandler.h"
#include "filehandler.h"
#include <iostream>
Todo::Todo(std::string file_name) {
m_filename = file_name;
m_errorhandler = new MyErrorHandler();
m_filehandler = new MyFileHandler();
}
Todo::~Todo() {
delete m_errorhandler;
delete m_filehandler;
}
void Todo:... | true |
0f79fd72c046cbbd19081d578d7d3aa942d5a6fd | C++ | rashedcs/LAB | /DS/Linear Search.cpp | UTF-8 | 529 | 3.640625 | 4 | [] | no_license |
#include <iostream>
using namespace std;
int main()
{
int arr[40], key,n,flag=0;
cout<<"Enter the number of elements in array : ";
cin>>n;
cout<<"The numbers are : ";
for (int i=0; i<n; i++)
{
cin>>arr[i];
}
cout<<"Enter the number to search : ";
cin>>key;
for (int i=0; i<n; i++)... | true |
34dc689fb695735294c3d64dd8b605b9e7945f0a | C++ | Tudor67/Competitive-Programming | /LeetCode/Problems/Algorithms/#745_PrefixAndSuffixSearch.cpp | UTF-8 | 1,956 | 3.546875 | 4 | [
"MIT"
] | permissive | class TrieNode{
public:
static const int ALPHABET_SIZE = 27;
static const char FIRST_LETTER = char('a' - 1);
int max_weight;
vector<TrieNode*> children;
TrieNode(){
this->max_weight = 0;
this->children.resize(ALPHABET_SIZE, NULL);
}
void insert(const str... | true |
5842d2862d5a7dc70e09f4ae4c7a40b28cc7f507 | C++ | xiweihuang/Primer | /chapter12/default_init.cpp | UTF-8 | 613 | 3.609375 | 4 | [] | no_license | // 默认初始化和值初始化
#include <iostream>
using namespace std;
// int a1[6];
// void print(int *p, int len) {
// for (size_t i = 0; i != len; ++i) {
// cout << *(p+i) << ", ";
// }
// cout << endl;
// }
// int main()
// {
// int a2[5];
// print(a1, 6); // 0, 0, 0, 0, 0, 0
// print(a2, 5); // 0, 0, 0, 0, 14393702... | true |
f2e943f4e9bb94e3c1319c7c03a9588c7c3c8720 | C++ | gamburgm/Exercises | /sorts/heapsort.cpp | UTF-8 | 1,783 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <string>
using namespace std;
#define LEN 10
void buildHeap(int* arr);
void heapsort(int* arr);
void upheap(int* arr, int valIdx);
void downheap(int* arr, int valIdx, int maxIdx);
void swap(int* valOne, int* valTwo);
void printArray(int* arr);
int main() {
int arr[LE... | true |
b8687a9fa0b326074701e2a4a4517cf3bf65b5c0 | C++ | munguia11/DATO3 | /DATO3.cpp | UTF-8 | 451 | 3.15625 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct Dato{
int dato1;
char dato2[20];
};
int main (int argc, char**argv){
struct Dato var1;
struct Dato *ptr;
ptr=&var1;
cout<<"puntero= "<<&ptr<<endl;
cout<< "direccion de ptr"<< ptr<<endl;
cin >>(*ptr).dato1;
cout<<(*ptr).dato1<<endl;
cin>>ptr->dato1;
cout<<ptr->d... | true |
528c38f239ba3876d14957208d2ef1997c19da41 | C++ | cypherix93/cse328-project | /RealFluid/src/App/Drawing/GridDrawer/GridDrawer.cpp | UTF-8 | 3,233 | 3.125 | 3 | [
"MIT"
] | permissive | #include "GridDrawer.h"
GridDrawOptions::GridDrawOptions()
{
CellDimensions = 40;
DrawCellContents = true;
DrawCellOutline = true;
DrawCellVectors = true;
DrawParticles = true;
}
GridDrawOptions::~GridDrawOptions()
{
}
void DrawCellGrid(Grid* grid, GridDrawOptions* options)
{
if (options == ... | true |
ba52f7ea8341e175d8ebea0b37aff6fbad49e019 | C++ | scheninsp/Cpp_Reps | /algorithms/longest_palindromic_substring_2.cpp | UTF-8 | 2,196 | 3.3125 | 3 | [] | no_license | //longest palindromic string 2
#include<string>
#include<algorithm>
#include<iostream>
using std::string;
using std::min;
using std::cout;
using std::endl;
static int lps_util(int* dp, int len, string& str){
int p0 = 1; //rightmost palindromic center
int p = 2; //rightmost palindromic length
dp[0]... | true |
cf2c4c9f6afcc936830594d2f5dd0e96d46085f0 | C++ | franckycodes/gestion_de_stock_en_cpp | /strtools.cpp | UTF-8 | 2,003 | 3.296875 | 3 | [] | no_license | #include "strtools.h"
#include <string>
#include <string.h>
#include "conversiontools.h"
using namespace std;
std::string getStr(std::string mainStr, int minIndex, int maxIndex)
{
std::string result("");
for(int i(minIndex),c(maxIndex);i<c;i++)
{
result += mainStr[i];
}
return result;
}
int getTotalWords(std... | true |
fc6ced1cfb9a1681eee929b49abcd713810dffa8 | C++ | SourDumplings/CodeSolutions | /Book practices/《C++primer》 5th 练习代码/chapter13/Exercise13.44.cpp | UTF-8 | 1,173 | 3.203125 | 3 | [] | no_license | /*
@Date : 2018-01-03 21:08:09
@Author : 酸饺子 (changzheng300@foxmail.com)
@Link : https://github.com/SourDumplings
@Version : $Id$
*/
/*
p531
*/
#include <iostream>
#include <algorithm>
#include <utility>
#include <memory>
#include <cstring>
using namespace std;
using namespace std::placeholders;
class S... | true |
92d2023d657516c6fe56a1d58f87f1db228f7062 | C++ | pig-zhang/pig-s | /数学运算符_循环结构.cpp | GB18030 | 4,605 | 4.1875 | 4 | [] | no_license | #include <iostream>
#include <stdio.h>
// ͷļ
// C/C++--ѧʽ/ѭṹ
int main() {
// C/C++ѧµĹ
// CС=ֵ==ڡ=ڡ
// <='Сڵڡ >='ڵڡ ڸֵҲнҸֵ
// ' == ' ʹڸж
// Ϊѧ
// ӷ+ - ˷ * / ģ%
// дʽҲѧдͬҪעŵȷʹ
// ΪֽΪѧ
// /Լ++/-- ʹ11
// ... | true |
304b42d3efb00aa1e2c519548cadf7e06eec935f | C++ | Axe-hyx/leetcode-salute | /712.minimum-ascii-delete-sum-for-two-strings.cpp | UTF-8 | 1,197 | 3.0625 | 3 | [] | no_license | /*
* @lc app=leetcode id=712 lang=cpp
*
* [712] Minimum ASCII Delete Sum for Two Strings
*/
// @lc code=start
#include <bits/stdc++.h>
using namespace std;
// Time Complexity:
// Space Complexity:
class Solution {
public:
int minimumDeleteSum(string s1, string s2) {
int n = s1.size(), m = s2.size();
... | true |
84c6fba859a3b9a556c76ed794c9956c2256a493 | C++ | Arbos/nwn2mdk | /dumpgr2/dumpgr2.cpp | UTF-8 | 23,133 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <set>
#include <map>
#include <string>
#include "gr2_file.h"
using namespace std;
void print_keys(GR2_property_key* k, std::set<GR2_property_key*>& printed,
int padding_size);
void print_key(GR2_property_key* k, std::set<GR2_property_key*>& printed,
int pa... | true |
079b313e4339c4996360e5d96fb7738a8c362f00 | C++ | MiroBeno/Volume-Rendering | /VolumeRendering/ViewBase.h | UTF-8 | 2,017 | 2.515625 | 3 | [] | no_license | /****************************************/
// Projection and camera manager
/****************************************/
#ifndef _VIEW_H_
#define _VIEW_H_
#include "common.h"
//#define INT_WIN_WIDTH 800
//#define INT_WIN_HEIGHT 680
#define INT_WIN_WIDTH 799
#define INT_WIN_HEIGHT 715
struct View { // parameters for... | true |
517498206f6a6abb2c7306772fc11ddc045bf9ba | C++ | civilian/competitive_programing | /_investigacion/contests/un_marzo/spiralPrimes.cpp | UTF-8 | 1,577 | 3.234375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cmath>
#include <map>
#include <utility>
#define EPS 1e-7
using namespace std;
typedef long long LL;
bool IsPrimeSlow (LL x)
{
if(x<=1) return false;
if(x<=3) return true;
if (!(x%2) || !(x%3)) return false;
LL s=(LL)(sqrt((double)(x))+EPS);
for(LL i=5;i<=s;i+=6)
{
if (!(x... | true |
6a1f5acc828077a5f5baabda586c90a1e0795ee4 | C++ | ranger9/ringlight | /ringlight/functions.ino | UTF-8 | 1,350 | 2.953125 | 3 | [] | no_license |
//turn all lights off and blink
void blinkMode()
{
for(int j=0; j<mode; j++)
{
for(int i=0; i<strip.numPixels(); i++)
{
strip.setPixelColor(i,(strip.Color(0,0,0)));
strip.show();
strip.setPixelColor(i,(strip.Color(128,0,0)));
strip.show();
}
... | true |
2be9c8095700e2c99bad18a3869552ed6f056046 | C++ | UGEL4/LearnOpenGL | /LearnOpenGL/Src/Texture.cpp | WINDOWS-1252 | 2,046 | 2.8125 | 3 | [] | no_license | #include "Texture.h"
#include "stb_image.h"
#include "gl_inf.h"
Texture::Texture(const std::string& path, const char* texType, bool flipUV)
:m_RendererID(0)
,m_Width(0), m_Height(0), m_Channles(0)
,m_TextureBuffer(nullptr)
{
unsigned int len = std::strlen(texType);
m_TexType = new char[len + 1];
strcpy_s(m_TexTy... | true |
f5bc3fb369493624019087399a36d367245bd93e | C++ | VegLeMeccano/EUROBOT-2017 | /PICKY_PI/Distributeur.h | UTF-8 | 683 | 2.890625 | 3 | [] | no_license | #ifndef DISTRIBUTEUR_H
#define DISTRIBUTEUR_H
#include <iostream>
#include "Coord.h"
#include "Module.h"
#define NB_MODULE_DISTRIBUTEUR 4
using namespace std;
class Distributeur
{
public:
Distributeur();
Distributeur(Coord coord_);
Distributeur(bool polychrome_, Coord coord_);
... | true |
73b0378dc8b51e4e3e6734e3653914d388cb7728 | C++ | jaggies/aed512emu | /lib/core/ram.h | UTF-8 | 1,654 | 3.265625 | 3 | [] | no_license | /*
* ram.h
*
* Created on: Sep 10, 2018
* Author: jmiller
*/
#ifndef RAM_H_
#define RAM_H_
#include <vector>
#include <cassert>
#include <iostream>
#include "peripheral.h"
template <bool debug>
class _Ram: public Peripheral {
public:
_Ram(int start, int size, const std::string& name = "RAM")
... | true |
42ae8f22bb3a29947d3202c8f4c0268b3c1754a3 | C++ | sturner84/LookingGlass | /lgTestingSupport.h | WINDOWS-1250 | 34,129 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* @file CppTestingSupport.h
*
* @brief Contains classes that support testing of c++ code.
*
* The classes in this header allow input/output to be redirected and for
* the output to be more easily compared. The Tokenizer class simplifies
* converting the output into string, int, or double tokens.
... | true |
749f7f7307b08157b06a446c3ad8d8540dade7e6 | C++ | ardayildirim/LeetCode | /November LeetCoding Challenge/2.week/1-Binary_Tree_Tilt.cpp | UTF-8 | 1,048 | 3.703125 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | true |
9e6ea5c2fb63fe4612b1fca27f4cc4b12d64881f | C++ | kujjwal02/practice | /HackerRank/Algorithms/warmup/Time Conversion.cpp | UTF-8 | 778 | 3.421875 | 3 | [] | no_license | /*
Given a time in AM/PM format, convert it to military (-hour) time.
Note: Midnight is on a -hour clock, and on a -hour clock. Noon is on a -hour clock, and on a -hour clock.
Input Format
A single string containing a time in -hour clock format (i.e.: or ), where .
Output Format
Convert and print the given ti... | true |
08fd51ddaddc1cfb1dd803526662b22b9eb6a0ff | C++ | 010ric/ms_bfs | /graphtraversal/include/graphtraversal/ms_bfs/ms_bfs_anp.h | UTF-8 | 5,617 | 2.5625 | 3 | [] | no_license | //
// Created by 010ric on 28.11.19.
//
#ifndef GRAPHTRAVERSAL_MS_BFS_ANP_H
#define GRAPHTRAVERSAL_MS_BFS_ANP_H
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <bitset>
#include <graphtraversal/webgraph/webgraph.h>
#include <graphtraversal/bfs/bfs.h>
#include <boost/dynamic_bitset.hpp>
namespace gr... | true |
91aae69c5b09a27ee7bb8a3329dcfdf43d82522a | C++ | KiillThemAll/cnc-vision | /rayreceiver.h | UTF-8 | 1,175 | 2.546875 | 3 | [] | no_license | #ifndef RAYRECEIVER_H
#define RAYRECEIVER_H
#include <QObject>
#include <QUdpSocket>
#include <QNetworkDatagram>
#include <QTimer>
#include <QThread>
typedef struct {
float mcs_x;
float mcs_y;
float mcs_z;
float mcs_b;
uint32_t state;
uint32_t played;
int32_t total;
} ray_payload_t;
class... | true |
411bf94a67c628da5233e509e7d9250cdc032c50 | C++ | Sayaten/StudyGameAI | /Chapter2_FSM/FiniteStateMachine/FiniteStateMachine/Global/EntityManager.h | UTF-8 | 553 | 2.734375 | 3 | [] | no_license | #pragma once
#include <map>
#include "BaseGameEntity.h"
class EntityManager
{
private:
typedef std::map<int, BaseGameEntity*> EntityMap;
private:
EntityMap m_EntityMap;
static EntityManager* instance;
EntityManager(){}
EntityManager(const EntityManager&);
EntityManager& operator=(const EntityManager&);
publi... | true |
bddfb8290afe15302a62d73a552e58d715c9c7d3 | C++ | Floodon/analog | /bin/Association.cpp | UTF-8 | 1,580 | 2.5625 | 3 | [] | no_license | /*************************************************************************
Association - description
-------------------
debut : 14/01/2020
copyright : (C) 2020 par Enzo Boschere, Tuoyuan TAN
e-mail : $EMAIL$
*********************************************************************... | true |
cf35734992be2e5c51e48bcac178c1c91d7100da | C++ | Ajay2521/Tutorial-on-CPlusPlus- | /Ternary Operator.cpp | UTF-8 | 856 | 4.03125 | 4 | [] | no_license | /*In this program we will be seeing Conditional Expression which is also known as Ternary Operator avaliable in C++*/
/*conditional operator is also known as Ternary Operator it is defined as when the condition is true then first expression will excuted , if the condition fails then second expression will be excuted .... | true |
9031df28dd309ac5b3dc67b57b789f03451ddfd9 | C++ | vp7273/Electronic-Components | /Battery.h | UTF-8 | 611 | 2.859375 | 3 | [] | no_license | /*
* Battery.h
*
* Created on: Mar 16, 2018
* Author: Varika
*/
#ifndef BATTERY_H_
#define BATTERY_H_
#include "ElectronicComponent.h"
class Battery: public Electronic_Component
{
private:
double batteryValue;
public:
Battery () //default constructor
{
}
Battery(double &ba... | true |
c163181061c351d87910587c289648bb2e5bb624 | C++ | yeahzdx/Leetcode | /双指针-Remove Duplicates fromS orted Array II.cpp | UTF-8 | 550 | 3.390625 | 3 | [] | no_license | #include"stage2.h"
/*
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,2,3].
*/
int removeDuplicates(int A[], int n) {
if(NULL==A || n<=0)return 0;
if(n==1)re... | true |
502ed23e72a2560686d6774cd763f2199eecf035 | C++ | magicmoremagic/bengine-core | /src/time.cpp | UTF-8 | 1,422 | 3.015625 | 3 | [
"MIT"
] | permissive | #include "pch.hpp"
#include "time.hpp"
namespace be {
///////////////////////////////////////////////////////////////////////////////
F64 tu_to_seconds(TU tu) noexcept {
return (F64)tu.count() / (F64)TU::period::den;
}
///////////////////////////////////////////////////////////////////////////////
TU seconds_to_t... | true |
2607db36a3b64b3c93b9d3cbd139f877b214c188 | C++ | SeanCST/Algorithm_Problems | /JianZhi_Offer/DeleteDuplication.cpp | UTF-8 | 1,580 | 3.984375 | 4 | [] | no_license | /* 剑指 Offer - 删除链表中重复的结点
* 在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。
* 例如,链表1->2->3->3->4->4->5 处理后为 1->2->5
**/
/*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
*/
class Solution {
public:
ListNode* deleteDuplication(ListNode* pHe... | true |
2970099b27bad7f88af6b58dce75114203acb724 | C++ | drofp/MyRPS | /src/start_menu.cpp | UTF-8 | 2,024 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <boost/algorithm/string.hpp>
#include "start_menu.h"
using namespace std;
namespace myrps
{
StartMenu::StartMenu()
{
difficulty = SettingOption::kRandom;
for (int i = 0; i < num_options; i++)
{
options.push_back(options_list[i]);
}
game.SetComputerMode(difficulty);
}
void... | true |
93942095e6f8048743e64931013db69c941a3f54 | C++ | ji-one/algorithm-study | /baekjoon_study_wook/백트래킹/10819_dw.cpp | UTF-8 | 660 | 3.09375 | 3 | [] | no_license | //10819 차이를 최대로
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int arr[10];
int visited[10];
int answer;
void dfs(int cnt, int idx, int sum){
if(cnt == n-1){
answer = max(answer, sum);
return ;
}
for(int i=0; i<n; i++){
if(visited[i]) continue;
vis... | true |
f66ca297f221cfac5d32e642d4e4bebebfd882eb | C++ | heX16/small_timer | /examples/mushrooms_cellar/mushrooms_cellar.ino | UTF-8 | 2,388 | 2.8125 | 3 | [] | no_license | #include <small_timer.hpp>
//////////////// Константы ////////////////
constexpr auto pinLight = 5;
constexpr auto pinVent = 6;
//constexpr auto pinLightButton = 7; //todo: добавить поддержку кнопки и таймер антидребезга
constexpr auto cEnable = 1;
constexpr auto cDisable = 0;
constexpr auto cMinute = 1000L*60;
//... | true |
e9e2a09792af26e1eaafee17f7f10b36c6933691 | C++ | tjfulle/lgrtk | /v3/hpc_index.hpp | UTF-8 | 4,189 | 2.765625 | 3 | [
"BSD-2-Clause"
] | permissive | #pragma once
#include <cstddef>
#include <type_traits>
#include <hpc_macros.hpp>
namespace hpc {
template <class Integral>
HPC_ALWAYS_INLINE HPC_HOST_DEVICE constexpr std::enable_if_t<std::is_integral<Integral>::value, Integral> weaken(Integral i) noexcept {
return i;
}
#ifdef HPC_ENABLE_STRONG_INDICES
template... | true |
5fc0480100d0db209f276cec40c4cd35f17a506a | C++ | vstflugel/tinykactl | /test/Testplate.cpp | UTF-8 | 581 | 2.796875 | 3 | [] | no_license | /* KTH ACM Contest Template Library
*
* Testing/Template
*
* Credit:
* By Mattias de Zalenski
*/
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
void init();
bool solve(int P);
int main() {
init();
// while-solve
int n = 0;
char c... | true |
daeec567c96732c5eb18db78aeab29e6fab47c8b | C++ | wardwellj/Assignment2 | /ContactManager.cpp | UTF-8 | 904 | 2.984375 | 3 | [] | no_license | #include "ContactManager.h"
#include<stdlib.h>
#include<string>
#include<vector>
#include<iostream>
using namespace std;
ContactManager::ContactManager()
{
}
ContactManager::ContactManager(string name, string adress, string number, string birthday):a_name(name), a_adress(adress), a_phoneNum(number), a_birthday(bi... | true |
b9b800c8af9a7ce377fa89eb9bdcd230e0259e3f | C++ | thenerdyouknow/Codeforces-Problems | /A/59A-Word.cpp | UTF-8 | 819 | 3.34375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
/* Solving the logic for this problem is left as a exercise to the reader */
int main() {
string original_mixedcase_string;
int length_of_string,uppercase_count = 0;
cin.sync_with_stdio(false);//For faster I/O
cin >> original_mixedcase_string;
length_of_string = ... | true |
a2d47d5fcef14ddf6194dc3fd8a84ee11cd8a887 | C++ | Luchanso/memoryjs | /lib/memory.h | UTF-8 | 1,858 | 2.9375 | 3 | [
"MIT"
] | permissive | #pragma once
#ifndef MEMORY_H
#define MEMORY_H
#define WIN32_LEAN_AND_MEAN
#include <node.h>
#include <windows.h>
#include <TlHelp32.h>
class memory {
public:
memory();
~memory();
std::vector<MEMORY_BASIC_INFORMATION> getRegions(HANDLE hProcess);
template <class dataType>
dataType readMemory(HANDLE hProces... | true |
efc52238ef7c5916e6c8464ba65791b8a4139f09 | C++ | mmarques-ssz/ADS-ED1-20210420 | /ex3.cpp | ISO-8859-1 | 624 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <locale.h>
using namespace std;
int main(int argc, char** argv)
{
setlocale(LC_ALL, "");
string msg = "amanh ser";
cout << msg << endl;
msg.append(" feriado");
cout << msg << endl;
msg.push_back('!');
cout << msg << endl;
msg.pop_back();
msg.pop_back();
... | true |
4c98f90577c0cc6541435ca69505834df8dd023d | C++ | mikcel/dnd-game | /COMP_345_Project/StrategyTest.cpp | UTF-8 | 5,204 | 3.25 | 3 | [] | no_license | //!
//! @file
//! @brief Implementation file for the StrategyTest class
//!
#include "StrategyTest.h"
//! cppunit test cases registration
CPPUNIT_TEST_SUITE_REGISTRATION(StrategyTest);
//! test method for checking that the ally actually transforms into an enemy when attacked
//! the test executes an attack from t... | true |
3f411176ccaacda6427106514a2898efbccdc564 | C++ | zeroplusone/AlgorithmPractice | /Leetcode/1903. Largest Odd Number in String.cpp | UTF-8 | 388 | 3.140625 | 3 | [] | no_license | class Solution {
public:
string largestOddNumber(string num) {
int odd_index=-1;
for(int i=num.length()-1;i>=0;--i) {
if((num[i]-'0')%2==1) {
odd_index=i;
break;
}
}
if(odd_index==-1) {
return "";
} else {
... | true |
331394133dc120ea31b1a37f3dc7bb230d2ac202 | C++ | apocalyptikz/Solitaire | /Program3/deck.cpp | UTF-8 | 2,114 | 3.609375 | 4 | [] | no_license | #include "deck.h"
//deck objects should do the following :
//
//have a deep copy constructor
//have a deep assignment operator
//default to a standard deck of 52 cards(see Other section for sequence)
//add a card to the top or bottom of the deck (pass card object)
//insert a card into the deck at some index (exit if i... | true |
866405f9da0c7d4727d1bf3b5d3255e6bdd401d8 | C++ | songhzh/The-Arena | /The Arena/The Arena/main.cpp | UTF-8 | 1,140 | 2.640625 | 3 | [] | no_license | #include <SFML/Graphics.hpp>
#include "GameStateManager.h"
int main()
{
sf::RenderWindow window(sf::VideoMode(1600, 900), "The Arena", sf::Style::Titlebar | sf::Style::Close);
sf::Texture logo_t;
logo_t.loadFromFile("Resources/Textures/title_logo.png");
sf::Sprite logo_s(logo_t);
logo_s.setPosition(sf::Vector2f(1... | true |
f8d4dcca4beccc925514260c9427ecf59d8199cb | C++ | tig/Tigger | /Experiments/WeatherBug/WeatherBug/WsHelpers.h | UTF-8 | 5,251 | 2.578125 | 3 | [
"MS-PL",
"MIT"
] | permissive | #pragma once
class WsError
{
WS_ERROR* m_h;
public:
WsError() :
m_h(0)
{
// Do nothing
}
~WsError()
{
if (0 != m_h)
{
WsFreeError(m_h);
}
}
HRESULT Create(__in_ecount_opt(propertyCount) const WS_ERROR_PROPERTY... | true |
7ce73dfd6a966b76da75c2d7d1c99a513286ad67 | C++ | xxwsL/hello-world- | /leecode/inc/remove_nth_listnode_t.h | UTF-8 | 969 | 3.03125 | 3 | [] | no_license | #ifndef _remove_nth_listnode_t_h_
#define _remove_nth_listnode_t_h_
#include <iostream>
#include <vector>
#include "ListNode.h"
using namespace std;
ListNode* remove_nth_listnode_t_fi(ListNode* head, int n)
{
cout << "this is remove_nth_listnode test\n";
ListNode *node_tp = head;
vector<ListNode*> buf;
... | true |
03e866a13281ccc187db55326d6aba40b1d260a3 | C++ | snytkine/router_lib | /RouterNode.h | UTF-8 | 2,869 | 2.8125 | 3 | [] | no_license | //
// Created by Snytkine, Dmitri (CORP) on 3/14/17.
//
#ifndef ROUTER_ROUTER_NODE_H
#define ROUTER_ROUTER_NODE_H
#include <iostream>
#include <vector>
#include <sstream>
#include <chrono>
#include <utility>
#include "node_result.h"
namespace router_lib {
using namespace std;
template<typename T>
clas... | true |
8f49c00fe388dcccba495eb86180bbcee3e27282 | C++ | SccsAtmtn/leetcode | /240.cpp | UTF-8 | 2,755 | 2.96875 | 3 | [] | no_license | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int m = matrix.size();
if (m == 0) return false;
int n = matrix[0].size();
if (n == 0) return false;
int upperx, uppery, bottomx, bottomy;
upperx = uppery = 0;
bottomx = m - ... | true |
9e64392f5347f680a977e8e0011c1916e7bbd89f | C++ | willsauer/invaders | /include/CSprite.h | UTF-8 | 2,152 | 2.53125 | 3 | [] | no_license | #ifndef CSPRITE_H
#define CSPRITE_H
/*
* CSprite.cpp
* Sprite class
*
* Created by Marcelo Cohen on 04/11.
* Copyright 2011 PUCRS. All rights reserved.
*
*/
#include <vector>
#include "CMultiImage.h"
#include "TexRect.h"
#include "tinyxml.h"
class CSprite : public CMultiImage, public TiXmlVisitor
{
pu... | true |
ddc4bfaca290fa7a987ce24feceb0b7e133be21b | C++ | Wishu969/Project-Euler | /VSstudio/project euler/problem40.cpp | UTF-8 | 392 | 2.78125 | 3 | [] | no_license | #include "problem40.h"
std::string problem40::s;
problem40::problem40()
{
}
problem40::~problem40()
{
}
void problem40::init()
{
for (int i = 1; s.length() <= 1000000; i++)
{
std::string temp = std::to_string(i);
s.append(temp);
}
}
int problem40::run()
{
init();
int j = 1;
for (int i = 1; i != 1000000; i... | true |
3fc65fdcd44381b4b03e73cbba6f60ba43f75e52 | C++ | SpaceMonkeyClan/FreeNOS-1.0.3 | /lib/libipc/Channel.h | UTF-8 | 2,364 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright (C) 2015 Niek Linnenbank
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is di... | true |