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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27907750117514dc581e036f484bfa867ca2ca93 | C++ | bridgeQiao/STLite | /src/stlite/jw_list.hpp | UTF-8 | 7,052 | 3.25 | 3 | [] | no_license | #pragma once
#include "jw_iterator.hpp"
#include "jw_alloc.hpp"
#include "jw_construct.hpp"
namespace jw {
// list node
template<typename T>
struct __list_node
{
__list_node<T>* prev;
__list_node<T>* next;
T data;
};
// iterator
template<typename T, typename Ref, typename Ptr>
struct __list_iterator
{
... | true |
e342a0339ea5e2c29b6b7cb8420c187da328fd87 | C++ | Hee-Jae/Algorithm | /boj/2263.cpp | UTF-8 | 1,042 | 2.625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int in[100001]={}, inPos[100001]={};
int post[100001]={};
void make_tree(int in_start, int in_end, int post_start, int post_end){
if(in_start > in_end) return;
if(post_start > post_end) return;
else{
cout << post[post_end] << " ";
int root = inPos[post[post_end]];
... | true |
4f5071f75f871850fd4ce5c2a803f4ea404eeabf | C++ | Petru98/Minesweeper | /src/MenuBar.cpp | UTF-8 | 4,737 | 2.78125 | 3 | [] | no_license | #include "MenuBar.hpp"
#include "textures.hpp"
const sf::Vector2f MenuBar::MENU_BUTTON_OFFSET = {6.0f, 4.0f};
void MenuBar::draw(sf::RenderTarget& target, sf::RenderStates states)const
{
states.transform.combine(this->getTransform());
target.draw(m_background, states);
for(std::size_t i = 0; i ... | true |
df0cb8d58db13425c04e4d73483e30f5d7259c65 | C++ | JohN-D/Info-2-Praktikum | /Praktikum Info2/Aufgabenblock_1/PKW.h | UTF-8 | 819 | 2.609375 | 3 | [] | no_license | #pragma once
#include "Fahrzeug.h"
#include <string>
using namespace std;
class PKW : public Fahrzeug
{
public:
PKW(void) : Fahrzeug() {};
PKW(string sName) : Fahrzeug(sName) {};
PKW(string sName, double dMaxGeschwindigkeit) : Fahrzeug(sName, dMaxGeschwindigkeit) {};
PKW(string sName, double dMaxGeschwi... | true |
74ad1b61d77c0d721f63969fafe3d531034c5e6d | C++ | lxpzh/leetcode-solutions | /260. Single Number III.cpp | UTF-8 | 616 | 2.953125 | 3 | [] | no_license | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
unordered_map<int, int> m;
for (auto const& num : nums) {
auto iter = m.find(num);
if (iter == m.end()) {
m.insert({num, 1});
} else {
++ite... | true |
d45c1275b73d91c40582a74b50b41cfb6b30f8fc | C++ | tiandada/Cpp_Primer_Notes | /code/9.52.cpp | UTF-8 | 509 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <stack>
#include <string>
using std::cout;
using std::endl;
using std::stack;
using std::string;
int main()
{
string str("s = (1+1)");
stack<char> stk;
bool spush = false;
for (auto const &i : str)
{
if(i == '(')
{
spush = true;
continue;
}
if(i == ')')
spush = false... | true |
60c95bd494cf35e6be4bd725b0bfa09ee82e28b3 | C++ | ZishanHuang/cracking_the_coding_interview | /Ch 8 Recursion and Dynamic Programming/8_3_magicIndex/8_3_magicIndex.cpp | UTF-8 | 2,189 | 3.859375 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int magicIndex(const vector<int> & arr){
for(int i=0; i<arr.size(); i++){
if(arr[i] == i) return i;
}
return -1;
}
int magicIndex2(const vector<int> & arr){
int low = 0;
int high = arr.size()-1;
while(true){
if(arr[low] == low) return low;
if(arr... | true |
518c75139ff8ccaf25053a85b1eab31e0ae7785d | C++ | MaSteve/UVA-problems | /UVA00374.cpp | UTF-8 | 387 | 2.953125 | 3 | [
"MIT"
] | permissive | #include <cstdio>
using namespace std;
long long power(long long b, long long e, long long mod) {
if (e == 0) return 1%mod;
if (e == 1) return b%mod;
long long aux = power(b, e/2, mod);
aux = (aux*aux)%mod;
if (e%2) aux = (aux*(b%mod))%mod;
return aux;
}
int main() {
int b, p, m;
while (scanf("%d %d %d", &b, ... | true |
91da3d22550ea005d4aeb7d1fd0ba019604fbbca | C++ | potal/miku_server | /common/auto_lock.h | UTF-8 | 626 | 2.640625 | 3 | [] | no_license | #ifndef AUTO_LOCK_H_
#define AUTO_LOCK_H_
#ifdef _WIN32
#include <Windows.h>
#else
#include <pthread.h>
#endif
class AutoLock
{
private:
#ifdef _WIN32
CRITICAL_SECTION *auto_lock_ptr_;
#else
pthread_mutex_t *auto_lock_ptr_;
#endif
public:
#ifdef _WIN32
AutoLock(CRITICAL_SECTION * lock_ptr)
{
auto_lock_ptr_ = ... | true |
dd7eb541d8699ea913b7d102574ff05cf47eee8f | C++ | stackCuiBin/DataStructure | /project/DTLib/inc/SmartPointer.h | UTF-8 | 944 | 2.796875 | 3 | [] | no_license | /*
* @Descripttion:
* @version: V0.01
* @Author: Cuibb
* @Date: 2019-07-30 01:00:26
* @LastEditors: Cuibb
* @LastEditTime: 2021-07-09 00:42:48
*/
#ifndef SMARTPOINTER_H
#define SMARTPOINTER_H
#include "Pointer.h"
namespace DTLib
{
template < typename T >
class SmartPointer : public Pointer<T>
{
public:
S... | true |
810f4a2816bb3934ad276d9a50c5701e38882570 | C++ | ElTangoBandito/Asteroids | /Asteroids/Explosion.cpp | UTF-8 | 1,484 | 2.765625 | 3 | [] | no_license | #include "Explosion.h"
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <SFML/OpenGL.hpp>
#include <SFML/Main.hpp>
#include <iostream>
Explosion::Explosion(sf::Vector2f positionIn, int typeIn) {
this->position = positionI... | true |
8a33fe2fd2bec6ba7a5a879b8f5fa3b3933cb182 | C++ | shivamkaushik12007/practice | /apc/atoi.cpp | UTF-8 | 718 | 2.515625 | 3 | [] | no_license |
int Solution::atoi(const string A) {
int n=A.size();
int i=0;
while(A[i]==' '){
i++;
}
int cm=1;
if(A[i]=='-'||A[i]=='+'){
cm=A[i]=='+'?1:1;
cm=A[i]=='-'?-1:1;
i++;
}
if(A[i]<'0'||A[i]>'9')
return 0;
int sum=0;
long lo... | true |
09fe232ec85bfd785e5e5139b35c5bee36ab4802 | C++ | leviathanbadger/gfn-compiler | /Gfnc/Parser/UnaryExpressionSyntax.cpp | UTF-8 | 4,098 | 2.765625 | 3 | [] | no_license | #include "stdafx.h"
#include "Parser/UnaryExpressionSyntax.h"
#include "Parser/PrimaryExpressionSyntax.h"
#include "Tokenizer/Token.h"
#include "Emit/MethodBuilder.h"
#include "Emit/OpLdcI4.h"
#include "Runtime/RuntimeType.h"
#include "Runtime/MethodGroup.h"
#include "Runtime/MethodOverload.h"
namespace Gfn::Compile... | true |
5ac5ba33d5de076b8c76bf46c496de8e59a0db1a | C++ | plepers/blur_hdr_cube | /cubicblur/cubicblur.cpp | UTF-8 | 9,938 | 2.578125 | 3 | [] | no_license | // cubicblur.cpp : Defines the entry point for the console application.
//
#include "cubicblur.h"
using namespace TCLAP;
using namespace std;
float** splitCrossmap( HDRLoaderResult* hdrRes );
float* assembleCrossmap( float** faces, int faceSize );
unsigned char* f32toRgbe( float* faces, int w, int h, double base );... | true |
21ef46f5e2a9de979d936bdd622fab14849d734b | C++ | fubyo/osccalibrator | /juce/extras/Jucer (experimental)/Source/Utility/jucer_MiscUtilities.cpp | UTF-8 | 14,139 | 2.5625 | 3 | [] | no_license | /*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-10 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistrib... | true |
ff41f98b6fec14a5be02085a7ff5df9b677d06dd | C++ | shubhlohiya/production-planning-cs218 | /DP.cpp | UTF-8 | 3,528 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cmath>
#include <chrono>
#include <climits>
using namespace std;
using namespace std::chrono;
using ll = long long;
ll getcost(int M, int D[], int E, ll Hcost, ll Fcost,
ll S, int C, int OTC, ll OTPrice, ll W){
// Naming of parameters is as described in the Problem ... | true |
5b794c766bcd60436d0cb7866fe151ef68273ff4 | C++ | cfcv/Perceptron | /perceptron.cpp | UTF-8 | 5,368 | 3.203125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <fstream>
#include <ctime>
#include <cstdlib>
#define TABLE_LENGHT 4
#define TABLE_WIDTH 3
#define FILE_NAME "TruthTable.txt"
#define DEBUG_TRAINING 0
#define THRESHOLD 0.9
using namespace std;
class Perceptron {
public:
Perceptron(double tr, double lr, double p1, d... | true |
784d1b2e36c3bf0c0c6e2735b41b263a5693ac06 | C++ | TensShinet/learn_graphics | /Lesson 5: Moving the camera/test.cpp | UTF-8 | 325 | 2.515625 | 3 | [
"MIT",
"Zlib"
] | permissive | #include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include "model.h"
int main() {
std::string stringvalues = "f 24/1/24 25/2/25 26/3/26";
std::istringstream iss(stringvalues.c_str());
char trash;
Vec3f tmp;
iss >> trash >> trash;
std::cout<< trash << '\n';
return... | true |
4c7fa72b2b5ff48eeacb81274b7ded15ea3432ba | C++ | rachitvk/Competitive-Programming | /Codeforces/Codeforces Round 550/B-Parity Alternated Deletions.cpp | UTF-8 | 723 | 2.765625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int>even,odd;
for(int i=0;i<n;i++){
int x;
cin >> x;
if(x%2)
odd.push_back(x);
else
even.push_back(x);
}
sort(even.begin(),even.end())... | true |
7a272efb27e86bd37f868a2b199b0e3a03518645 | C++ | rubenglezortiz/Proyectos2-2020-21 | /PaintlLess/Textura.cpp | UTF-8 | 1,181 | 3.109375 | 3 | [
"CC0-1.0"
] | permissive | #include "Textura.h"
#include <iostream>
using namespace std;
void Textura::clear() {
SDL_DestroyTexture(texture);
texture = nullptr;
w = h = 0;
}
void Textura::load(string filename, uint nRows, uint nCols) {
SDL_Surface* tempSurface = IMG_Load(filename.c_str());
if (tempSurface == nullptr) throw string("Error ... | true |
d477d9e1b7975ea5da88b909f7278dcb32ce2a8e | C++ | checkoutb/LeetCodeCCpp | /ge2000/LT2037_2022-02-26_Minimum_Number_of_Moves_to_Seat_Everyone.cpp | UTF-8 | 818 | 2.96875 | 3 | [] | no_license |
#include "../header/myheader.h"
class LT2037
{
public:
// D D
//Runtime: 14 ms, faster than 49.16% of C++ online submissions for Minimum Number of Moves to Seat Everyone.
//Memory Usage: 18.2 MB, less than 44.92% of C++ online submissions for Minimum Number of Moves to Seat Everyone.
// seat 的 位置, student 的 位置。
... | true |
b783a2aab1095641ad3e602080914ba26bb0ce25 | C++ | elsioantunes/cloud9 | /(spoj)/histograma.cpp | UTF-8 | 447 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main(){
int X, Y, C, c;
while(true){
cin >> X;
cin >> Y;
cin >> C;
if (X==0) break;
int *h = new int[X*Y];
for(int i=0;i<C+1;i++) h[i]=0;
for(int i=0;i<X;i++)
for(int j=0;j<Y;j++){
cin >> c;
... | true |
534c66fffd7d5bb4a52a8ff2b64a1f7fbbf7dad6 | C++ | grasmanek94/sluice2017 | /product/DoorOneSecondMotor.cpp | UTF-8 | 598 | 2.859375 | 3 | [] | no_license | #include "DoorOneSecondMotor.hpp"
DoorOneSecondMotor::DoorOneSecondMotor(SluiceNetworkHandler* handler, const std::string& door_name)
: Door(handler, door_name)
{}
bool DoorOneSecondMotor::Open()
{
timer.Restart();
return Door::Open();
}
bool DoorOneSecondMotor::Close()
{
timer.Restart();
return Door::Close();
... | true |
eba0995d3132cf34cb0ab101c79c55117fd5d5cd | C++ | MrLukeKR/Party-Animals | /G53GRA.Framework/Code/SpecialFX/Confetti.h | UTF-8 | 675 | 2.71875 | 3 | [] | no_license | #pragma once
#include "DisplayableObject.h"
#include "Animation.h"
/*
Party Animals: Confetti (Header File)
Author: Luke K. Rose
April 2018
*/
class Confetti :
public DisplayableObject,
public Animation {
public:
/*
Public Constructor/Destructor
*/
Confetti(float x, float y, float z) {
dropLoc[0] = (x);
... | true |
059e89c67b1e4bd4510f48001bcc6e761d619ced | C++ | paweldata/Kodowanie-i-kompresja-danych | /lista6/src/Decoder.cpp | UTF-8 | 3,889 | 2.875 | 3 | [] | no_license | #include <cmath>
#include <bitset>
#include "Decoder.h"
#include "TGAHeader.h"
Decoder::Decoder() {
this->redLowPassDict = std::map<std::string, int>();
this->redHighPassDict = std::map<std::string, int>();
this->greenLowPassDict = std::map<std::string, int>();
this->greenHighPassDict = std::map<std:... | true |
4298aea8a1a16bd7dcf1ca82b3ba23cdc98b93ea | C++ | ciupmeister/Surse | /numar4/main.cpp | UTF-8 | 791 | 2.625 | 3 | [] | no_license | #include <cstdio>
#define DN 2005
int ni,nz,a[DN],b[DN];
void imp(int x[], int y) {
int i,r=0;
i=x[0];
for(;i;) {
r=r*10+x[i];
x[i]=r/y;
r=r%y;
i--;
}
for(;!x[x[0]];--x[0]);
}
void afis(int x[]) {
for(int i=x[0];i>0; --i) printf("%d",x[i]);
}
int main()
{
... | true |
6ff2ad270089141a565b5b4ce8f6abe42a4cb908 | C++ | wonbae/Algorithm | /SWEA/SWEA_1215.cpp | UTF-8 | 2,180 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <string.h>
using namespace std;
int main(){
int Palindrome_Len,len;
char Teststr[8][8] = {0,};
len = sizeof(Teststr[0]);
int count = 0;
bool flag = false;
for(int tc = 1; tc <= 10; tc++){
cin>>Palindrome_Len;
for(int i = 0; i < 8; i++){
... | true |
106e4ecc0b97eea990e39401a0b2bb983635b5b1 | C++ | pgarnaut/sha256 | /main.cpp | UTF-8 | 1,316 | 2.671875 | 3 | [
"Zlib"
] | permissive | //
// author: patrick garnaut
// date: AUG 2010
//
// small piece of rubbish code to read a file and run the sha256 over it
//
//
#include "sha256.h"
#include "types.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define CHUNK_SIZE 256
void usage(int argc, char **argv)
{
printf("%s <filename>... | true |
79f5ddc8435751378a9aaa083b0fd8769d85c23a | C++ | Mathrix16/ASD | /Mergesort.cpp | UTF-8 | 1,062 | 3.328125 | 3 | [] | no_license | #include "Mergesort.h"
void Mergesort::merge(int input[], int left, int middle, int right)
{
int n1 = middle - left + 1;
int n2 = right - middle;
int* L = new int[n1];
int* R = new int[n2];
for (int i = 0; i < n1; i++)
L[i] = input[left + i];
for (int j = 0; j < n2; j++)
R[j] ... | true |
5a80b3db9e3af8573d3d130ed331abd797d38aae | C++ | rlannon/csin | /src/parser/statement/function_definition.hpp | UTF-8 | 773 | 2.578125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "definition.hpp"
#include "../../util/data_type.hpp"
namespace statement
{
class function_definition : public definition
{
std::vector<std::unique_ptr<statement_base>> formal_parameters;
data_type return_type;
public:
const data_type& get_type_information() c... | true |
8b75554c7b270df55fee7e78ef8889dd34016029 | C++ | AlolyanRoaa/CircuitDesign-5Servos-potentiometers | /5_servos_with_potentiometer1.ino | UTF-8 | 1,187 | 3.03125 | 3 | [] | no_license | // C++ code
//
#include <Servo.h>
Servo gripper, wrist, elbow, shoulder, base;
int gpin = 5;// analog pin used to connect the potentiometer
int wpin = 4;
int epin = 3;
int spin = 2;
int bpin = 1;
int gval, wval, eval, sval, bval; // variable to read the value from the analog pin
void setup()
{
gripper.attach(... | true |
0cbca0cd1774bccbe1d83d966eb834654f6e9c61 | C++ | alexandraback/datacollection | /solutions_5634947029139456_1/C++/Zwergesel/solution.cpp | UTF-8 | 1,983 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int n, l;
string a[150], b[150];
int a1[40], b1[40];
void flip(int j) {
for (int i=0; i<n; i++) {
a[i][j] = '1' + '0' - a[i][j];
}
}
bool prefix(int k) {
for (int i=0; i<n; i++) {
for (int j=0; j<=k; j++) {
if (a[i][j] != b[i]... | true |
827e5bb0106ade1c865d9245506559863a7328fd | C++ | Jasuse/BitIO | /BitReader.cpp | UTF-8 | 961 | 3.1875 | 3 | [] | no_license | #include "BitReader.h"
BitReader::BitReader(std::fstream* stream) : m_stream(stream), buffer(0), bitcount(0)
{
if (!stream->is_open())
{
throw std::runtime_error("Unable to initialize closed filestream");
}
}
bool BitReader::good()
{
return (m_stream->good() && (m_stream->peek(), !m_stream->eof(... | true |
7ddd5d4f14dcf5d0e0c0e5fec775e1f7b8890a07 | C++ | wlhee/practice-on-programming | /week3/CDragon.cpp | UTF-8 | 892 | 3.15625 | 3 | [] | no_license | #include "CWarrior.hpp"
#include "Type.hpp"
class CDragon: public CWarrior {
private:
Weapon weapon;
int damage;
float morale;
public:
CDragon(int id, const CHeadquarter *pHQ, WarriorType type, int strength);
Weapon getWeapon() const { return weapon; }
void setWeapon(Weapon &w) { weapon = w; }
in... | true |
d23c1a11b2371651e9d4bedaee8a94971ee5a264 | C++ | lucasjliu/web | /src/Poller.cpp | UTF-8 | 3,009 | 2.78125 | 3 | [] | no_license | //
// Poller.cpp
//
// by jiahuan.liu
// 11/28/2016
//
#include <unistd.h>
#include "Poller.h"
#include "Logger.h"
#ifdef OS_LINUX
#include <sys/epoll.h>
#elif defined(__APPLE__) || defined(MACH)
#include <sys/event.h>
#else
#error "platform unsupported"
#endif
#ifdef OS_LINUX
class Epoller : public PollerBase
{
... | true |
0decf70a7047080f9fc8394ae94c6f05e03bb765 | C++ | gaozihang/ShadowMap_Point_Light_OpenGL | /opengl4.3_test_program/camera.h | UTF-8 | 2,704 | 3.0625 | 3 | [] | no_license | #pragma once
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"
enum Camera_Movement {
FORWARD,
BACKWARD,
LEFT,
RIGHT
};
const float PITCH = 0.0f;
const float YAW = -90.0f;
const float SPEED = 2.5f;
const float SENSITIVITY = 0.1f;
const float ZOOM = 45.0f;
class Camera... | true |
d4877502b6f2d288bba9a3dff7c3dc921d0d1156 | C++ | flappyZeng/C-plus-plus-Learning | /TextQuery.cpp | GB18030 | 2,909 | 3.046875 | 3 | [] | no_license | #include"TextQuery.h"
TextQuery::TextQuery(std::ifstream& infile):file(new std::vector<std::string>()) {
std::string line;
std::string word;
int countLine = 0;
while (std::getline(infile, line))
{
file->emplace_back(line);
std::istringstream iss(line);
while (iss >> word)
{
auto& lines = wm[word]; //... | true |
9c9f66a18d78a2d90b09d9032aac5bc65d5a41de | C++ | laurensiusadi/elearning-pweb | /public/similarity_plugin/input/10/12/10 12 5112100100--3.12.cpp | UTF-8 | 543 | 3.421875 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
class Account
{
private :
int accountBalance;
public :
Account(int aB)
{
if(aB>=0)
accountBalance=aB;
else
{
accountBalance=0;
cout<<"Initial balance was invalid\n";
}
}
void credit(int nominal)
{
accountBalance+=nominal;
}
void debit... | true |
2052325c5092e5d2a6ae7baa3fcbea1237971218 | C++ | confusedconsciousness/geeks-for-geeks | /Graph/directed_graph_check_cyclicity.cpp | UTF-8 | 4,277 | 3.625 | 4 | [] | no_license | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
const int EDGES = 100;
int INPUTS[EDGES][2]; // at max we can have 100 edges
/*
In this problem we'll be given an directed graph, our aim is to detect whether there is a cycle present?
This problem is little bit tricky than its undirect... | true |
d2fadf898579b49167fe61014b35908e34a39343 | C++ | void-trinity/OOPs-Assignment | /Assignment 4/5.cpp | UTF-8 | 1,294 | 4 | 4 | [] | no_license | #include <iostream>
using namespace std;
int days_arr[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
class Date{
public:
int day, month, year;
void add_days(int d){
while(d){
day++;
d--;
if(day > days_arr[month-1])
{
day = 1;
... | true |
34316c0030565e55be7d8d09a7a26722c9efab1b | C++ | DanielDelchev/vector-vs-list-comparisson | /VectorTester.cpp | UTF-8 | 8,756 | 3.6875 | 4 | [] | no_license | #include "VectorTester.h"
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <iostream>
#include <algorithm>
/**
* @brief this function currenty does nothing
* @detailed this function is private and it contains the action which must be preformed in the destructor,should any dynamic memory be handled manual... | true |
fcfb28a6e6786456033713032d46e5a851033c18 | C++ | darcyg/Caramel | /include/Caramel/Numeric/NumberConverter.h | UTF-8 | 3,077 | 2.921875 | 3 | [] | no_license | // Caramel C++ Library - Numeric Amenity - Number Converter Header
#ifndef __CARAMEL_NUMERIC_NUMBER_CONVERTER_H
#define __CARAMEL_NUMERIC_NUMBER_CONVERTER_H
#pragma once
#include <Caramel/Setup/CaramelDefs.h>
#include <Caramel/Numeric/NumberTraits.h>
#include <cfloat>
namespace Caramel
{
//////////////////////////... | true |
0585573e99bbea56084b1ef0bafe04814da9e674 | C++ | TedaLIEz/SimpleH264 | /include/parser/parser.h | UTF-8 | 2,021 | 2.78125 | 3 | [] | no_license | //
// Created by aLIEzTed on 5/14/18.
//
#ifndef SIMPLEH264_PARSER_H
#define SIMPLEH264_PARSER_H
#include <sstream>
#include <context.h>
#include "h264/sps.h"
#include "util/golomb.h"
template<class T>
class Parser {
public:
Parser() = default;
virtual T parse(unsigned char *data, unsigned long len, unsigned long... | true |
d901634d8d45f9dab7ac42d21a6b0fbe9bbbd4ad | C++ | flameshimmer/Leet2015_2.5 | /Leet2015_2.5/Leet2015_2/WordBreakII.cpp | UTF-8 | 482 | 3.109375 | 3 | [] | no_license | #include "stdafx.h"
//Given a string s and a dictionary of words dict, add spaces in s to
//construct a sentence where each word is a valid dictionary word.
//
//Return all such possible sentences.
//
//For example, given
//s = "catsanddog",
//dict = ["cat", "cats", "and", "sand", "dog"].
//
//A solution is["cats and... | true |
ebfabef5de4599c71f7b2b21617c1c1c29647f2e | C++ | lwzswufe/CppCode | /Cmake/Sell_Strategy.cpp | UTF-8 | 424 | 2.5625 | 3 | [] | no_license | #include "Sell_Strategy.h"
void Sell_Strategy::init()
{
this->position_vec = {{"600000", 100}, {"600004", 54}};
}
void Sell_Strategy::run()
{
;
}
void Sell_Strategy::update(Stock_Data* data_ptr)
{
for(auto position: this->position_vec)
{
if(data_ptr->code == position.first &&
data_... | true |
da45dbe96447dc664806ae87463d37a0afea039c | C++ | matheusmso/code | /uva/900.cpp | UTF-8 | 308 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
int f(int x) {
if (x == 1)
return 1;
if (x == 2)
return 2;
return f(x-1) + f(x-2);
}
int main() {
int x;
while(scanf("%d", &x) == 1) {
if (x == 0)
return 0;
printf("%d\n", f(x));
}
return 0;
}
| true |
3d6b0ee3920a41ff050c1970c776ecb8fb751182 | C++ | kerinin/arduino-splines | /spline.cpp | UTF-8 | 2,825 | 3.1875 | 3 | [] | no_license | #include "WProgram.h"
#include "spline.h"
#include <math.h>
Spline::Spline(void) {
_prev_point = 0;
}
Spline::Spline( float x[], float y[], int numPoints, int degree )
{
setPoints(x,y,numPoints);
setDegree(degree);
_prev_point = 0;
}
Spline::Spline( float x[], float y[], float m[], int numPoints )
{
setPoi... | true |
3cf3f2fa174252803d6171a42d1d4d75c797490c | C++ | changchuming/rpi-gun | /arduino/i2c/i2c.ino | UTF-8 | 2,288 | 2.875 | 3 | [] | no_license | #include <Wire.h>
#include <Servo.h>
#include <SoftwareSerial.h>
#define SLAVE_ADDRESS 0x04
// Servo
Servo pan_servo;
Servo tilt_servo;
int pan_pin = 10;
int tilt_pin = 11;
// Pan tilt angles
int pan_angle = 90;
int tilt_angle = 60;
int encoded_thetas = 0;
int pan_theta = 0;
int tilt_theta = 0;
int motorControl = 9;... | true |
a3a0ccca142aaef062930ce369322f048aa7e753 | C++ | NiteshPidiparars/CodeBlock | /C++/OverloadOperatorTimeClass.cpp | UTF-8 | 803 | 3.453125 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
class Time
{
private:
int HR,MIN,SEC;
public:
void setTime(int h,int m,int s)
{
HR = h;
MIN = m;
SEC = s;
}
void showTime()
{
cout<<endl<<HR<<" : "<<MIN<<" : "<<SEC;
}
void normalize()
{
... | true |
ed1b32950eefc0b3cdcc2ad62aa43a97760016ae | C++ | oujinhaoai/shadertoy | /source/body.h | UTF-8 | 663 | 2.6875 | 3 | [] | no_license | #pragma once
#include "utils.h"
struct Body
{
Body(const OVR::Vector3f& position, const OVR::Vector3f& angles);
void apply_inputs(const OVR::Vector3f& lin_inputs, const OVR::Vector3f& ang_inputs, float dt);
void integrate(float dt);
OVR::Matrix4f get_matrix() const;
private:
void updateController(SDL_Joystic... | true |
c11c79af21563c746042796a8bb42d78a6122c86 | C++ | SdobnovE/msu_cpp_autumn_2019 | /09/main.cpp | UTF-8 | 1,779 | 2.578125 | 3 | [] | no_license | #include<stdio.h>
#include<iostream>
#include<fstream>
#include<queue>
#include<algorithm>
#include<thread>
#include<pthread.h>
#include<atomic>
#include<string>
#include<condition_variable>
#include<mutex>
#include<functional>
#include"sort.h"
using namespace std;
int main()
{
uint64_t* memory1 = new uint6... | true |
7212051262781d9a39b384b0c00a15ad5e5e4822 | C++ | cyx233/MyDB | /src/system/instance.h | UTF-8 | 3,695 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef THDB_INSTANCE_H_
#define THDB_INSTANCE_H_
#include "condition/conditions.h"
#include "defines.h"
#include "field/fields.h"
#include "index/index.h"
#include "manager/index_manager.h"
#include "manager/recovery_manager.h"
#include "manager/table_manager.h"
#include "manager/transaction_manager.h"
#include "reco... | true |
8cfb50fc6b95f5d04afa495af869073086ad2508 | C++ | olgt/Laboratorio_EDD_201612341_Proyecto1 | /arbol_binario.cpp | UTF-8 | 8,553 | 3.1875 | 3 | [] | no_license | #include "arbol_binario.h"
Arbol_Binario::Arbol_Binario()
{
this->raiz = NULL;
}
Arbol_Binario::~Arbol_Binario(){
Delete(this->raiz);
}
void Arbol_Binario::Delete(Nodo_Binario *raiz){
if(raiz==NULL){return;}
if(raiz->getIzquierda() != NULL){
Delete(raiz->getIzquierda());
}
if(raiz->g... | true |
aecb25dc9aa3c666dae74d9a9a9e3a765fc315ba | C++ | ColinParrott/raytracer | /shapes/selfbalance.hpp | UTF-8 | 779 | 2.9375 | 3 | [] | no_license | // Self Balancing Binary Search Tree
// Adapted from https://www.tutorialspoint.com/cplusplus-program-to-implement-self-balancing-binary-search-tree
#include<iostream>
#include<cstdio>
#include<sstream>
#include<algorithm>
#define pow2(n) (1 << (n))
using namespace std;
struct avl//node declaration
{
int d;
int in... | true |
4cf5055c9b7f446af6edba7db95ef0b35f6a9cb1 | C++ | ChangguHan/studyAlgorithm | /Simulation/BJ-15686.cpp | UTF-8 | 1,384 | 3.046875 | 3 | [] | no_license | // 백트래킹 위치 조합 : 2^(M)
// 각 위치에서 최소거리 치킨집 확인 : N^2
// 치킨집마다 확인 N*M
// N=50, M=13 이니까 치킨집마다 확인하는게 빠르겠군
// O(NM2^M) : 650*1e3*8 = 5e6
#include <iostream>
#include <vector>
using namespace std;
int N,M;
int map[60][60];
vector<pair<int, int> > chick;
vector<pair<int, int> > home;
vector<int> v;
int minv = 3600*13;
int... | true |
a322f9a6e1f31977de008448501469f97f0b65af | C++ | leetrent/BeginnerCPP | /Challenges/Challenge16-Polymorphism/SavingsAccount.h | UTF-8 | 694 | 3.046875 | 3 | [] | no_license | #ifndef _SAVINGSACCOUNT_H_
#define _SAVINGSACCOUNT_H_
#include "Account.h"
class SavingsAccount : public Account
{
private:
static constexpr const char *default_name = "Unamed Savings Account";
static constexpr const double default_balance = 0.0;
static constexpr const double default_interest_rate = 0.0;... | true |
f654330d98e1a456d7c3a69cb973d1a8fb88efda | C++ | franceschi/CECS2223 | /Lab_11/Product.h | WINDOWS-1258 | 786 | 3.375 | 3 | [] | no_license | #pragma once
#ifndef Product_H
#define Product_H
#include <string>
#include <iostream>
using namespace std;
class Product
{
private:
string productName;
string productBarCode;
public:
Product();
Product(string productName, string productBarCode);
Product(const Product & tempProduct);
~Product();
//(get y s... | true |
ad0916d26ce3b2b83a27b992b16a3cf56ea1f8be | C++ | yasinxdxd/orbit_simulation | /include/Math/Vectors.h | UTF-8 | 2,557 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#ifndef GO_VECTORS_H
#define GO_VECTORS_H
#include <cmath>
#include "Core/Definitions.h"
#define GO_PI 3.14159265359
#define GO_R2D(radian) radian * 180 / GO_PI
#define GO_D2R(degree) degree * GO_PI / 180
#define GO_DIST(x1,y1,x2,y2) sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)))
namespace go
{
template... | true |
3326534ad4e43b55a2a37c24f713630100ac10c0 | C++ | suhyun1/problem-solving | /suhyun/SWEA1234_비밀번호.cpp | UTF-8 | 687 | 2.890625 | 3 | [] | no_license | #include<iostream>
#include<stack>
using namespace std;
int main(int argc, char** argv)
{
int test_case;
int T=10;
for(test_case = 1; test_case <= T; ++test_case)
{
int len;
string secret;
cin >> len >> secret;
stack<char> s;
for(int i=0;i<len;i++){
if(!s.empty() && ... | true |
6cd29b7c099b59cef4215075b3145f2361b3ac1c | C++ | makreft/openPubSub | /openPubSub/VariableNode.h | UTF-8 | 2,195 | 2.671875 | 3 | [] | no_license | //
// Created by sba on 28.02.20.
//
#ifndef SMARTFACTORYLIB_VARIABLENODE_H
#define SMARTFACTORYLIB_VARIABLENODE_H
#include <vector>
#include <open62541/server.h>
#include "UATypes.h"
#include "Errors.h"
class NodeDataBase{
public:
bool isInit(){
return _init;
}
virtual void init(UA_Server *ser... | true |
75009616925358a9b433622cebea5ab90e02b202 | C++ | SakiiR/Arcade | /Loader.cpp | UTF-8 | 5,072 | 2.75 | 3 | [] | no_license | //
// Loader.cpp for Arcade in /home/dupard_e/rendus/cpp_arcade
//
// Made by Erwan Dupard
// Login <dupard_e@epitech.net>
//
// Started on Wed Mar 9 15:53:55 2016 Erwan Dupard
// Last update Sun Apr 3 23:17:38 2016 Barthelemy Gouby
//
#include "Loader.hh"
Loader::Loader() : _game(0), _display(0), _graphicHand... | true |
9f570327842d217eca2fb05010981d0f614957bd | C++ | nagyrobert1996/bevprog | /szohossz_shiftelessel.cpp | UTF-8 | 147 | 2.71875 | 3 | [] | no_license | #include "iostream"
int main()
{
int a = 1;
int db = 0;
while(a != 0)
{
++db;
a = a << 1;
}
std::cout << "Eredmeny: " << db << "\n";
}
| true |
37e6ea4edd220c03f275a3229356af73fb983eca | C++ | Badabum/Prata_task | /chapter_8/chapter8_1/chapter8(ex2).cpp | UTF-8 | 953 | 3.5 | 4 | [] | no_license | #include "stdafx.h"
#include <iostream>
#include <string>
struct CandyBar
{
std::string name;
double mass;
int calories;
};
void show(const CandyBar& bar);
void setstr(char*str);
void set(CandyBar&bar,char*name="Millennium Munch",double mass=2.85,int calories=350);
void main()
{
using std::cout;
using std::cin;
... | true |
d29a2d919239b6ea3413bcb5f8b4ed772795d5c0 | C++ | naeimsalib/High_Adventure_Travel_Agency | /Lab2.cpp | UTF-8 | 7,214 | 3.59375 | 4 | [] | no_license | //CSC 211 Lab 2
// Naeim Salib
#include <iostream>
using namespace std;
//Function Declration
void climbing();
void scuba();
void skyDive();
void spelunk();
int menu();
//Assigned variavles
const double climbRate = 300; // to Hold base rate of Devil's Courthouse adventure
const double scubaRate = 1000; // to hold ... | true |
54e217770589aae09eb46ef3eef55ef88985a4d9 | C++ | DR9885/Pong | /Development/Pong.Box2D/Pong.Box2D/CapsuleCollider.h | UTF-8 | 898 | 3.578125 | 4 | [] | no_license | /* This is a combination of 2 circles and a rectangle bound. The sizes adjust with the height and width of the capsule object. */
#pragma once
#ifndef CAPSULE_H
#define CAPSULE_H
class capsule {
public:
real height, width;
vector2* position;
rect* middle;
circle* circle1;
circle* circle2;
capsule(){
position... | true |
564779fad545e99cfc6909b482d0c6383205cd22 | C++ | Lujie1996/Leetcode | /373. Find K Pairs with Smallest Sums/373. Find K Pairs with Smallest Sums/main.cpp | UTF-8 | 1,758 | 3.328125 | 3 | [] | no_license | //
// main.cpp
// 373. Find K Pairs with Smallest Sums
//
// Created by Jie Lu on 2019/2/10.
// Copyright © 2019 Jie Lu. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
vector<pair<int, int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k) {
int i = 0, j = 0;
... | true |
53cc17596ab530105d4610ca336592e19d32d5fc | C++ | ywnwa/compiler-pl0-cpp | /identifiermanager.h | UTF-8 | 1,737 | 2.75 | 3 | [] | no_license |
#ifndef IDENTIFIERMANAGER_H
#define IDENTIFIERMANAGER_H
#include <QtCore/QList>
#include <QtCore/QString>
class IdentifierManager
{
public:
IdentifierManager();
~IdentifierManager();
void setName( const QString &name );
void setValue( int value );
bool pushConstIdentifier();
bool pushVari... | true |
e2a7e10c98c97604fa56c6cd6179d2ae61add261 | C++ | rishabh-11/C-- | /placement prep/linkedlist/rotate_list.cpp | UTF-8 | 668 | 3.21875 | 3 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
ListNode* Solution::rotateRight(ListNode* A, int B) {
if(A==NULL)return A;
int len=0;
ListNode* head=A;
ListNode* tail=A;
ListNode* ans=A;
... | true |
847fba1fa7ce31f2be3e4ef1b4d5721e2a556486 | C++ | mosqlwj/leetcode | /344_反转字符串.cpp | UTF-8 | 609 | 3.296875 | 3 | [] | no_license | //
// Created by lwj on 2020/5/12.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
// 递归
void reverseString(vector<char>& s) {
helper(s, 0, s.size()-1);
}
void helper(vector<char>& s, int l, int r) {
if (l >= r)
return;... | true |
5583537672afc4e45290ad01f58097cb27e6a7b2 | C++ | blockspacer/vrm_core | /test/core/static_if/static_if_return.cpp | UTF-8 | 1,164 | 3.125 | 3 | [
"AFL-3.0",
"AFL-2.1",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include "../../utils/test_utils.hpp"
#include <cstddef>
#include <vrm/core/config.hpp>
#include <vrm/core/static_if.hpp>
struct banana
{
};
struct apple
{
};
struct chestnut
{
};
template <typename T>
using is_banana = std::integral_constant<bool, std::is_same<banana, T>{}>;
template <typename T>
using is_apple =... | true |
a9e9099ab6e88befdf27d2e1ee759fae617af179 | C++ | jack06215/C-programming-quiz | /diet.cpp | UTF-8 | 1,723 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
int main()
{
int arr1[] = {1,3,5,7,10};
int arr2[] = {2,3,7,8,9};
int target = 12;
int high = target + 1;
int low = target - 1;
int width = sizeof(arr1)/sizeof(arr1[0]);
int height = sizeof(arr2)/sizeof(arr... | true |
ada0b28970c66ebbd7cbb60d178e1c6f57146b67 | C++ | Vashishtha/CAlgoPractice | /staircase.cpp | UTF-8 | 3,137 | 3.46875 | 3 | [] | no_license | //There exists a staircase with N steps,
//and you can climb up either 1 or 2 steps at a time.
//Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters.
//For example, if N is 4, then there are 5 unique ways:
//1, 1, 1, 1
//2, 1, 1
//1, 2... | true |
357d78b1cabab01b9acf30c1785fec446f397230 | C++ | AmazingCaddy/leetcode | /Remove_Duplicates_from_Sorted_Array.cpp | UTF-8 | 503 | 2.90625 | 3 | [] | no_license | class Solution {
public:
void test () {
int a[] = {1, 2, 3, 4, 5, 10, 2, 3, 1, 20, 1};
int n = 11;
int ans[] = {1, 2, 3, 4, 5, 10, 20};
int ans_n = 7;
sort (a, a + n);
int len = this -> removeDuplicates(a, n);
for (int i = 0; i < len; i ++) {
cout << a[i] << " ";
}
cout << "\n";
}
int removeDupl... | true |
df5a440fffef4b5f0004a32b11b3f48d0356b8d2 | C++ | dpatino07/Student-Roster-Program | /student.cpp | UTF-8 | 2,672 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <iomanip>
#include <string>
#include <iostream>
#include "student.h"
#include "degree.h"
using namespace std;
Student::Student() {
}
Student::Student(string newStudentID, string newFirstName, string newLastName, string newEmailAddress, int newAge, int newNumDaysInCourse... | true |
36cc093f92a43552c1986ec022953161298de492 | C++ | ToruNiina/Jarngreipr | /jarngreipr/util/parse_range.hpp | UTF-8 | 2,427 | 3.125 | 3 | [
"MIT"
] | permissive | #ifndef JARNGREIPR_PARSE_RANGE_HPP
#define JARNGREIPR_PARSE_RANGE_HPP
#include <jarngreipr/util/log.hpp>
#include <string>
#include <vector>
#include <cstdint>
#include <regex>
#include <numeric>
#include <cassert>
namespace jarngreipr
{
//
// [1,5] -> {1,2,3,4,5}
// [1,5) -> {1,2,3,4}
// (1,5) -> {2,3,4}
// (1,5] ->... | true |
9d8683d50a5b598ca00d9ae4e20d0ea438160ecb | C++ | thedewangan/spoj | /aggrcow.cpp | UTF-8 | 1,017 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
// predicate - with x as minimum diff, C cows are NOT able to fit
bool p(int x, vector<unsigned int> s, int C) {
int cowsAccomodated = 1;
int latestStall = 0;
for(int i = 1; i < s.size(); i++) {
if(s[i] - ... | true |
4f1b95c7bd94b341c1e14c74d25de36075d03810 | C++ | Rayti/humanist-invaders | /include/Foe.hpp | UTF-8 | 478 | 2.578125 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
#include <iostream>
class Foe {
public:
Foe(sf::RenderWindow *window, sf::Sprite sprite, sf::Vector2f position, int speed);
~Foe();
bool is_alive();
void draw_foe();
void move_right();
void move_left();
void move_down();
sf::Vector2f get_positi... | true |
2ef04f241e407760c9aecb269898dbae488add25 | C++ | 136397089/Windows_Projects | /CreatAllParameter - 副本/CreatAllParameter/StatisticeTool.h | GB18030 | 5,441 | 2.65625 | 3 | [] | no_license | #pragma once
#ifndef STATICTOOL_H
#define STATICTOOL_H
#include <string>
#include <vector>
#include <algorithm>
#include "number/NumberInter.h"
#include "Number/commonfunction.h"
using namespace std;
struct StaticResults
{
float RiseDayRate;//ռ
float FallDayRate;//ռ
float MaxRise;//ǵ
CDate BeginDat... | true |
43223488d59177e0dca0c38d330574ed9c99711f | C++ | anasmoni/competitive-programming | /uva_cpp/11727uva.cpp | UTF-8 | 349 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
#define nmax(a,b,c) (max(a,b)>c ? max(a,b) : c)
#define nmin(a,b,c) (min(a,b)<c ? min(a,b) : c)
using namespace std;
int main()
{
int t ;
cin>>t;
for(int i=1 ; i<=t ; i++)
{
int a,b,c;
cin>>a>>b>>c;
cout<<"case "<<i<<": "<<a+b+c-nmax(a,b,c)-nmin(a,b,c)<<... | true |
f0f4ee1f8f75cfade747ee2fd2f7cf53a323f7e5 | C++ | mflehmig/Adept-2 | /include/adept/Minimizer.h | UTF-8 | 8,598 | 2.828125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"GFDL-1.1-or-later",
"Apache-2.0"
] | permissive | /* Minimizer.h -- class for minimizing the cost function of an optimizable object
Copyright (C) 2020 European Centre for Medium-Range Weather Forecasts
Author: Robin Hogan <r.j.hogan@ecmwf.int>
This file is part of the Adept library.
*/
#ifndef AdeptMinimizer_H
#define AdeptMinimizer_H 1
#include <ade... | true |
25a872faaf982b16de21a8ab5953b99706c13042 | C++ | jonasdahl/cprog-lab3 | /sword.cpp | UTF-8 | 254 | 2.65625 | 3 | [] | no_license | #include "sword.h"
#include <sstream>
using namespace std;
namespace lotr {
string Sword::to_string() const {
stringstream stream;
stream << Weapon::to_string() << endl;
stream << "Det är ett svärd också" << endl;
return stream.str();
}
} | true |
256316f890b9e95d5161dab06fe36518c1f247da | C++ | JulienZeng/bky-data-structure | /百科园-第五章/原题/1/Program.cpp | GB18030 | 4,280 | 3.671875 | 4 | [] | no_license | /*------------------------------------------------
ơ
--------------------------------------------------
ÿԪؾΪһַ˳
ΪǰУԪΪ'#'ʱʾýΪգ
дαС
뽨ǰС
αС
1
ab##c##
1
abc
--------------------------------------------------
ע⣺Դ¡Ķ
mainеκݣں
Ļbeginend֮д䡣
*********Begin******************** End **********ɾ
------------... | true |
ef1807d7683188eec7e17668151c53e0e53a2bc8 | C++ | hetpatel4902/cpp_programs | /cpp_practicals/Pro25.cpp | UTF-8 | 577 | 3.546875 | 4 | [] | no_license | #include<iostream>
using namespace std;
class PointS
{
int x,y;
public:
PointS ( int x1, int y1 )
{
x = x1;
y = y1;
}
PointS (const PointS &p1)
{
x = p1.x;
y = p1.y;
}
int getX()
{
return x;
}
int getY()
... | true |
a34e00dd5401a2cf4e548b871e8d36559681c314 | C++ | believeszw/LeetCode | /AllQuestions/title1.cc | UTF-8 | 1,340 | 3.3125 | 3 | [] | no_license | //
// Created by PC-Saw on 2018/12/25.
// Copyright (c) 2020 believe. All rights reserved.
//
#include "util.h" // NOLINT
#include <unordered_map>
#include <vector>
// 题号 1 : Two Sum
//
// Given an array of integers, return indices of the two numbers such that they
// add up to a specific target.
//
// You may assume... | true |
2641462dba96585acea9c191282491c78c31f1da | C++ | zhang165/simpleShader | /object.cpp | UTF-8 | 7,541 | 3.296875 | 3 | [] | no_license | #include "object.hpp"
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <cmath>
#include <cfloat>
#include <iostream>
// 2016 Version
bool Object::intersect(Ray ray, Intersection &hit) const
{
// Assert the correct values of the W coords of the origin and direction.
// You can c... | true |
0f77c7742c649aeda4ddae5f2281fa11645ec568 | C++ | scottyfulton/WormholeAdventure2 | /WormholeAdventure_v2/GObject.cpp | UTF-8 | 1,735 | 2.703125 | 3 | [] | no_license | #pragma once
#include "GObject.h"
using namespace glm;
/*
** Each GObject's light sources should be obtained by looping through every object, determining if a GObject is a light,
** then sorting (binarySort) for the 10 closest light sources
*/
GObject::GObject(){}; // implicitly called when child classes are... | true |
f0758f66697750523763ce171351177b3d377b67 | C++ | angelopagliuca/fiea-game-engine | /source/Library.Shared/Factory.h | UTF-8 | 3,017 | 2.984375 | 3 | [] | no_license | #pragma once
#include <gsl/gsl>
#include <limits>
#include "HashMap.h"
namespace FieaGameEngine
{
/// <summary>
/// Our configuration language allows us to express the intention of creating objects, based on the name
/// of their type. Factory, is suitable for use with any interface class that has a de... | true |
8b98fd43a7e67bad397f167e000204f2f5edc738 | C++ | BeatEngine/sieve-of-eratosthenes | /primesSieve.cpp | UTF-8 | 1,733 | 3.703125 | 4 | [] | no_license | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
int* findPrimes(int max = 100)
{
int* arr = (int*)malloc(sizeof(int) * max);
if(arr == 0)
{
return 0;
}
memset(arr,0, sizeof(int)*21);
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
arr[4] = 5;
arr[6] ... | true |
62fb863142ff9264c147bb5ed9a4d972c5480a10 | C++ | ooooo-youwillsee/leetcode | /0000-0500/0421-Maximum XOR of Two Numbers in an Array/cpp_0421/main.cpp | UTF-8 | 197 | 2.609375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "Solution1.h"
int main() {
Solution solution;
vector<int> nums = {3, 10, 5, 25, 2, 8};
int ans = solution.findMaximumXOR(nums);
cout << ans << endl;
return 0;
}
| true |
b6a6f4e9700ae1bcb1438858edbe478234a43de3 | C++ | howlie190/POSD_HW3 | /term.h | UTF-8 | 265 | 2.78125 | 3 | [] | no_license | #ifndef term_h
#define term_h
#include <string>
using std :: string;
class Term {
public:
virtual string symbol() const = 0;
virtual string value() const { return symbol(); }
virtual bool match(Term &term) { return symbol() == term.symbol(); }
};
#endif | true |
46ab4114c973f27b1693155fa9d1104dda564dd0 | C++ | msanchezzg/UVaOnlineJudge | /12000-12999/12403/saveSetu_12403.cpp | UTF-8 | 366 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main(){
int total,donacion,casos,i;
total=0;
i=0;
string entrada;
cin>>casos;
while(i<casos){
i++;
cin>>entrada;
if (entrada.compare("report")==0) cout<<total<<endl;
else{
cin>>donacion;
total+=donacion;
}
... | true |
dfaea1f8feac3f5dca7609eb9b661bc12b064258 | C++ | webformation/initiationCPP | /exceptionCapteur.h | UTF-8 | 637 | 2.796875 | 3 | [] | no_license | #ifndef EXCEPTIONCAPTEUR_H_INCLUDED
#define EXCEPTIONCAPTEUR_H_INCLUDED
class exceptionCapteur {
private:
string message;
public:
exceptionCapteur(string message) : message(message) {}
string what() {
return message;
}
};
class capteurParametreInvalide : public exceptionCapteur {
public:
... | true |
f6fbed74bb9d83eb6e34af688e098913a73a7331 | C++ | vyomkeshj/TriangulationFEM | /Source/point_cloud_reader.cpp | UTF-8 | 708 | 2.953125 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "../headers/point_cloud.h"
using namespace std;
using namespace algorithms;
vector<Vec3D *> point_cloud_reader::get_point_cloud() {
vector<Vec3D *> points = vector<Vec3D *>();
cout << "Loading: ";
string filename = "Resou... | true |
12d26d3d87226d3870925e0f7456d9e86b1a25dd | C++ | ggmorais/flappybird-sfml | /sources/Pipes.cpp | UTF-8 | 2,189 | 3.046875 | 3 | [] | no_license | #include <Pipes.hpp>
#include <Player.hpp>
#include <constants.hpp>
Pipes::Pipes(std::string texturePath)
{
if (!m_texture.loadFromFile(texturePath))
std::cerr << "Error loading pipes texture\n";
m_sprite_top.setTexture(m_texture);
m_sprite_bottom.setTexture(m_texture);
m_sprite_top.setScale(... | true |
3ba68a7aa100aeac13cb5d1733a24cc9b621a4b3 | C++ | cyberfenrir/programs-C | /Untitled4.cpp | UTF-8 | 766 | 3.421875 | 3 | [] | no_license | #include<iostream.h>
#include<stdlib.h>
#include<string.h>
using namespace std;
int main( )
{
char str1[800], str2[800];
cout<<"Enter first string: ";
cin.getline(str1, 800);
cout<<"Enter second string: ";
cin.getline(str2, 800);
int l = 0; //Hold length of second string
//finding... | true |
f6c8ee6f9d2daa9cf8722358b440dc962ee320b8 | C++ | Cookiefan/ZigZag | /Zigzag/May/CF#354/D.cpp | UTF-8 | 1,953 | 2.5625 | 3 | [] | no_license | #include <bits/stdc++.h>
#define maxn 1200
using namespace std;
int v[maxn][maxn][4];
int mp[maxn][maxn][4];
struct point
{
int x, y, z;
point(){}
point(int x, int y, int z):x(x),y(y),z(z){}
friend point operator +(point a, point b)
{
return point(a.x+b.x, a.y+b.y, (a.z+b.z)%4);
}
friend bool operator ==(point... | true |
60ebbc5f0d4674ebdabba3e50fd4531768f15556 | C++ | Wilhelmshaven/LeetCode-OJ | /LeetCode OJ/Number of Digit One.cpp | UTF-8 | 452 | 2.890625 | 3 | [] | no_license | int countDigitOne(int n) {
if (n<1)return 0;
long ten = 1, cnt = 0, right, left, now;
while (n / ten != 0)
{
right = n%ten; //High NUM
left = n / (ten * 10); //Low NUM
now = (n / ten) % 10; //Now Dight
if (now == 0)cnt = cnt + left*ten;
else if (now == 1)cnt = cnt + left*ten + 1 + right;
... | true |
caf81688f8f9c3582c6286bcdf2435bf04d60719 | C++ | ortlaz/Laba2 | /include/Massive.h | WINDOWS-1251 | 767 | 3.171875 | 3 | [] | no_license | #ifndef MASSIVE_H
#define MASSIVE_H
#include <cstdlib>
class Massive
{
std::size_t last; //-
int *data; //
std::size_t max_elem; //
public:
int pop(void); //
void push(int);//
int size(void);//
bool empty(void);//
Massive();
... | true |
7f968bd4a661affba35d8590a9b0ded27eb4674b | C++ | exetr/CS2040C | /Problem Sets/ps2b.cpp | UTF-8 | 3,887 | 3.59375 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class LinkedList {
struct Node {
char c;
Node* next;
};
public:
Node* head;
//constructor
LinkedList() {
head = NULL;
}
void insertNode(int pos, char c) {
//insert data into new ... | true |
f76c2f25f38ed84f7b7e1995390c5e2f9449892d | C++ | contrapct/onlinej | /valid palindrome.cpp | UTF-8 | 1,627 | 3.21875 | 3 | [] | no_license | class Solution {
public:
bool isPalindrome(string s) {
int start=0,end = s.length()-1;
int ch_start=0,ch_end=0;
while(start<=end){
if(start == end) return true;
ch_start=0,ch_end=0;
while(start <= end && !('a'<=s[start] && s[start]<='z') )
if(!('A... | true |