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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d615e9edcc1783c987ad287a1f2bd6803c2394b9 | C++ | lipan6461188/icSHAPE-pipe | /PsBL/src/pan_type.h | UTF-8 | 6,355 | 2.65625 | 3 | [] | no_license |
#ifndef PAN_TYPE_H
#define PAN_TYPE_H
#include <unordered_map>
#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <memory>
#include <cstring>
#define PsBL_LIB_VERSION "PsBL 1.1.0(2018-11-2)"
using std::unordered_map;
using std::vector;
using std::string;
using std::pair;
using st... | true |
68d0e94869b754988327461d987038bdd96d01db | C++ | nmai/esp32-tft-progress-bar-clock | /src/classes/Screen.cpp | UTF-8 | 8,614 | 2.578125 | 3 | [] | no_license |
#include <classes/Screen.h>
// I believe this will create it outside the scope of the class instance itself, sort of a singleton
TFT_eSPI tft = TFT_eSPI(135, 240);
// const int CHOSEN_FONT = &FreeSansBold9pt7b;
const int FONT_DEFAULT_WIDTH = 6;
const int FONT_DEFAULT_HEIGHT = 8;
const int FONT_PT9_WIDTH = 11;
const ... | true |
f0b2d64a03caf885585d48d02d26fe0ff7a4f7d3 | C++ | dabibbit/keyvadb-cc | /db/db.h | UTF-8 | 4,746 | 2.53125 | 3 | [] | no_license | #pragma once
#include <string>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <system_error>
#include "db/memory.h"
#include "db/file.h"
#include "db/buffer.h"
#include "db/tree.h"
#include "db/log.h"
namespace keyvadb {
template <class Storage, class Log = NullLog>
class DB {
using util... | true |
838cbdbf1efa9f3fd79dc0080ff173031bc7e0c2 | C++ | jmkim/algorithm_and_practice-pknu-2016 | /excercise04/sort/merge_sort.cpp | UTF-8 | 891 | 3.734375 | 4 | [
"MIT"
] | permissive | #include <string.h> /* memcpy() */
#include "merge_sort.hpp"
void merge_sort(int *data, const int size_of_data)
{
return merge(data, 0, size_of_data - 1);
}
void merge(int *data, const int start, const int end)
{
int size = end - start + 1;
if(size <= 1) return; /* base case */
/* divide */
int ... | true |
702ac3df21061e95aa1a678f01c8c7d2b96a9ebc | C++ | SpookyScaryDev/Jem | /Engine/Source/Core/Game/Game.h | UTF-8 | 1,079 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <Core/Window/Window.h>
#include <Core/Event/Event.h>
namespace Jem {
// ===============================================================================
//
// Base Game Class.
// To be subclassed by the client and run by Jem Engine.
// Game is a singleton - you can use the GetGame me... | true |
2325a178ba691671b0d339acc899dbe0b7d24a6b | C++ | hulcyp/GuildhallProjects | /QTProjects/MonkyMaterialEditor/GraphLayoutParser.cpp | UTF-8 | 4,331 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "GraphLayoutParser.h"
#include "Node.h"
#include "MaterialGraphWidget.h"
#include "NodeType.h"
#include "Link.h"
void GraphLayoutParser::ParseGraphLayout( const char* layoutBuffer, int size, MaterialGraphWidget* graph )
{
char* currPos = const_cast<char*>( layoutBuffer );
if( size > 0 )
{
... | true |
daf37af266b499a6b6f7c5711fb438905260e1dc | C++ | BlackWind001/C_plus_plus_trial | /04_user_defined_types_01_structs.cpp | UTF-8 | 1,103 | 3.984375 | 4 | [] | no_license | #include <iostream>
struct Custom_Vector{
int size;
double* array;
};
void Custom_Vector_init(Custom_Vector& ref_v, int size){
ref_v.size = size;
double* arr = new double [size];
ref_v.array = arr;
}
void assign(Custom_Vector& ref_v){
int size = ref_v.size;
auto arr_pointer = ref... | true |
a715fb5d8f7b4269229b9bd8597cd1db6cc8298f | C++ | HiroshiNohara/Recognition-Algorithm | /C++/Algorithm/Algorithm/traintest.cpp | UTF-8 | 7,858 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
std::vector<Mat> _histograms;
Mat _labels;
extern Mat lbp(Mat src);
extern Mat elbp(Mat src, int radius, int neighbors);
extern Mat DCP1(Mat src, int Rin, int Rex);
extern Mat DCP2(Mat src, int Rin, int Rex);
extern Mat LTP1(M... | true |
bf076da8bb678a0653d3bcf329ea24ec00de33f0 | C++ | sancherie/docker-compose-multistage | /src/app/docker/builder/ComposeBuilder.cpp | UTF-8 | 1,721 | 2.6875 | 3 | [] | no_license | //
// Created by clementsanchez on 4/19/20.
//
#include <iostream>
#include "ComposeBuilder.hpp"
Docker::Builder::ComposeBuilder::ComposeBuilder(Vector<String> files) :
files(std::move(files))
{
}
Docker::Compose Docker::Builder::ComposeBuilder::build()
{
this->parseComposeConfig();
return Compose(t... | true |
6052188bca8d437c19628c17746f1b173f84ec60 | C++ | jamalhsargana/Assignment-2 | /ownedPointer.cpp | UTF-8 | 3,784 | 4.03125 | 4 | [] | no_license | #include <iostream>
class STRING_BUFFER
{
public:
char* stringbuff;
int stringlength;
bool owner;
public:
STRING_BUFFER();
STRING_BUFFER(char*, int);
char charAt(int) const;
int length() const; ... | true |
7fcf5160c4a5ac872314c057a124f11b432c9951 | C++ | sameer-h/CSCE121 | /Homeworks/HW8/School.cpp | UTF-8 | 4,647 | 3.21875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <iomanip>
#include "School.h"
#include "AttendanceRecord.h"
using namespace std;
/* Sameer Hussain - CSCE 121 - Attendance */
// need a helper function for validity that a value exists within vector
bool School::conta... | true |
a9579f1975ff2c5a6cb295e44eeca37a70fca575 | C++ | Gorvillio/mobiledragon | /src/include/md_tl/iterator.h | UTF-8 | 1,312 | 3.109375 | 3 | [
"MIT"
] | permissive | /** \file
* Basic template iterators. <br>
*
* Copyright 2005-2006 Herocraft Hitech Co. Ltd.<br>
* Version 1.0 beta.
*/
#ifndef __MD_ITERATOR_H__
#define __MD_ITERATOR_H__
namespace mdragon
{
template <class BackInsertionSequence>
class back_insert_iterator
{
public:
typedef back_insert_iterat... | true |
dc73364b5bbb8f56ad79ec3539d508e4b68b7287 | C++ | xingangshi/study_exec | /design_pattern/8_composite/composite.cpp | UTF-8 | 1,456 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include "composite.h"
void compont::add(compont* child)
{
}
void compont::remove(compont* child)
{
}
compont* compont::getChild(int index)
{
return NULL;
}
void leaf::operation()
{
std::cout << "operation by leaf" << std::endl;
}
composite::~composite()
{
std::l... | true |
a6fafdff97c07bbf63494f628d47d6e8c6456351 | C++ | Caspar-Chen-hku/C-practices | /palindrome2.cpp | UTF-8 | 801 | 3.3125 | 3 | [] | no_license | #include <iostream>
using namespace std;
bool charAndNum(char text){
if ((text>='a' && text<='z') || (text>='A' && text<='Z')
|| (text>='0' && text<='9')){
return true;
}
return false;}
string makeFixed (){
string fixed = "";
char text;
while (cin >> text){
... | true |
057fa2529dd5a00bca3b5fd7a1949ed83ca0b8b9 | C++ | KarthikeyaYadav/Competitive-Programming | /PRAC/dec_to_bin.cpp | UTF-8 | 455 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <bitset>
#include <string>
#include <bits/stdc++.h>
int main()
{
std::string binary = std::bitset<32>(2147483647).to_string(); //to binary
std::cout<<binary<<"\n";
unsigned long decimal = std::bitset<32>(binary).to_ulong();
std::cout<<decimal<<"\n";
std::st... | true |
9ff6e6d68a31a93d3c15172538593050a080f763 | C++ | harshitgupta2019/khatarnakcoder | /codeforces/62A-A student's Dream.cpp | UTF-8 | 198 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
if((d-2*a<3)&&(a-d<=1)||(c-2*b<3)&&(b-c<=1))
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}
| true |
aaf12c5d0849ddedc17b049870a783fd40df2099 | C++ | carexoid/os-critical-region | /demo/demoDekkerLock.cpp | UTF-8 | 3,904 | 3.546875 | 4 | [] | no_license | #include <iostream>
#include <iomanip>
#include <thread>
#include "DekkerLock.hpp"
constexpr std::size_t THREAD_OPERATION_REPEATS = 100000;
constexpr std::size_t RUNS_NUMBER = 10;
template <class Subtraction, class Addition>
void subtraction_addition_counter_demonstration(Subtraction subtraction, Addition addition)
... | true |
7fb9e053775378e24ea06a158d776054db17f1ff | C++ | Jokeswar/Bee-Engine | /include/Sprite.h | UTF-8 | 588 | 2.5625 | 3 | [] | no_license | #ifndef SPRITE_H
#define SPRITE_H
#include "Utility.h"
#include "Component.h"
#include <SDL2/SDL.h>
class Sprite: public Component
{
public:
Sprite();
Sprite(void*);
~Sprite();
void update() override;
int getWidth();
int getHeight();
void setNumberOfFrame... | true |
abb5c71254b5e79b116d9d783fb99f484f75705f | C++ | lkolezhuk/AdvancedImageAnalysisUNICAS | /project2/image_management.cpp | UTF-8 | 2,410 | 2.96875 | 3 | [] | no_license |
#include "image_management.h"
#include "aia/aiaConfig.h"
#include "ucas/ucasConfig.h"
#include <iostream>
using namespace std;
ImageManagement::ImageManagement(void)
{
}
ImageManagement::~ImageManagement(void)
{
}
std::vector<cv::Mat> ImageManagement :: LoadAllInDir(std::string folder, std::string ext, bool force_g... | true |
7bc8e1bdb064b00a4ce2b303d0a1a7538fde5990 | C++ | DuPengFei-du/Cpp--Learning | /Cpp(36)/Cpp(36)/main.cpp | GB18030 | 15,073 | 3.875 | 4 | [] | no_license | //#include<iostream>
//using namespace std;
//struct Student
//{
// char name[20];
// int age;
// char gender;
//};
////CеĽṹ壬ֻܷݣܷźģCԵǰ
////ṹзźôʱǻģܷ֮
////ΪC̵ģݺͷǷ뿪
////C++УstructĽṹ壬ԷݻǿԷź
////Ҳ˵C++ЩݺͲЩݵķһ
//int main()
//{
// return 0;
//}
//#include<iostream>
//using namespace std;
//class Student
//{
//public:
// void ... | true |
f8c453085963c1bd2fe6941938431289c8f360e8 | C++ | BhishmDaslaniya/Operating-System-Algorithms | /sjf_p.cpp | UTF-8 | 2,700 | 3.078125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef struct process
{
char name[5];
int bt;
int at;
int wt, ta;
int flag;
int prt;
} processes;
void b_sort(processes temp[], int n)
{
processes t;
for (int i = 1; i < n; i++)
{
for (int j = 0; j < n - 1; j++)
{
... | true |
d84173bd238bb89bc64a6ba94c122363c4ceb003 | C++ | longluo/leetcode | /Cpp/leetcode/editor/cn/1855_maximum-distance-between-a-pair-of-values.cpp | UTF-8 | 2,905 | 2.90625 | 3 | [
"MIT"
] | permissive | //给你两个 非递增 的整数数组 nums1 和 nums2 ,数组下标均 从 0 开始 计数。
//
// 下标对 (i, j) 中 0 <= i < nums1.length 且 0 <= j < nums2.length 。如果该下标对同时满足 i <=
//j 且 nums1[i] <= nums2[j] ,则称之为 有效 下标对,该下标对的 距离 为 j - i 。
//
// 返回所有 有效 下标对 (i, j) 中的 最大距离 。如果不存在有效下标对,返回 0 。
//
// 一个数组 arr ,如果每个 1 <= i < arr.length 均有 arr[i-1] >= arr[i] 成立,那么该数组是一个... | true |
f152d3bdaa77ad0cf9d698ec0fd88239b2c5ed1d | C++ | q10/SPCE2 | /src/ewald.cpp | UTF-8 | 10,161 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | #include "common.h"
void SPCEHamiltonian::initialize_all_ewald_tables() {
ASSERT(EWALD_ALPHA > 0.0 and EWALD_NXY > 0 and EWALD_NZ > 0, "INVALID EWALD PARAMETERS ALPHA, NXY, OR NZ");
K_111_INDEX = (3 * EWALD_NXY + 2) * (2 * EWALD_NZ + 1) + EWALD_NZ;
NUM_K_VECTORS = (EWALD_NXY + 1) * (2 * EWALD_NXY + 1) * (2... | true |
d6b8f40b296454d3e6d20e1a53fc22f0831f96b6 | C++ | magnusl/fuzzengine | /test/variables.cpp | UTF-8 | 1,100 | 2.90625 | 3 | [] | no_license | #include <gtest\gtest.h>
#include <fuzzengine\parser.h>
#include <sstream>
using namespace fuzzer::parser;
static std::shared_ptr<fuzzer::parser::Expression>
ParseExpression(const char * Expression)
{
std::stringstream str;
str << Expression;
fuzzer::parser::Tokenizer token(str);
fuzzer::p... | true |
814e6be884925314ef8b5b922651aa183c57084a | C++ | LarsIngo/VR | /VR/Scene.cpp | UTF-8 | 1,630 | 2.875 | 3 | [] | no_license | #include "Scene.hpp"
#include "DxHelp.hpp"
#include "Material.hpp"
Scene::Scene(ID3D11Device* pDevice, ID3D11DeviceContext* pDeviceContext)
{
mpDevice = pDevice;
mpDeviceContext = pDeviceContext;
mpSkybox = nullptr;
}
Scene::~Scene()
{
}
void Scene::SortBackToFront(const glm::vec3& cameraPosition, const... | true |
fe0057dad61f5ef0bc1fbdcdccefd8c0e03558a8 | C++ | Diptiman1/BuzzFizz | /BizzFuzz.cpp | UTF-8 | 1,035 | 3.640625 | 4 | [] | no_license | #include<iostream>
#include<iomanip>
using namespace std;
bool prime(int a)
{
bool flag = true;
int i = 0;
for (i = 2; i <= (a / 2); i++)
{
if ((a % i) == 0) flag = false;
}
return flag;
}
int main()
{
int n,i=0;
int num1 = 0, num2 = 1;
int curr,next,prev;
cout << "Enter the number... | true |
20df8f3fa925172c663b95eb98df0d4a4345e695 | C++ | TheFebrin/UNIVERSITY | /Algorithms and Data Structures/Pracownia 6/main.cpp | UTF-8 | 3,101 | 2.546875 | 3 | [] | no_license | /* Dejwo to ziomal ®© */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, ll> pl;
typedef tuple <int, int, int> ti;
typedef vector < pl > vpl;
typedef vector < pi > vpi;
typedef vector < ti > vti;
typedef ... | true |
8cf9a5b2a679a40092bb7b6bb93f16149310d46c | C++ | Zuvo007/InternSearchWorkspace | /sourcecodes/LinkedList/1.CreateLL.cpp | UTF-8 | 884 | 3.78125 | 4 | [] | no_license | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
node * next;
};
node * MakingNode(int data)
{
node *newnode=new node();
newnode->data=data;
newnode->next=NULL;
return newnode;
}
node * InsertingNode(node *head,int data)
{
if(head==nullptr)
{
... | true |
3acb2418e515cc36368f9edf5031b99b96c90c97 | C++ | PYChih/CppPrimer | /ch03_strings_vectors_and_arrays/exercise_3_32.cpp | UTF-8 | 703 | 3.453125 | 3 | [] | no_license | // g++ exercise_3_32.cpp && ./a.out
/*
- 練習3.32: 將你在前面定義的陣列拷貝到另一個陣列。使用vector改寫你的程式。
*/
#include<iostream>
#include <string>
#include <vector>
#include <cctype>
using std::string;
using std::vector;
using std::cout;
using std::cin;
using std::endl;
int main(){
int index_array[10];
int copy_index_array[10];
... | true |
0b01468e804f77e4412c44acc3deb5adca404ac6 | C++ | kcmao/leetcode_exercise | /c_coding_exercise/c_coding_exercise/05_替换空格/ReplaceSpaces.cpp | GB18030 | 3,124 | 3.9375 | 4 | [] | no_license | // 5滻ո
// Ŀʵһַеÿո滻"%20"롰We are happy.
// We%20are%20happy.
#include <stdio.h>
#include <string.h>
//====================Ŀ=====================
/*length Ϊַstrڻַstrʵʳ*/
void ReplaceBlank(char str[], int length)
{
if (str == nullptr || length <= 0)
{
return;
}
/*ԭʼַ*/
int originLength = 0;
int number_blank = 0;
... | true |
6bc1146c25122a65c5f9e8b2895aae49779ea2e2 | C++ | JoshKing56/BB8-Breadboard-Computer | /Arduino Code/main/clock.cpp | UTF-8 | 2,530 | 3 | 3 | [
"MIT"
] | permissive |
#include "Arduino.h"
#include "pins.h"
#include "clock.h"
void main_clock_ISR()
{
static byte system_clock_flag = 0;
// Toggle Pin
//
if (system_clock_flag == 1) { //If pin on.
PORTB &= SYSTEM_PORT_MASK_LOW; //Turn pin off.
system_clock_flag = 0;
}
else {
PORTB |= SYSTEM_PORT_MASK_HIGH;
... | true |
aa2e9551e7bc7cc2852b4a6c9dbe9a94a3d3b2a3 | C++ | jimmylin1017/UVA | /11005 - Cheapest Base.cpp | UTF-8 | 991 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
int dollar[36];
bool min_base[36+1];
int cheap_count(int num, int base)
{
int money = 0;
for(;num > 0;num/=base)
money+=dollar[num%base];
return money;
}
int main()
{
int a,b;
cin>>a;
for(int kase = 1;kase <= a;kase++)
{
memset(dollar,0,sizeof(d... | true |
7e6b49633f661835db93dd87a74d4a871b823682 | C++ | netanelsu/college_cpp_projects | /build stack/stack.h | UTF-8 | 643 | 3.328125 | 3 | [] | no_license | #include<iostream>
using namespace std;
class Stack {
private:
class Node {
private:
int value;
Node* next;
friend class Stack;
public:
Node(int value) :value(value), next(NULL) {};
Node(const Node &);
void print() { cout << value << endl; };
};
Node* head;
int size;
public:
Stack() ... | true |
a1906f757258725b048c68c0da89972d89bec9aa | C++ | bullocgr/cs162 | /assignments/assignment3/Apartment.cpp | UTF-8 | 797 | 3.09375 | 3 | [] | no_license | #include "Apartment.hpp"
using namespace std;
//accessors
Tenants_other& Apartment::get_tenants(int i) {return tenants[i];}
Apartment::Apartment() {
this->property_val = ((rand()%200)+400)*100;
this->num_tenants = (rand()%7)+4;
this->name = "Apartment";
this->rent = ((rand()%500) + 100);
this->tenan... | true |
4dc97586f12cbaf671590ea10553b2e050d4a748 | C++ | taehee-kim-dev/Problem-solving | /Baekjoon/Function/1065.cpp | UTF-8 | 666 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
bool HanCheck(int n);
int main_1065(void) {
int n;
cin >> n;
int hanCount = 0;
for (int i = 1; i <= n; i++) {
if (HanCheck(i) == true)
hanCount++;
}
cout << hanCount << endl;
return 0;
}
bool HanCheck(int n) {
string nS... | true |
b51495baf8b41c9ed1329713937b842fb8a39275 | C++ | abidshaikh1941/Trie_Dictionary | /TrieDictionary.cpp | UTF-8 | 1,471 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <vector>
#include "Trie.cpp"
using namespace std;
int main()
{
std::cout << "Dictionary using Trie Datastructure \n";
fstream data;
string s;
data.open("C:\\Users\\Adil\\Desktop\\Trie\\data.txt",ios::in);
if (!data)
{
cout <<... | true |
03180fd5e14ab8e91f2b86b968d7ebf5a3e0579e | C++ | thakurutkarsh22/Hacktober-Open | /SelectionSort.cpp | UTF-8 | 919 | 3.84375 | 4 | [] | no_license | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
//you can directly use stl swap for swapping it will make your code more functioning
/*void swap(int &a, int &b)
{ int temp;
temp = a;
a = b;
b = temp;
} */
void display(int *arr, int n) {
for(int i = 0; i<n; i++)
{ cout << a... | true |
194071bc86d018fd4bbde35862f735e5e4b4ed9d | C++ | beawar/HBStats | /label.cpp | UTF-8 | 879 | 2.609375 | 3 | [] | no_license | #include "label.h"
#include <QRect>
#include <QFont>
Label::Label(QWidget *parent, Qt::WindowFlags f){
QLabel(parent, f);
}
Label::Label(const QString &text, QWidget *parent, Qt::WindowFlags f){
QLabel(text, parent, f);
}
void Label::resizeEvent(QResizeEvent* event){
QLabel::resizeEvent(event);
QFon... | true |
87674574a5340e14d29ea9ed6fa7e64d192ebccb | C++ | masonium/sketchbook | /dpad/src/image.h | UTF-8 | 2,544 | 3.171875 | 3 | [] | no_license | #ifndef IMAGE_H__
#define IMAGE_H__
class LPD8806x8;
/**
* Representation of given as input. The public interface to all color-based
* methods assume that colors are 8-bit per component. Any conversions are done
* internally and transparently.
*/
struct color
{
union
{
uint8_t grb[3];
struct
{
... | true |
e9dcd904c4ffff9054fd640e8222cc94b6fb76e1 | C++ | RedwanNewaz/ActiveSLAM | /hexTree/coverage.cpp | UTF-8 | 2,004 | 3.078125 | 3 | [] | no_license | #include "coverage.h"
coverage::coverage()
{
//manually defined area constraint
area_constraint.area_x=area_constraint.area_y=7;
area_constraint.sampling_length=0.5;
// initialze local map
local_map=new MST;
reset_local_map_with_heading(UP);
update_global_map(local_map,0);
}
int coverage... | true |
b801237df19e7bd7918a8da0cab11cebcf4902a8 | C++ | superweaver/leetcode | /p1442.cc | UTF-8 | 1,501 | 3.484375 | 3 | [] | no_license | #include "common.h"
class Solution {
public:
int countTriplets(vector<int>& arr) {
int result = 0;
int n = arr.size();
/*
unordered_map<int, vector<int>> cache; // xor value -> index of first element to get xor value
int x = 0;
cache[x] = {-1};
for (int i = 0;... | true |
66c30ce3fe27d5f52e4323b6aca2a65fe2f69da6 | C++ | kunwar-vikrant/Hackerrank- | /aggressive_cows.cpp | UTF-8 | 815 | 2.875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include<algorithm>
using namespace std;
bool check(int mid, int arr[], int c, int size_arr){
int cows = 1, pos = arr[0];
for(int i = 1; i < size_arr; i++){
if(arr[i]-pos >= mid){
pos = arr[i];
cows++;
if(cows == c){
return true;
}
}
}
return fals... | true |
979825e834d6ec8f2ca8ec950532ffa18bfaf5f4 | C++ | runru1030/PS | /1000-9999/2920.cpp | UTF-8 | 280 | 2.828125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
string s[3]={"ascending", "descending", "mixed"};
int a, b;
int i;
for(i=1;i<9;i++){
cin>>a;
if(a==b-1||a==b+1||i==1){
b=a;
}
else{
cout<<s[2];
return 0;
};
}
if(a==1)cout<<s[1];
else cout<<s[0];
}
| true |
b84f4f6d40a0f6766c965d726473bffa09cb66e3 | C++ | houdini22/impulse-dataset | /src/main.cpp | UTF-8 | 5,610 | 2.75 | 3 | [] | no_license | #include "src/Impulse/Dataset/include.h"
#include <sys/stat.h>
using namespace Impulse::Dataset;
using namespace std::chrono;
void test1() {
auto start = std::chrono::system_clock::now();
// build dataset from csv...
DatasetBuilder::CSVBuilder builder("/home/hud/projekty/impulse-ml-dataset/src/data/data.... | true |
f20df60ecf17491c30580b3b55106ab85640934e | C++ | Mstoned/leetcode-solutions | /test/204_count_primes_test.cpp | UTF-8 | 962 | 3.140625 | 3 | [] | no_license | #include "204_count_primes.h"
#include "gtest/gtest.h"
using namespace std;
CountPrimesSolution *solution204 = new CountPrimesSolution;
TEST(CountPrimes, Test0) {
int actual = solution204->countPrimes(10);
int expected = 4;
EXPECT_EQ(actual, expected);
}
TEST(CountPrimes, Test1) {
int actual = solut... | true |
a3b68d3ae65f4c24bbe29b5eaefe53266c073c3f | C++ | RickyLiu0w0/Snake | /Snake/food.cpp | UTF-8 | 367 | 2.984375 | 3 | [] | no_license | #include "food.h"
Food::Food(int hight, int width, int weight)
{
srand(static_cast<unsigned int>(time(nullptr)));
//要取得[a,b)的随机整数,使用(rand() % (b-a))+ a;
foo = new FoodUnit((rand()% (hight - 2 - 2)) + 2, (rand()% (width - 2 - 2)) + 2 , weight);//随机生成食物单元
}
FoodUnit * Food::getFoodUnit() const
{
return... | true |
068fd2176d19a324672d61d93f7178730104e559 | C++ | vcato/guisolver | /scenestatetaggedvalue.cpp | UTF-8 | 36,910 | 2.671875 | 3 | [] | no_license | #include "scenestatetaggedvalue.hpp"
#include <sstream>
#include "indicesof.hpp"
#include "contains.hpp"
#include "nextunusedname.hpp"
#include "taggedvalueio.hpp"
#include "pointlink.hpp"
using std::string;
using std::cerr;
using std::istringstream;
using std::ostringstream;
using XYZChannels = SceneState::XYZChanne... | true |
682bb019f829deb63c43f014ef853b65fa247458 | C++ | pn1137/University-Administration-System | /Course.cpp | UTF-8 | 3,948 | 3.71875 | 4 | [] | no_license | /*
* Functions for Course.h
* Patrick Naugle : 18 November 2016
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include "Course.h"
#include "Student.h"
#include "Teacher.h"
using std::vector;
using std::string;
using std::cout;
using std::find;
/*
* Constructo... | true |
d2cca463a64ef27231b6dfbecae7e185eb286236 | C++ | ryanr08/CS-32 | /Homework 2/eval.cpp | UTF-8 | 6,841 | 3.46875 | 3 | [] | no_license | #include "Set.h"
#include <stack>
#include <string>
#include <cassert>
#include <iostream>
using namespace std;
bool isOperator(char c);
bool isValidExpression(string infix);
bool hasHigherPrecedence(char l, char r);
void applyBooleanOperation(bool& operand1, bool& operand2, char ch, bool& result);
bool eva... | true |
a13737f91aaf79ac8c923f6a595da490e2e7b650 | C++ | kclick91/KMeansCPlusPlus | /KMeans/main.cpp | UTF-8 | 1,089 | 3.046875 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include "DataCollection.h"
#include "Partitioner.h"
//Implementation of the K-Means algorithm//
void Run()
{
int clu;
//User enter both # of clusters and # of data Points
cout << "Enter number of clusters." << endl;
cin >> clu;
int dP;
cout << "Enter number of data po... | true |
bc180d09b31e98fdfcb72e491e4a54e13039d1c5 | C++ | ChildofFire/CodingStuff | /Geeks4Geeks/LCS.cpp | UTF-8 | 933 | 2.90625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int maximum(int a, int b)
{
return (a>b)? a: b;
}
string LCS(string s1, string s2, int a, int b)
{
int mat[a+1][b+1];
for(int i=0;i<=a;i++)
for(int j=0;j<=b;j++)
if(i==0 || j==0)
mat[i][j]=0;
else
... | true |
370a266b7f06ea6d658e74cf8bd298822a682de2 | C++ | Jane11111/leetcode | /417.cpp | UTF-8 | 4,284 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<pair<int, int>> pacificAtlantic(vector<vector<int>>& matrix);
bool isValid(pair<int,int> p,int m,int n);
bool canGo(pair<int,int> p,int cur,vector<vector<int>>& matrix);
int main() {
vector<vector<int>> matrix;
vector<int> row1;
... | true |
9a768f113818ad9b4f64d1a9bb6a9146bcd995ae | C++ | artcom/asl | /asl/thread/completion.h | UTF-8 | 1,100 | 2.984375 | 3 | [
"BSL-1.0"
] | permissive | #ifndef ASL_THREAD_COMPLETION_H_
#define ASL_THREAD_COMPLETION_H_
#include <boost/thread.hpp>
namespace asl {
namespace thread {
class completion {
public:
completion() : complete_(false) {}
~completion() {}
private:
volatile bool complete_;
boost::mutex mutex_;
boost::condition_variable condi... | true |
83d366b5a2eff1cce956782f08e01dba803c18ef | C++ | yuchaozh/EECS395_Programming-Assignment-4 | /town.h | UTF-8 | 664 | 2.734375 | 3 | [] | no_license | /*
Author: Zhou Yuchao
Date:12/03/2013
Store the information of destination. This is the node of the map_array
*/
#ifndef _TOWN_H
#define _TOWN_H
#include<iostream>
#include<string>
#include "list.h"
#include "node.h"
using namespace std;
class town
{
public:
list *edges;
//constructor
town();
//destructor
... | true |
3da6073b417bffea140cc4b49fdf69e9d5f1b458 | C++ | khanmosajjid/DataStructure | /structure.cpp | UTF-8 | 668 | 3.109375 | 3 | [] | no_license | #include<iostream>
using namespace std;
// struct address
// {int stateNo;
// int cityNo;
// };
// struct student
// {int rNo;
// char* name;
// struct address addr;
// float cgpa;
// };
// int main(){
// struct student std;
// std.rNo=10;
// std.name="mj";
// std.addr.stateNo=3;
// cout<<std.name;
// cout... | true |
bfc39ac08a426b6e3fd05fe9e4e84fe176818c5c | C++ | smilagros/Algorithm-And-Data-Structures-Implementation | /College Placement Practice - HackerCode/Recursion/Q7_reverse_string_not_words.cpp | UTF-8 | 880 | 3.40625 | 3 | [] | no_license | #include<string>
#include<iostream>
using namespace std;
//function to reverse a given string
void reverse_string(string str,int st,int ed)
{
if(st == ed)
return;
char ch = str[st];
str[st] = str[ed];
str[ed] = ch;
reverse_string(str,st+1,ed-1);
}
string getString(string str)
{
string result = "";
int l =... | true |
66a55429c92bce61b307ddae085f4e610e8a7d1f | C++ | r3dark/DS_CODES | /ll_check_fixed.cpp | UTF-8 | 1,475 | 3.71875 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct node
{
node *next;
int data;
node *prev;
};
class ll
{
node *head=NULL;
public:
void insertend()
{
int value;
cout<<"enter value"<<endl;
cin>>value;
node *newnode=new node;
newnode->d... | true |
374da3056e1a686516eb88ae3da19bc20bcc59c5 | C++ | CXUtk/TRV2 | /src/TREngine/Core/Utils/Collision.h | UTF-8 | 3,115 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <Core.h>
#include <glm/glm.hpp>
#include <algorithm>
#include <vector>
#include <Core/Structures/Rect.hpp>
TRV2_NAMESPACE_BEGIN
constexpr float EPS = 1e-5f;
enum class CollisionSide
{
LEFT,
RIGHT,
TOP,
BOTTOM
};
struct Interval
{
bool horizontal;
float V;
float L, R;
};
inline bool I... | true |
42ed2157307a0d4747a0bca54ffb0c5eabeb6e90 | C++ | pbraga88/study | /2022/CPP-01_ConceptsReview/13-OOP-ClassesAndObjects/Section-Challenge/include/Movies.h | UTF-8 | 685 | 2.96875 | 3 | [] | no_license | #ifndef _MOVIES_CLASS_H_
#define _MOVIES_CLASS_H_
#include <string>
#include <vector>
#include "Movie.h"
class Movies {
std::vector<Movie> movies;
// std::string movie_name;
// std::string movie_rating;
// int movie_watch_count;
public:
/* Both 'Constructor' and 'Destructor' will be automatically ... | true |
4ab30ebcf7a237d6f7d42083da8b2cb48bf06373 | C++ | pnthao/P3_AQSIOS | /stream.thao/dsms/src/common/include/execution/scheduler/lottery_sched_id.h | UTF-8 | 1,025 | 2.734375 | 3 | [] | no_license | #ifndef _LOTTERY_SCHEDULER_ID
#define _LOTTERY_SCHEDULER_ID
#ifndef _SCHEDULER_
#include "execution/scheduler/scheduler.h"
#endif
#include <vector>
namespace Execution {
class LotterySchedulerID : public Scheduler {
private:
static const unsigned int MAX_OPS = 100;
// Operators that we are scheduling
Oper... | true |
286a716b0dbea3fc28af6c21b0d79d056604e1a6 | C++ | zimnicky/knu-iii-s-labs-oop | /tasks/19/disjointset.cpp | UTF-8 | 491 | 2.890625 | 3 | [] | no_license | #include "disjointset.h"
DisjointSet::DisjointSet(unsigned int count)
{
sets.resize(count);
for (unsigned int i = 0; i < count; i++)
sets[i] = i;
}
int DisjointSet::getNumberOfSet(unsigned int element)
{
if (element != sets[element])
sets[element] = getNumberOfSet(sets[element]);
retu... | true |
93deec0bf0562f1cc43b4282f008209b8df74667 | C++ | zeze1004/C-practice | /Programers_Level1.cpp | UHC | 1,073 | 3.53125 | 4 | [] | no_license | #include <string>
#include <vector>
#include <iostream>
#include <stdio.h>
using namespace std;
/*
1-1. Էµ ¦ 2 ϴ.
1-2. Էµ Ȧ 3 ϰ 1 մϴ.
2. ۾ 1 ݺմϴ.
*/
int solution(int num) {
int answer = 0;
int i = 0;
while (i < 500)
{
if (num % 2 == 0)
{
num ... | true |
df2e7f26355b0d32696842ed48315adae631cce1 | C++ | jared-two-foxes/BlackJack | /framework/include/terminal/util.hpp | UTF-8 | 1,655 | 3.1875 | 3 | [] | no_license | #ifndef FRAMEWORK_TERMINAL_UTIL_HPP__
#define FRAMEWORK_TERMINAL_UTIL_HPP__
#include <string>
#define ESC "\x1b"
#define CSI "\x1b["
namespace framework {
inline auto toString(std::string const& x) -> std::string {
return x;
}
template <class T>
auto toString(T const& x) ->decltype(std::to_string(x)) {
return st... | true |
411aa275ddd9d1ae36ae59a6e9277fba07da6e89 | C++ | akboga/80sampleCProjects | /project4.cpp | ISO-8859-9 | 344 | 3.0625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
// Bir kenar girilen karenin alan ve evresini hesaplayan program.
int main(){
int i,alan,cevre;
printf("Karenin bir kenar uzunlugunu giriniz : ");
scanf("%d",&i);
alan = i*i;
cevre = i*4;
printf("Karenin alani : %d\n",alan);
printf("Karenin cevresi : %d\n",cevre... | true |
93ca1e0df9aaeaa2c1a1342d59fad2795d0bf928 | C++ | helcl42/line | /src/DetectionSettings.cpp | UTF-8 | 2,028 | 3.09375 | 3 | [] | no_license | #include "DetectionSettings.h"
//format 334432 657687 657654 ...
DetectionSettings::DetectionSettings(int argc, char** argv)
: colorIndex(0)
{
for (int i = 2; i < argc; i++)
{
DetectionColorItem* item = new DetectionColorItem();
std::string color(argv[i]);
if (color.len... | true |
af915567af112fe5636fba00515567b5a52a09f1 | C++ | deadpool10086/love-C | /del.cpp | GB18030 | 2,466 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <time.h>
#include <stdlib.h>
#define DEFAULTNUM 10000
using std::cin;
using std::cout;
using std::endl;
using std::cerr;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
template <typename WC>
class SeqList
{
private:
WC *data;
int... | true |
48905ef8841e6bcf6e5fab0928015f3182587c00 | C++ | terishrimp/SDL_BlackJack | /source/Deck.cpp | UTF-8 | 2,588 | 3.390625 | 3 | [] | no_license | #pragma once
#include "Deck.h"
Deck::Deck(SDL_Renderer* const renderer) : m_renderer{ renderer } {
createDeck();
}
Card Deck::takeCardFromFront() {
Card takenCard = getCardAtIndex(0);
removeCard(0);
return takenCard;
}
void Deck::shuffleCardList() {
srand((unsigned int)time(nullptr));
std::random_shuffle(deckL... | true |
b5accfba27c4208253161ca618c7df5d0026a43e | C++ | tarasrumezhak/CString | /test/my_str_clear.cc | UTF-8 | 353 | 2.59375 | 3 | [] | no_license | #include "gtest/gtest.h"
extern "C" {
#include "cstrings.h"
}
TEST(CStringsTest, my_str_clear) {
my_str_t str;
my_str_create(&str, 0);
my_str_from_cstr(&str, "merry christmas!", 100);
my_str_clear(&str);
ASSERT_EQ(str.size_m, 0);
ASSERT_EQ(str.capacity_m, 100);
ASSERT_STREQ(my_str_get_c... | true |
520dcefe7b7ce66a9c70ab32fd52c7f636b67fab | C++ | jackaberdeen15/EE40GA_Sort | /EE40GA_Sort/generalArray.h | UTF-8 | 13,664 | 3.859375 | 4 | [] | no_license | #ifndef __GENERALARRAY_H_
#define __GENERALARRAY_H_
#include "ArrayItem.h"
// version with inheritance
class general_array{
protected:
// "reference item" has to be initialized with the address
// of a (non-base class) valid object, allocated on the heap
basic_item *reference_item;
// this is an array of po... | true |
c008bbe0e88e10ccaaa0ec4e0e6299c784e0ecc9 | C++ | fxst1/spaceinvader | /src/objects/enemywaves.cc | UTF-8 | 3,559 | 2.546875 | 3 | [] | no_license | #include "spaceinvader.hh"
#include "gameobjects.hh"
Wave::EnemyShip::EnemyShip(Wave* w):
engine::Entity(),
_group(w),
_pv(3),
_last_shoot(0),
_recovery(500),
_move_func(nullptr)
{
std::cout << "* Alloc ship without call move" << std::endl;
}
Wave::EnemyShip::EnemyShip(Wave* w, MoveFunc *mvfunc):
engine::Entit... | true |
afdb9a229f4c32713db3535dd816a7a908ad6998 | C++ | fpoinsot/projetMathFinal | /ConsoleApplication1/Grille.cpp | ISO-8859-1 | 13,423 | 2.953125 | 3 | [] | no_license | #include "stdafx.h"
#include "Grille.h"
#include <iostream>
#include <random>
#include "GestionRandom.h"
#include <fstream>
Grille::Grille(int paramDegre) : degre(paramDegre), dimensionTabSudoku(paramDegre*paramDegre), nombreCaseAfficheeEtRemplie(0),nombreCaseRemplie(0)
{
if(paramDegre > 0)
{
tabSudoku = new Case... | true |
caabe7a2b6d243d2342136a017e772cce0c8cb44 | C++ | shubhham786/Coding | /array and string/test.cpp | UTF-8 | 2,326 | 3.015625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
//To print the matrices
vector<int> kadens_algo_generic_subarry01(vector<int>&arr)
{
int gsum=-(int)1e9,csum=0,gedx=0,csdx=0,gsdx=0;
for(int i=0;i<arr.size();i++)
{
int ele=arr[i];
csum=csum+ele;
if(ele>csum... | true |
674342e993a0134eb832ce4896af183deb733f5c | C++ | bavernet/cpp-idioms | /day3/7_value_type2.cpp | UTF-8 | 531 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <list>
using namespace std;
// 반복자는 결국 클래스타입의 객체입니다.
// template <typename T>
// class vector_iterator {
// typedef T value_type;
// };
template <typename T>
typename T::value_type Sum(T first, T last) {
typename T::value_type s = typename T::value_type();
for (T i... | true |
e6a3164d6eddceab72a13fb387259a77ea37b030 | C++ | tim37021/R3D | /include/r3d/Pipeline/PostFX.hpp | UTF-8 | 1,806 | 2.84375 | 3 | [] | no_license | #ifndef __R3D_PIPELINE_POSTFX_HPP_
#define __R3D_PIPELINE_POSTFX_HPP_
#include <list>
#include <string>
#include <memory>
namespace r3d
{
class PostEffect;
class PostFX;
class Engine;
class ContextWindow;
class VertexArray;
class RenderTarget2D;
class Texture2D;
typedef std::shared_ptr<RenderTarget2D> Render... | true |
07e6540b8a958a17a076eea6f2bdb8a6d06dc874 | C++ | kuzemczak/PAMSI_Projekt1 | /vectorAddon.h | UTF-8 | 376 | 3.15625 | 3 | [] | no_license | #ifndef VECTORADDON_H
#define VECTORADDON_H
#include <iostream>
template <typename T>
std::ostream& operator<< (std::ostream& out, const std::vector<T>& v) {
if (!v.empty()) {
out << '[';
for (T element : v)
out << element << ", ";
out << "\b\b]";
}
return out;
}
template<typename T>
void Swap(T & v0,... | true |
cff9077159d80610bec690a9f1680961b0cb0633 | C++ | lonkaars/avans-kluis | /ReadSwitch/ReadSwitch.ino | UTF-8 | 557 | 2.8125 | 3 | [
"MIT"
] | permissive | int drukKnop = 12; //Hier initialiseer je de waarden
int led = A0;
int StaatdrukKnop = LOW; //Staat van de druktoets instellen
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT); //LED instellen als uitvoer
pinMode(drukKnop, INPUT); //Druktoets instellen als invoer
}
void loop() {
StaatdrukKnop = ... | true |
9483ca067454a03ae9b30c3296c23a2a8d01a9fa | C++ | Ivonhoe/LeetCode | /c++/src/leetcode/editor/cn/127-WordLadder.cpp | UTF-8 | 2,672 | 3.375 | 3 | [] | no_license | //给定两个单词(beginWord 和 endWord)和一个字典,找到从 beginWord 到 endWord 的最短转换序列的长度。转换需遵循如下规则:
//
//
//
// 每次转换只能改变一个字母。
// 转换过程中的中间单词必须是字典中的单词。
//
//
// 说明:
//
//
// 如果不存在这样的转换序列,返回 0。
// 所有单词具有相同的长度。
// 所有单词只由小写字母组成。
// 字典中不存在重复的单词。
// 你可以假设 beginWord 和 endWord 是非空的,且二者不相同。
//
//
// 示例 1:
//
// 输入:
//beginWord = "hit... | true |
339785c2267ce01d3f1c1882a5b3188f374ae4fa | C++ | vivi/bess | /core/utils/ip_test.cc | UTF-8 | 1,302 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | #include "ip.h"
#include <gtest/gtest.h>
using bess::utils::be32_t;
namespace {
using bess::utils::Ipv4Prefix;
// Check if Ipv4Prefix can be correctly constructed from strings
TEST(IPTest, CIDRInStr) {
Ipv4Prefix prefix_1("192.168.0.1/24");
EXPECT_EQ((192 << 24) + (168 << 16) + 1, prefix_1.addr.value());
EXP... | true |
1e1a63bcefadf9e8df000d4a04eebb272c1acdd4 | C++ | SvetlanaZhurba/Queue-and-time | /queue.cpp | UTF-8 | 4,092 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include "queue.h"
#include "node.h"
using namespace std;
queue::queue()
{
end = nullptr;
}
queue::~queue()
{
node *ptr = end;
while( ( ptr = end ) != nullptr )
{
end = end->getprev();
delete ptr;
ptr = nullptr;
}
delete end;
end = nullptr;
}
void queue::show()
{
nod... | true |
492bc6a13c8274c682770745f62fd2a2c350eb53 | C++ | chiragxarora/SDE-SHEET | /Arrays/merge2sortedArrays.cpp | UTF-8 | 2,101 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <utility>
#include <iomanip>
using namespace std;
// https://www.geeksforgeeks.org/efficiently-merging-two-sorted-arrays-with-... | true |
dfc11a0347eb88082518db7b84a3058c95f12761 | C++ | shaked6/splProject | /src/Watchable.cpp | UTF-8 | 1,405 | 2.734375 | 3 | [] | no_license | //
// Created by shaked on 25/11/2019.
//
#include <iostream>
#include "../include/Action.h"
#include "../include/Session.h"
#include "../include/Watchable.h"
using namespace std;
int Watchable::getLength() const {
return this->length;
}
std::vector<std::string> Watchable::getTags() const {
return this->tags... | true |
796d153c4d59e9dce135ae397e37fc8370a759f3 | C++ | Jorgefiestas/CompetitiveProgramming | /Codeforces/CF1303A.cpp | UTF-8 | 429 | 2.796875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int t, z, zo;
string str;
int main() {
cin >> t;
while (t--) {
z = 0;
zo = 0;
cin >> str;
bool seenOne = false;
for (char c : str) {
if (!seenOne && c != '1') {
continue;
}
else if (!seenOne && c == '1') {
seenOne = true;
}
else if (c ... | true |
b52e2d7d9fbb9942b9dac9fa88bce007f7b07b5f | C++ | StabCrab/Data_Structures | /ShuntingYard/Token.cpp | UTF-8 | 943 | 3.203125 | 3 | [] | no_license | //
// Created by trykr on 18.05.2020.
//
#include "Token.h"
Token::Token()
{
this->token ="ERROR";
this->tokenType = TokenType::Number;
this->value = 0;
}
Token::Token(std::string token, TokenType tokenType)
{
this->token = std::move(token);
this->tokenType = tokenType;
this->value = 0; //чис... | true |
309c8e1d948a60a45dc5ca1ece916eb0f126f75d | C++ | VekotinVerstas/NoiseSensorWorkshop | /arduino/i2s_Spectrum_test/i2s_Spectrum_test.ino | UTF-8 | 3,325 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
This example reads audio data from an Invensense's ICS43432 I2S microphone
breakout board, and prints out the spectrum to the Serial console. The
Serial Plotter built into the Arduino IDE can be used to plot the audio
amplitude data (Tools -> Serial Plotter)
Circuit:
* Arduino/Genuino Zero, MKRZero or MKR1000... | true |
8fe103a5312c2bb5e32931fc2deaead7663cf716 | C++ | Falcon22/TowerDefense | /src/Units/Warrior/Warrior.cpp | UTF-8 | 1,678 | 2.984375 | 3 | [] | no_license | #include "Warrior.h"
Warrior::Warrior(Type type, const sf::Vector2f& position, const Map::LogicMap& logicMap, int cost,
float velocity, int hp)
: GameUnit(type, position),
logicMap_(logicMap),
direction_(0),
alive_(true),
finished_(false),
cost_(cost),
velocity_... | true |
0d200ce3c5bf289a5040ff7bc67e04197763ec54 | C++ | yunqingjia/feron_drone | /ATtiny85 Code/ATtiny85_ESC_Test/ATtiny85_ESC_test.ino | UTF-8 | 1,686 | 3.234375 | 3 | [] | no_license | // Simple program to test the ATtiny85's
// ability to control ESCs/Brushless Motors
#include "SoftwareSerial.h"
#include "Servo8Bit.h"
#define ESC_PIN (0) // PWM pin for signaling ESC
#define RX_PIN (3) // RX pin for SoftwareSerial
#define TX_PIN (4) // TX pin for SoftwareSerial
#def... | true |
333266c3c59421fdc7018b1caba3bab5064ac39f | C++ | menghuadong/FaceAndEyeDetect | /main.cpp | GB18030 | 4,218 | 2.703125 | 3 | [] | no_license | //--üʵּ
//--By Steven Meng 2012.11.29
//עӦobject.dllļ.xml
//ļŵǰĹĿ¼
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/ml/ml.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
//--
void detect... | true |
cb476ae9c5c4d3e62c5d16748ba83754a6a03b92 | C++ | kityprincess/ponder12-spellchecker | /sp/sp/spellCheck.cpp | UTF-8 | 5,630 | 3.328125 | 3 | [] | no_license | /***********************************************************************
* Module:
* Week 12, Spell Check
* Brother Helfrich, CS 235
* Author:
* <your name here>
* Summary:
* This program will implement the spellCheck() function
************************************************************************/
#ifde... | true |
433047da52b214c2b1246116900d0b84b70687c5 | C++ | leandro-araujo-silva/Estrutura-de-dados | /Estruturas/fila.cpp | UTF-8 | 1,923 | 3.984375 | 4 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
typedef int TipoItem;
const int max_itens = 100;
class fila
{
private:
int primeiro, ultimo;
TipoItem *estrutura;
public:
fila();
~fila();
bool estavazio();
bool estacheio();
void inserir(TipoItem item);
TipoItem remover();
void imprimir();
};
fila::fila()... | true |
8daecf70ac995f048d78ee873e1338736b034a44 | C++ | zhaowei-rs/crane | /crane/logger.h | UTF-8 | 3,540 | 2.9375 | 3 | [] | no_license | #ifndef CRANE_LOGGER_H_
#define CRANE_LOGGER_H_
#include <string>
#include <memory>
#include <iostream>
#include <fstream>
#include <sstream>
#include <mutex>
using namespace std;
#define USE_LOGGING 1
#define STD_OUTPUT 1
#define LOG_FILE "crane.log"
class log_policy_interface
{
public:
virtual void open_... | true |
36992c79f9c26a9fd69ccc0397028e5659e326d7 | C++ | Cataclysm234/SP01-Trap-la-pist | /SP1Framework/game.cpp | UTF-8 | 21,600 | 2.515625 | 3 | [] | permissive | // This is the main file for the game logic and function
// gud day 14/8/2018
//
#include "game.h"
#include "Framework\console.h"
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <Windows.h>
#pragma comment (lib,"Winmm.lib")
using namespace std;
double g_dElapsed... | true |
82e83c7001ac2f66045af87e16bbab470813c6b0 | C++ | JeffBobbo/Interpreter | /C++/Interpreter.h | UTF-8 | 4,143 | 2.890625 | 3 | [] | no_license | #ifndef INTERPRETER_H_INCLUDE
#define INTERPRETER_H_INCLUDE
#include <cctype> // std::isalpha, std::isalnum, std::isdigit, etc
#include <string>
#include <cmath>
#include <map>
#include "Parser.h"
#include "Token.h"
class Interpreter
{
public:
Interpreter(Parser* p) : parser(p), tree(nullptr) {};
~Interpreter() ... | true |
1b4b9da205ad4c89f29c9f8d0f31b7fd6097642a | C++ | fivard/Laboratory-works-sem2-2019-2020-academic-year | /lab1/message.cpp | UTF-8 | 3,149 | 3.15625 | 3 | [] | no_license | #include "message.h"
#include <iostream>
#include <ctime>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
void MessageLog::coutElem() {
cout << this->id << ' ' << this->countWords << ' ' << this->text << ' ' << this->timeCreated.year << ' ' << this->timeCreated.month
... | true |
3a4146d3beb4f70c5602b229f3f3a795edda0506 | C++ | delcanovega/AER | /317/main.cpp | UTF-8 | 1,457 | 2.578125 | 3 | [] | no_license | #include <cstdio>
#include <string>
#include <set>
using namespace std;
int main() {
int size;
scanf("%d", &size);
while (size != 0) {
set<string> hash;
char key[5];
for (int i = 0; i < size; ++i) {
scanf("%s", key);
string k(key);
hash.insert(k);
}
char c_str[1003];
sca... | true |
8177465064530eb0d4dde8e066147626727b9d13 | C++ | clab/dynet | /dynet/training.h | UTF-8 | 24,388 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /**
* \file training.h
* \defgroup optimizers
* \brief Training procedures
*
* The various trainers are defined here.
* All trainers are structures inheriting from the `Trainer` struct.
*
*
*/
#ifndef DYNET_TRAINING_H_
#define DYNET_TRAINING_H_
#include <vector>
#include <iostream>
#include "dynet/model.h"
... | true |
4b27d4861014de4403a10a9e66cc5be3bcb12c3d | C++ | emresolugan/Robot-Turtles-Console-Game-with-Cpp- | /robot_turtles/main.cpp | WINDOWS-1258 | 9,333 | 3.296875 | 3 | [] | no_license | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
char map[8][8];
char changed_map[8][8];
int i, j, flag_row, flag_column;
int k, move, l, direction=0, result;
char root; ... | true |
f59911eec35dc18d41d5f2d95b699cd9560e6529 | C++ | jisukJ/network | /c05_TCP_base_server_and_client2/c5_op_server.cpp | UTF-8 | 2,031 | 2.59375 | 3 | [] | no_license | #include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#define BUF_SIZE 1024
#define OPSZ 4
#define RLT_SIZE 4
void error_handling(char* message){
fputs(message,stderr);
fputc('\n',stderr);
exit(1);
}
int main(int argc,char* argv[])
{... | true |
8f2da9bea6fcb82aa5ed484b174a1201252e0981 | C++ | Kitsch1/BOJ | /1436.cpp | UTF-8 | 502 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
int n,cnt = 1;
cin >> n;
if(n == 1){
cout << "666\n";
}
else{
for(int i=1666;i<10000000;i++){
string cur_str = to_string(i);
if(cur_str.find("666") != string::npos){
... | true |
62491f1cfd2b525dd06d19f401bb30c8af62c8f2 | C++ | keyllalorraynna/AtividadesEmC | /Lista4/13questao.cpp | ISO-8859-1 | 750 | 3.390625 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
#include<locale.h>
#include<iomanip>
using namespace std;
int main(void) {
setlocale(LC_ALL,"portuguese");
float altura, peso_ideal;
char sexo;
cout << " Informe a altura: ";
cin >> altura;
cout << " Informe o sexo sendo: " << endl;
cout << " F - Feminino | M - Mascul... | true |
76cf150f6415c9f530fb4000cb3203d89cd6721d | C++ | boredbird/C_playground | /DataStructure/BOOK_G/第7章 图/图的表示_邻接矩阵/main.cpp | GB18030 | 3,742 | 3.46875 | 3 | [
"MIT"
] | permissive | // main7-1.cpp C7-1.cpp
#include "C1.h"
#include "C7-1.h"
void print(char *c)
{
printf("%s ", c);
}
bool LoopCommand(MGraph &g)
{
char command = '0';
int m;
VertexType v, w;
printf("\n");
printf("1-ͼ 2-Ҷ 3-붥 4-ɾ 5-Ķ\n");
printf("6-ӻ 7-ɾ 8-DFS 9-BFS 0-˳\n");
printf("\nҪִе... | true |