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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bf002cf839bff547d3a4a5001360d00a74b7698d | C++ | parthdhwajendramishra/DS-and-DAA | /Graph/iscyclic_undirected.cpp | UTF-8 | 1,434 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Graph
{
int v,e;
public:
Graph(int v,int e);
bool isCyclic(vector<int> graph[]);
bool cyclic_Util(int sv,vector<int> graph[],vector<bool> &visited,int parent);
void input();
};
bool Graph::cyclic_Util(int sv,vector<int> graph[],vector<bool> &vi... | true |
8c3ab6cbb3258e136abdc202a5d9de1ce6591aa1 | C++ | VIENA-IST/AHRS | /tools/calibrate_adxl345/calibrate_adxl345.cpp | UTF-8 | 1,789 | 2.59375 | 3 | [] | no_license | #include <ADXL345.h>
#include <Arduino.h>
ADXL345 accel;
int16_t ax, ay, az;
double ax_stOff=0, ay_stOff=0, az_stOff=0;
#define GRAVITY 256.0f
#define LED_PIN 13 // (Arduino is 13, Teensy is 6)
bool blinkState = false;
int I;
void setup() {
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire... | true |
4f94141ca88239a24150cb988fb421c202f1f3f7 | C++ | lrh360com/interview | /判断两个链表是否相交.cpp | GB18030 | 1,744 | 3.96875 | 4 | [] | no_license | /*---------------------------------
жǷཻ
-----------------------------------
***ͷָ룬h1,h2жǷཻ
*/
#include<iostream>
using namespace std;
struct Node{
int data;
Node *next;
};
/*--------------------------
һ
--------------------------
*/
bool isJoinedSimple(Node *h1,Node *h2)
{
if(h1 == NULL || h1 =... | true |
7959a190c667a85990b900a1cff38b562d2825cf | C++ | navidemad/cpp-babel-voip-epitech | /Babel/client/sources/Commands/CommandExit.cpp | UTF-8 | 668 | 2.609375 | 3 | [] | no_license | #include "CommandExit.hpp"
#include "CommandException.hpp"
#include <cstring>
CommandExit::CommandExit(void) {
}
CommandExit::~CommandExit(void) {
}
ICommand::Instruction CommandExit::getInstruction(void) const {
return ICommand::EXIT;
}
IClientSocket::Message CommandExit::getMessage(void) const {
IClientSocket::... | true |
1e709054e1d3d27729cfe70688b61abd4bcb6385 | C++ | Abhi-Balijepalli/C-Cpp_Projects | /Zoo-Tycoon/zoo.cpp | UTF-8 | 21,319 | 3.609375 | 4 | [] | no_license | /* Program: Zoo_Tycoon.cpp
* Author: StickZ
* Date: 05.12.2019
* Description: fun zoo tycoon game, where players play till they loose all thier money
* Input: options to choose animal, and if you want to buy
* Ouput: money, profit, bonuses, etc...
*/
#include <iostream>
#include "./zoo.h"
#include <string>
#inclu... | true |
fb4a7cc64620d30f11fe95ca415d9eaf02e1fdd0 | C++ | FrancoisChabot/cpl_tmpl | /tests/data_provider.cpp | UTF-8 | 655 | 2.90625 | 3 | [] | no_license | #include "catch.hpp"
#include "cpl_tmpl/data_provider.h"
#include <sstream>
std::string get(cpl_tmpl::Data_provider dp) {
std::ostringstream dst;
dp.get(dst);
return dst.str();
}
TEST_CASE("Numeric", "[data_provider]") {
REQUIRE(get(cpl_tmpl::data_provider(3)) == "3");
}
TEST_CASE("String",... | true |
a7f3fbb81e86ad1425f9bb395deb7756fa7db1f2 | C++ | killbug2004/fshooterbetaproject | /dbghelper/HandleBase.cpp | UTF-8 | 1,885 | 2.734375 | 3 | [] | no_license | #include "HandleBase.h"
#include "kernel_dbg.h"
HandleTarget::HandleTarget(void) : _refCount(0)
{
}
HandleTarget::~HandleTarget(void)
{
}
ULONG HandleTarget::AddRef()
{
KASSERT(_refCount <= 0xf000000);
return ++_refCount;
}
ULONG HandleTarget::ReleaseRef()
{
KASSERT(_refCount <= 0xf000000);
... | true |
c294a6557f352e2fdf559e2c306d91d474951ae7 | C++ | Igronemyk/OI | /CodeForces/903E.cpp | UTF-8 | 1,990 | 3.28125 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
const int MAX_CHILD_SIZE = 26;
int k,length;
bool found;
struct Trie {
struct Node {
Node *childs[MAX_CHILD_SIZE];
int countEnd;
Node() {
for(int i = 0;i < MAX_CHILD_SIZE;i++) child... | true |
9e3ff04a9228f1166cdebc216687257592723353 | C++ | raptoravis/voxelbasedgi | /GlobalIllumination/src/Camera.cpp | UTF-8 | 1,614 | 2.640625 | 3 | [
"MIT"
] | permissive | #include <stdafx.h>
#include <Demo.h>
#include <Camera.h>
bool Camera::Init(float fovy, float aspectRatio, float nearClipDistance, float farClipDistance)
{
this->fovy = fovy;
this->aspectRatio = aspectRatio;
if ((nearClipDistance <= 0.0f) || (farClipDistance <= 0.0f))
return false;
bufferData.nearClipDistance = ... | true |
99cc0bd475847bfac1f9a40b5b62e818834e21a6 | C++ | zhongershun/data-structure | /heapsort.cpp | UTF-8 | 2,507 | 3.625 | 4 | [] | no_license | #include<iostream>
using namespace std;
// 整体的思路:子树与父节点比较每次将最大的数向上传递,最后使得最大的数位于树顶,最后再把最后位置上的数与子节点上最大的数交换得到最大的数就去到了最后一位
struct point
{
int x;
int y;
};
// 比较,如果A大则返回True
bool compare(point A,point B)
{
if (A.x>B.x)
{
return true;
}
else if (A.x<B.x)
{
return false;
... | true |
456d0c2cb6a2d68a18ed785890c22afba2d4f633 | C++ | genzyy/ncurses-library | /recursion/hard/board_game.cpp | UTF-8 | 391 | 3.09375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int diceArray[] = {1, 2, 3, 4, 5, 6};
int boardGame(int start, int end) {
if(start == end) return 1;
if(start > end) return 0;
int count = 0;
for(int i=1; i<=6; i++)
count += boardGame(start + i, end);
return count;
}
int main() {
int dest;
cin>>dest;... | true |
4ea0eeddb65ec88ccce4336c9ce9a01efb29a4f9 | C++ | networkit/networkit | /include/networkit/distance/APSP.hpp | UTF-8 | 1,465 | 2.875 | 3 | [
"MIT"
] | permissive | /*
* APSP.hpp
*
* Created on: 07.07.2015
* Author: Arie Slobbe
*/
#ifndef NETWORKIT_DISTANCE_APSP_HPP_
#define NETWORKIT_DISTANCE_APSP_HPP_
#include <memory>
#include <networkit/base/Algorithm.hpp>
#include <networkit/distance/SSSP.hpp>
#include <networkit/graph/Graph.hpp>
namespace NetworKit {
/**
* @... | true |
b60d124c5036606debec3245ebbfa4b39f80cf6a | C++ | moakbari/LeetCode | /MaximumSumOf3Non-OverlappingSubarrays.cpp | UTF-8 | 1,595 | 2.953125 | 3 | [] | no_license | class Solution {
public:
vector<int> maxSumOfThreeSubarrays(vector<int>& nums, int k) {
if (k == 0){
return vector<int>();
}
vector<int> runSum(nums.size() + 1, 0);
partial_sum(nums.begin(), nums.end(), runSum.begin() + 1);
vector<int> le... | true |
3ef27edd200210f4f5ea9ab0606a83ac09620ea6 | C++ | xmlb88/algorithm | /leetcode/superPow.cpp | GB18030 | 1,466 | 3.59375 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
// a k ηĽ
int mypow(int a, int k);
//
int superPow(int a, vector<int>& b) {
// ݹbase case
if (b.empty()) return 1;
// ȡһ
int last = b.back();
b.pop_back();
// ԭ⻯Сģݹ
int part1 = mypow(a, last);
int part2 = mypow(superPow(a, b... | true |
7218c2bf117a345b7bf26b1612c93e7bfc6a1ff5 | C++ | rutitka/TetrisGame | /TetrisGame/Joker.h | UTF-8 | 385 | 2.6875 | 3 | [] | no_license | #pragma once
#include "Shape.h"
class Joker : public Shape
{
public:
virtual void setShape(const Point& head) override;
virtual void move(char keypressed, bool erase) override;
virtual void dropDown(int lowestLine) override;
virtual bool checkAvailability(Board &board, char keyPressed) override;
virtu... | true |
a15f229e73ebed6a8580e3d9997701a5ea454dc2 | C++ | KimBoWoon/HomeWork | /Visual Studio 2013/Projects/Data Structures/Data Structures/Sparse Matrix.h | UTF-8 | 871 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define SIZE 5
typedef int DataType;
class Matrix
{
private:
int row, col;
DataType elem;
public:
friend ostream& operator<< (ostream& os, vector<Matrix *> M);
void Setrow(int x);
void Setcol(int x);
void Setelem(DataType x);
int ... | true |
86ec6594094dd212bcc5a4005abd2a492ffdb720 | C++ | eokeeffe/quasi_invariant-features | /src/gder.cc | UTF-8 | 2,442 | 2.59375 | 3 | [] | no_license | /*
* Creating Gaussian Derivatives for images
*/
#include <gder.h>
#include <operations.h>
cv::Mat fill_border(cv::Mat in, int bw)
{
int hh = in.rows;
int ww = in.cols;
int dd = in.depth();
if(dd == 1)
{
}
else
{
}
return cv::Mat::eye(hh,ww,CV_32F);
}
cv::Mat gder(cv::M... | true |
3b55b6cf82d5ce9f916f730c681e9054d66f28e7 | C++ | Hatsunespica/PlayWithLLVM | /firstTry/Hello.cpp | UTF-8 | 6,011 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | //===- Hello.cpp - Example code from "Writing an LLVM Pass" ---------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | true |
3ba38141b7e999619855a759bb01137d5a51434e | C++ | Professor-Emanuel/Cpp_Advanced | /PointersExample/PointersExample/PointersExample.cpp | UTF-8 | 1,806 | 3.953125 | 4 | [] | no_license | #include <iostream>
int main()
{
//a POINTER is just an INTEGER that holds an address -> that address can point to int, float, user defined data type, etc
int var = 8; //variables created on the STACK memory
void* ptr = NULL; // or 0 or nullptr (added since cpp11)
void* ptrI = &var; //debug and ... | true |
b60afc53c061958b0610dd7a408e667296a95654 | C++ | ajay7633/Computer-Science-Projects | /Project4/implementation.cpp | UTF-8 | 13,369 | 3.421875 | 3 | [] | no_license | //Name:Ajay M Nair
#include "header.hpp"
//Default Constructor for FlightInfo Class
FlightInfo::FlightInfo(){
airline = nullptr;
departAirport = nullptr;
arriveAirport = nullptr;
}
//Destructor for FlightInfo class
FlightInfo::~FlightInfo() {
if(airline != nullptr){
delete[]airline;
ai... | true |
facf293157f7643e66c1b3bba58b5e34c0479c6d | C++ | PrakharJain-Git/InterviewBit | /Array/Maximum_Absolute_Difference.cpp | UTF-8 | 972 | 2.515625 | 3 | [] | no_license | int Solution::maxArr(vector<int> &A) {
/* int len,i,j,k,l,sum=0,max=INT_MIN ;
len=A.size() ;
for (i=0;i<len;i++)
{
for (j=i;j<len;j++)
{
k=A[i]-A[j] ;
l=j-i ;
if (k<0)
{
k=-1*k ;
}
sum=k+l ;
... | true |
c0439ea70916d18f61973c696e4614f3fde87142 | C++ | RiceReallyGood/LeetCode_Revise | /101-200/113_Path_Sum_II.h | UTF-8 | 774 | 3.046875 | 3 | [] | no_license | #include "../definitions.h"
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> pathSum(TreeNode* root, int sum) {
if(root == nullptr) return {};
vector<vector<int>> ret;
vector<int> path;
recurse(root, path, sum, ret);
return ret;
}
priv... | true |
3ddebe409762e8ea010e9e16e5c34c2a15ac2233 | C++ | sittu071/cpp | /DuplicateElementInVector/main.cpp | UTF-8 | 645 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int main()
{
vector<std::string> vecOfStings{ "at" , "hello", "hi", "there", "where", "now", "is", \
"that" , "hi" , "where", "at", "no", "yes", "at"};
map<string,int> countMap;
for (auto & ... | true |
f272c4af4affa445453bbb75c16dbdb4aa34a4f6 | C++ | tridibsamanta/Algorithmic-Toolbox | /Week 2/fibonacci_partial_sum.cpp | UTF-8 | 1,273 | 3.328125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int get_fibonacci_small(int n, int m) {
int fib[n + 1];
fib[0] = 0;
fib[1] = 1;
for (int i = 2; i <= n; i++) {
fib[i] = (fib[i - 1] + fib[i - 2]) % m;
}
return fib[n];
}
int get_pisano_period_length(int m) {
if (m == 1)
... | true |
c1f240249c33f2fa221070b524e5684b1e90f460 | C++ | ammadz789/DataStructures | /HW2/26277-MuhammadAmmadZohair/QuadTree.h | UTF-8 | 11,704 | 3.671875 | 4 | [] | no_license | #include <string>
#include <string.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
using namespace std;
//the node structure has seven field
struct node{
//4 pointers denoting quadrants
node *NE;
node *NW;
node *SE;
node *SW;
int X_cord;
int Y_cord;
string city... | true |
55f1adb8642dfa872958afb2398af37de5334b9d | C++ | MilanFIN/TrainGame | /TrainGame/TrainGame/playerlogic.h | UTF-8 | 6,140 | 2.71875 | 3 | [] | no_license | #ifndef PLAYERLOGIC_H
#define PLAYERLOGIC_H
#include <memory>
#include <QGraphicsScene>
#include <vector>
#include <QObject>
#include "playertrain.h"
#include "traininterface.h"
#include "shop.h"
/**
* @brief The PlayerLogic class defines player related logic
*/
class PlayerLogic: public QObject
{
Q_OBJECT
pub... | true |
8994502bc6e179358de165e4b6d45c9611b1d929 | C++ | yangzeyu1026/practice-code | /0103.cpp | UTF-8 | 476 | 3 | 3 | [] | no_license | #include <bits/stdc++.h>
int main()
{
//三位数反转
/*
不含0
int n;
scanf("%d",&n);
printf("%d%d%d\n",n%10,n/10%10,n/100 );//注意这里是逗号
*/
/*
含0
int n,m;
scanf("%d", &n);
m = (n%10)*100 + (n/10%10)*10 + n/100;
printf("%03d\n", m );*/
//变量交换
/*
引入新的变量
int a,b,t;
scanf("%d%d",&a,&b);
t = a;
a = b;
b = t;
print... | true |
2e8174354c0f83d08fe1139d792355e15dacd2a5 | C++ | TBBle/libscx | /src/AssetName.cpp | UTF-8 | 1,462 | 2.734375 | 3 | [] | no_license | #include "AssetName.hpp"
#include <boost/locale.hpp>
using boost::locale::conv::to_utf;
using boost::locale::conv::from_utf;
#include <array>
using std::array;
#include <gsl/gsl>
using gsl::as_multi_span;
void AssetName::read_data(fixed_string_span string0,
fixed_string_span s... | true |
7677d36d6a4e51c95ec3872db62ddd6d77735e39 | C++ | Lowvoice-git/BOJCode | /BOJ/Silver/Silver_17087_숨바꼭질 6.cc | UTF-8 | 431 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cmath>
std::vector<int> Array;
int GCD(int A, int B) {
if (B == 0) return A;
return GCD(B, A % B);
}
int main() {
int N, M, result = 0;
std::cin >> N >> M;
for (int i = 0; i < N; i++) {
int temp; std::cin >> temp;
Array.push_back(std::abs(temp - M));
}
resul... | true |
92477e38b67ec53e41b0040d372ff64b6e940b16 | C++ | jimsjoo/FinancialCPP | /MA.cpp | UTF-8 | 1,183 | 3.28125 | 3 | [] | no_license | // MA.cpp
#include "MA.h"
#include <iostream>
MA::MA()
{
}
MA::MA(int numPeriods)
: m_numPeriods(numPeriods)
{
}
MA::~MA()
{
}
MA::MA(const MA &ma)
: m_numPeriods(ma.m_numPeriods)
{
}
MA &MA::operator = (const MA &ma)
{
if (this != &ma) {
m_numPeriods = ma.m_numPeriods;
m_pr... | true |
d5a07de4359f2693d415221a477bb7166544cb3f | C++ | osak/Contest | /POJ/3774.cc | UTF-8 | 5,003 | 3.203125 | 3 | [] | no_license | //Name: Elune’s Arrow
//Level: 3
//Category: 幾何
//Note:
/*
* まず目標を構成する線分のどれかに当たるかを計算し,当たるなら一番近い交点の距離を記憶しておく.
* そのあと他の物体で同じことを行ない,目標物体より距離の近い交点を持つものがなければHIT.
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <complex>
using namespace std;
typedef complex<double> P;
static con... | true |
bd1e06962963fc162fc9001621e7247777f3a168 | C++ | sounak07/DS-algo-pointer-Programs | /Pointers/pointerarray.cpp | UTF-8 | 243 | 2.8125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int a[10];
cout<< a <<endl;
cout<< &a << endl;
a[0] = 5;
a[1] = 10; //*(a + i) => a[i]
int *p = &a[0];
cout<< *p << endl;
cout<< a <<endl;
cout<< &p << endl;
}
| true |
91f2cab0d9fdb36ebe8e5b6a00c1232dc2ad30fe | C++ | ypsitau/jrasm | /src/jrasmcore/PCGRange.h | UTF-8 | 1,721 | 2.71875 | 3 | [] | no_license | //=============================================================================
// PCGRange.h
//=============================================================================
#ifndef __JRASMCORE_PCGRANGE_H__
#define __JRASMCORE_PCGRANGE_H__
#include "PCGChar.h"
//-------------------------------------------------------... | true |
2bf1e9ddd9932244230af3d4520328220266ffd0 | C++ | gnosiop/fromPhone | /C++/Essential/Errors/throwCatch/multiCatch.cpp | UTF-8 | 330 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
void Xhandler(int test)
{
try {
if (test) throw test;
else throw "Value is zero";
}
catch (int i) {cout << "Caught exception #: " << i << "\n";}
catch (...) {cout << "Caught other \n";}
}
int main()
{
Xhandler(1);
Xhandler(2);
Xhandler(0);
Xhandler(3);
r... | true |
66247413827964a38f8041d83e465391fe35a51b | C++ | Valentina5/ConvolutNNetwork | /convolutNN/ConvLayer.h | UTF-8 | 4,591 | 2.890625 | 3 | [] | no_license | #ifndef __CONVLAYER_H__
#define __CONVLAYER_H__
#include <vector>
#include <cmath>
#include "Sigmoid.h"
#include "Layer.h"
template<int kernDim, int inDim, int outDim>
class ConvLayer : public Layer {
const int mapsIn, mapsOut;
const int inSize, outSize, kernSize;
const int inExitSize, outExitSize;
float *weigh... | true |
9c165db4c7705705b7d5cd38083e10ccda0381dd | C++ | Jorge-Rmz/Sucesion-de-Fibonnacci | /fibonacci.cpp | UTF-8 | 716 | 3.875 | 4 | [] | no_license | #include<iostream>
using namespace std;
int serie_fibonacci(int x);
int main(){
int numDeSucecion, x;
do{
x = 0;
cout<<"Inserte el numero de elementos que desea de la serie de fibonacci"<<endl;
cin>>numDeSucecion;
if(numDeSucecion < 0){
cout<<"Inserte un numero positivo."<<endl;
x = 1;
... | true |
d51894f69a0ab374e68a876485261e3d8731860b | C++ | flagflag/FlagGG | /FlagGG/Container/StringHash.h | UTF-8 | 800 | 2.671875 | 3 | [] | no_license | #pragma once
#include "Container/Str.h"
#include "Core/BaseTypes.h"
namespace FlagGG
{
class FlagGG_API StringHash
{
public:
StringHash() NOEXCEPT;
StringHash(const char* str) NOEXCEPT;
StringHash(const String& str) NOEXCEPT;
StringHash(UInt32 value) NOEXCEPT;
StringHash(const StringHash& value) NOEXCEPT;
... | true |
c54692ce6a25e022baf3b25a5ecd1d14eda16013 | C++ | bkdoo/TIL | /arduino-programming-class/Quiz/traffic_lights_button/traffic_lights_button.ino | UTF-8 | 813 | 2.921875 | 3 | [] | no_license | /*LED 3개(red, yellow, green)가 각 버튼을 누르면 점등되는 아두이노 코드를 작성하자.*/
int red =13;
int yellow =12;
int green=8;
int redBtn = 7;
int yellowBtn =4;
int greenBtn = 2;
int r, y, g;
void setup() {
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
pinMode(redBtn, INPUT);
pinMode(yellowBtn, INPUT... | true |
b163cf6f84676880b756af365329ac64986c476d | C++ | fixopen/cpputil | /Util/IniFile.h | UTF-8 | 1,622 | 2.765625 | 3 | [] | no_license | #ifndef __UTIL_INIFILE_H__
#define __UTIL_INIFILE_H__
#include <map> //for std::map
#include <vector> //for std::vector
#include <string> //for std::string, std::wstring
namespace Util {
class IniFile {
public:
explicit IniFile(std::string const& filename = "");
~IniFile();
... | true |
18ece7654e1eddd90a00e0df87d62fb39c560430 | C++ | fmorel/SoC | /main/increment/increment_hard/increment_hard.cpp | UTF-8 | 1,927 | 2.546875 | 3 | [] | no_license | #include "increment_hard.h"
#include <iostream>
#define TILE_WIDTH 16
#define TILE_HEIGHT 16
// Init all registers with p_init_mux_switched to true for at least 2 cycles. Then switch it to false and read the values from p_OUT
namespace soclib { namespace caba {
// Constructor
IncrementHard::IncrementHard(sc_core:... | true |
2fae26342b94f263a426f6c254a00e0912e28de2 | C++ | RoSchmi/Esp32_I2S_Microphone_Vol_Switcher | /lib/RoSchmi/SensorData/SoundSwitcher.h | UTF-8 | 4,646 | 2.546875 | 3 | [] | no_license | // Copyrigth RoSchmi, 2021. License Apache 2.0
// SoundSwitcher for Esp32 on PlatformIO Arduino platform
// How it works:
// SoundSwitcher is a class to implement a two state sensor reacting on sound levels
// The sound volume is measured by an I2S micophone (SPH0645LM4 or INMP441)
// The state toggles when a changeabl... | true |
6559d4ddbad02b43facc5df33541a5af9fc86253 | C++ | suu-K/AlgorithmPractice | /Beakjoon/2577 숫자의 개수.cpp | UHC | 355 | 3 | 3 | [] | no_license | /*
: (https://www.acmicpc.net/problem/2577)
*/
#include <iostream>
using namespace std;
int main() {
int a = 0, b = 0, c = 0;
int mul;
int arr[10] = { 0 };
cin >> a >> b >> c;
mul = a * b * c;
while (mul != 0) {
arr[mul % 10]++;
mul = mul / 10;
}
for (int i = 0; i < 10; i++)
cout << arr[i] << endl;
... | true |
519e6dfca2aae5c79307796b5cb2dc3933499257 | C++ | FuSoftware/ShmupEditor | /src/editor/Widgets/bullet_editor.cpp | UTF-8 | 4,821 | 2.640625 | 3 | [] | no_license | #include "bullet_editor.h"
BulletEditor::BulletEditor(QWidget *parent) : QWidget(parent)
{
loadUI();
}
BulletEditor::BulletEditor(QString file, QWidget *parent) : QWidget(parent)
{
loadUI();
loadFile(file);
}
void BulletEditor::loadUI()
{
sprite_loaded = false;
QHBoxLayout *mainLayout = new QHBo... | true |
4489d7e485238c64d058402bc0bfcb1ceb3da3ac | C++ | jeffreynkali/SevenDragons | /Deck.h | UTF-8 | 350 | 3.21875 | 3 | [] | no_license | #ifndef DECK_H
#define DECK_H
#include <vector>
#include <memory>
template <class T>
class Deck : public std::vector<T>{
public:
T draw(){
T result = this->back();
this->pop_back();
return result;
}
void setDeck(std::vector<T> _v){
deck1 = _v;
}
std::vector<T> getDeck(){
return dec... | true |
c1097738ac809b6b2b7708162137110383403d04 | C++ | rpuntaie/c-examples | /cpp/utility_initializer_list_size.cpp | UTF-8 | 348 | 2.546875 | 3 | [
"MIT"
] | permissive | /*
g++ --std=c++20 -pthread -o ../_build/cpp/utility_initializer_list_size.exe ./cpp/utility_initializer_list_size.cpp && (cd ../_build/cpp/;./utility_initializer_list_size.exe)
https://en.cppreference.com/w/cpp/utility/initializer_list/size
*/
#include <initializer_list>
int main() { static_assert(std::initializer_lis... | true |
673a62ae7e5fff1047e6626e8ff4c2246ef52cdb | C++ | OliverMoli/Multimediaproject2a | /Project/source/ResourceManager.cpp | UTF-8 | 3,306 | 3.109375 | 3 | [] | no_license | #include "pch.h"
#include "ResourceManager.h"
ResourceManager& ResourceManager::getInstance()
{
static ResourceManager instance;
return instance;
}
void ResourceManager::loadTexture(std::string name, std::string fileName)
{
if (textures.find(name) != textures.end())
{
std::cout << "Careful! you are overriding t... | true |
9c2e7dd3e8c47eab9b679b4a2ae12e368338e3e1 | C++ | MrMiilkNotes/Graphics | /project03/project03/project03/main.cpp | GB18030 | 4,533 | 3.078125 | 3 | [] | no_license | /* Rotating cube with viewer movement from Chapter 5 */
/* Cube definition and display similar to rotating--cube program */
/* We use the Lookat function in the display callback to point
the viewer, whose position can be altered by the x,X,y,Y,z, and Z keys.
The perspective view is set in the reshape callback */
#inc... | true |
5061ea77c42c1f6fe5f97b599309aafb38fa91ff | C++ | XiaoYuhao/ACM-ICPC-practice | /A - Nearest Common Ancestors/test.cpp | GB18030 | 2,035 | 2.65625 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
using namespace std;
const int MAX = 10010;
const int MAX_LOG = 50;
/* LCA */
/* ڶ㷨*/
vector<int>G[MAX];
vector<int>T[MAX];
int root;
/*
int parent[MAX_LOG][MAX];
int depth[MAX];
void dfs(int v, int p, int d) {
... | true |
07b958541ebff5f477d5d3844b5d26c324f6b293 | C++ | dhoman01/cs3100 | /mult-thread/src/WorkQueue.cpp | UTF-8 | 912 | 3.09375 | 3 | [] | no_license | #include "WorkQueue.hpp"
#include <algorithm>
void WorkQueue::start(int n)
{
auto doTask = [&](){
try
{
while(cont.load())
{
try
{
tasklist.dequeue()();
} catch(const std::exception &exc)
{
std::cerr << exc.what() << std::endl;
}
}
}
catch(const std::exception &exc)
... | true |
74dd87dee057f8a3981a7c986f6bc18e93bf1975 | C++ | gitynity/CP | /kangaroo.cpp | UTF-8 | 263 | 2.859375 | 3 | [] | no_license | //https://www.hackerrank.com/challenges/kangaroo/problem
string kangaroo(int x1, int v1, int x2, int v2) {
if(x1<x2 && v1<=v2 )
return "NO";
else if(x2<x1 && v2<=v1)
return "NO";
if((x1-x2)%(v1-v2)==0)
{
return "YES";
}
else
return "NO";
}
| true |
904b1785617d367ee8851ba1d8301d90dfe32106 | C++ | PowerNeverEnds/BaekjoonOnlineJudge_Cpp | /07000~7999/7569_토마토.cpp | UHC | 2,429 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;
// ݽð + յ
int dy[6] = { -1,0,1,0,0,0 };
int dx[6] = { 0,-1,0,1,0,0 };
int dh[6] = { 0,0,0,0,-1,1 };
struct MyPoint
{
int y;
int x;
int h;
};
int bfs(vector<MyPoint>& vec, int*** arr, int*** visited)
{
queue<MyPoin... | true |
4ecf81ddfd48419161177249225d28f0f9cec8b3 | C++ | thegamer1907/Code_Analysis | /CodesNew/933.cpp | UTF-8 | 962 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
vector<string> polball;
vector <string> enemy;
int main(){
int n , m ;
string t;
cin >> n >>m;
for(int i =0 ; i < n ; i++) {
cin >>t;
polball.push_back (t) ;
}
for(int i =0 ; i <m ; i++){
cin >... | true |
43a57ee0a5ef3f1b456a71a844dae06c4ff5a29b | C++ | XiaoChen0837/BiShi | /MyBishi/远景.cpp | UTF-8 | 1,954 | 3.359375 | 3 | [] | no_license | //#include <iostream>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <stack>
//#include <unordered_map>
//
//using namespace std;
//int main() {
// string str;
// getline(cin, str);
//
// stack<char> s1;
//
// for (auto i : str) {
// if (i == '\" ' || i == '{' || i == '}' || i == '[' || i ... | true |
ea1bb5a422153e83dc0b20640dc744b34fd02c20 | C++ | yaominzh/CodeLrn2019 | /boboleetcode/Play-Leetcode-master/0945-Minimum-Increment-to-Make-Array-Unique/cpp-0945/main2.cpp | UTF-8 | 956 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | /// Source : https://leetcode.com/problems/minimum-increment-to-make-array-unique/
/// Author : liuyubobobo
/// Time : 2018-11-25
#include <iostream>
#include <vector>
using namespace std;
/// Using sort and don't change the A array
/// Time Complexity: O(nlogn)
/// Space Complexity: O(1)
class Solution {
public:... | true |
1de7cb884a75bd4be24c9c4e4956f6e44065bd98 | C++ | mparsakia/pic-ucla | /10b/hw 6/hmw_6_3.cpp | UTF-8 | 3,672 | 3.34375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | /*
Homework: 6 Problem: 3
Crunch some prime numbers and test how long the algorithm takes
*/
#include <iostream>
#include <cassert>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#inc... | true |
d131a4208a74a763d99b8217136064d36ce4e6ce | C++ | ChrisAshton84/LeetCode | /number-of-islands.cpp | UTF-8 | 6,417 | 2.703125 | 3 | [] | no_license | class Solution {
public:
int numIslands(vector<vector<char>>& grid) {
if (grid.size() == 0)
return 0;
if (grid[0].size() == 0)
return 0;
auto lsize = grid[0].size();
typedef struct {
int start;
int end;
... | true |
8c596411c73a2d28bdcd3a983fb5cc8025678d96 | C++ | tyleragreen/rice-demo | /test.cpp | UTF-8 | 394 | 2.71875 | 3 | [] | no_license | #include "rice/Data_Type.hpp"
#include "rice/Constructor.hpp"
using namespace Rice;
class Test
{
public:
Test() {}
std::string sayHello()
{
return std::string("Hello, World!");
}
};
extern "C"
void Init_Test()
{
Data_Type<Test> rb_cTest =
define_class<Test>("Test")
.define_constr... | true |
18307b2b5b5bb85a10bcb2eecc73e425ac370954 | C++ | MaelQuemard/Compilation | /src/Compilateur.cpp | UTF-8 | 6,553 | 2.96875 | 3 | [] | no_license | #include "Compilateur.hpp"
using namespace std;
Compilateur::Compilateur() {}
Compilateur::~Compilateur() {}
string Compilateur::readFile(string path) {
string fileRead = "";
std::string line;
std::cout << "PATH :: " << path << '\n';
ifstream myfile (path);
if (myfile.is_open()) {
while (getline (myfil... | true |
dddffe23b98a17199e99bc0ea1eb9874063b69ba | C++ | SAM33/TSCC2015_MPI2 | /T3CP.cpp | UTF-8 | 4,674 | 2.53125 | 3 | [] | no_license |
/* PROGRAM T3CP
Boundary data exchange with computing partition without data partition
Using MPI_Send, MPI_Recv to distribute input data
*/
#include <iostream>
#include <mpi.h>
#define ntotal 200
using namespace std;
int main (int argc,char ** argv)
{
double amax,gmax,a[ntotal],b[nto... | true |
658d27a606a63afbbdc2dc398563e9a2e912f0ab | C++ | kaitian521/topcoder | /TC_SRM_566_B/main.cpp | UTF-8 | 2,605 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <string>
#include <string.h>
using namespace std;
#define N 60
#define MAX(a,b) (a>b)?a:b
int dp[N][N];
int n;
int f(string colors)
{
cout << colors << endl;
memset(dp, 0, sizeof(dp));
int i, j, k;
for (i = 2; i <= n; i ++)
{
for(j = 0; j <= n - i ; j... | true |
9a49beee314f915cf810e3afab1cbcfde78276fe | C++ | pinghaoluo/499-zhihanz-usc-edu | /service/kvstore_client.h | UTF-8 | 3,936 | 2.546875 | 3 | [] | no_license | #ifndef KVSTORE_CLIENT_H_
#define KVSTORE_CLIENT_H_
#include "../kvstore/cchash.h"
#include "../service/service_helper.h"
#include "kvstore.grpc.pb.h"
#include "kvstore.pb.h"
#include "service.pb.h"
#include <grpcpp/grpcpp.h>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
using chirp::Chirp... | true |
2c6a2f3a7936e69c4a682b1027984fd34a762e4a | C++ | ruishaopu561/lc | /design_patterns/chapter28/action.cpp | UTF-8 | 875 | 3.0625 | 3 | [] | no_license | #include "action.h"
#include "person.h"
#include <iostream>
void Success::getManConclusion(Man *man)
{
std::cout << "男人成功时,背后多半有一个伟大的女人。" << std::endl;
}
void Success::getWomanConclusion(Woman *woman)
{
std::cout << "女人成功时,背后大多有一个不成功的男人。" << std::endl;
}
void Failing::getManConclusion(Man *man)
{
std::c... | true |
51759643a246f8ef97ee08b3aa28f40bdad8035c | C++ | dv66/programming_problems_cpp | /2char.cpp | UTF-8 | 817 | 2.8125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int len(string str){
int i;
for( i = 0; str[i]; i++);
return i;
}
int onlytwo(string str )
{
int ara[150] = {0} , cnt = 0 , i;
for(i=0; str[i] ; i++){
ara[(int)str[i]]++;
}
for(i=95; i<125; i++){
if(ara[i]>0) cnt++;
}
if(... | true |
70bd84dc901773ddf471952c620a6d0d0dc99fef | C++ | Leon-Cao/CarND-Extended-Kalman-Filter | /src/kalman_filter.cpp | UTF-8 | 2,234 | 2.96875 | 3 | [
"MIT"
] | permissive | #include "kalman_filter.h"
#include <iostream>
using Eigen::MatrixXd;
using Eigen::VectorXd;
using std::cout;
using std::endl;
/*
* Please note that the Eigen library does not initialize
* VectorXd or MatrixXd objects with zeros upon creation.
*/
const double PI = 3.141592653589793238463;
const double EPS = 0.... | true |
f16ee3e24c8c587fcbe275f82dc84521a7e52198 | C++ | enricobu96/second-antlr4-exercise | /tinyrexx/MyListener.cpp | UTF-8 | 3,795 | 2.734375 | 3 | [] | no_license | // Generated from tinyrexx.g4 by ANTLR 4.7
#include <iostream>
#include "MyListener.h"
using namespace std;
MyListener::MyListener(const std::set<std::string> &ids) {
vars = ids;
}
void MyListener::enterProgram(tinyrexxParser::ProgramContext *ctx) {
cout << "#include <iostream>" << endl << endl
<< "u... | true |
2369bb2527a2948f16159c753ab81f69a09ccbb9 | C++ | desinghkar/Object-Search-ROS | /icpr_prob_module/src/test_viewpoint.cpp | UTF-8 | 7,231 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <math.h>
#include <ros/ros.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#define RANGE 40
#define SCALE 10
using namespace std;
using namespace cv;
class Potential_map
{
ros::NodeHandle nh;
Mat P_map;
... | true |
5275bf6185c05efafbeb163f10fbafba5261647b | C++ | JeongYeonUk/MemoryManager | /MEMORY MANAGEMENT.h | UTF-8 | 997 | 2.828125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <windows.h>
using namespace std;
enum MemoryMenu
{
MM_NONE,
MM_ONE,
MM_TWO,
MM_THREE,
MM_EXIT
};
typedef struct _tagMemory
{
int iStart;
int iSize;
}MEMORY;
typedef struct _tagNode
{
MEMORY tMemory;
_tagNode *pPrev;
_tagNode *pNext;
}NODE, ... | true |
48d7e7c6818d500afe0b2fe27a4ce95e44535761 | C++ | pannunzio/Unb-Nightmare | /src/EndState.cpp | UTF-8 | 2,272 | 2.546875 | 3 | [] | no_license | #include "EndState.h"
#define DEBUG
#ifdef DEBUG
//se estiver definido debug, imprime os trecos
#define DEBUG_PRINT(message) do{std::cout << message << std::endl;}while(0);
#define DEBUG_ONLY(x) do{x;}while(0);
#else
//caso contrario, recebe argumentos mas faz nada
#define DEBUG... | true |
cc2104d328bba73e80ceada7ecaea76f140eaa34 | C++ | jaspersong/Project_CS-4500 | /src/dataframe/copy_writer.cpp | UTF-8 | 1,213 | 2.8125 | 3 | [
"MIT"
] | permissive | /**
* Name: Snowy Chen, Joe Song
* Date: 24 March 2020
* Section: Jason Hemann, MR 11:45-1:25
* Email: chen.xinu@husky.neu.edu, song.jo@husky.neu.edu
*/
// Lang::Cpp
#include "copy_writer.h"
CopyWriter::CopyWriter(DataFrame *source_dataframe) {
assert(source_dataframe != nullptr);
this->source_dataframe = s... | true |
678836b64b24c03a63586317e2144edc1fdc178b | C++ | Footpad/Cyclometer | /DisplayDistance.cpp | UTF-8 | 1,504 | 2.9375 | 3 | [] | no_license | /*
* DisplayDistance.cpp
*
* Created on: Feb 5, 2013
* Author: dam7633
*/
#include "DisplayDistance.h"
#include "SetCircumference.h"
#include "DisplayTime.h"
#include "NormalOperation.h"
#include "PulseScanner.h"
#include "CyclometerController.h"
#include <math.h>
DisplayDistance::DisplayDis... | true |
c3408f5f7fec04fbacff006b16508f72819ad589 | C++ | ysdeal/LeetCode | /addBinary.h | UTF-8 | 2,542 | 3.375 | 3 | [] | no_license | /**
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
*/
class Solution {
public:
string addBinary(string a, string b) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int n = a.size()... | true |
001fa05c6e46024585cacd524da8d82de50f2276 | C++ | qq464418017/bintalk | /runtime/cpp/bintalk/ProtocolReader.cpp | UTF-8 | 2,993 | 2.515625 | 3 | [] | no_license | #include "Config.h"
#include "ProtocolReader.h"
namespace bintalk
{
bool ProtocolReader::readMID(BinaryReader* r, MID& mid)
{
#if BINTALK_BIG_ENDIAN
if(!r->read(&mid, sizeof(MID))) return false;
mid = swapEndian(mid);
return true;
#endif //BINTALK_BIG_ENDIAN
return r->read(&mid, sizeof(MID));
}
#if BINTALK_BIG_E... | true |
9cb1a5af46ff0558e50772e15cf98ad51804af8e | C++ | S391D4002S576/ParFM | /src/utils/SVGViewbox.h | UTF-8 | 1,093 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef SSSVGVIEWBOX_H_
#define SSSVGVIEWBOX_H_
#include <vector>
using std::vector;
using std::ios_base;
#include <iostream>
#include <fstream>
using std::ostream;
using std::ofstream;
#include <string>
using std::string;
#include "Point.h"
#include "Color.h"
#include "SVGElement.h"
#include "SVGEElementCollectio... | true |
13dc49471248b15551427b8171b10c6ef08a37e9 | C++ | mcyril/barcodes | /core/lib/aztec/src/base/bin_dec_conversion.h | UTF-8 | 2,487 | 3.359375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #pragma once
#include <cstddef>
#include <cassert>
#include <climits>
#include <iterator>
#include <algorithm>
template <typename BinIterator, typename DecValue>
void dec2bin(BinIterator bin_first, BinIterator bin_last, DecValue dec)
{
assert(bin_last - bin_first > 0);
for (BinIterator bin_current = bin_firs... | true |
9757d49402b8f72c6ed1b6f137f8223ad5aabade | C++ | WizardCarter/OpenGL-Pong | /src/ParticleSystem.cpp | UTF-8 | 2,578 | 2.828125 | 3 | [
"Unlicense"
] | permissive | #include "ParticleSystem.h"
#include <SFML/System.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <GL/glew.h>
#include "Shader.h"
ParticleSystem::ParticleSystem(glm::vec2 pos, Shader s, unsigned int particleNum, glm::mat4 proj, float lifeT, glm::ve... | true |
79f1d5e335949a2fa9b570045a3dd749c4a31518 | C++ | SirHall/chess | /src/ai/Test.cpp | UTF-8 | 1,186 | 2.921875 | 3 | [] | no_license | #include "ai/Test.hpp"
#include "Board.hpp"
#include "Piece.hpp"
#include <limits>
#include <utility>
#include <vector>
struct PathResult
{
PieceMove pieceMove;
std::int16_t score;
PathResult(PieceMove m, std::int16_t s) : pieceMove(m), score(s) {}
PathResult() : score(0) {}
};
PathResult GetBestS... | true |
93783fcd41dd789a0f4fa3703d3293609918d0c2 | C++ | kazunetakahashi/atcoder | /201510_201609/1205_code_thanks_2015/F.cpp | UTF-8 | 1,006 | 2.828125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cmath>
#include <set>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
using namespace std;
vector<int> V[100010];
int main() {
int N;
cin >> N;
for (auto i = 0; i < N-1; i++) {
int s, t;
cin >> s >> t;
s--; t--;
V[s].push_back(t);
V[t].... | true |
7b52da7293fc90b66342b2c504f5d11989061ea6 | C++ | mxiao6/CS225_Daily-leetcode | /potd-q25/q25.cpp | UTF-8 | 2,245 | 3.859375 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct node{
int val;
node * next;
};
void printList(node * head){
if(head == NULL){
cout << "Empty list" << endl;
return;
}
node * temp = head;
int count = 0;
while(temp != NULL){
cout << "Node " << count << ": " << temp ->v... | true |
9cc13153c8d6bf0b6b351bb6d2c9de345e8d73cc | C++ | Sul123/Demo | /Lisp interpreter/lispp/lispp.cpp | UTF-8 | 1,265 | 2.765625 | 3 | [] | no_license | #include "lispp.h"
#include "scope.h"
#include <iostream>
#include "tokenizer.h"
#include "parser.h"
#include <sstream>
#include <string>
#include "errors.h"
Interpreter::Interpreter() : global_scope_(std::make_shared<Scope>(MakeGlobalScope())) {}
Interpreter::~Interpreter() {
global_scope_->Reset();
}
void In... | true |
1de1db2d9a60181e698edb7635020f1ecdb37aba | C++ | aws/aws-sdk-cpp | /generated/src/aws-cpp-sdk-ecs/include/aws/ecs/model/ClusterServiceConnectDefaults.h | UTF-8 | 4,912 | 2.578125 | 3 | [
"Apache-2.0",
"MIT",
"JSON"
] | permissive | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ecs/ECS_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonVie... | true |
7ad1b041eed633047244e38be192344a0b2d47f9 | C++ | nguyenvanson1998/Cmpsc-Casino-Game | /Craps.h | UTF-8 | 688 | 3.09375 | 3 | [] | no_license | //Craps.h - header class for craps minigame (dice)
//Written by Emma Roudabush
#pragma once
#include "Game.h"
#include "Dice.h"
#include <iostream>
using namespace std;
class Craps : public Game
{
public:
//default constructor which calls its superclass
Craps(const Money& playerMoney): Game(playerMoney) {}
//fu... | true |
76ce669848d646c8ff8f4312b924a01b72ef3652 | C++ | bayu-baskara/SpaceDefender-GLUT | /SpaceDefender/Player.h | UTF-8 | 985 | 3.078125 | 3 | [] | no_license | #ifndef PLAYER_H_INCLUDED
#define PLAYER_H_INCLUDED
#include <utility>
#include "Enemy.h"
using namespace std;
/*
* Player game object.
* Can move horizontally and fire charges.
* Can be destroyed by an enemy.
*/
class Player {
public:
Player( double playerXPos, double playerYPos, double player... | true |
949849a24bbe84ca0e2fcced92ccb09cfcb9524a | C++ | SirRodriguez/AreaAbsorberGame | /lib/shapes/derivedShapes/Square.h | UTF-8 | 974 | 3.015625 | 3 | [] | no_license | #ifndef SQUARE_H
#define SQUARE_H
#include "../Shape.h"
class Square: public Shape{
protected:
int length;
public:
Square(olc::PixelGameEngine& pge, AnimationContainer& ac, olc::vi2d& pos, int _speed, const olc::Pixel& _color, int newLength)
: Shape(pge, ac, pos, _speed, _color), length(newLength){}
virtual voi... | true |
ad1d0f4af4feb9b0af62301c99992a3999c40248 | C++ | NikolenkoMaria/Checker01 | /Board.h | UTF-8 | 364 | 2.65625 | 3 | [] | no_license | #pragma once
#ifndef BOARD_H
#define BOARD_H
class Figure;
class Board
{
public:
Board(int size = 8);
~Board();
Board(const Board& other);
Board& operator=(const Board& other);
char** ToCharArray();
int GetSize() { return m_Size; }
protected:
private:
int m... | true |
cf523ad5aa24f5886ffe9e60d83ff9aeba2c39aa | C++ | arnaudduval/TTman | /src/Circuit.cpp | UTF-8 | 986 | 2.796875 | 3 | [] | no_license | #include <Circuit.h>
#include <string>
#include <fstream>
#include <stdexcept>
Point::Point(const GPSPoint& c, const double& e)
{
alt = e;
coords = c;
}
Circuit::Circuit(const GPXFile& f)
{
for(auto itrack = f.tracks.begin() ; itrack != f.tracks.end() ; ++itrack)
{
for(auto isegment = (*itrack).trksegs... | true |
5e4c7b9efccaee591713826c58a54cea1903ad60 | C++ | yuliangl/Algorithm-sets | /剑指Offer题解/offer12/main.cpp | UTF-8 | 3,507 | 3.828125 | 4 | [] | no_license | /******剑指 Offer 12. 矩阵中的路径******
请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。
路径可以从矩阵中的任意一格开始,每一步可以在矩阵中向左、右、上、下移动一格。
如果一条路径经过了矩阵的某一格,那么该路径不能再次进入该格子。
例如,在下面的3×4的矩阵中包含一条字符串“bfce”的路径(路径中的字母用加粗标出)。
[["a","b","c","e"],
["s","f","c","s"],
["a","d","e","e"]]
但矩阵中不包含字符串“abfb”的路径,
因为字符串的第一个字符b占据了矩阵中的第一行第二个格子之后,
路径不能再次进入这个格子。
******... | true |
89ef97e2a7093ac1e19d1e9f640e3f11993bdfb1 | C++ | saifpathan/cpp-programs | /src/8_constructors/7_marks.cpp | UTF-8 | 1,407 | 3.5625 | 4 | [] | no_license | #include<stdio.h>
#include<string.h>
class marks
{
int rollno;
char name[20];
double percentage;
int total;
int rank;
public:
marks()
{
this->rollno = 10;
strcpy(this->name, "not given");
this->percentage = 80.2;
this->total = 410;
this->rank = 5;
}
marks(int r, char* nm, double p, int t, int rn)
{
... | true |
1500236b8d472df2081f21aeb0a0f636f1105b5b | C++ | nicyun/DirectedMST | /src/main.cpp | UTF-8 | 523 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <vector>
#include "Network.hpp"
using namespace std;
int main(int args, char * argv[])
{
int n, m;
if(args < 2){
cout << "USAGE: " << argv[0] << " " << "test_file" << endl;
return 1;
}
ifstream fin(argv[1]);
while(fin >> n >> m){
Network network(n);
while... | true |
c3c27c498a9f6ec0f4c3c3fecd2086d30f0c2d34 | C++ | cha63506/chromium-44 | /chrome/browser/prerender/prerender_manager.h | UTF-8 | 2,841 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
#define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_
#pragma once
#include <list>
#include "b... | true |
3d1de07acaf8081fc7974bd5f622811f8bc17331 | C++ | ninag09/test | /lorder.cpp | UTF-8 | 634 | 3.296875 | 3 | [] | no_license | #include "common.h"
using namespace std;
int height(treenode* root){
if(!root) return 0;
return (1+max(height(root->left), height(root->right)));
}
void printLevel(treenode* root, int l){
if(!root) return;
if(l == 1) cout << root->val << endl;
printLevel(root->left, l-1);
printLevel(root->rig... | true |
5892d75f361c99faa880855bcd1594e23952a6f4 | C++ | busebd12/InterviewPreparation | /LeetCode/C++/General/Medium/RangeAddition/solution.cpp | UTF-8 | 3,266 | 3.671875 | 4 | [
"MIT"
] | permissive | #include <string>
#include <unordered_map>
#include <vector>
using namespace std;
/*
Solution 1: Brute force.
Time complexity: O(u * L) [where u is the number of updates and L is the average length of an update interval]
Space complexity: O(1)
*/
class Solution
{
public:
vector<int> getModifiedArray(int ... | true |
fcd8eecc8efd3af4e9c5fb08c0420fb38b53c0d8 | C++ | killvxk/rc | /src/rc/core/num/mod.h | UTF-8 | 827 | 2.9375 | 3 | [] | no_license | #pragma once
#include "rc/core/intrin.h"
namespace rc::num {
template <class T>
constexpr auto max_value() -> T {
static_assert(rc::is_integeral<T>());
if constexpr (rc::is_unsigned<T>()) {
return ~T(0);
}
if constexpr (rc::is_signed<T>()) {
return ~T(1 << (8 * sizeof(T) - 1));
}
}
template <clas... | true |
3f9b4e390570135537ac52ed70bf65cc59fd626f | C++ | bluepine/topcoder | /topcoder-master/TheFansAndMeetingsDivTwo.cpp | UTF-8 | 1,072 | 2.6875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<list>
#include<deque>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<sstream>
#include<cstring>
using namespace std;
class TheFan... | true |
baf1dcca914c6020edd43cb91d76ee5a2b6acdaf | C++ | lythro/ProjectHeartbeat | /ProjectHeartbeat.ino | UTF-8 | 2,881 | 2.828125 | 3 | [] | no_license | #include "EffectManager.h"
#include <SPI.h>
// max len of incoming message
#define INCOMING_MAX_LEN 100
// global message buffer
char incoming[INCOMING_MAX_LEN];
int cnt = 0;
EffectManager effectManager;
int numLEDs;
// timer
HardwareTimer timer(1);
// incoming data flag to pause led updates!
volatile bool receivi... | true |
0773a3649a87eccf454f3d727a0631faa2a51649 | C++ | Vulkan4D/v4d_core | /utilities/graphics/vulkan/ImageObject.cpp | UTF-8 | 10,316 | 2.515625 | 3 | [] | no_license | #include "ImageObject.h"
namespace v4d::graphics::vulkan {
COMMON_OBJECT_CPP(ImageObject, VkImage)
ImageObject::ImageObject(VkImageUsageFlags usage, uint32_t mipLevels, uint32_t arrayLayers, const std::vector<VkFormat>& preferredFormats, VkImageViewType viewType)
: usage(usage),
mipLevels(mipLevels),
arrayLayers(a... | true |
020ee5573de000a74598ae6c462e377e9bba849a | C++ | geekanamika/Interview-Prep-DS-Algo | /arrays/c++/findMissingAndRepeating.cpp | UTF-8 | 1,921 | 3.984375 | 4 | [] | no_license | /*
Time Complexity: O(n)
Auxiliary Space: O(n)
Find Missing And Repeating
Given an unsorted array of size N of positive integers.
One number 'A' from set {1, 2, …N} is missing and
one number 'B' occurs twice in array. Find these two numbers.
Note: If you find multiple answers then
print the Smallest num... | true |
4a4cdf7d057113abe06b502eaa92303ee0082920 | C++ | LiyliLee/PracticaRVR | /rvr-release1.0/prediction/prediction.cc | UTF-8 | 11,615 | 2.6875 | 3 | [
"MIT"
] | permissive | #include <memory>
#include <iostream>
#include <mutex>
#include <condition_variable>
#include <cstdint>
#include <thread>
#include <tuple>
#include <map>
#include <chrono>
#include <string>
#include <unistd.h>
#include "XLDisplay.h"
/* -------------------------------------------------------------------------- */
/* ... | true |
3d58901202d162ce97a3c023933d619bf434ad1c | C++ | a-kashirin-official/spbspu-labs-2018 | /shalgueva.sofiya/common/circle.cpp | UTF-8 | 1,021 | 3.359375 | 3 | [] | no_license | #include "circle.hpp"
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
shalgueva::Circle::Circle(const point_t & pos, const double radius) :
position_(pos),
radius_(radius),
angle_(0.0)
{
if (radius_ < 0.0)
{
throw std::invalid_argument("Error. Invalid radius");
}
}
double shalgueva::Cir... | true |
4eff563ac0ecbe8bf05000e21a6c11b3ee31267c | C++ | lukedoucet92/Art | /SVGCanvas.cpp | UTF-8 | 994 | 2.796875 | 3 | [
"MIT"
] | permissive | //
// SVGCanvas.cpp
// Art
//
// Created by Luke Doucet on 4/4/17.
// Copyright © 2017 Luke Doucet. All rights reserved.
//
#include "SVGCanvas.h"
SVGCanvas::SVGCanvas() {
this->objects = vector<SVGObject*>();
this->size = Size();
}
SVGCanvas::SVGCanvas(Size size) {
this->objects = vector<SVGObject*>... | true |
40d859797aee7aad9e19a765ab983cfaf24421f0 | C++ | spondiirty/junhong_utils | /std_utils.h | UTF-8 | 3,639 | 2.578125 | 3 | [] | no_license | #ifndef __STD_UTILS_H__
#define __STD_UTILS_H__
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cctype>
#define umap unordered_map;
#define uset unordered_... | true |