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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
702c0d74f3320db3fe58031088c14635c2abd9c2 | C++ | kbergerstock/myProjects | /projects.c/WSRC32/WBASE32/cDIALOG32.CPP | UTF-8 | 2,089 | 2.640625 | 3 | [] | no_license | //*******************************************************************
//
// FILE: cDIALOG.CPP
//
// AUTHOR: Keith R. Bergerstock
//
// PROJECT: wbase32
//
// COMPONENT: DIALOGBOX
//
// DATE: 29.07.2004
//
// CO... | true |
ffefadbc961eed312a2bed9fecd5c56b26bc59cd | C++ | WhiZTiM/coliru | /Archive2/19/9fc3048002f9eb/main.cpp | UTF-8 | 429 | 3.5 | 4 | [] | no_license | #include <iostream>
class foo
{
public:
foo() { std::cout << "default" << std::endl; }
foo(const foo &) { std::cout << "copy" << std::endl; }
foo(foo &&) { std::cout << "move" << std::endl; }
};
foo f1()
{
foo f;
return f;
}
foo f2()
{
foo f;
return std::move(f);
}
int main()
{
foo f... | true |
a3ee7a369adff8997c7c0709e537516c0d01535d | C++ | wy0705/untitled4 | /main.cpp | UTF-8 | 410 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include "string.h"
void move(char *str,int n){
char temp;
int i;
temp=str[n-1];
for ( i = n-1; i >0 ; i--) {
str[i]=str[i-1];
}
str[0]=temp;
}
int main() {
char s[50];
int n,i,z;
scanf("%d,%s",&n,s);
z=strlen(s);
f... | true |
bec15cc3ddcc2f3995174dce076a1b2e1ff2e132 | C++ | Chan124a/leetcode-problems | /69. x 的平方根.cpp | UTF-8 | 958 | 2.984375 | 3 | [] | no_license | #include <stack>
#include <string>
#include <iostream>
#include <assert.h>
#include <vector>
#include <sstream>
#include <cctype>
#include <algorithm>
#include <climits>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;
class Solution {
public:
int mySqrt(int x) {
if (x... | true |
12e1973e72b76ae2fe363ce0d60b1a2f4039ebc9 | C++ | AlexAndDad/gateway | /libs/minecraft/nbt.hpp | UTF-8 | 1,754 | 2.703125 | 3 | [] | no_license | #pragma once
#include "minecraft/nbt/nbt_end.hpp"
#include "minecraft/nbt/tags.hpp"
#include "minecraft/net.hpp"
#include <stack>
#include <variant>
namespace minecraft::nbt
{
using value_variant = std::variant< nbt::nbt_end >;
struct value
{
explicit value(nbt::nbt_end val = {})
: value... | true |
a9c5b151e1fbcd57f15403740d30fb30c6975efe | C++ | sim2908/ES-SS19 | /Task2/dimmLED/dimmLED.ino | UTF-8 | 1,015 | 2.578125 | 3 | [] | no_license | #include <DueTimer.h>
const uint8_t led_pin = 7;
const uint8_t b1_pin = 3;
const uint8_t b2_pin = 5;
const int dimm_step = 50;
volatile int led_state = LOW;
volatile int debounced_button1_state = HIGH;
volatile int debounced_button2_state = HIGH;
int led_intensity = 255;
int last_button1_state = HIGH;
int last_butt... | true |
de5df0c866c6f683ea6d2534d100db00a2c86507 | C++ | endymioncheung/CarND-Path-Planning-Project | /src/classifier.h | UTF-8 | 812 | 2.671875 | 3 | [
"MIT"
] | permissive | #ifndef CLASSIFIER_H
#define CLASSIFIER_H
#include <string>
#include <vector>
#include "Eigen-3.3/Eigen/Dense"
using Eigen::ArrayXd;
using std::string;
using std::vector;
class GNB {
public:
/**
* Constructor
*/
GNB();
/**
* Destructor
*/
virtual ~GNB();
/**
* Train classifier
*/
voi... | true |
4a9c2be3d954e2bb588521facf96450a508f10b2 | C++ | choi-william/digital-pathology-old | /src/library/MSLeoGrady/x64_mex/qpbo_mex.cpp | UTF-8 | 3,937 | 2.875 | 3 | [] | no_license |
#include "mex.h"
#include "qpboint.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
/* Vlad's example code
QPBO* q;
q = new QPBO(2, 1); // max number of nodes & edges
q->AddNode(2); // add two nodes
q->AddUnaryTerm(0, 0, 2); // add term 2*x
q->AddUnar... | true |
d765a7bdab0fa977964a81d1174bee96743dbfc9 | C++ | SergioRAgostinho/PoseCNN | /lib/kinect_fusion/src/util/args.cpp | UTF-8 | 4,300 | 2.78125 | 3 | [
"MIT"
] | permissive | #include <df/util/args.h>
#include <getopt.h>
#include <cstring>
#include <limits>
#include <set>
#include <stdexcept>
#include <iostream>
namespace df {
void OptParse::registerOptionGeneric(const std::string flag, void * valuePtr, const unsigned char shorthand, const bool required, const ArgType type) {
flags... | true |
876dab912faf3c9ee3b4c200f046e098045602b3 | C++ | ivanovskii/UniversityTasks | /AllTasks/SubstringSearching/Brute Force algorithm.cpp | UTF-8 | 756 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <vector>
std::vector<size_t> naiveStringMatcher(const std::string& haystack,
const std::string& needle)
{
std::vector<size_t> res;
for (size_t i = 0; i <= haystack.size() - needle.size(); ++i)
{
bool success = true;
for (size_t j = 0... | true |
cdfef471c3ee12bd6be78b1d3893b17b5bd3df61 | C++ | yogeesh/AdvCpp_Project02 | /src/reporter.h | UTF-8 | 857 | 3 | 3 | [] | no_license | #ifndef PROJECT1_REPORTER_H
#define PROJECT1_REPORTER_H
#include "hero.h"
/**
* All Reporters are basically Hero's
*/
class Reporter : public Hero{
public:
/**
* create new reporter
* @param id : reporter actor id
*/
Reporter(unsigned int id);
/**
* Destructor for Reporter
*/
... | true |
cd6bd331a9c1d65376da85768593147a45b0329d | C++ | Tonghua-Li/ChineseChess | /AppLib/ChessBoard.h | UTF-8 | 1,196 | 2.53125 | 3 | [
"MIT"
] | permissive | #ifndef CHESSBOARD_H
#define CHESSBOARD_H
#include "ChessPiece.h"
#include "IBoard.h"
#include "Shuai.h"
#include <QObject>
class ChessBoard : public QObject, public IBoard
{
Q_OBJECT
public:
explicit ChessBoard(QObject *parent = nullptr);
~ChessBoard();
void reset();
QList<ChessPiece *> chessPiec... | true |
bd44a9218700426bc0755ae592c5785e03154115 | C++ | dangdang1250/LearnCPP | /DesignPattern/DesignPattern/DesignPattern/Pizza.cpp | UTF-8 | 393 | 2.796875 | 3 | [] | no_license | #include "Pizza.h"
#include <iostream>
#include <string>
void Pizza::prepare()
{
std::cout << topping + " Preparing Pizza!" << std::endl;
}
void Pizza::bake()
{
std::cout << topping + " Baking!" << std::endl;
}
void Pizza::cut()
{
std::cout << topping + " Cutting!" << std::endl;
}
void Pizza::box()
{
std::cout ... | true |
ff63985ec7206f8b0cc701457f7e85b22e6dace1 | C++ | btcup/sb-admin | /exams/2558/02204111/1/final/3_2_839_5420501333.cpp | UTF-8 | 336 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main ()
{
int i,j,m,n ;
cout<<"Enter matrix size:" ;
cin >>n;
int B[n][n] ;
cout<<"Enter matrix values:" ;
for (i=0;i<n;i++)
{
for (j=0;j<n;j++)
cin>>B[i][j];
}
for (i=0;i<m;i++)
{
cout <<B[i][j];
cout<<endl;
}
system ("pause"... | true |
c6585befe05c12eccb2c9597a65410b2147ebc03 | C++ | psenzee/senzee5 | /blog/optimization/primes_senzee_multicore.cpp | UTF-8 | 7,449 | 2.8125 | 3 | [] | no_license | /**
*
Primes_Senzee_MultiCore is an optimized brute force (Sieve of Eratosthenes) implementation of the prime counting problem.
It uses no dynamically allocated memory and approximately 90k * # threads of stack.
A release build of this implementation enumerates and counts the primes from 2 to 2**32-1 (429... | true |
d5ebacf09015281289013f6aa52b194642cf2c9f | C++ | ToLoveToFeel/LeetCode | /Cplusplus/_0000_study/_leetcode/_swordoffer/_005_replaceSpace/_swordoffer_05_main.cpp | UTF-8 | 403 | 3.296875 | 3 | [] | no_license | // Created by WXX on 2021/7/18 14:28
#include <iostream>
using namespace std;
class Solution {
public:
string replaceSpace(string s) {
string res = "";
for (auto c : s)
if (c == ' ') res += "%20";
else res += c;
return res;
}
};
int main() {
cout << Soluti... | true |
3938a56fc7685c3801a9c2aa3746d5468adca650 | C++ | alex4814/algo-solution | /usaco/ch2/2.3/cow-pedigrees.cc | UTF-8 | 1,168 | 2.5625 | 3 | [] | no_license | /*
ID: alex4814
LANG: C++
TASK: nocows
*/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define EPS 1e-8
#define MAXN 205
#define MAXK 105
#define MOD 9901
typedef pair<int, int> pii;
typedef ... | true |
19435fe6b4dc5245e93040facbf70f86c990552c | C++ | z-Endeavor/PAT | /Advanced Level/1012 The Best Rank(部分正确).cpp | UTF-8 | 1,939 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct student{
int id;
int cGrade;
int mGrade;
int eGrade;
int aGrade;
int cRank;
int mRank;
int eRank;
int aRank;
}stus[2005];
int main(){
int N, M, stuID[2005], flag = 0;
cin>>N>>M;
for (int i=0; i<N; i++) {
cin>>stus[i].id>>stus[i].cGrade>>stus[i].mGrade... | true |
f9bd81429eed7a93705152280da6e5377461d7d8 | C++ | Pendulun/SistemaDeProvas | /src/persistence/DAO/UsuarioDAOJSON.cpp | UTF-8 | 5,244 | 2.953125 | 3 | [] | no_license | #include <business/Modelo/professor.hpp>
#include <business/Modelo/aluno.hpp>
#include "persistence/DAO/UsuarioDAOJSON.hpp"
namespace Persistence{
UsuarioDAOJSON::~UsuarioDAOJSON(){
delete jsonObject;
}
std::string UsuarioDAOJSON::ARQUIVO_USUARIOS = "usuarios.json";
UsuarioDAOJSON::UsuarioDA... | true |
32b209644cc051afcec1b05da4644cb538cb2f98 | C++ | art-lux/C17_stl_features | /C17_chapter3/C17_chapter3/using_validated_iter.cpp | UTF-8 | 293 | 2.578125 | 3 | [] | no_license | #define _ITERATOR_DEBUG_LEVEL 2 // sanitizer feature
#include <iostream>
#include <vector>
void using_validated_iter()
{
std::vector<int> v{ 1,2,3 };
v.shrink_to_fit();
const auto it(std::begin(v));
std::cout << *it << std::endl;
v.push_back(123);
//std::cout << *it << std::endl;
} | true |
2a0eb573012ec6f2a12fa307374304b476936d3b | C++ | YuHao000/sign_objects_detection | /SignObjectsDetection/SignObjectsDetection/sources/thread_pool.cpp | UTF-8 | 771 | 2.9375 | 3 | [] | no_license | #include "thread_pool.h"
void Worker::AppendFunc(func_type fn)
{
std::unique_lock<std::mutex> locker(mMutex);
mFqueue.push(fn);
mCv.notify_one();
}
size_t Worker::GetTaskCount()
{
std::unique_lock<std::mutex> locker(mMutex);
return mFqueue.size();
}
bool Worker::IsEmpty()
{
std::unique_lock<... | true |
399fdfc6e70e041caad9cbc6052da39367336e94 | C++ | Xumengqi0201/OJ | /Leetcode/001-100/005.cpp | UTF-8 | 2,714 | 3.796875 | 4 | [] | no_license | /*
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
Example 1:
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.
Example 2:
Input: "cbbd"
Output: "bb"
*/
/*
求字符串的最长回文子串
1.DP:
if p[i][j] = 1, then s[i...j] is palindrome
if p[i... | true |
fa1aa3dfac5860a351306dff1509606565507207 | C++ | koneu/Stereokamera | /Menue.h | UTF-8 | 1,649 | 2.640625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <sstream>
class Menue
{
public:
Menue(void);
~Menue(void);
static void Menue::printMenueEntry(int userEntry, const char* description, int value, const char* end="");
static void Menue::printMenueEntry(int userEntry, const char* description, float value, const char* end="... | true |
adf5378dd390f9724da16631eda8ea442316383a | C++ | maknoll/cg | /raytracer/Ray.hpp | UTF-8 | 2,918 | 3.28125 | 3 | [] | no_license | #ifndef RAY_HPP_INCLUDE_ONCE
#define RAY_HPP_INCLUDE_ONCE
#include <memory>
#include "Math.hpp"
namespace rt
{
class Renderable;
/// Ray consists of point and direction
class Ray
{
public:
Ray() : mOrigin(0.0,0.0,0.0), mDirection(0.0,0.0,0.0) {}
Ray(const Vec3 &origin, const Vec3 &direction) :... | true |
424f060f818639835ee4556e75aeb54e131730cd | C++ | HenriChataing/cppnes | /src/exception.h | UTF-8 | 846 | 3.078125 | 3 | [] | no_license | #ifndef _EXCEPTION_H_INCLUDED_
#define _EXCEPTION_H_INCLUDED_
#include <exception>
class InvalidRom : public std::exception
{
public:
InvalidRom() {}
~InvalidRom() {}
const char *what() const noexcept { return "Invalid ROM File"; }
};
class UnsupportedInstruction : public std::exception
{
public:
Uns... | true |
1b6d70ade09940185ad02af9534db3a467b9ac17 | C++ | southor/planet | /Prototype/src/Rectangle.h | UTF-8 | 1,589 | 3.171875 | 3 | [] | no_license | #ifndef __rectangle_h__
#define __rectangle_h__
#include "basic.h"
#include "OrthogonalLine.h"
namespace Prototype
{
class Rectangle
{
public:
Pos pos;
Vec size;
inline Rectangle() {}
inline Rectangle(Pos pos, Vec size) : pos(pos), size(size) {}
inline Rectangle(float x, float y, float w,... | true |
a2960be1868f9c4099fc3086945cd02f93c1d8b9 | C++ | kkbwilldo/all-problems | /swea/correct/1952 [모의 SW 역량테스트] 수영장/file.cpp | UTF-8 | 744 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 13;
int testcase;
int day,month1,month3,year;
int minVal;
int plan[MAX];
void allCase(int startM,int startC){
if(startM>=MAX) minVal = min(startC,minVal);
else{
allCase(startM + 1, startC + plan[startM]*day);
allCase(startM + 1, star... | true |
47d8a1fb9d04366438735b6b574aede7f63d266b | C++ | sanjuchandra/Greedy-Algorithm | /DEFKIN - Defense of a Kingdom.cpp | UTF-8 | 1,163 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
int main(){
int t;
cin>>t;
vector<int> x , y;
while(t--){
int r , c , n;
cin>>r>>c>>n;
for(int i = 0 ; i < n ; i++){
int a , b;
cin>>a>>b;
x.p... | true |
2a7e744120264ba6af7fe0152b8275a2589bcff9 | C++ | shreygupta2809/Among-Us-Maze | /source/game.h | UTF-8 | 926 | 2.609375 | 3 | [] | no_license | #ifndef GAME_H
#define GAME_H
#include <glad/glad.h>
#include <GLFW/glfw3.h>
// Represents the current state of the game
enum GameState {
GAME_ACTIVE,
GAME_WIN,
GAME_OVER,
GAME_LOSE
};
// Game holds all game-related state and functionality.
// Combines all game-related data into a single class for
//... | true |
3cbf9918e7fe8bbeab516e8b28dcc827cdfa69f1 | C++ | svens/pal | /pal/net/async/service.test.cpp | UTF-8 | 3,199 | 2.765625 | 3 | [
"MIT"
] | permissive | #include <pal/net/async/service>
#include <pal/net/test>
#include <catch2/catch_approx.hpp>
#include <catch2/catch_test_macros.hpp>
namespace {
//
// Because OS poller may return early/late, this test is flaky
//
TEST_CASE("net/async/service", "[!mayfail]")
{
using namespace std::chrono_literals;
using Catch::Ap... | true |
b1569e95f4fbd9730e5e55a8fd16255a69914b19 | C++ | FutaAlice/doujin-game-demo | /src/layer-title/giflabel.hpp | UTF-8 | 616 | 2.515625 | 3 | [] | no_license | #pragma once
#include <QLabel>
#include <QMovie>
#include <QResizeEvent>
class GIFLabel :
public QLabel
{
public:
GIFLabel(QWidget *parentWidget) :
QLabel(parentWidget)
{
}
~GIFLabel()
{
delete movie_;
}
void load(QString filename)
{
delete movie_;
mo... | true |
8ba3a5264eaddb135e262f228d27bdd5b686cb20 | C++ | MYREarth/secret-weapon | /2014-03-02/j.cpp | UTF-8 | 2,420 | 2.546875 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
struct point
{
int x,y,id;
point(){}
point(int x,int y):x(x),y(y){}
};
inline point operator -(const point &a,const point &b)
{
return(point(a.x-b.x,a.y-b.y));
}
inline bool operator <(... | true |
097519bdca9c6b9e8ac1326b9b1d63d3609d5a44 | C++ | liaoqingfu/ScreenCap | /src/configurationManager.hpp | UTF-8 | 692 | 3.03125 | 3 | [
"MIT"
] | permissive | #ifndef CONFIGURATIONMANAGER_HPP
#define CONFIGURATIONMANAGER_HPP
#include <memory>
#include <string>
#include <boost/any.hpp>
class ConfigurationManager
{
public:
static std::unique_ptr<ConfigurationManager> create();
template< typename T>
T getOption(const std::string& name)
{
return boost::... | true |
e07c367c908f6aecc98dae320e9a47288191749d | C++ | codeoloco/cpp_primer | /exercises/ch02/showtime.cpp | UTF-8 | 421 | 4.0625 | 4 | [] | no_license | // showtime.cpp - exercise 7
#include <iostream>
void printTime(int, int);
int main()
{
using namespace std;
int hours;
int mins;
cout << "Enter the number of hours: ";
cin >> hours;
cout << "Enter the number of minutes: ";
cin >> mins;
printTime(hours, mins);
return 0;
}
void... | true |
4401cf641e86124663cb2f13d09989934b4db525 | C++ | lucivpav/bomberman | /src/server.h | UTF-8 | 5,482 | 3.09375 | 3 | [] | no_license | #ifndef SERVER_H
#define SERVER_H
#include <deque>
#include <thread>
#include <mutex>
#include "map.h"
#include "player.h"
enum class ClientMessage : char;
/**
* @brief The ServerMessage struct represents a message the Server can
* send to the Client.
*/
struct ServerMessage
{
/**
* @brief The Type enum... | true |
4b634fad01bf6b6e454381221de1624b03551a18 | C++ | micheldavalos/examen_edi18B_bicipuerto | /main.cpp | UTF-8 | 959 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include "bicipuerto.h"
using namespace std;
int main()
{
Bicipuerto bicipuerto;
string op;
while (true) {
cout << "1) Agregar bici" << endl;
cout << "2) Mostrar bicis" << endl;
cout << "0) Salir" << endl;
getline(cin, op);
if (op == "1") {
... | true |
95f02cb91a37893b14391e11b2c3887246ea27d0 | C++ | srod-prog-cwiczenia/GCC | /biblioteczneFunkcje.h | UTF-8 | 843 | 2.796875 | 3 | [] | no_license | #include <string>
#include <vector>
using namespace std;
/* Wyrzuca na ekran zawartosc lancucha, znak po znaku, podaje tez kody ASCII */
void dumpLancuch(char* str);
/* Wypisuje komunikat na ekranie. TODO: Obudowac to w jakas sensowna ramke, itp */
void komunikat(string txt);
void komunikat(int liczba);
/* Wyswietl... | true |
6491157219807dfbb9c5947edcbc35d6fef7e3fb | C++ | shg9411/algo | /algo_cpp/bj9935.cpp | UTF-8 | 651 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
char str[1000020], bomb[40];
int len, blen, tmp = 0;
bool ok;
int main(void) {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
cin >> str >> bomb;
len = strlen(str);
blen = strlen(bomb);
for (int i = 0; i < len; i++) {
str[tmp] = str[i];
if (tmp >... | true |
738ada67ffc0f983e1dcb380856977788b83eb8c | C++ | faniajime/searchAlgorithms | /SolucionadorASTAR.cpp | UTF-8 | 2,279 | 2.84375 | 3 | [] | no_license | #include "SolucionadorASTAR.h"
#include "Estado.h"
#include "Solucion.h"
#include "Lista.h"
#include "Problema.h"
#include <bits/stdc++.h>
using namespace std;
SolucionadorASTAR::SolucionadorASTAR(){
unexplored = new Lista();
explored = new Lista();
}
Solucion* SolucionadorASTAR::solucione( Problema * proble... | true |
545f1a21b9cfd54a359d47ab008ea666b1bb7995 | C++ | hackwaretech/hackware-bot | /VMatrix.hpp | UTF-8 | 2,648 | 3.171875 | 3 | [] | no_license | #pragma once
#include <limits>
#include "Vector3.hpp"
class matrix3x4_t
{
public:
matrix3x4_t() {};
matrix3x4_t(float _11, float _12, float _13, float _14,
float _21, float _22, float _23, float _24,
float _31, float _32, float _33, float _34)
{
m_flMatVal[0][0] = _11; m_flMatVal[0][1] = _1... | true |
ca3ae836f2ba1007c2aa67182dbfa6002fbe97b1 | C++ | darksun2000/Jeu-robot | /robot.h | UTF-8 | 1,147 | 3.03125 | 3 | [] | no_license | #include <iostream>
using namespace std;
class robot{
public:
double Xpos=0.0;
double Ypos =0.0;
char dir='n';
double x();
double y();
void avance(int n );
void tourn();
};
double robot::x(){
return Xpos ;
}
double robot::y(){
return Ypos;
}
void robot::avance(int n){
if(d... | true |
2fbe179953d25de303568d879b32b528acece402 | C++ | haki-1/raster-graphics | /main.cpp | UTF-8 | 710 | 2.859375 | 3 | [] | no_license | #include "cli.h"
#include "session.h"
#include <iostream>
int main()
{
CommandLineInterface cli;
std::vector<UserSession> sessions;
std::string command;
while (true)
{
std::cin >> command;
cli.setCommand(command);
cli.executeCommand(sessions);
}
// in class destr ... | true |
3a853048a23303d634e29e35ad96ce0c94c87a4d | C++ | kovtunsergey/mainrepo | /src/index.cpp | UTF-8 | 215 | 2.53125 | 3 | [] | no_license | bool index(int x1, int y1, int x, int y)
{
if((x1==4)||(y1==4))
{
return 0;
}
if((((x+1)==x1)&&(y1==y))||(((x-1)==x1)&&(y1==y))||(((y+1)==y1)&&(x1==x))||(((y-1)==y1)&&(x1==x)))
{
return 1;
}
return 0;
}
| true |
680974545cf7c93bfe1e70656bb184203a8fcb14 | C++ | jasonchan117/ularProject | /ular/problem44.cpp | UTF-8 | 1,772 | 2.796875 | 3 | [] | no_license | /*************************************************************************
> File Name: problem44.cpp
> Author:
> Mail:
> Created Time: 2018年04月29日 星期日 10时50分32秒
************************************************************************/
#include<math.h>
#include<iostream>
#include<stdio.h>
#include<inttypes.h>
us... | true |
5abd18d35b9534e1bc8115df939658acfa4d8aea | C++ | x86nick/leetcode | /Algorithm/SearchInRotatedSortedArray/SearchInRotatedSortedArray.cpp | UTF-8 | 3,224 | 3.984375 | 4 | [
"BSD-3-Clause"
] | permissive | /*
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
*/
#include <vector>
#include <stdio.h... | true |
544f2a104f8001f0a59c1e93bfc1bf9061b2f2bd | C++ | ltimaginea/Xinbiaozhun_cpp_Chengxusheji | /XinBiaoZhun_Cpp/Chapter4_Overload/OperatorOverloading2_Assign.cpp | UTF-8 | 2,876 | 3.796875 | 4 | [
"MIT"
] | permissive | // 重载赋值运算符 "="
#include <iostream>
#include <cstring>
#pragma warning(disable:4996)
using namespace std;
class CString
{
private:
char* str;
public:
CString() :str(NULL) {}
CString(const char* s);
CString(const CString& s);
const char* c_str() const;
CString& operator=(const char* s);
CString& operator=(cons... | true |
3a91a0a2778f88aabbbe6802ea6dc222a622a7f3 | C++ | victornoriega/data-structures | /SegundoParcial/src/cola.cpp | UTF-8 | 970 | 3.296875 | 3 | [] | no_license | #include "cola.h"
#include <cstdlib>
#include <iostream>
cola::cola()
{
principio=NULL;
ultimo=NULL;
cuantos=0;
//ctor
}
cola::~cola()
{
caja *p;
while(principio){
p=principio;
principio=p->siguiente;
free(p);
}
}
void cola::agregar(int a){
caja *p;
p=(caj... | true |
b72b1ed7d5b2d0a43430597cdbda13f75b433230 | C++ | Jungjaewon/ProblemSolving | /16926_array_rotation1/16926_array_rotation1/16926_array_rotation1.cpp | UTF-8 | 2,333 | 3.203125 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
/*
11 12 13 14 15
21 22 23 24 25
31 32 33 34 35
41 42 43 44 45
51 52 53 54 55
11 ~ 15 right
25 ~ 45 down
55 ~ 51 left
41 ~ 21 up
순으로 하면 처음 시도했던 방법보다 훨씬 깔끔하고 좋다.
vector를 조정하면 시계 반시계 조정이 가능하다.
shifting 할때 for문을 사용하면 훨씬 빨라질 수 있다. ... | true |
06e58dd5e52e60094f604165aaf58389f515a0dc | C++ | BDSuther/ProjectEuler | /016/16.cpp | UTF-8 | 1,262 | 4.0625 | 4 | [] | no_license | #include <iostream>
using namespace std;
/*
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2^1000?
*/
int digitSum(int exponent){
unsigned int number[500] = {0};
int remExp = exponent; //how many exponents are remaining
int finalIndex = 0; //the f... | true |
450f48914b1070c56d45c1d4f1413e2c4ad2d8b4 | C++ | abidenm/HujoonROS | /src/SkillMate/src/HapticCommandPublisher.cpp | UTF-8 | 2,893 | 2.71875 | 3 | [] | no_license | // -------------------------------------------------------- //
// CKim - This ROS node reads HapticDevice command from
// network and publishes it
// -------------------------------------------------------- //
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>
#includ... | true |
a1092c0b65f2809f3bda13b9c3b90b0dd18f63fa | C++ | y2kiah/icarus | /Icarus/source/Render/Renderer.h | UTF-8 | 1,223 | 2.875 | 3 | [] | no_license | /* Renderer.h
Author: Jeff Kiah
Orig.Date: 5/22/12
Description: Renderer is a base class to be implemented using static
polymorphism and the curiously recurring template pattern (CRTP).
http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
A #define can be used choose a specific implementation for at
co... | true |
d46f5111e1ea5e0d57df9dcd6ef8b7aaa436235d | C++ | Zenikolas/PosixThreadPool | /test/threadPoolTest.cpp | UTF-8 | 2,310 | 3.125 | 3 | [] | no_license | #include "ThreadPool.hpp"
#include <atomic>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
class CallableMock {
public:
MOCK_METHOD0(run, void());
};
std::atomic<bool> start{false};
class Waiter {
public:
void run() { while(!start); }
};
TEST(ThreadPoolTest, smoke)
{
threadUtils::ThreadPool threa... | true |
1fa0d6743ad68ecec1820ebac46bdd2e06176cdc | C++ | charlesrwest/GoodBotLearning | /src/library/Experimenter.cpp | UTF-8 | 3,272 | 3.109375 | 3 | [
"BSD-2-Clause"
] | permissive | #include "Experimenter.hpp"
#include<random>
#include<chrono>
#include<set>
#include<iostream>
using namespace GoodBot;
Investigator::Investigator(const InvestigatorRunConstraints& constraints,
const std::function<double(const std::vector<double>&, const std::vector<int64_t>&)> objectiveFunction) : Objec... | true |
698c35992e646728986cce3b82c443a22e3465a6 | C++ | iliescu6/GLT | /Engine/Engine/InputManager.h | UTF-8 | 1,092 | 2.78125 | 3 | [] | no_license | #ifndef CINPUT_MANAGER
#define CINPUT_MANAGER
#include "includes.h"
enum eMouseButtons
{
LEFT_MOUSE_BUTTON=0,MIDDLE_MOUSE_BUTTON,RIGHT_MOUSE_BUTTON
};
#define INPUT cInputManager::getSingleton()
class cInputManager
{
private:
int m_currentKey[256];
int m_prevKey[256];
cVector2di m_mousePos;
unsigned int m_mouse... | true |
ac5fc07509873583d94de65949a8773829dd2f6e | C++ | karvotch/CPP_Code | /Practice/Practice/main4.cpp | UTF-8 | 2,685 | 3.265625 | 3 | [] | no_license | ////
//// main4.cpp
//// Practice
////
//// Created by Ronald Ginoti on 8/31/19.
////
//
//#include <iostream>
//#include <ctime>
//#include <cmath>
//#include <chrono> // for std::chrono functions
//using namespace std;
//
//
//class Timer
//{
//private:
// // Type aliases to make accessing nested type easier
// ... | true |
fa6770b2cb1ce12daec8a5fc13ca0fb9572a8473 | C++ | Prakhar-FF13/Competitive-Programming | /CodeForces/382A - Ksenia and Pan Scales.cpp | UTF-8 | 714 | 2.921875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
string str;
cin>>str;
string str2;
cin>>str2;
string arr[2];
arr[0] = ""; arr[1] = "";
int ind=0;
for(int i=0; i<str.length() ;i++){
if(str[i] == '|') { ind++; continue;}
arr[ind] += str[i];
}
int u = 0;
... | true |
ec9b9cee63901f4f5a8164a7000df412f0c865ba | C++ | AlexPy/impl-s | /generator.cpp | UTF-8 | 3,270 | 3.1875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#include <iostream>
#include "generator.h"
#include<ctime>
#define threshold 2000000 //threshold of 2 seconds for reseting the seed for rand()
using namespace std;
//gen... | true |
c3422b0af9f2ec0b5a7ba57d4495ac432789f058 | C++ | uytran20111999/Graph | /graph/Source.cpp | UTF-8 | 4,308 | 2.953125 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<climits>
#include<fstream>
using namespace std;
struct vertex {
int key;
int index;
vertex * p;
};
struct graph {
vector<vertex> vertices;
int numedges;
int **edge;
};
int ** creat2Darr (int n){
int ** u = new int*[n];
for (int i = 0; i < n; i++) {
u[i] = new int... | true |
af5bee98d6b3041e7ae87f71ed6ab69c0482400c | C++ | b-xiang/hyrise-1 | /src/lib/logical_query_plan/mock_node.cpp | UTF-8 | 3,736 | 2.609375 | 3 | [
"MIT"
] | permissive | #include "mock_node.hpp"
#include <memory>
#include <string>
#include <vector>
#include "expression/lqp_column_expression.hpp"
#include "statistics/table_statistics.hpp"
#include "utils/assert.hpp"
using namespace std::string_literals; // NOLINT
namespace opossum {
MockNode::MockNode(const ColumnDefinitions& colu... | true |
ced6224148a7cfb72af0967bc02de44ddd94c388 | C++ | moulik-roy/SPOJ | /AE00.cpp | UTF-8 | 271 | 2.71875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int N, i, j, count;
cin>>N;
for(i=2, count=1; i<=N; i++){
for(j=1; j*j<=i; j++){
if(i%j==0)
count++;
}
}
cout<<count<<"\n";
return 0;
} | true |
b381f35f2d34270b41b070adc5dde57ea2d7145d | C++ | ardaOnal/CS201 | /hw4/FlightMap.h | UTF-8 | 691 | 2.53125 | 3 | [] | no_license | // Arda Onal 21903350 Section1
#ifndef __FLIGHTMAP_H
#define __FLIGHTMAP_H
#include "CityList.h"
#include "FlightList.h"
class FlightMap {
public:
FlightMap( const string cityFile, const string flightFile );
~FlightMap();
void displayAllCities() const;
void displayAdjacentCities( const string ... | true |
c2fdbe6bc737ba2b6e5a89a89fc9fa6dade1b247 | C++ | hackerlank/XEffect2D | /engine/XEffeEngine/XControl/XImageList.h | GB18030 | 3,481 | 2.546875 | 3 | [] | no_license | #ifndef _JIA_XIMAGELIST_
#define _JIA_XIMAGELIST_
//++++++++++++++++++++++++++++++++
//Author: ʤ(JiaShengHua)
//Version: 1.0.0
//Date: 2014.3.5
//--------------------------------
//һͼγеĿؼ
#include "XButtonEx.h"
#include "XSlider.h"
#include <deque>
namespace XE{
class XImageList:public XControlBasic
{
private:
XBool ... | true |
4c8f2e0bda045eb2fa3d91871b10e88f95e2bdeb | C++ | vivisuke/NumberLink | /NumberLink/NumberLink/genQuestions.cpp | UTF-8 | 4,909 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "Board.h"
#include <random>
using namespace std;
typedef unsigned char uchar;
typedef const char cchar;
extern mt19937 g_mt;
cchar *q2x2 = "11"
"..";
cchar *q4x4 = "3..3"
"24.."
".1.."
".214";
cchar *q4x4_2 = "1..."
"...."
"...."
"1...";
cchar *q4x4_3 = "1..... | true |
0a60124aec3c8adbce064f7f8b738325c5fe8429 | C++ | adbjesus/mooutils | /tests/mooutils/orders.cpp | UTF-8 | 12,743 | 2.875 | 3 | [
"MIT"
] | permissive | #include <catch2/catch.hpp>
#include <mooutils/orders.hpp>
// TODO improve sets/vectors generation
constexpr size_t min_m{2};
constexpr size_t max_m{10}; // exclusive
constexpr size_t repeats{50};
constexpr int min_v{0};
constexpr int max_v{100};
TEST_CASE("equivalent vectors", "[orders][dominance]") {
auto m = ... | true |
7918bfbfd974776119eea7e723a34e65f965bbde | C++ | andika-eka/praktikum-alpro-ilkom-undiksha-2k19 | /modul 3/Otonan.cpp | UTF-8 | 3,714 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <string>
#include <conio.h>
using namespace std;
int kabisat(int start, int stop){
//menghitung jumlah tahun kabisat
int days = (stop/4)-(start/4);
days-=(stop/100)-(start/100);
days +=(stop/400)-(start/400);
return days;
}
int Tahun(int sta... | true |
a95a63dc7f74388bbde05b71f8823636ed7477cc | C++ | oysiya/OnlineJudge | /BaekjoonOJ/1009_Divided process.cpp | UTF-8 | 254 | 2.515625 | 3 | [] | no_license | #include <stdio.h>
int main(int argc, char *argv[])
{
int C,a,b,t,i;
scanf("%d", &C);
for(int c=0;c<C;c++) {
scanf("%d %d",&a,&b);
t = a%10;
for(i=1;i<b;i++) {
t *= a;
t %= 10;
}
printf("%d\n",((t==0)?10:t));
}
return 0;
}
| true |
bcf1e428580787466bfb42dcbc54d8d4f500869b | C++ | gurmaaan/AtlasKidney | /dialogs/authdialog.cpp | UTF-8 | 2,042 | 2.65625 | 3 | [] | no_license | #include "authdialog.h"
#include "ui_authdialog.h"
AuthDialog::AuthDialog(DataBaseService& db, QWidget *parent) :
QDialog(parent),
ui(new Ui::AuthDialog),
db(db)
{
ui->setupUi(this);
// NOTE credentionals hard coding
ui->login_le->setText(USER_LOGIN);
ui->password_le->setText(USER_PASSWOR... | true |
7ecb865efa0f39cb839dc6f352059b2665a61142 | C++ | ErinTanaka/OperatingSystemsII | /testfolder/testresource.cpp | UTF-8 | 1,795 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <pthread.h>
#include <unistd.h>
using namespace std;
#define NUM_THREADS 7
#define MAX_THREADS 3
//global variables
int numProcesses = 0;
bool hitMaxThreads=false;
int resource[4096];
bool canStartProcesses(){
if(numProcesses == MAX_THREADS || hitMaxThr... | true |
6270fa4d503c976b4cf1496fe42a3324e3977acc | C++ | Ghimli/new-ospgl | /src/universe/propagator/RK4Interpolated.h | UTF-8 | 1,036 | 2.59375 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | #pragma once
#include "SystemPropagator.h"
// Implements a variation of RK4 which only samples the
// solar system twice per time step, and interpolates
// between samples. Appropiate for relatively small timesteps
// and real-life-like systems as planetary variation is pretty
// much linear over these scales
class... | true |
2d7d9e65904dbd0bbfcaf0e5b3d081008c295337 | C++ | Catofes/RootScript | /RootExam/read_data.cpp | UTF-8 | 1,876 | 3.34375 | 3 | [] | no_license | //
// Created by herbertqiao on 12/21/16.
//
#include <iostream>
#include <TFile.h>
#include <TTree.h>
#include <vector>
#include <string>
#include <TChain.h>
#include <TMath.h>
using namespace std;
class ReadData
{
public:
ReadData(string path);
void print_distance();
void save_distance();
private:
... | true |
b605a4414158369e6bc0fbc7c0c2f722776175e8 | C++ | Syrdni/AiBattle | /code/Game/Messages/DiscoverySet.h | UTF-8 | 535 | 2.84375 | 3 | [] | no_license | #pragma once
//Message base class
#include "ECS/Message.h"
//Entity Class
#include "ECS/Entity.h"
/**
Message used when an explorer discovers a set of resources or level objects.
Note that a discovery set may contain some identical resources as a preivously sent set.
@author Philip Stenmark
*/
class DiscoverySet ... | true |
58606df963487171d31e68499a3199c6f457c293 | C++ | KyleeValencia/Project-I | /Function/addfriend.cpp | UTF-8 | 1,050 | 3.25 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct Node {
char username[255];//username
Node *next;
} *head, *tail;
Node *createNode(const char *username) {
Node *newNode = (Node*)malloc(sizeof(Node));
strcpy(newNode->username, username);
return newNode;
}
void pushHead(const char *... | true |
4b92184caf93399ccb90a9f595efded2e6b5f03e | C++ | mLenehanDCU/EE402 | /Assignments/Assignment1/EE402Assignment1/Piano.h | UTF-8 | 545 | 2.609375 | 3 | [] | no_license | /*
* Piano.h
*
* Created on: 30 Oct 2018
* Author: mlenehan
*/
#ifndef PIANO_H_
#define PIANO_H_
#include <iostream>
#include "Instrument.h"
using std::string;
class Piano: public Instrument {
private:
static int nextPianoSerialNumber;
int serialNumber;
void construct();
protected:
int noOfKeys;
publ... | true |
9e293e8aef8dd06e6fdb2edd7e07fcd0ca9f28a8 | C++ | schadov/libwombat | /primitives/FullMatrix.h | UTF-8 | 2,311 | 2.71875 | 3 | [] | no_license | #pragma once
template<class RealT> class FullMatrix{
public:
typedef std::map<unsigned int,RealT> Row;
typedef std::vector<Row> MatrData;
private:
MatrData data_;
//unsigned int nrows_,ncolumns;
public:
void set_value(unsigned int nrow,unsigned int ncolumn, RealT val){
if(data_.size()<=nrow)
da... | true |
177a53de850e5054093319f43a064aac3adf4dfc | C++ | NipunSyn/DSA-CPP | /Basic C++/Code/syntax/simple_switch.cpp | UTF-8 | 588 | 3.609375 | 4 | [] | no_license | #include<iostream>
using namespace std;
int main() {
int a, b;
char c;
cin>>a>>c>>b;
switch (c) {
case '+':
cout<<a+b<<endl;
break;
case '-':
cout<<a-b<<endl;
break;
case '*':
cout<<a*b<<endl;
break;
... | true |
3bad301a67ed693aa6fd73dfab3c2fcbfde9d27c | C++ | Alvtron/OpenGLGraphics | /OpenGL/OpenGL/Rectangle.h | UTF-8 | 512 | 3.125 | 3 | [] | no_license | #pragma once
#include "Vertex.h"
class Rect : public Vertex
{
private:
const float WIDTH = 1.0f, HEIGHT = 1.0f;
/* Creates the rectangle. */
void createRectangle(float width, float height, vec3 position);
public:
/* Create a Rectangle object. Uses default sizes. */
Rect();
/* Create a Rectangle object with width... | true |
f6148e4694b00b16e89923eb178e0fe3a9bf2bf3 | C++ | guilhermealbm/CC-UFMG | /pds2/lab1/01.02/rectangle.cpp | UTF-8 | 675 | 3.28125 | 3 | [] | no_license | #include "rectangle.h"
Rectangle::Rectangle(double width, double height){
_height = height;
_width = width;
}
Rectangle::Rectangle(){
_height = 1.0;
_width = 1.0;
}
double Rectangle::get_height(){
return _height;
}
double Rectangle::get_width(){
return _width;
}
void Rectangle::set_he... | true |
8f1e864c88f90c3e269e17fd8b21e2311a515ef8 | C++ | marrujoalex/CollegeCourseWork | /C++ Class/hw4b/pwfile.cpp | UTF-8 | 2,372 | 3.53125 | 4 | [] | no_license | /* Student ID#: 003914325
Name: Samuel Marrujo
Date: 11/22/11
Professor: Dr. Murphy
Class: CSCI202
Project: Homework 4
*/
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include "pwfile.h"
#include "userpw.h"
using namespace std;
PasswordFile::PasswordFile(string f) {
... | true |
91cc45bff6748f01997ee3bc37630e38490c6381 | C++ | lliuyingjie/jianzhi | /balance.cpp | UTF-8 | 607 | 3.0625 | 3 | [] | no_license | #include<iostream>
#include"tree.h"
using namespace std;
bool if_balance(tree& node, int& x)
{
if(node==NULL)
{
x = 0;
return true;
}
int left,right;
if(if_balance(node->l,left)&&if_balance(node->r,right))
{
int dif= left-right;
if( dif<=1&&dif>=-1)
{
x = 1+ ((left>right)?left:right);
cout<<x<<... | true |
43f79c1dcf5cb1b6a4ea8725edacf770f5ffcc88 | C++ | AndreyMarkinPPC/ArduinoExamples | /door_lock_detector/door_lock_detector.ino | UTF-8 | 863 | 2.5625 | 3 | [] | no_license | int echoPin = 7;
int trigPin = 8;
int ledPin = LED_BUILTIN;
int buzzer = 6;
int maximumRange = 10;
int minimumRange = 0;
long duration, distance;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
unsigned... | true |
526828df59e181ed1934ffb2b05a2334166abd93 | C++ | riyasachdeva-22/DS-Problems | /Strings/palindrome.cpp | UTF-8 | 466 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include<bits/stdc++.h>
bool helper(char s[],int st,int e)
{
if(st==e)
return true;
if(s[st]!=s[e])
return false;
if(s[st]<e)
return helper(s,st+1,e-1);
}
int main() {
//code
int t;
cin>>t;
while(t--)
{
int l;
cin>>l;
char s[l];
for(in... | true |
83a6fc0806d76f0c9c54b9283417023960e72de0 | C++ | sureshyhap/Schaums-Outlines-Programming-with-C-plus-plus | /Chapter 9/Problems/9/9.cpp | UTF-8 | 443 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <string>
const int CHAR_PER_LINE = 60;
int main(int argc, char* argv[]) {
std::string lines[10];
std::string s;
int k = 0;
while (std::getline(std::cin, s)) {
int num_spaces = CHAR_PER_LINE - s.length();
for (int i = 0; i < num_spaces; ++i) {
lines[k] += ' ';
}
... | true |
ded119e71ee5ffcace104f5beb17cca300c19b8e | C++ | El-Maco/q-learning-project | /src/exceptions/qlearning-exception.cpp | UTF-8 | 360 | 2.609375 | 3 | [
"MIT"
] | permissive | #include "qlearning-exception.hpp"
namespace QLearningExceptions {
QLearningRuntimeException::QLearningRuntimeException(std::string message) :
std::runtime_error(message) {}
QLearningException::QLearningException(std::string message) :
message(message) {}
const char* QLearningException::what() const thr... | true |
4e0468d708356c8fd02da2cf67a08e73b2193940 | C++ | deruikong/Competitive-Programming-sols | /USACO/tupletest.cpp | UTF-8 | 1,472 | 2.625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct point{
int a, b;
bool operator <(const point& pt) const
{
return (a < pt.a) || (pt.a >= a && (b < pt.b));
}
};
int main() {
ifstream fin;
ofstream fout;
fin.open("triangles.in");
fout.open("triangles.out");
... | true |
7348ab1804d2bf732411138999901d0e0e188965 | C++ | honeyaya/interview | /BinaryTree.cpp | UTF-8 | 1,382 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
};
TreeNode * CreateBitTree(){
int data;
scanf("%d",&data);
if(data == 0)
return NULL;
else{
TreeNode *tmp = new TreeNode();
tmp->... | true |
409f9977c175fb866774cc61a3fa1d858faa7bb8 | C++ | yculcarneee/leetcode-30-Day-challenge | /Merge Sorted Array/main.cpp | UTF-8 | 1,718 | 3.25 | 3 | [] | no_license | class Solution {
public:
/* First Approach -
vector<int> tempVector;
for(int i = 0; i < m; i++) {
tempVector.push_back(nums1[i]);
}
for(auto num : nums2) {
tempVector.push_back(num);
}
sort(tempVector.begi... | true |
4860fde3b175d2334f47c9822e4f5263231c6518 | C++ | bo0st3r/pool_and_run | /include/ECS/Components/UIComponent.h | UTF-8 | 573 | 2.59375 | 3 | [] | no_license | #ifndef UICOMPONENT_H
#define UICOMPONENT_H
#include <Component.h>
#include <UITypeEnum.h>
class UIComponent : public Component
{
public:
UIComponent(UITypeEnum type = UITypeEnum::HealthBar, int data = -1);
virtual ~UIComponent();
static inline const ComponentID ID = 10;
virtual ... | true |
92382ef59b617024a1e296c437379b967b5aba27 | C++ | ipr/qAudiotest | /IffContainer.h | UTF-8 | 4,107 | 2.53125 | 3 | [] | no_license | /////////////////////////////////////////////////////////
//
// CIffContainer : generic IFF-format parser,
// detailed parsing must be per file-type (format)
// since IFF is more generic.
//
// (c) Ilkka Prusi, 2011
//
#ifndef _IFFCONTAINER_H_
#define _IFFCONTAINER_H_
#include <stdint.h>
#include <string>
// chunk-... | true |
38e80a7116fc67a1fd4522923e1a4a565cf68062 | C++ | wjcskqygj2015/RStream | /src/apps/pr_cf.cpp | UTF-8 | 6,518 | 2.59375 | 3 | [] | no_license | // /*
// * pagerank.cpp
// *
// * Created on: Aug 10, 2017
// * Author: Zhiqiang
// */
//
// #include "../core/engine.hpp"
// #include "../core/scatter.hpp"
// #include "../core/gather.hpp"
// #include "../core/global_info.hpp"
//
// #include "../core/aggregation.hpp"
// #include "../utility/ResourceManager.... | true |
ee417eaa8841c62fa7ac175cbb50206b1390ca6f | C++ | Happy-Ferret/CuarzoOS | /Code/CFramework/Headers/CImage.h | UTF-8 | 973 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef CIMAGE_H
#define CIMAGE_H
#include <QWidget>
#include <QPainter>
#include <QBitmap>
class CImage : public QWidget
{
Q_OBJECT
public:
CImage(QWidget *parent = nullptr);
CImage(QPixmap image,QWidget *parent = nullptr);
CImage(QPixmap image,QSize size,QWidget *parent = nullptr);
CImage(QPixm... | true |
d1b2b0f117706ea54160b9749af171ccf7ab9cda | C++ | hky5820/Registration_Tooth_ICP | /Registration_Tooth_ICP/calc_alignment.cpp | UTF-8 | 3,628 | 3 | 3 | [] | no_license | #include "calc_alignment.h"
float calc_mat_element(vector<float> ¶m1, vector<float> ¶m2, float avg1, float avg2) {
float sum = 0;
size_t size = param1.size();
for (int i = 0; i < size; i++) {
sum += (param1[i] - avg1) * (param2[i] - avg2);
}
return sum;
}
void calc_mat_cross_covariance(vector<float> ... | true |
0e74145eff189e0da232bb8c350380b0f86ed66a | C++ | iFihy1475/C_C- | /C_CPP_STL/C_CPP_STL/pair_ex2.cpp | UTF-8 | 908 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector <pair<int, string>> v;
v.push_back(pair<int, string>(3, "Song"));
v.push_back(pair<int, string>(6, "Nam"));
v.push_back(pair<int, string>(1, "Joo"));
v.push_back... | true |
7b9c550e49cf6c3bb9d2dc356fd631fb9bc59eba | C++ | runvs/QuasarRush | /src/jamtemplate/sfml/rect_lib.hpp | UTF-8 | 2,195 | 2.640625 | 3 | [] | no_license | #ifndef GUARD_JAMTEMPLATE_RECT_LIB_GUARD_HPP
#define GUARD_JAMTEMPLATE_RECT_LIB_GUARD_HPP
#include "rect_base.hpp"
#include <SFML/Graphics/Rect.hpp>
namespace jt {
class Rect final : public rectBase {
public:
Rect()
: m_rect { 0.0f, 0.0f, 0.0f, 0.0f }
{
}
Rect(float left, float top, float wi... | true |
df7c5b0c71996f03c2439f9a3da483047520f3a1 | C++ | OpenGene/gencore | /src/pair.cpp | UTF-8 | 9,234 | 2.59375 | 3 | [
"MIT"
] | permissive | #include "pair.h"
#include "bamutil.h"
#include <memory.h>
Pair::Pair(Options* opt){
mLeft = NULL;
mRight = NULL;
mLeftScore = NULL;
mRightScore = NULL;
mMergeReads = 1;
mReverseMergeReads = 0;
mMergeLeftDiff = 0;
mMergeRightDiff = 0;
mOptions = opt;
mIsDuplex = false;
mCssD... | true |
6350c4881973fed593cd067128e8d9f68768ed7c | C++ | HannahMuetzel/AVLTree | /AVLTree/AVLTree.cpp | UTF-8 | 7,290 | 3.609375 | 4 | [] | no_license | #include "AVLTree.h"
#include <ostream>
#include <string>
/*
AVLTree() constructor
initializes size to 0 and root to NULL pointer
Runtime: theta(1)
*/
AVLTree::AVLTree() {
size = 0; //number of nodes in the tree initialized to 0
root = NULL; //root initialized to null ptr
}
/*
bool insertAVL(int, int)
Adds a node t... | true |
c6298522b0b814c9749ca3f807e7d0096cd3f008 | C++ | xhsimonmo/C90-compiler-translator | /include/declaration_list.hpp | UTF-8 | 1,035 | 2.6875 | 3 | [] | no_license | #ifndef ast_declaration_list
#define ast_declaration_list
#include "ast.hpp"
// declaration_list
// : declaration {$$ = $1; std::cerr << "declaration list 1" << std::endl;}
// | declaration_list declaration {$$ = new declaration_list($1, $2); std::cerr << "declaration list 2" << std::endl;... | true |
2ea79c56dfaeaae461643ec3b5373f9421f1be66 | C++ | currant77/interview-preparation | /data-structures/LinkedList.h | UTF-8 | 18,127 | 4.03125 | 4 | [] | no_license | /**
* @file LinkedList.h
* @author Taylor Curran
* @brief Linked list with iterators
* @version 0.1
* @date 2020-06-16
*
* @copyright Copyright (c) 2020
*
*/
#ifndef LINKED_LIST_H
#define LINKED_LIST_H
#include "stddef.h" // size_t
#include <stdexcept> // std::out_of_range, std::invalid_argument
#in... | true |
17e5896ceba5fe7751b5b7973f6ab1fa78102445 | C++ | palomaalves/Desafios-em-linguagem-C | /codigoCelulaLista.cpp | ISO-8859-1 | 5,173 | 3.375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
/* A altura de uma clula c em uma lista encadeada a distncia entre c e o fim da lista. Mais precisamente, a altura de c o nmero de
passos do caminho que leva de c at a ltima clula da lista. Escreva uma funo que calcule a altura de uma dada clula. */
#include <stdio.h>
... | true |
f46c1815ed5d1cf6acb333295474392d22903df9 | C++ | m-peko/booleval | /include/booleval/token/token.hpp | UTF-8 | 5,057 | 2.75 | 3 | [
"MIT"
] | permissive | /*
* Copyright (c) 2019, Marin Peko
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditi... | true |
6da49147035538fbc88175b5b8dfd2ef17ec5bc3 | C++ | qis/vcpkg-test | /src/dtz/main.cpp | UTF-8 | 589 | 2.578125 | 3 | [
"BSL-1.0"
] | permissive | #include <gtest/gtest.h>
#include <dtz.hpp>
const auto g_tzdata_initialized = []() {
dtz::initialize();
return true;
}();
TEST(date, date)
{
constexpr auto ymd = date::year{ 2019 } / date::month{ 1 } / 1;
constexpr auto tp = std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>{
date::s... | true |