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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f0b0bf5b46d0c2ac33d8ef94c9666f07a4d3d821 | C++ | Kikirrus/DON | /src/Tree.h | UTF-8 | 6,506 | 2.953125 | 3 | [] | no_license | //#pragma once
#ifndef TREE_H_
#define TREE_H_
#include <memory>
#include <vector>
#include <stdexcept>
#pragma warning (disable: 4290)
template<class T>
class Tree
{
public:
typedef Tree<T>* Ptr;
typedef std::vector<std::shared_ptr<Tree<T> > > List;
private:
typename T _data;
typename... | true |
bc70c7b3b5c9be704e1dd0b72d59d8385cd365e8 | C++ | mattyan1053/StateMachineForSiv3D | /StateMachineForOpenSiv3D/Main.cpp | UTF-8 | 1,967 | 3.28125 | 3 | [] | no_license |
# include <Siv3D.hpp> // OpenSiv3D v0.4.0
# include "StateMachine.hpp"
// 状態
// 列挙体を使っているがStringなどでも良い
enum BallStates {
Idle,
Moving,
};
// 状態管理したいクラス
class MovingBall : public StateMachine<BallStates> {
Circle m_ball;
public:
MovingBall() {
m_ball.r = 40;
m_ball.setPos({ 100, 200 });
initializeState... | true |
6113e1a428cc79de038ae0433a715f4b13401cab | C++ | KishParikh13/CS1342 | /Parikh,Kish,p4/Stock.cpp | UTF-8 | 5,425 | 3.671875 | 4 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
#include "Stock.h"
// default constructor
Stock::Stock (string stockName, string dateIn, int yearIn, int monthIn, double openingValueIn, double highValueIn, double lowValueIn, double closingValueIn, double closeValu... | true |
ef068621623e33fcb7ac794e07fb6346eb646200 | C++ | yangjufo/LeetCode | /C++/78. Subsets.cpp | UTF-8 | 673 | 3.125 | 3 | [] | no_license | class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
vector<vector<int>> res;
vector<int> subset;
res.push_back(subset);
subsets(res, subset, 0, 1, nums);
return res;
}
private:
void subsets(vector<vector<int>>& res, vector<int> ... | true |
096bdca046a188074df60a56918cc2e23ae6f36e | C++ | drzazga888/MandelbrotSetSRiR | /parallel/Utils.cpp | UTF-8 | 1,085 | 2.96875 | 3 | [] | no_license | #include "Utils.h"
#include <iostream>
#include <cmath>
#include <mpi.h>
#include <cstdlib>
using std::cerr;
using std::endl;
using std::cout;
void warning(std::string message){
cerr << "Uwaga: " << message << endl;
}
void error(const char *message){
cerr << "Blad: " << message << endl;
exit(-1);
}
int getRow... | true |
2c3ae1fba1ddadc1d7c71b5c3d15d97ac063b000 | C++ | ShawnFSL/DirectX-11-Renderer | /DirectX11Engine/Src/Image.cpp | UTF-8 | 4,069 | 3.015625 | 3 | [] | no_license | #include "Image.h"
#include "GlobalDefines.h"
#include "Utilities/EngineUtilities.h"
#include <assert.h>
Image::Image(int width, int height) noexcept
{
HRESULT hr = scratch.Initialize2D(format, width, height, 1u, 1u);
if (FAILED(hr))
{
assert("Failed to initialize image");
}
}
Image Image::FromFile(const std::... | true |
37a250c118302ed70b1b3d8059d93aac907f332e | C++ | cw2744101/winter-cis-5-course-40626 | /homework/assignment2/currencyexchange/main.cpp | UTF-8 | 1,007 | 3.546875 | 4 | [] | no_license | /*
* File: main.cpp
* Author: chenlin
* Purpose: currency exchange
* Created on 2018年1月12日, 下午2:00
*/
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
int main(int argc, char** argv) {
const double yenperDollar = 98.93,
europerDollar = 0.74;
l... | true |
c4be5f2a47e0ecc21d25d76747baee86b695f435 | C++ | 226252/PAMSI | /lab7/inc/Tree.hpp | UTF-8 | 8,012 | 2.9375 | 3 | [] | no_license | #ifndef Tree_HPP
#define Tree_HPP
#include <iostream>
#include "interfaces/iRunable.hpp"
#include "TreeNode.hpp"
#include "timer.hpp"
#include <cstdlib>
template <typename TYP>
class Tree :public iRunable
{
TreeNode<TYP> guard;
TreeNode<TYP>* root;
string cr,cl,cp;
string wh... | true |
b5c84e8d70540cc129b70bb9c9915e10af73b510 | C++ | Ruby-Void/Game_Tec | /CSC8503/CSC8503Common/GameWorld.h | UTF-8 | 2,156 | 2.609375 | 3 | [] | no_license | #pragma once
#include "Ray.h"
#include "CollisionDetection.h"
#include "QuadTree.h"
#include "GameObject.h"
#include "ObjectNames.h"
#include "Layers.h"
#include <string>
#include <vector>
namespace NCL {
class Camera;
using Maths::Ray;
namespace CSC8503 {
class GameObject;
class Constraint;
typedef std:... | true |
a42f99f81f6a82623b5b501efae2940e47174ddc | C++ | coding10000/ctci150 | /p0301_queue.h | UTF-8 | 332 | 2.703125 | 3 | [] | no_license | #ifndef P0301_QUEUE
#define P0301_QUEUE
#include "p0301_node.h"
class MyQueue{
private:
Node* head;
Node* tail;
size_t size;
public:
MyQueue():head(0),tail(0),size(0){
}
~MyQueue(){
}
bool enQueue(int);
bool deQueue(int&);
bool destroy();
bool empty() const;
size_t checkSize() const;
};
#endif // define... | true |
cd70b241b6eeca2405a57e81c2159cc35cbaf277 | C++ | pnowak2/learnjs | /electronics/arduino/Elegoo The Most Complete Starter Kit/13-analog-joystick-module/13-analog-joystick-module.ino | UTF-8 | 612 | 2.78125 | 3 | [] | no_license | const int HORIZONTAL_PIN = A0;
const int VERTICAL_PIN = A1;
const int SWITCH_PIN = 7;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(HORIZONTAL_PIN, INPUT);
pinMode(VERTICAL_PIN, INPUT);
pinMode(SWITCH_PIN, INPUT_PULLUP);
digitalWrite(SWITCH_PIN, HIGH);
}
void loop() ... | true |
8283c3043c7e0fd98934edd44baa0d91e3e69313 | C++ | zhangsu/ccspec | /spec/matchers/contain_spec.cc | UTF-8 | 2,871 | 2.75 | 3 | [
"MIT"
] | permissive | #include <string>
#include "ccspec/core.h"
#include "ccspec/expectation.h"
#include "ccspec/matchers.h"
using std::string;
using ccspec::core::describe;
using ccspec::core::it;
using ccspec::expect;
using ccspec::matchers::contain;
using ccspec::matchers::eq;
using ccspec::matchers::match;
namespace spec {
namespace... | true |
055d21e28c8815fe673be96a0d62eee8718208d1 | C++ | Kasen87/Scorpion-Dist | /junk/identifier.cpp | UTF-8 | 8,303 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | #include "clib/arraylist.h"
#include <iostream>
#include <sstream>
#include <string>
#include <regex>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define RESERVED 35
string reserved[RESERVED] = { "public" , "private", "static" "void", "bool", "catch", "char", "class",
"cons... | true |
82a3e74601d5ae1c35bb13b00fc1af6e9740ff24 | C++ | MaxKuryez/Advanced-Algorithms | /AllAlgorithms/KMPalg.cpp | UTF-8 | 946 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int KMP(string x, string y);
void preKmp(string x, int m, int *kmpNext);
int main(){
string pat = "lol";
string text = "lololololklolol";
cout<<KMP(pat,text);
}
void preKmp(string x, int m, int *kmpNext) {
int i = 0;
int j =... | true |
48ae46d1f66fa0208cd477cb26dcf0d47c9a1a06 | C++ | layzacs/PRG29003 | /arvores-binarias/cria-arvore-especifica.cpp | UTF-8 | 818 | 2.953125 | 3 | [] | no_license | #include <prglib.h>
#include <string>
using prglib::arvore;
using namespace std;
arvore<string> * cria_arvore() {
// mar é o valor da raiz, ele é passado primeiramente. A árvore nunca fica vazia
// é importante que a raiz seja um valor mediano, no caso, a letra m está perto do centro do alfabeto.
arvore<... | true |
7dbab1930f2c20c9076dbe2ab7c28be2b3ddd0a0 | C++ | shadowwalker2718/cppclass | /homework/tests/tests_hw01.cpp | UTF-8 | 450 | 2.890625 | 3 | [] | no_license | #include <cmath>
#include "hw01.h"
#include "gtest/gtest.h"
TEST(HW01, RETURN_TRUE) {
EXPECT_EQ (return_true(), true);
}
TEST(HW01, RETURN_FALSE) {
EXPECT_EQ (return_false(), false);
}
TEST(HW01, RETURN_42) {
EXPECT_EQ (return_42(), 42);
}
TEST(HW01, RETURN_NEG_42) {
EXPECT_EQ (return_neg_42(), -42... | true |
efa42a0499991914b31cb319ccd569f6ebce374a | C++ | manthenasirisha/allpractice | /PSP 1 Practical/PSP1 Assigenment final submission/FinalSubmission/Q4.h | UTF-8 | 277 | 2.640625 | 3 | [] | no_license | // Author : Sirisha penmetsa
// Date : 21/03/2019
#include <iostream>
#include <string>
using namespace std;
int calculateTheSumOfDivisors(int);
string calculateThePositiveIntegerIsDeficientPerfectORabundant(int);
void calculateTheXnor(int, int);
int calculateTheReverseNumber(int); | true |
d1d5053c706b7f3e6bcce25ddc7e65ed8e9e8ddf | C++ | suprnrdy/CarND-Extended-Kalman-Filter-Project | /src/tools.cpp | UTF-8 | 2,186 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include "tools.h"
using Eigen::VectorXd;
using Eigen::MatrixXd;
using std::vector;
Tools::Tools() {}
Tools::~Tools() {}
VectorXd Tools::CalculateRMSE(const vector<VectorXd> &estimations,
const vector<VectorXd> &ground_truth) {
/**
TODO:
* Calculate the RMSE... | true |
f092f155a4567eec5cb6b0b02dc921d3ea2b3c0d | C++ | akansha-jain/ESDL-Akansha-Jain | /hello.cpp | UTF-8 | 182 | 2.921875 | 3 | [] | no_license | #include<iostream.h>
int main()
{
int a,b,c;
cout<<"Hello";
cout<<"This is Cummins college of engineering";
cout<"Enter two numbers:";
cin>>a>>b;
c=a+b;
cout<<"sum:"<<c;
return 0;
}
| true |
d13beaec968fd9657895a9f0b63052a51bbcfa1c | C++ | DmitryPrischep/Scenarios | /target.h | UTF-8 | 811 | 2.984375 | 3 | [] | no_license | #ifndef TARGET_H
#define TARGET_H
class target
{
private:
float distance;
float azimuth;
float x;
float y;
float course;
float velocity;
public:
target();
float getDistance(){return this->distance;}
void setDistance(float value){this->distance = value;}
float getAzimuth(){retu... | true |
dad6ee404eee99e6b9b9f8f22d89522c85f041a9 | C++ | melonCoder/leetcode | /power_of_two.cpp | UTF-8 | 347 | 2.78125 | 3 | [] | no_license | class Solution {
public:
bool isPowerOfTwo(int n) {
if(n <=0) return false;
int cnt = 0;
int mask = 0x1;
while(n){
cnt += (mask&n);
if(cnt >1) return false;
n = n >> 1;
}
if(cnt ==1) return true;
e... | true |
ee903a71ced9f005bca6b01c0eeb47db7caeae64 | C++ | zhangyonglele/Datastructure | /twointoten/stack.cpp | UTF-8 | 2,192 | 3.453125 | 3 | [] | no_license | //
// Created by 张永乐 on 2018/10/16.
//
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include "stack.h"
using namespace std;
int creatstack(linkst &L){
L = (linkst)malloc(sizeof(Snode));
if(!L){
exit(OVERFLOW);
}
L->next = NULL;
return 1;
};
int push(linkst &L,... | true |
e2a9b3ba03eeaba19734b0259a324368864f23ad | C++ | jasonlaw-dev/leetcode | /src/286.walls-and-gates(bfs-revision-0).cpp | UTF-8 | 1,195 | 2.8125 | 3 | [] | no_license | #include <vector>
#include <queue>
#include <array>
using namespace std;
/*
* @lc app=leetcode id=286 lang=cpp
*
* [286] Walls and Gates
*/
// @lc code=start
int dirs[][2]{{0,1},{0,-1},{1,0},{-1,0}};
// array<array<int, 2>, 4> dirs{{{0,1},{0,-1},{1,0},{-1,0}}};
class Solution {
public:
void wallsAndGates(vecto... | true |
1d34a13b293c1d32b9ff6ed8e2fe1392c6ee2596 | C++ | TobiahRex/algorithms | /comsc165/7B/7B-2/7B-2.cpp | UTF-8 | 826 | 4.03125 | 4 | [
"MIT"
] | permissive | /* 7B-2
•Design a StudentGrades class that has member variables to hold four grades.
The class should have a constructor, accessor, and mutator functions for
the grades fields and a member function that returns the average of the grades.
Demonstrate the class by writing a separate program that creates an instance of
t... | true |
b43d973b4351652d038f53459b792c5cbbfbc6b0 | C++ | Vlad-kv/bimap | /bimap.h | UTF-8 | 4,262 | 2.828125 | 3 | [] | no_license | #ifndef BIMAP_H
#define BIMAP_H
#include <cassert>
#include <string>
struct bimap{
private:
typedef std::string left_t;
typedef std::string right_t;
struct node {
left_t l_data;
node *l_left;
node *l_right;
node *l_par;
right_t r_data;
node *r_left;
node *r_right;
node *r_par;
node(lef... | true |
af2c580180e80e518bb35094d3c62e7dfb629b9c | C++ | patelrajnath/MMT | /src/decoder-phrasebased/src/native/include/mmt/IncrementalModel.h | UTF-8 | 1,723 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by Davide Caroselli on 02/09/16.
//
#ifndef MMT_COMMON_INTERFACES_INCREMENTALMODEL_H
#define MMT_COMMON_INTERFACES_INCREMENTALMODEL_H
#include <mmt/sentence.h>
namespace mmt {
typedef int8_t channel_t;
typedef int64_t seqid_t;
struct translation_unit {
channel_t channel;
... | true |
fc826363d006ee31448548cffd9ef29cea9c93de | C++ | antoniocamas/klondike | /src/model/movement/MovementClassfWaste2Pile.cpp | UTF-8 | 499 | 2.671875 | 3 | [] | no_license | #include "MovementClassfWaste2Pile.h"
MovementClassfWaste2Pile::MovementClassfWaste2Pile(
string o, string d, shared_ptr<MovementClassifier> n):
MovementClassifier(o, d, n) {
};
MovementClassfWaste2Pile::MovementClassfWaste2Pile(string o, string d):
MovementClassfWaste2Pile(o, d, nullptr) {
}
MovementTyp... | true |
fd2e5daf7aae4b9fabd8ed7ad878a897a930b97b | C++ | KU-t/Computer_Graphics | /실습/GL_1(11~)/GL_1(11~)/20.cpp | UHC | 6,833 | 2.65625 | 3 | [] | no_license | #include <gl/freeglut.h>
#define W_x 800
#define W_y 600
#define W_z 600
enum VIEW { Perspective, Orthographic };
enum DIRECTION { Left, Right };
VIEW View = Perspective;
GLvoid drawScene(GLvoid);
GLvoid Reshape(int w, int h);
void Mouse(int button, int state, int x, int y);
void Motion(int x, int y);
void Timer(int... | true |
6de2ea2f687f9171803ad061af05d51cf47879f5 | C++ | L1U617/Leetcode | /027_remove_element.cpp | UTF-8 | 619 | 2.875 | 3 | [] | no_license | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int len = nums.size();
int i = 0, j = len - 1;
int cnt = 0, flag = 0;
while(i < j){
if(nums[i] == val){
if(nums[j] == val){
j--;
}
... | true |
5fe4af13375ce4ca67b47585f3496fb2b1fcbebd | C++ | NyanKiyoshi/Webpp | /tests/fcgi/test_cgi.cpp | UTF-8 | 1,225 | 2.734375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "fcgio.h"
using namespace std;
int main(void) {
// Backup the stdio streambufs
streambuf * cin_streambuf = cin.rdbuf();
streambuf * cout_streambuf = cout.rdbuf();
streambuf * cerr_streambuf = cerr.rdbuf();
FCGX_Request request;
FCGX_Init();
FCGX_InitRequest(... | true |
506c168417d802e5ba262a652d9ff4f23ef98002 | C++ | joapim/Gamle-fag | /1.klasse/Prosedyre og objektorientert/Øvinger/Øving 5/card.cpp | ISO-8859-15 | 4,019 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "card.h"
using namespace std;
string suitToString(Suit s) {
switch (s) {
case CLUBS: return "Clubs"; break;
case DIAMONDS: return "DIAMONDS"; break;
case HEARTS: return "HEARTS"; break;
case SPADES: return "SPADES"; break;
default: return "You made an ill... | true |
198d4281b3aa8cbc578ea239fe9cedf052a6c367 | C++ | Mindjolt2406/Competitive-Programming | /Codechef/Practice/COMPILER.cpp | UTF-8 | 381 | 2.640625 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
int sum1 = 0;
int count = 0;
int max1 = 0;
for(int i=0;i<s.size();i++)
{
if(s[i]=='<') sum1++;
else if(s[i]=='>' && sum1>0){sum1--;}
else if(s[i]=='>')break;
... | true |
952dc7836535cb5122cfb1fb2c9a179b01562f54 | C++ | takkyu2/purely-functional-data-structures | /List/BottomUpMergeSort.cpp | UTF-8 | 334 | 2.625 | 3 | [] | no_license | #include "BottomUpMergeSort.hpp"
#include <iostream>
int main() {
BottomUpMergeSort<int> e = BottomUpMergeSort<int>::empty();
for (int i = 100; i >= 0; --i) {
e = e.add(i);
}
ImList<int> se = e.sort();
while (!se.isEmpty()) {
std::cout << se.head() << std::endl;
se = se.tai... | true |
e213d7f98774127336aba82790dfa887547fa2cd | C++ | Rutikab12/C-Revision-Programs | /Linked List/nth_node_from_end_of_list.cpp | UTF-8 | 956 | 3.5625 | 4 | [] | no_license | #include<bits/stdc++.h>
#include<assert.h>
using namespace std;
//O(n)
class node{
public:
int data;
node* next;
};
void push(node** head, int data){
node* newnode=new node();
newnode->data=data;
newnode->next=(*head);
(*head)=newnode;
}
int printNthFromLast(node *head, int n){
... | true |
21de893ea426eb2ff16f93805f669d1e167fd39b | C++ | Bioliquid/Operating-Systems | /net/client.cpp | UTF-8 | 612 | 2.875 | 3 | [] | no_license | #include "session.h"
#include <iostream>
#include <string>
#include <optional>
int main(int argc, char **argv) {
IPv4_client client;
if (argc == 3) {
client.init(argv[1], argv[2]);
} else if (argc != 1) {
std::cout << "Usage:" << std::endl;
std::cout << "1.make client" << std::endl;
std::cout << "2.make cli... | true |
ef97c0d93c9c64500be2d5c3ad0701f5eb46413b | C++ | Vignesh-Sairaj/Operating-Systems | /Lab Work/Fork/forkArr.cpp | UTF-8 | 762 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
using namespace std;
int main(void) {
int *arr;
int n;
shmfd = shm_open(shmName, O_CREAT | O_RDWR, 0777);
ftruncate(s... | true |
4125b97b670a61bcb4899d0a4930f0b983e5b7dd | C++ | petcomputacaoufrgs/lobo-brain | /reinforcement-learning/alinhamento/State.hpp | UTF-8 | 2,196 | 3.359375 | 3 | [] | no_license | #ifndef STATE_H
#define STATE_H
#include <vector>
#include <string>
using namespace std;
// Useful definitions
typedef vector<vector<char>> Board;
class State{
public:
State(char p1, char p2); // constructor
~State(); //destroyer
Board getBoard(); // get the board
void setBoard(... | true |
f024debdde2562e6d94a9a899733aa5628e42114 | C++ | GoCodingIcreated/alg_course | /kr_2/3.cpp | UTF-8 | 1,258 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
struct Node {
std::string data;
std::vector<Node*> children;
int R;
Node() { R = 0; }
};
void dfs(Node *head, int level) {
//std::cout << head->data << ' ' << level << ' ' << head->R << std::endl;
for (int i = 0; i < he... | true |
984397d9e7d64b95a03807922e7faa17d01e86ff | C++ | Divya-1994/repo1 | /ACC/Assignment2/A3.cpp | UTF-8 | 3,574 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <chrono>
#include "input.h"
using namespace std;
/* count number of inversion */
void bruteForceTechnique(vector<int> input);
int mergeNcount(vector<int> arr, int array_size);
int mergeSort(vector<int> arr, int temp[], int left, int right);
int merge(vector<int> arr, i... | true |
214292e3f16d5ad59a3bb1c6bb4f2986eac69d2e | C++ | mittalprince/Everyday-Stuff | /c++/binary-tree/fenwick-tree/fenwick_tree.cpp | UTF-8 | 1,492 | 3.96875 | 4 | [] | no_license | /* Probleme statement link https://www.geeksforgeeks.org/binary-indexed-tree-or-fenwick-tree-2/
To understand logic https://cs.stackexchange.com/questions/10538/bit-what-is-the-intuition-behind-a-binary-indexed-tree-and-how-was-it-thought-a
Binary Indexed Tree or Fenwick Tree
Let us consider the following problem t... | true |
347fdead199cf272d86214763078ee55c5681076 | C++ | tectronics/safe-haven | /JRX/Source/JRXTimer.h | UTF-8 | 767 | 2.671875 | 3 | [] | no_license | /*
Class: JRXTimer
Purpose: Manage time
Author: Jehanlos Roman
*/
#ifndef JRX_TIMER_H
#define JRX_TIMER_H
namespace JRX
{
class JRXTimer
{
public:
JRXTimer();
// Sets the start time and resets the frame count to zero
void Reset();
// Updates the fps, time, and delta time
void Upd... | true |
ea910e154c00f9dbf1f11c0cc3ff1d8d244b6917 | C++ | bkklee/group_particles | /detail/geom_utils.hpp | UTF-8 | 2,601 | 3.15625 | 3 | [] | no_license | #ifndef GEOM_UTILS_HPP
#define GEOM_UTILS_HPP
#include "fields.hpp"
#include <cmath>
#include <array>
#include <type_traits>
namespace grp_prt_detail {
namespace GeomUtils {
// wraps idx with period N
static inline size_t
periodic_idx (int idx, int N)
{// {{{
return (N + idx%N) % N;
}// }}}
// computes the sq... | true |
67f12cba56310b7a918f720b1cc6800e8a955452 | C++ | myan028/Shunting-Yard | /node.cpp | UTF-8 | 1,092 | 3.5 | 4 | [] | no_license | #include <iostream>
#include "node.h"
using namespace std;
Node::Node(char* tempData){
data = tempData; //pass in and set data
//left = NULL;
//right = NULL;
}
/*Node::~Node(){
delete node;
left = NULL;
right = NULL;
}*/
char* Node::getData(){
return data;//return data
}
/*void Node:... | true |
2552db0ebf57be1a5640e3921c50be3dc186db77 | C++ | FeibHwang/OJ-Leetcode | /Code/23_Merge_k_Sorted_Lists.cpp | UTF-8 | 1,662 | 3.65625 | 4 | [] | no_license | /**********************************************************************************
* Merge k sorted linked lists and return it as one sorted list.
* Analyze and describe its complexity.
**********************************************************************************/
/*********************************************... | true |
92e6ea8cac7adb912ea8ac2af15ef59ded0ea0b9 | C++ | aRbhaSun20/OpenGl3d | /source/Mvps/ModelMatrix.h | UTF-8 | 1,853 | 2.703125 | 3 | [] | no_license | #pragma once
#include <Precomz/precomz.h>
#include <glm/glm.hpp> //maths library
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "../Core/LogFile.h"
class ModelMatrix
{
private:
glm::vec3 m_Translation;
glm::vec3 m_RotationAxis;
float m_RotationAngle = 0.0f;
float m_S... | true |
8ed251cb292a32bac7c1f218a989877932c8fb38 | C++ | rainofwinter/NetnTV | /Core/ImageChangerShowImageAction.cpp | UTF-8 | 2,832 | 2.625 | 3 | [] | no_license | #include "stdafx.h"
#include "ImageChangerShowImageAction.h"
#include "Scene.h"
#include "SceneObject.h"
#include "Writer.h"
#include "Xml.h"
#include "Reader.h"
#include "ImageChanger.h"
#include "ElementMapping.h"
ImageChangerShowImageAction::ImageChangerShowImageAction()
{
imageIndex_ = 0;
mode_ = Specific;
dire... | true |
93ae7352c781c92fb3580ab670de52042083fafe | C++ | tprice108/School-Projects | /COP 3530 - Data Structures and Algorithms/Homework/Sorting Analysis/heap_sort.cpp | UTF-8 | 8,934 | 3.6875 | 4 | [] | no_license |
#include <algorithm>
#include <chrono>
#include <fstream>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
using namespace std;
//gets left child index
int getLeftChildIndex(int parentIndex) {
//edge case: invalid parent index
if(parentIndex < 0) { throw out_of_range("Parent index ... | true |
f1eaa4f08a522accdbf51a8f25c49d4abd1f466f | C++ | leckie-chn/Brook | /src/message/message_test.cc | UTF-8 | 1,437 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2015 PKU-Cloud
// Author : Chao Ma (mctt90@gmail.com)
//
//
#include "src/message/message.pb.h"
#include <string>
#include "gtest/gtest.h"
using namespace std;
using brook::HeadMessage;
using brook::DoubleMessage;
using brook::VectorMessage;
using brook::Vector;
TEST(MessageTest, HeadMessage) {
Hea... | true |
9c361d0f7f1b46ae7614bdc09a12c9e54d53e284 | C++ | Aworumaton/Flee | /Flee/Flee/Input.cpp | UTF-8 | 2,323 | 2.625 | 3 | [] | no_license | /*
* Author: Omer Sari
*/
#pragma once
#include "Input.h"
Input::Input()
{
force_exit = false;
_game_controls.reset();
_main_agent_controls.reset();
}
Input::~Input()
{
}
void Input::Tick(int dt)
{
_main_agent_controls.on_action = false;
bool quit = false;
SDL_Event e;
//if (e->type == SDL_MOUSEMOTION || e->... | true |
ffa092b45a9205faa162900b8265033ba9996a06 | C++ | MiohitoKiri5474/CodesBackUp | /C++/ZJ/d489.cpp | UTF-8 | 294 | 2.96875 | 3 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
long long count ( long long a,long long b,long long c ){
long long s = ( a + b + c ) / 2;
return s * ( s - a ) * ( s - b ) * ( s - c );
}
int main(){
long long a,b,c;
cin >> a >> b >> c;
cout << count ( a,b,c ) << endl;
return 0;
}
| true |
3e45687e24ad1b40af5a7bb9a3f89785dbc6a279 | C++ | Amakazor/olga-zadanie1 | /Olga-Zadanie1/Olga-Zadanie1/Olga-Zadanie1.cpp | WINDOWS-1250 | 5,149 | 3.53125 | 4 | [] | no_license | /*ZADANIE 1*/
/*TEMAT: podstawowe operacje arytmetyczne i wykorzystanie zmiennych w celach praktycznych*/
//Podwjny slash oznacza komentarz liniowy. Komentarze nie s przetwarzane na program.
/*
Slash i gwiazdka oznacza komentarz blokowy.
Zamyka si go gwiazdk i slashem.
Wykurwicie estetyczny
*/
#include <iostream> //... | true |
c2fe701b8453cece8f88107e26bf377c4da980fe | C++ | costarzhang/C-Plus-Plus | /zhang/tree/trees.cpp | UTF-8 | 1,360 | 3.96875 | 4 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
// 树的孩子兄弟表示法
typedef struct TNode
{
char data;
struct TNode *firstchild, *nextsibling;
} * Tree;
/*创建树
tree 当前节点
pre 当前节点的父节点
*/
void create(Tree &tree, bool iffirstchild, bool ifnextsibling, TNode *pre)
{
char data;
if (iffirstchild)
{
cout << "输入... | true |
cf1b8c028a3b707ac06f8680c8441aa75ac866a5 | C++ | RitikJainRJ/DailyCodingProblem-Practice | /Longest consecutive subsequence.cpp | UTF-8 | 687 | 2.78125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int longConsSeq(int);
int main(){
int t, n;
cin >> t;
while(t--){
cin >> n;
cout << longConsSeq(n) << endl;
}
return 0;
}
int longConsSeq(int n){
int arr[n], ans = 0;
unordered_set<int> us;
for(int i = 0; i < n; i++)
... | true |
23de51e90bc58dff96f81ca3779e50f6637ae076 | C++ | sgc87/Interactive-Lab-Hub | /Final Project/final_code.ino | UTF-8 | 2,625 | 2.6875 | 3 | [] | no_license | #include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Re... | true |
e3bb873f1f1f8f69bddedb489f9c613a23526e4b | C++ | dualword/Portal2D | /LevelRenderer.h | UTF-8 | 419 | 2.546875 | 3 | [
"MIT"
] | permissive | #ifndef __PORTAL2D_LEVEL_RENDERER_H__
#define __PORTAL2D_LEVEL_RENDERER_H__
#include "LevelBuilder.h"
#include <SFML/Graphics/RenderTarget.hpp>
class LevelRenderer
{
public:
// get the list of obstacles from LevelBuilder
void Create(LevelBuilder& builder);
// render all the obstacles
void Render(sf::Render... | true |
0f120ef5ac3a2c4ed8af45c0b0cb99c738053a3a | C++ | alaneos777/club | /project euler/565.cpp | UTF-8 | 1,986 | 2.609375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const lli M = 1e11;
const int mod = 2017;
const int g = 5;
__int128 powerMod(__int128 a, __int128 b, __int128 m){
__int128 ans = 1;
while(b){
if(b & 1) ans = ans * a % m;
b >>= 1;
a = a * a % m;
}
return ans;
}
lli power(lli a, lli b)... | true |
8997ead78c143f3f681855bc71c96b8ee59eb343 | C++ | Geniok/Dviglo | /Source/Urho3D/Math/StringHash.h | UTF-8 | 2,738 | 2.90625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | // Copyright (c) 2008-2021 the Urho3D project
// Copyright (c) 2021 проект Dviglo
// Лицензия: MIT
#pragma once
#include "../Container/Str.h"
namespace Dviglo
{
class StringHashRegister;
/// 32-bit hash value for a string.
class URHO3D_API StringHash
{
public:
/// Construct with zero value.
StringHash() no... | true |
fb745808dbfbfaf9e92921cc9577c98065435be3 | C++ | WaltWatt/dojo | /cc/kata/Vehicles/src/Car.cc | UTF-8 | 970 | 3 | 3 | [] | no_license | #include "Car.h"
using namespace week02;
Car::Car(int numberOfPassengers,
int topSpeed,
double kilometersPerLitre,
int numberOfAirBags,
bool abs,
int numberOfWheels)
: MotorVehicle(numberOfPassengers,
topSpeed,
numberOfWheels,
kilometersPerLitre),
m_numberOfAirBags(numberOfAirB... | true |
3b582e024f19963410a13d08a6eb158a55f8f906 | C++ | kkc-krish/RSiena | /src/model/EffectInfo.h | UTF-8 | 2,455 | 3.09375 | 3 | [] | no_license | /******************************************************************************
* SIENA: Simulation Investigation for Empirical Network Analysis
*
* Web: http://www.stats.ox.ac.uk/~snijders/siena/
*
* File: EffectInfo.h
*
* Description: This file contains the definition of the
* EffectInfo class.
*************... | true |
74fdbcf8374c08abd8fc7298c62be6028cefb5ea | C++ | ZZGG0524/Algorithm | /shiyan1_5/main.cpp | GB18030 | 405 | 3.09375 | 3 | [] | no_license | #include <iostream>
using namespace std;
long long int f(int n){
long long int f0 = 0;
long long int f1 = 1;
if(n<=1){
return f0;
}
if(n == 2){
return f1;
}
for(int i = 3;i<=n;++i){
int t = f0+f1;
f0 = f1;
f1 = t;
}
return f1;
}
int main(){
cout<<"Ҫfibonacciĵڼ"<<endl;
int... | true |
0a725a8599695f1c67d51edcea36294233747783 | C++ | thePLManHubert/Arduino | /programy/termometr_RC/termometr_RC.ino | UTF-8 | 2,606 | 3.203125 | 3 | [] | no_license | #include <VirtualWire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
char* To_Char_Array(long x); // Zwraca ciag znakow typu char odpowiadajaca argumentowi
int Count_All(char* tab[], int tab_length); // Zlicza i sumuje... | true |
9441ebd293331d30238c33b31bdbc275046a117e | C++ | OKullmann/oklibrary | /Satisfiability/Transformers/Generators/Bicliques/DirStatistics.cpp | UTF-8 | 2,358 | 2.625 | 3 | [] | no_license | // Oliver Kullmann, 26.6.2023 (Swansea)
/* Copyright 2023 Oliver Kullmann
This file is part of the OKlibrary. OKlibrary 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 and included in this library; either version 3... | true |
d98e126e5cfbb74d6c9119b49c9f9845700d0af6 | C++ | wjdwls0630/2018_2_C_KHU | /KHLUG/Day07/day07_8.cpp | UTF-8 | 282 | 2.828125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
cout.setf(ios::scientific);
std::cout << "과학적 표기법 : "<<314.1592<<'\n';
cout.unsetf(ios::scientific);
cout.setf(ios::fixed);
std::cout << "고정소수점 표기법: " <<314.1592<< '\n';
return 0;
}
| true |
43de7cf366c14483be02d6a46f6e6b517064dc54 | C++ | hant0508/lessons | /9/20_6.cpp | UTF-8 | 352 | 3.25 | 3 | [] | no_license | // Напечатайте квадраты целых чисел от 0 до n, не используя умножение и вложенные циклы
#include <iostream>
using namespace std;
int main()
{
int n, a = 0;
cout << "Введите число: ";
cin >> n;
for (int i = 0; i < n; ++i)
{
a += i + i + 1;
cout << a << ' ';
}
}
| true |
03368eb69854f327b92e713c7fb7dc9ab321e2b9 | C++ | AndreLouisCaron/jsonxx | /code/json.hpp | UTF-8 | 16,459 | 2.609375 | 3 | [
"MIT"
] | permissive | #ifndef _json_hpp__
#define _json_hpp__
// Copyright (c) 2012, Andre Caron (andre.l.caron@gmail.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code... | true |
92a7a5d35d220d7ed3b40a059204148e22edf5d9 | C++ | daisyr07/Operating-System | /Course Design/处理机调度的模拟实现/ot/c-c++ 多种实现/3/程序/R0701_07/ch1.cpp | GB18030 | 3,199 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<string.h>
#include <iomanip>
using namespace std;
const int PCB=10; //10
void readData();//
int quantity;
typedef struct process
{
char pname[20];//
struct process *next;
int BurstTime;//ʱ
int priority; // ԽȼԽ
char Status;
}PROCE... | true |
b65379cf6f23d80e549556b0ce9fc87718c7c2ac | C++ | SebastianDang/OpenGL | /src/Geo_Object.cpp | UTF-8 | 6,916 | 3.015625 | 3 | [] | no_license | #include "stdafx.h"
#include "Geo_Object.h"
Geo_Object::Geo_Object()
: Object()
{
}
Geo_Object::Geo_Object(float size)
{
// Load the data for a cube.
int success = LoadDataForCube(size);
if (success != -1) LoadDataIntoBuffers();
}
Geo_Object::Geo_Object(float radius, int slices, int stacks)
{
/... | true |
a3d65a8cd9841d5bb51e13ba485326b5523f5586 | C++ | mycode-hub/InterviewBits | /Stack/Rain Water Trapped.cpp | UTF-8 | 1,228 | 3.421875 | 3 | [] | no_license | /*Asked in:
Qualcomm
Amazon
Microsoft
Goldman Sachs
Problem Description
Given an integer array A of non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
Problem Constraints
1 <= |A| <= 100000
Input Format
The only argumen... | true |
b168c46cc5468d6077145748ab2a5f1c780aa415 | C++ | kwk18/OOP | /oop_exercise_04/main.cpp | UTF-8 | 2,167 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <tuple>
#include "Pair.h"
#include "trapezoid.h"
#include "rectangle.h"
#include "rhombus.h"
#include "templates.h"
template<class T>
void init(std::istream& is, std::ostream& os) {
if constexpr (is_figurelike_tuple<T>::value) {
int arg;
std::cin >> arg;
std::co... | true |
e147f7ea3f11769bff6a0352c990a52411f7a2bd | C++ | nschepsen/codeforces | /src/gym/101010/B.cpp | UTF-8 | 1,642 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
/*
* Contest: Russian Code Cup 2016 (Q2 Task B)
* URL: http://codeforces.com/gym/101010/problem/B
*/
template <typename it> it last(it iter) { return --iter; }
void solve(void);
// TODO: rewrite this function
int main(in... | true |
ddb33757176ed0b423929a2fff8402c9dc9821d0 | C++ | dirleut/CryptoSys | /src/lib/SymCiphers.cpp | UTF-8 | 2,353 | 2.921875 | 3 | [] | no_license | #include "SymCiphers.h"
#include <algorithm>
#include <map>
bool isLatin(const std::string &str) {
return str.size() > 0 &&
str.find_first_not_of("*:'-_,.!? 0abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 0) == std::string::npos;
}
void leaveLettersOnly(std::string& content) {
if (content.... | true |
07330c8634c9ff2628e6be2d4a3183710685e63c | C++ | Rakatashii/cpp_ch8 | /P8_2/P8_2/student.cpp | UTF-8 | 790 | 3.328125 | 3 | [] | no_license | //
// student.cpp
// P8_2
//
// Created by Christian Meyer on 11/3/18.
// Copyright © 2018 Christian Meyer. All rights reserved.
//
#include "student.hpp"
Student::Student() : Person() {
}
Student::Student(std::string n, std::string b, std::string m) : Person(n, b){
name = n;
//birthday = b;
// s... | true |
fd96977d5c5bc329cbd132926f1e549255991db8 | C++ | jensecj/code-challenges | /hackerrank/general-programming/basic-programming/easy-birthday-cake-candles.cpp | UTF-8 | 482 | 3.609375 | 4 | [] | no_license | /*
tags: loop
task: given a stream of numbers, print how many times the largest
one has occured
*/
#include <iostream>
using namespace std;
int main() {
int n; // the number of candles on Colleens cake
cin >> n;
int max_height = 0;
int candles = 0;
while(n--) {
int candle;
cin >> candle;
... | true |
f0a6ee04dc5413c1b8361e08325d43dbe2e293af | C++ | Ojurek/training | /Tree.h | UTF-8 | 393 | 2.75 | 3 | [] | no_license | #ifndef Tree_h
#define Tree_h
template <typename T>
class Tree {
public:
virtual void traversal() const = 0;
virtual void insert (const T &data) = 0;
virtual void remove (const T &data) = 0;
virtual const T& getMaxValue () const = 0;
virtual const T& getMinValue () ... | true |
8ca921e6b037f0993524f540025d6881a8e37ca3 | C++ | hsemmzykin/cosec-examples | /block-scene/src/blocktypesmodel.cpp | UTF-8 | 1,165 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "blocktypesmodel.hpp"
#include "blocktypes.hpp"
#include <QtCore/QMimeData>
int BlockTypesModel::rowCount(const QModelIndex& index) const
{
return !index.isValid()?getRegisteredBlockTypes().size():0;
}
Qt::ItemFlags BlockTypesModel::flags(const QModelIndex& index) const
{
return index.isValid()?
... | true |
16eba754c8bd664fe9dca2736b48b2d72c0cf772 | C++ | RobMandelings/ProjectSoftwareEngineering | /src/tests/inputTest.cpp | UTF-8 | 8,401 | 2.59375 | 3 | [] | no_license | //
// Created by jasper on 26/03/2020.
//
#include <gtest.h>
#include <fstream>
#include "metro_utils.h"
#include "metro_parser.h"
#include "simulation_utils.h"
/**
* Wrong station input type
*/
TEST(InputTest, NegativeInput_station_1){
bool failed = false;
try{
MetroNet* metroNet = metro_parser::p... | true |
163e2c122acecc2a5388e6e5ec5c2e7eec206e6a | C++ | thBonore/Meus-Estudos | /c_c++/exercícios_univem/Modulo_1/Exerc/Exerc.4-aula3.cpp | UTF-8 | 212 | 3.0625 | 3 | [] | no_license | #include <stdio.h>
main(){
int a,b,c;
printf("Digite o valor de A:");
scanf("%d",&a);
printf("Digite o valor de B:");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("O valor de A = %d e B = %d", a,b);
}
| true |
2cad7f5c88c033c11e358e94951e1947ba7c8938 | C++ | ericlin1001/offlineJudge | /hws/problem2/16308087/main.cpp | UTF-8 | 316 | 2.609375 | 3 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
float a,b,c,d;
float s,e,f,h,i,j;
cin>>a>>b>>c>>d;
e=(a+b+c+d)/4.0;
f=a-e;
h=b-e;
i=c-e;
j=d-e;
f=pow(f,2);
h=pow(h,2);
i=pow(i,2);
j=pow(j,2);
s=h+i+j+f;
s=pow((s/3.0),1/2);
cout<<e<<" "<<s;
return 0;
}
| true |
56fb9cb99945f3aca24abe7b4e532cc9077c3752 | C++ | marlowe-ml/Voltricity | /GameFrame/src/Label.h | UTF-8 | 673 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef Label_h__
#define Label_h__
#include <SFML/Graphics.hpp>
#include "Direction.h"
namespace game {
class Label : public sf::Drawable {
public:
Label();
Label(const sf::String& text);
void Render(sf::RenderTarget& target) const;
const sf::Vector2f GetSize() const;
void SetText(const std::string& text);
... | true |
f9394795970a9bdc4aaa6fb276dc9d733b8ce8b3 | C++ | mrmohim/All-OJ-Contest-Problem-Solution | /LightOj/1133.cpp | UTF-8 | 1,169 | 2.578125 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int i,j,t,n,m,s,ch[110],x,y;
char c;
cin>>t;
for(i=1; i<=t; i++)
{
cin>>n>>m;
for(j=0; j<n; j++)
cin>>ch[j];
while(m--)
{
... | true |
03a7d5a741eaebbc3271e1b04c66c12045f2efb1 | C++ | AlexWorx/ALib-Class-Library | /src/alib/characters/chararray.hpp | UTF-8 | 29,051 | 2.890625 | 3 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /** ************************************************************************************************
* \file
* This header file is part of module \alib_characters of the \aliblong.
*
* \emoji :copyright: 2013-2019 A-Worx GmbH, Germany.
* Published under \ref mainpage_license "Boost Software License".
***********... | true |
53d0645f45b510a255083fe6acb743742690c42c | C++ | bmcdonnel/data-structures | /cpp/exercises/trees/from_sorted_array.cpp | UTF-8 | 1,186 | 3.796875 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <stack>
#include "utils/tree_utils.h"
using namespace utils;
TreeNode* tree_from_sorted_array(const int* array, const int size)
{
if (size == 0)
{
return nullptr;
}
else if (size == 1)
{
return new TreeNode(array[0]);
}
int x = size / 2;
TreeNo... | true |
b4659e1f400c8bba48bdd70c4a4d7a05d3fa22f3 | C++ | marcinms7/Cpp-Algorithms | /AlgorithmsArraysClass/Array.cpp | UTF-8 | 2,383 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <Array.hpp>
using namespace std;
template<class T>
Array<T>::Array(int length_set )
{ length = length_set;
a = new T [length]{};
}
template<class T>
Array<T>::~Array()
{
delete []a;
}
template<class T>
void Array<T>:: print_array(){
for (int i{0};i<length;i++){
cout<<a[i]<< '\t';
... | true |
12bb218fb25b4e3e532d6d507c97f0caf9abd7dc | C++ | Merna-Raouf/ASUMobiCarG18 | /AnalogInput.ino | UTF-8 | 1,751 | 2.609375 | 3 | [] | no_license |
int analogpin0 = A0;
int analogpin1 = A1;
int analogpin2 = A2;
int analogpin3 = A3;
int analogpin4 = A4;
int analogpin5 = A5;
int counter=0;
int buttonstate=0;
int lastbuttonstate=0;
int switchpin = 2;
int sensorValue0=0;
int sensorValue1=0;
int sensorValue2=0;
int sensorValue3=0;
int sensor... | true |
4532645eeaa144a602d5088097a00277250f9a15 | C++ | TinfoilPancakes/PiSoftPWM | /main.cpp | UTF-8 | 1,865 | 2.9375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <thread>
#include <chrono>
#include "GPIO/GPIOInterface.hpp"
#include "GPIO/SoftPWMControl.hpp"
using namespace std;
int main(int argc, char* argv[]) {
GPIOInterface blueLights("17", GPIO_DIR_OUT);
GPIOInterface redLights("22", GPIO_DIR_OUT);
GPIOInterface greenLights("27", GP... | true |
feb50b3cac32567c98fb6f7bdbb8214f98a15bdc | C++ | JuanBeedee/Shapes_calculator | /Triangle.h | UTF-8 | 524 | 2.640625 | 3 | [] | no_license | /*
* Triangle.h
*
* Created on: Jul 5, 2018
* Author: szymon
*/
#ifndef TRIANGLE_H_
#define TRIANGLE_H_
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include "Shape.h"
class Triangle: public Shape {
public:
Triangle();
virtual ~Triangle();
Triangle (const Triangle & figure)... | true |
f937002e43fb337b2239d4101d816a061da25f0f | C++ | JaeHeee/algorithm | /baekjoon_c++/2828.cpp | UTF-8 | 834 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int location[21];
int main(void) {
int N, M, J;
int distance = 0;
cin >> N >> M;
cin >> J;
for (int i = 1; i <= J; i++)
{
cin >> location[i];
}
if (M == 1)
{
for (int i = 1; i < J; i++)
{
distance += abs(location[i + 1] - location[i]);
... | true |
d910029f0a281c061586543f6e55e6e094465628 | C++ | modulo-/SDP-2016-Team-F | /arduino/libraries/comms/comms.cpp | UTF-8 | 3,040 | 2.78125 | 3 | [] | no_license | #include "comms.h"
#include "base64.h"
#include <stddef.h>
#include <string.h>
#include <Arduino.h>
#include <Wire.h>
#define MAXBUF 64
namespace comms {
static char buf[MAXBUF];
static uint8_t buflen = 0;
// The PANID used.
static const char * const PANID = "6810";
// The encryption key.
static const char * const... | true |
44d98a032f9492a1b31b2f4fc9c192733e6178ab | C++ | josephjojy/OOT-Lab | /prime.cpp | UTF-8 | 446 | 3.765625 | 4 | [] | no_license | #include<iostream>
using namespace std;
class Prime
{
int a,b,i,j;
public:
void accept()
{
cout<<"Enter the limits:";
cin>>a>>b;
}
void display()
{
cout<<"Prime numbers:";
for(i=a;i<=b;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
break;
}
if(i==j)
... | true |
69faf62a3242d28daf209d26f3c7a7f12ea443e9 | C++ | shao-you/NHRI | /format_imputed_dat_ped.cpp | UTF-8 | 2,789 | 2.5625 | 3 | [
"MIT"
] | permissive | #include "control.h"
void format_imputed_dat_ped(map< pair<int,int>, int >* ID_affect, int chr)//merlin-infer.ped => CHR1_infer.ped
{
char pattern[CHAR_MAX_LENGTH+1]="";
ifstream merlin_ped, merlin_dat;
ofstream infer_ped, infer_dat, infer_dosage;
char buffer[50];
sprintf (buffer, "dir_%d/merlin-infer.ped", chr)... | true |
9acec4ee47a533a4645f66b071657dbf4d6cda09 | C++ | Sanaxen/cpp_torch | /cpp_torch/third_party/CSVparser/CSVparser.hpp | UTF-8 | 2,591 | 3.125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | #ifndef _CSVPARSER_HPP_
# define _CSVPARSER_HPP_
# include <stdexcept>
# include <string>
# include <vector>
# include <list>
# include <sstream>
namespace csv
{
class Error : public std::runtime_error
{
public:
Error(const std::string &msg):
std::runtime_error(std::string("CSV... | true |
26b1cf833b1a8bd0c6474ec7de9792bca5a57eda | C++ | fjvbn2003/BOJ_backup | /cpp/5596.cpp | UTF-8 | 256 | 2.90625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int a=0;
int b=0;
int t;
for(int i=0; i<4; i++){
cin>> t;
a+= t;
}
for(int i=0; i<4; i++){
cin>> t;
b+= t;
}
cout << ((a>b)? a:b)<<endl;
} | true |
da2cd25c43afc553fec3633be52077e60b0da13c | C++ | SushmaMacha/CPlusPlus | /quickSort.cpp | UTF-8 | 1,901 | 3.078125 | 3 | [] | no_license | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debu... | true |
c054006257295be6edcca5e4b4779bb171e31b93 | C++ | Halamqi/firey | /base/thread/Threadff.cpp | UTF-8 | 3,462 | 2.859375 | 3 | [] | no_license | #include "Threadff.h"
#include "CurrentThreadff.h"
#include "Loggingff.h"
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/prctl.h>
#include <linux/unistd.h>
using namespace firey;
void afterFork()
{
CurrentThreadff::t_threadName="main";
CurrentThreadff::tid();
}
//RA... | true |
4ca86a9caa59773ac18c3b86529dd93dacd33e4a | C++ | ucwong/btcpool | /3rdparty/cuckoo/cuckarooz.cpp | UTF-8 | 2,298 | 2.640625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include "cuckarooz.h"
#include "siphash.h"
#include <iostream>
using namespace std;
static const uint64_t EDGE_BLOCK_BITS = 6;
static const uint64_t EDGE_BLOCK_SIZE = 1 << EDGE_BLOCK_BITS;
static const uint64_t EDGE_BLOCK_MASK = EDGE_BLOCK_SIZE - 1;
// fills buffer with EDGE_BLOCK_SIZE siphash outputs for block cont... | true |
ede7a63f876a73b49f3c3f78cbd994cb8bdf3642 | C++ | Shivam-Vishwakarma/CPP | /class/MAIN_CON.CPP | UTF-8 | 204 | 2.515625 | 3 | [] | no_license | //WAP to which illustrate main() as class and constructor.
#include"my.h"
class main
{
public: main()
{
cout<<"\n hello i am main() constructor ";
}
};
void main()
{
clrscr();
class main m;
getch();
}
| true |
765f4044aa26dd8f9d348377fc480f5cb07ceb84 | C++ | bondarevts/amse-qt | /2010/korgov/task5/ChatDialog.cpp | UTF-8 | 2,383 | 2.640625 | 3 | [] | no_license | #include "ChatDialog.h"
ChatDialog::ChatDialog(quint16 port, QWidget *parent)
: QDialog(parent)
{
myListWidget = new QListWidget(this);
myLineEdIp = new QLineEdit("127.0.0.1",this);
myLineEdPort = new QLineEdit(QString::number(port+1),this);
myLineEdMessage = new QLineEdit(this);
myBtnSend = ne... | true |
ec37805e8541135ba2c578e613fd25bf9464230d | C++ | Kulcsarzsolt/TrafficLights | /sevenSegmentDisplay.cpp | UTF-8 | 1,708 | 2.703125 | 3 | [] | no_license | #include <Arduino.h>
#include "sevenSegmentDisplay.h"
void resetDisplay()
{
digitalWrite(DISPLAY_A, LOW);
digitalWrite(DISPLAY_B, LOW);
digitalWrite(DISPLAY_C, LOW);
digitalWrite(DISPLAY_D, LOW);
digitalWrite(DISPLAY_E, LOW);
digitalWrite(DISPLAY_F, LOW);
digitalWrite(DISPLAY_G, LOW);
digitalWrite(DIS... | true |
e644f4ee0f0a8b5d886f90c4708b1e3b6c3fb080 | C++ | mohfunk/Rouge-Like | /include/characters.hpp | UTF-8 | 975 | 3.203125 | 3 | [] | no_license | #ifndef CHARACTERS_HPP
#define CHARACTERS_HPP
#include <string>
class Character{
private:
int HP;
int Atk;
int Def;
int row; // row position of charactor on the board
int column; // column position of charactor on the board
std::string race;
int Go... | true |
8992d201936ade61639d012b4844f627e178fdeb | C++ | textiles-lab/autoknit | /plan_transfers-helpers.hpp | UTF-8 | 6,152 | 2.921875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #pragma once
#include "plan_transfers.hpp"
#include <cassert>
#include <iostream>
#include <algorithm>
struct NeedleRollGoal {
NeedleRollGoal() = default;
NeedleRollGoal(int32_t needle_, int32_t roll_, int32_t goal_, int32_t left_slack_, int32_t right_slack_) : needle(needle_), roll(roll_), goal(goal_), left_slack... | true |