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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a4956972a8be12c230d4022ef8350c8c8fb1c61b | C++ | Chrinkus/wumpus | /src/Random_utils.h | UTF-8 | 2,063 | 3.4375 | 3 | [
"MIT"
] | permissive | //
// Created by Chris Schick on 2018-06-05.
//
#ifndef WUMPUS_RANDOM_UTILS_H
#define WUMPUS_RANDOM_UTILS_H
#include <random>
#include <chrono>
#include <vector>
class Random_int {
public:
Random_int()
: ran{static_cast<unsigned int>(std::chrono::system_clock::now()
.time_since_epoch().count(... | true |
a5b88958feb8fa67225fcccb69e90e55156abb97 | C++ | pahowes/hash-test | /include/murmur_hash.hpp | UTF-8 | 3,660 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | /**
* @file murmur_hash.hpp
*/
#pragma once
#include "hash_base.hpp"
#include "MurmurHash1.h"
#include "MurmurHash2.h"
#include "MurmurHash3.h"
class murmurhash1 : public hash_base<murmurhash1, uint32_t> {
public:
std::string do_name() {
return "MurmerHash1";
}
uint32_t do_hash(const void* d... | true |
9d726405ab9ffc3bb8879be0090b57aec3e0af45 | C++ | sssphil/openeb | /sdk/modules/core/cpp/include/metavision/sdk/core/algorithms/flip_y_algorithm.h | UTF-8 | 4,501 | 2.609375 | 3 | [] | no_license | /**********************************************************************************************************************
* Copyright (c) Prophesee S.A. *
* ... | true |
1441005a66f8185c739323389772ce25bd855dcf | C++ | Mervap/ITMO | /LabsDM/term1/3/Z2/Z2.cpp | UTF-8 | 724 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <fstream>
using namespace std;
int main() {
freopen("gray.in", "r", stdin);
freopen("gray.out", "w", stdout);
int n;
cin >> n;
vector<string> a;
a.push_back("0");
a.push_back("1");
for (int i = 1; i < n; i++) {
... | true |
fd3d5e4030ee296fed549fd803b595c9020769f6 | C++ | Funto/Tohoku-Engine | /src/glm/BACKUP/core/type_mat3x3.inl | UTF-8 | 16,054 | 3.140625 | 3 | [] | no_license | ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2005-01-27
// Updated : 20... | true |
c15eca2d816f57d02d03def26b61cf8e961f6eac | C++ | ChaoXs08201991/Information-Theory-Source-Coding | /C++ Source Code/Shannon Fano/fano.h | UTF-8 | 7,784 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
using namespace std;
class Fano
{
public:
struct FanoNode
{
unsigned char value; // 字符
struct FanoNode *Lchild = NULL; //左孩子
struct FanoNode *Rchild = NULL; //右孩子
};
private:
struct CountVector
{
unsigned char value;
i... | true |
8a4d3d3f9293183128ec088d6c419c9784aaa003 | C++ | Dakimakura/Homework-ICS-2 | /1337 [BA1002] The Account class/Latest Submission/source.h | UTF-8 | 626 | 4.03125 | 4 | [] | no_license | class Account{
private:
int id;
double balance, rate;
public:
Account(){
id = 0;
balance = 0;
rate = 0;
}
Account(int a, double b, double c){
id = a;
balance = b;
rate = c;
}
double getMonthlyInterestRate(){
return r... | true |
7056d0ed09345494a36c4aade6a699255394a779 | C++ | ZSShen/IntrospectiveProgramming | /LintCode/Foundation/DataStructures_II/139_Subarray_Sum_Closest.cpp | UTF-8 | 1,678 | 3.453125 | 3 | [] | no_license |
class Solution {
public:
/*
* @param nums: A list of integers
* @return: A list of integers includes the index of the first number and the index of the last number
*/
vector<int> subarraySumClosest(vector<int> &nums) {
// write your code here
int size = nums.size();
if (... | true |
94b036029e3f79121f3ac7a551282949475e5ca7 | C++ | FerreyJ/estructuras-repetitivas-en-cpp | /ejercicio 7 seccion 4 Joseph.cpp | UTF-8 | 348 | 3.546875 | 4 | [] | no_license | /*7. Escriba un programa que calcule el valor de:
1+2+3+...+n.*/
#include<iostream>
#include<conio.h>
using namespace std;
int main(){
int n,suma=0;
cout<<"Introduzca el valor del ultimo numero a sumar: ";cin>>n;
for(int i=1;i<=n;i++){
suma+=i;
}
cout<<"\nLa suma total de "<<n<<" numeros es: "<<suma<<endl... | true |
954545fe9516860596d9edabf552739b94093ce8 | C++ | ming5656/uva | /00271.cpp | UTF-8 | 1,018 | 2.671875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
char input[1024];
while(cin>>input)
{
int len=strlen(input),num(0);
bool ans(true);
for(int i=len-1;i>=0;i--)
{
if(input[i]>='p'&&input[i]<='z')
{
num++;
... | true |
71b9d14923e78270720cff1d6597845a8e110d2e | C++ | SpectrumIM/spectrum2 | /include/transport/ThreadPool.h | UTF-8 | 2,016 | 2.890625 | 3 | [
"BSL-1.0"
] | permissive | #pragma once
#include <boost/bind.hpp>
#include <boost/signals2.hpp>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <queue>
#include <iostream>
#include "Swiften/EventLoop/EventLoop.h"
namespace Transport {
/*
* Thread serves as a base class for any code that has to be excuted as a thread
... | true |
b68eb5ced91c571dcd01775137a3fc104954abc4 | C++ | stefankurz1/pepper_emotion | /emotional_system/theatre_bot/src/Parameters/SpeakParameters/Speak.h | UTF-8 | 641 | 2.546875 | 3 | [] | no_license | ///////////////////////////////////////////////////////////
// Speak.h
// Implementation of the Class Speak
// Created on: 04-dic-2014 04:42:42 p.m.
// Original author: julian
///////////////////////////////////////////////////////////
#if !defined(SPEAK_H_)
#define SPEAK_H_
#include "../Parameter.... | true |
beab033f0dcb4ed184d77a23c80c4501bed420f2 | C++ | joydeeps/boost.asio | /network_programming/threaded_async_client_server/threaded_async_client_server---Example-1---Version-1/my_connection.hpp | UTF-8 | 1,199 | 2.5625 | 3 | [] | no_license | #include <boost/asio.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
class my_connection {
public:
my_connection() // constructor
{
close = false;
// create new socket into which to receive the new connection
this->socket = boost::shared_ptr<boost::asio::ip::tcp::socket>(
... | true |
98615058ade55d967538e67de89b2db02225f6d8 | C++ | zhengweifu2018/fungame | /src/fungame/math/Matrix4.cpp | UTF-8 | 6,329 | 2.671875 | 3 | [] | no_license | //
// Matrix4.cpp
// fungame_libs
//
// Created by zwf on 11/12/2015.
// Copyright © 2015 com.zwf. All rights reserved.
//
#include "fungame/math/Matrix4.h"
#include "fungame/math/Vector3.h"
#include <math.h>
namespace fungame { namespace math {
Matrix4::Matrix4() {
identity();
}
... | true |
da6bf02117ef907660462b40b74acc63723ad267 | C++ | MatteoSalvalaggio/Cplusplus_exercises | /practical_7_exercise_2.cpp | UTF-8 | 1,513 | 3.78125 | 4 | [] | no_license | #include <iostream>
using namespace std;
template <typename T> class StackI {
public:
virtual void push(T t) = 0;
virtual void pop () =0;
virtual T top() = 0;
virtual bool isEmpty() = 0;
virtual void print() = 0;
};
template <typename T> class Stack:StackI<T>{
protected:
int firstindex;
int elements... | true |
5a63e9228339245d38b57e6f4567027142b82326 | C++ | janranz/college | /CS311/studentRecordsDB/menu.hpp | UTF-8 | 880 | 2.9375 | 3 | [] | no_license | #pragma once
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include "student.hpp"
using std::string;
using std::vector;
using std::ofstream;
using std::cout;
using std::cin;
using std::endl;
using std::sort;
class Menu
{
private:
bool yayNay = false; // general I/O
... | true |
75d884cb577ba3944caaab0b95cd0476b05a9210 | C++ | BoneLord/CreatorCharacterDND4 | /character/characteristics/deity/typeDeity/ioun/ioun.cpp | UTF-8 | 759 | 2.640625 | 3 | [] | no_license | #include "character/characteristics/deity/typeDeity/ioun/ioun.h"
Ioun * Ioun::pIoun = 0;
IounDestroyer Ioun::destroyer;
Ioun::Ioun() {
mAlignment = unaligned;
}
Ioun::Ioun(const Ioun& b) {
}
Ioun& Ioun::operator=(const Ioun& b) {
return *this;
}
Ioun::~Ioun() {
}
Ioun& Ioun::getInstance() {
if (!pIoun... | true |
931f4279c08e3cf6a5d6f840c57458a94afcf275 | C++ | eracs/toy_jvm | /src/classpath/DirClasspathEntry.cpp | UTF-8 | 1,115 | 2.671875 | 3 | [
"MIT"
] | permissive | #include <utility>
#include "DirClasspathEntry.h"
#include "../file_reader/file_reader.h"
#include "../utils/string_utils.h"
#include "spdlog/spdlog.h"
using namespace std;
using namespace string_util;
DirClasspathEntry::~DirClasspathEntry()
{
}
DirClasspathEntry::DirClasspathEntry(std::string dirPath) : dirPath(st... | true |
2b972b5b46adf9074dd0742dde5968ba8f422445 | C++ | JuanGonzalez9/Cucurucho | /src/EscuchadorDeAcciones.cpp | UTF-8 | 2,390 | 2.859375 | 3 | [] | no_license | /*
* EscuchadorDeAcciones.cpp
*
* Created on: Oct 15, 2018
* Author: juan
*/
#include "EscuchadorDeAcciones.h"
EscuchadorDeAcciones::EscuchadorDeAcciones() {
jugando = true;
if (SDL_Init (SDL_INIT_VIDEO) < 0) {
cout<<"No se pudo inicializar SDL"<<endl;
jugando = false;
}
}
string EscuchadorDeAccion... | true |
b2b0484f105ca68b182b8d74601a1d040a307d9b | C++ | lsa-src/ArduinoBible | /본문소스/CH_27_18/CH_27_18.ino | UTF-8 | 1,193 | 3.0625 | 3 | [] | no_license | #include <SPI.h>
#define DELAY_BETWEEN_TRANSFER_US 100 // transfer 함수 사이 시간 간격
void setup (void) {
SPI.begin (); // SPI 통신 초기화
Serial.begin(9600);
}
void loop (void) {
uint8_t from_slave; // 슬레이브로부터의 수신 데이터
String receive_data = ""; // 수신 데이터 버퍼
// 안정적인 전송을 위해 전송 속도를 1MHz로 낮춤
SPI.beginTrans... | true |
225c510d307cf747e3dfedbf15990a4c12a55dd2 | C++ | cdcurtis/BioSystem | /Headers/Operations/Output.h | UTF-8 | 1,566 | 2.859375 | 3 | [] | no_license | /*
* Output.h
*
* Created on: Jun 2, 2017
* Author: chriscurtis
*/
#ifndef HEADERS_OPERATIONS_Output_H_
#define HEADERS_OPERATIONS_Output_H_
#include "Operation.h"
#include <vector>
namespace BioCoder
{
class Output:public BioCoder::Operation{
Container* __inputs;
std::vector<Property*> __properties;
... | true |
718eef7bb22f88e94ec5edf95624e85e2a187bdb | C++ | Javanater/utilities | /src/utilities.cpp | UTF-8 | 2,468 | 2.84375 | 3 | [] | no_license | /*
* utilities.cpp
*
* Created on: Apr 15, 2016
* Author: Madison
*/
#include <utilities/utilities.hpp>
#include <utilities/Monitor.hpp>
#include <map>
using namespace std;
using boost::posix_time::ptime;
using boost::posix_time::time_input_facet;
using boost::posix_time::time_facet;
using boost::gregorian... | true |
949ed4f9731f2588f1d16e9ed042581501e924bf | C++ | msrai92/Linked-List-Addition-and-Multiplication | /hw1/main.cpp | UTF-8 | 1,696 | 3.21875 | 3 | [] | no_license | //
// main.cpp
// hw1
//
// Created by Manvir Rai on 6/8/17.
// Copyright © 2017 Manvir Rai. All rights reserved.
//
#include <iostream>
#include "ArgumentManager.h"
#include "DoubleLinkedList.h"
#include <fstream>
int main(int argc, char* argv[])
{
if (argc < 2) {
std::cerr << "Usage: infinitearithmet... | true |
3165910e1789afd80c687273082ae1c2f1f24366 | C++ | ebadusb/Common | /tools/config_parse/unit_test/test1/test1_main.cpp | UTF-8 | 32,564 | 2.859375 | 3 | [] | no_license | // $Header$
//
// Main program for config_parse unit test 1
//
// $Log: test1_main.cpp $
// Revision 1.1 2005/05/11 15:15:03Z jl11312
// Initial revision
// Revision 1.2 2005/01/24 16:01:26Z jl11312
// - updated for new version of configuration parse utility
// Revision 1.1 2004/07/21 19:00:38Z jl11312
// Initial... | true |
bd45df162fefe44999e9870bcb2e84f216ff519e | C++ | acnokego/LeetCode | /389_Find_the_Difference/hash.cpp | UTF-8 | 532 | 3.21875 | 3 | [] | no_license | class Solution {
/*
* Complexity: O(n)
* Space: O(n)
*/
public:
char findTheDifference(string s, string t) {
unordered_map<char, int>occurrence;
for(auto& c:s){
occurrence[c] += 1;
}
for(auto& c:t){
auto it = occurrence.find(c);
if(it ==... | true |
e682289cd057c361c0bd97231cc3fc2e6a6f48f7 | C++ | lyonsno/cubes | /collisionPlane.cpp | UTF-8 | 3,357 | 2.875 | 3 | [] | no_license | #include "collisionPlane.h"
CollisionPlane::CollisionPlane() : depth(10), camera(new Camera()){}
CollisionPlane::CollisionPlane(float depth, Camera* camera) : depth(depth), camera(camera)
{
}
glm::vec4 CollisionPlane::worldFromScreenCoords(float winX, float winY)
{
std::cout<<"getWorld"<<std::endl;
float aspect =... | true |
d65bbe3b4497c5473f98fa521d953a6219396c0f | C++ | bshkola/StreetSimulator | /common/traffic/pedestrian.h | UTF-8 | 536 | 2.546875 | 3 | [] | no_license | //Author: Wojciech Ceret
//Represent move object on the board
#ifndef PEDESTRIAN_H
#define PEDESTRIAN_H
#include "trafficparticipant.h"
#include "../../view/items/pedestrianitem.h"
struct Pedestrian : public TrafficParticipant {
Pedestrian(int id, float speed, std::pair<int, int> start_point, std::pair<int, int> ... | true |
5cf820193a3d0e5ba2bc804a76a6b1de5e52ce09 | C++ | chubbymaggie/irreg-simd | /euler/seq-tiling/tile_euler.cpp | UTF-8 | 2,955 | 2.546875 | 3 | [] | no_license | #include <atomic>
#include <unordered_map>
#include <fstream>
#include <iostream>
#include <math.h>
#include <omp.h>
#include <sstream>
#include <thread>
#include <tuple>
#include <vector>
#include <x86intrin.h>
#include "SSE_API_Package/SSE_Template/sse_api.h"
#include "conf.h"
#include "../../tools/csr_loader.h"
#in... | true |
905fbfb3df7cb15f177168f6e706b0d9d08fe75e | C++ | allipurHari/DataStructure | /queue/evaluate-expression.cpp | UTF-8 | 763 | 3.3125 | 3 | [] | no_license | // https://www.interviewbit.com/problems/evaluate-expression/
int Solution::evalRPN(vector<string> &A) {
stack<string>s;
int len = A.size(), first, second, temp;
for(int i = 0;i < len;i++){
if(A[i] == "+" || A[i] == "-" || A[i] == "*" || A[i] == "/"){
second = stoi(s.top());s.pop();
... | true |
cfcd6405f51a6b54ef10814c9f39ae71f0f9b5fb | C++ | eeeeeta/inebriated-cpp-edition | /rand.cpp | UTF-8 | 1,832 | 3.03125 | 3 | [] | no_license | /*
* Random number generation, weighting, and all that good stuff(tm)
*/
#include "rand.hpp"
#include <iostream>
using namespace Markov;
Key *Rand::randomKey(Key *kp) {
int wt_sum = 0;
for (auto k : *kp) {
#ifdef DEBUG
std::cout << "MDB: weight for " << k->ptr->val << " is " << k->ptr->getWeight() <<... | true |
489d1f7b5683d19cedd0e4ae92c266b6c276ce04 | C++ | LBNL-UCB-STI/routing-framework | /Tools/Bitwise.h | UTF-8 | 3,144 | 3.5 | 4 | [
"MIT",
"GPL-3.0-only"
] | permissive | #pragma once
#include <bitset>
#include <cassert>
#include <limits>
namespace bitwise {
// We add an overloaded version of __builtin_clz.
inline int builtin_clz(const unsigned int x) { return __builtin_clz(x); }
inline int builtin_clz(const unsigned long x) { return __builtin_clzl(x); }
inline int builtin... | true |
cb1beb0d248acace9af6a298a0cff976d0e36f39 | C++ | katarinasupe/NapredniCpp | /hash/src/lookup-seq-main.cpp | UTF-8 | 3,232 | 3.453125 | 3 | [] | no_license |
#include "lookup-seq.h"
#include <string>
#include <iostream>
bool predicate_function_key(std::pair<std::string, int> bucket_value)
{
return bucket_value.first == "Katarina";
}
bool predicate_function_value(std::pair<std::string, int> bucket_value)
{
return bucket_value.second == 989898;
}
//testiranje p... | true |
bfa8c00cf1069d7a64b3552c5cc04f61cf296904 | C++ | niyaznigmatullin/nncontests | /utils/IdeaProject/archive/unsorted/2015.05/2015.05.03 - Yandex Algorithm 2015 Warm up Round/e.cpp | UTF-8 | 2,097 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct state {
signed char x1;
signed char y1;
signed char x2;
signed char y2;
};
vector<pair<int, int> > get(int p1, int q1) {
return {{-p1, -q1}, {-p1, q1}, {p1, -q1}, {p1, q1}, {-q1, -p1}, {-q1, p1}, {q1, -p1}, {q1, p1}};
}
int from... | true |
5cc112741f016928d53aa82c564c35943c3c7dad | C++ | rafalzuk/HPC_copy | /burgers.cpp | UTF-8 | 51,140 | 2.875 | 3 | [] | no_license | #include "BURGERS.h"
#include "cblas.h"
//#include <array>
//#include <numeric>
Burgers::Burgers(const Model& model)
{
/*Import some parameters, to avoid calling getters
of Model class every time these are needed, thus boost performance */
Dx = model.GetDx();
Dy = model.GetDy();
Dt = model.GetDt();
// Physic... | true |
a19cb09eabb8e5e8d70134533fe1906da894ccac | C++ | nathan-mhk/COMP_2012_PA4 | /utils.cpp | UTF-8 | 5,117 | 3.109375 | 3 | [] | no_license | #include "utils.h"
Utils::Utils() {}
Utils::~Utils()
{
tree.release();
}
bool Utils::loadDictionary(const string& text_dic)
{
// load the file with name text_dic, and save all characters in this->content
ifstream load_file(text_dic);
if (!load_file.is_open()) {
cout << "Failed to load the ar... | true |
a3f79f149a6857dc364ff5c0fc5adbc9fc1499ec | C++ | bobbyshashin/tesla_coding_challenge | /challenge/supercharger_graph.h | UTF-8 | 3,135 | 3.140625 | 3 | [] | no_license | #ifndef SUPERCHARGER_GRAPH_H_
#define SUPERCHARGER_GRAPH_H_
#include <cmath>
#include <limits>
#include <memory>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
#include "network.h"
class SuperchargerGraph {
public:
// delete the default constructor
SuperchargerGraph() = delete;
/... | true |
063bd6b34ef2f7b730ee6150dd6b086d05e1fec8 | C++ | akalsi87/pcsh | /include/pcsh/arena.hpp | UTF-8 | 1,789 | 2.796875 | 3 | [] | no_license | /**
* \file arena.hpp
* \date Jan 28, 2016
*/
#ifndef PCSH_ARENA_HPP
#define PCSH_ARENA_HPP
#include "pcsh/exportsym.h"
#include <algorithm>
#include <cstring>
#include <new>
#include <type_traits>
namespace pcsh {
//////////////////////////////////////////////////////////////////////////
/// arena
... | true |
1cca477a2459cfeddecad1d118fa6aa55c6388ec | C++ | patilsatish/local_beamforming | /tdoa-test.cc | UTF-8 | 1,507 | 2.546875 | 3 | [] | no_license | /* Created on 2016-08-16
* Author: Zhang Binbin
*/
#include <stdio.h>
#include <string.h>
#include "tdoa.h"
#include "ds.h"
#include "data.h"
static void DelaySequence(float *in_data, int num, int delay, float *out_data) {
for (int i = 0; i < num; i++) {
if (i - delay >= 0 && i - delay < num) {
... | true |
4f380f91f5568ba15a3b55f9eee6e725188917b0 | C++ | trarck/mylibs | /yh/io/Buffer.h | UTF-8 | 25,907 | 2.59375 | 3 | [] | no_license | #ifndef YH_IO_BUFFER_H_
#define YH_IO_BUFFER_H_
#include "../YHMacros.h"
#include "../base/Ref.h"
#include "../platform/Internals.h"
#include "../platform/YHStdC.h"
#include "IOMacros.h"
#include "IeeeHalfPrecision.h"
NS_YH_IO_BEGIN
/**
* 字节操作类
*/
class Buffer:public Ref
{
public:
Buffer();
Buff... | true |
16dc443131d0907bf3ef6b96b6a9723415dc2d6c | C++ | southern-yan/OJ_code | /求最大连续bit数.cpp | GB18030 | 549 | 3.34375 | 3 | [] | no_license | Ŀ
һbyteֶӦĶ13ĶΪ0000001121
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
int count=0,maxcount=0;
while(n)
{
if(n&1)
{
count++;
maxcount=max(count,maxcount);
}
... | true |
e40f28fd99e79808f4ccb489f222622276223353 | C++ | Sabuj-Kumar/Problem_Solve | /lightoj online/Light Oj Beginner/Light oj 1212 - Double Ended Queue.cpp | UTF-8 | 1,682 | 3.28125 | 3 | [] | no_license | #include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int test,value,i,j;
scanf("%d",&test);
for(i = 1; i <= test; i++)
{
deque<int> input;
int s,limit;
cout<<"Case " << i <<":\n";
cin>>s;
cin>>limit;
for(j = 0; j... | true |
6c6a5bd044d94ee3d96f711e5b4af3f4b0aae45a | C++ | LUS1N/EAAA_ProgrammingLanguagesExam_CPP | /ProgLangExamCpp/Crate.cpp | UTF-8 | 866 | 3.203125 | 3 | [] | no_license | #include "stdafx.h"
#include "Crate.h"
Crate::Crate()
{
}
Crate::~Crate()
{
for (auto const& value : *this->products) {
delete value;
}
}
float Crate::calculatePrice()
{
float basePrice = calculateBasePrice();
int bonus = calculateBonusPercentage();
basePrice += basePrice / 100.0 * bonus... | true |
eee25c7e29596c8286d6ec3d02b569803584e51d | C++ | Passw/BPlusTreeBase | /src/BPlusTreeBaseInternalNode.hpp | UTF-8 | 12,479 | 2.984375 | 3 | [
"MIT"
] | permissive | #ifndef BPLUSTREEBASEINTERNALNODE_H
#define BPLUSTREEBASEINTERNALNODE_H
#include <vector>
#include <memory>
#include <functional>
#include "BPlusTreeBaseNode.hpp"
__B_PLUS_TREE_NODE_TEMPLATE__
class BPlusTreeBaseInternalNode : public __B_PLUS_TREE_BASENODE_CLASS__
{
typedef __B_PLUS_TREE_BASENODE_CLASS__ Node;
... | true |
1618e05a9474a95fa4b4d794093792aa20efcb7c | C++ | mmmim24/CP | /random_CF/1332C.cpp | UTF-8 | 923 | 2.515625 | 3 | [] | no_license | #include <string.h>
#include <stdio.h>
#define MAX(a,b) ((a>b)?a:b)
using namespace std;
char s[1000000], chars_c[100000], maxs[100000];
int tochange, n, k, max, chars[27];
char check(int i, char gg){
printf("checking %c - ", gg);
int count = 0;
for(int ix=i; ix<n; ix+=k){
if(s[ix]==gg) count++;
p... | true |
81e6530e17f457a3cc61fcde2eb91c94924ebfac | C++ | Zyrst/Fallen-Stars | /Fallen Stars/SpriteSheet.h | UTF-8 | 893 | 3.046875 | 3 | [] | no_license | #pragma once
#include <SFML/System/Vector2.hpp>
#include <SFML/Graphics/Rect.hpp>
#include <vector>
/* Note: This is a helper class for generating frames and doesn't actually contain a texture.
*
* Can be used to split a sprite sheet into separate frame rectangles. It simplifies generating
* frames by treating th... | true |
18adcc127f59e5b92030a6cd83b326a523c8e1f8 | C++ | techtim/trippybird | /app/src/main/jni/Utils.hpp | UTF-8 | 8,119 | 2.59375 | 3 | [] | no_license | //
// Created by Timofey Tavlintsev on 4/27/16.
//
#pragma once
#include <EGL/egl.h>
#include <GLES/gl.h>
#include <vector>
#include <math.h>
#include <stdlib.h>
#define FLT_EPSILON 1.19209290E-07F
#define BUFFER_OFFSET(i) ((char*)NULL + (i))
enum SHADER_ATTRIBUTES {
ATTRIB_VERTEX,
ATTRIB_NORMAL,
ATTRI... | true |
8a305734a38a1b6fc2d40a1050adb16c117e9a3d | C++ | LeviMollison/GameProgramming | /Relearning C++/Practice/Practice/classes.cpp | UTF-8 | 510 | 2.984375 | 3 | [] | no_license | //
// classes.cpp
// Practice
//
// Created by Levi Mollison on 2/2/16.
// Copyright © 2016 Levi. All rights reserved.
//
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
class Simplest {};
class Simple{
public:
void display(){
cout << "Displaying a simple object\n";
... | true |
c4c54bc44244ad7f81036824104efb90738f96ef | C++ | JosnickCB/AED | /aed_list.cpp | UTF-8 | 9,812 | 3.484375 | 3 | [] | no_license | #include <iostream>
using namespace std;
template <class Type>
struct nodeType{
Type info;
nodeType<Type> *link;
};
template <class Type>
class linkedListIterator{
public:
linkedListIterator();
linkedListIterator(nodeType<Type> *ptr);
Type operator*();
linkedListIterator<Type> operator++();
bool operator=... | true |
9c222d3c1158c932451dc895c9c22f468317c183 | C++ | Minumu/CPP-Rush00 | /Ship.cpp | UTF-8 | 679 | 2.875 | 3 | [] | no_license | #include "Ship.hpp"
Ship::Ship() {
_size = 1;
_hp = 3;
_who = "}";
}
Ship::Ship(int size, int hp, std::string who) : _size(size), _hp(hp), _who(who) { }
Ship::~Ship() { }
Ship::Ship( Ship const & src) {
*this = src;
}
Ship & Ship::operator=(Ship const & rhs) {
_hp = rhs.getHp();
_size = rhs.getS... | true |
f04ce0e2923c6c20d6a486aa99b76f7f61a3443a | C++ | yushiyaogg/backup | /practice/algorithm_practise/algorithm_design/Fulkerson.h | UTF-8 | 1,366 | 3.046875 | 3 | [] | no_license | //Fulkerson.h header file
//Standard Ford-Fulkerson Algorithm
//Author: Fengdong
#include <stack>
#include <list>
using namespace std;
typedef pair<int,int> flowPair;
typedef struct _node
{
int number;
int C;
int F;
struct _node* next;
_node(int _number,int _C)
{
... | true |
61048a865509152aa7afe76aaec7150e6ca4946e | C++ | AnnVita/i-love-oop | /Car/tests/carTests.cpp | UTF-8 | 4,292 | 3.1875 | 3 | [] | no_license | #include "stdafx.h"
#include "../Car/car.h"
struct CarFixture
{
CCar car;
};
BOOST_FIXTURE_TEST_SUITE(Car, CarFixture)
BOOST_AUTO_TEST_SUITE(when_the_newly_constructed)
BOOST_AUTO_TEST_CASE(engine_is_turned_off_by_default)
{
BOOST_CHECK(!car.IsTurnedOn());
}
BOOST_AUTO_TEST_CASE(speed_is_zero_by_de... | true |
dba4570200f152c637277cd16b0e1617236d6967 | C++ | luqian2017/Algorithm | /LintCode/1125_Jump-Pillar/1125_Jump-Pillar.cpp | UTF-8 | 926 | 2.984375 | 3 | [] | no_license | class Solution {
public:
/**
* @param h: the height of n pillar
* @param k: the limit
* @return: Xiao Yi can or can't reach the n-th pillar
*/
bool jumpPillar(vector<int> &h, int k) {
int len = h.size();
vector<vector<int>> dp(len, vector<int>(2, 0));
//dp[i]... | true |
ad868c5a59264ad470d78e1ee72929cffc797b8e | C++ | jiramateGitHub/LAB-88814459 | /LAB_09/LAB_9-1/BankAccount.cpp | UTF-8 | 719 | 3.296875 | 3 | [] | no_license | #include "BankAccount.h"
BankAccount::BankAccount()
{
name = "";
}
int BankAccount::initial_value(string n,double m){
name = n;
if(m >= 500){
balance = m;
cout << "Deposit " << balance << " Complete. " << endl;
printInfo();
return 1;
}else{
cout << "Can't Deposit " << m << endl;
}
}
void BankAccount::... | true |
82c6009822769f7cc25fcbde73b925416e33429d | C++ | sky-cfw/comm | /test/performance/test_false_sharing.cpp | UTF-8 | 3,084 | 3.203125 | 3 | [] | no_license | /*
参考:https://github.com/MJjainam/falseSharing/blob/master/parallelComputing.c
*/
#include <sys/times.h>
#include <time.h>
#include <stdio.h>
#include <pthread.h>
struct timespec tpBegin1,tpEnd1,tpBegin2,tpEnd2,tpBegin3,tpEnd3; //These are inbuilt structures to store the time related activities
double compute(s... | true |
17d9b6acbd4eadbd59862870aa0cf3a4ab9bbacd | C++ | habiss/syntax_checker | /GenStack.cpp | UTF-8 | 618 | 3.140625 | 3 | [] | no_license | /*
#include "GenStack.h"
using namespace std;
GenStack::GenStack(int maxSize)
{
Stack = new char[maxSize];
max = maxSize;
top = -1;
size= 0;
}
GenStack::~GenStack()
{
//need to delete array
cout << "object destroyed" << endl;
}
void GenStack::push(char data)
{
//error checking (is the array full?)
... | true |
4dbb83c494659151049682322f87a277ed98a46a | C++ | hadesbox/arduino-legacy-projects | /libraries/ORSINI_ARPEGGIO/examples/ORSINI_ARPEGGIO/control.ino | UTF-8 | 7,121 | 2.546875 | 3 | [] | no_license | #include <Bounce.h>
byte debounce= 5; // Debounce Time in ms
Bounce channel_mode_up= Bounce( 2, debounce);
Bounce channel_mode_down= Bounce( 3, debounce );
Bounce scale_part_up= Bounce( 4, debounce );
Bounce scale_part_down= Bounce( 5, debounce );
Bounce shift= Bounce( 6, debounce );
bool checkAnalog... | true |
c39bd8ab9975718b19c0b910a35f0a3ff64c92a2 | C++ | checkoutb/LeetCodeCCpp | /daily_challenge/2021/LT_2021-07-07_Reduce_Array_Size_to_The_Half.cpp | UTF-8 | 1,258 | 3.21875 | 3 | [] | no_license |
#include "../../header/myheader.h"
class LT
{
public:
// D D
// sort后,遍历能直接知道个数(==前面就++,不等于的时候就是前值的个数)。 然后个数再sort。
//
// 看到一个桶排序,然后看到限制: arr.length is even. 不过值最高要10^5,桶排序有点不太好吧。。
// for(int i = 0; i < arr.size(); ++i)
// {
// int count = 1;
// while(i < arr.size()-1 && arr[i... | true |
8c079132181e01bce88b977302793ac2f8a764d3 | C++ | Chris443/GeKo | /GeKo/Applications/K_Application/Data.h | UTF-8 | 821 | 2.578125 | 3 | [] | no_license | #pragma once
#include <vector>
//Data for a Cube
float vertices[] = {
//Front
//positions //colors
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,// top right
0.5f, -0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,// bottom right
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,// bottom left
-0.5f, 0.5f, 0.5... | true |
62aa62fdd1420b67093967426876aa58d9c01f6a | C++ | Newpersonhere/cuphead-1 | /entity/entity.h | UTF-8 | 1,115 | 2.765625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "animation/animation.h"
#include "util/vector2d/vector2d.h"
#include "events/eventemitter.h"
#include <SDL2/SDL.h>
#include <map>
class Entity : public EventEmitter
{
public:
Entity(const float& x, const float& y);
virtual ~Entity(){}
int speed = 5;
Vector2D velocity;
Vec... | true |
b5ebfb8440ef4df0111869aa3ab161911f819198 | C++ | jcamilom/aire | /source/main-test.cpp | UTF-8 | 1,512 | 3.171875 | 3 | [] | no_license | #include "select-demo.h"
#include "mbed.h"
// Creates an event bound to the specified event queue
#if DEMO == DEMO_TEST
//counter handlers
class Counter {
public:
Counter(PinName pin) : _interrupt(pin) { // create the InterruptIn on the pin specified to Counter
_interrupt.rise(callback(this, &Count... | true |
31225ca25e685287c58ce168a87cd5443530b9b3 | C++ | AnastasiaYiChen/cPlusPlus_COGS | /PROG2100/A3_afterPWP/main.cpp | UTF-8 | 2,570 | 3.390625 | 3 | [] | no_license | /*Alice's Chess
somewhat inspired by Lewis Carroll's Through the Looking Glass
This kind game of chess is played on a chessboard, at least 8x8 in size, but sizes like 8x10, or 20x10
are OK too. At least two players are needed, each one controlling her/his "army" of chess pieces -
where such antagonistic "armies" are bu... | true |
e045fc15b61ccd676deeedb0978424c92b2f0589 | C++ | jk983294/Store | /DataBus/Include/CUDPReceiver.h | GB18030 | 873 | 2.84375 | 3 | [] | no_license |
/**************************************************
Receiver
˵
ִ߳йѭȡӦ˿ڣҽݷװΪ
ӦĽṹյԭʼݣԭʼݴ洢ڻ
**************************************************/
class CUDPReceiver:public CReceiver
{
public:
CUDPReceiver(SOCKET s );
~CUDPReceiver();
/*
* øýӿڵõ洢buffer_еԭʼݡͨźsema_Զд
* ͬ
*/
int Receive(TopicID& topic... | true |
923a37b771142e24a23048bb39d15c78a4230a7c | C++ | Blue-Latios/A_N_T_I | /Trial1/randomer.cpp | UTF-8 | 606 | 2.859375 | 3 | [] | no_license | #include "randomer.hpp"
#include <ctime>
#include <random>
std::mt19937 G(time(0)); //Seed dengan time(0)
int randomInt(int min, int max) {
std::uniform_int_distribution<> D(min, max);
return D(G);
}
double randomDouble(double min, double max) { //random pakai mersenne_twister
///Note: Tidak error ... | true |
ae36bd29f7a8f33159dfcfb5a0187ac9664ba159 | C++ | gael42r/DactyloChuteFaurieRiou | /DactyloChuteFaurieRiou/Main.cpp | ISO-8859-1 | 669 | 3.046875 | 3 | [] | no_license | #include "Menu.h"
int main()
{
//Cration du menu
Menu menu;
//Chargement des scores
menu.load();
//Ecran titre
menu.title();
//Boucle du menu
for (;;)
{
//Affichage du menu
menu.display();
//Choix de navigation
int choice = 0;
while (choice < 1 || choice > 4)
{
choice = menu.enterChoice();
... | true |
e26ea65b22cf1a680702db223c35b6faf0261f20 | C++ | Buanderie/CauchyCaterpillar | /tests/SiameseTools.h | UTF-8 | 11,036 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | /** \file
\brief Siamese FEC Implementation: Tools
\copyright Copyright (c) 2017 Christopher A. Taylor. 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 c... | true |
0c91f432522b2dbca7c0b2a2a4daba6d93b6996c | C++ | wcmonty/sw | /385/hw1/child.cpp | UTF-8 | 7,040 | 3.140625 | 3 | [] | no_license | /*
* William Montgomery
* wmontg2@uic.edu
* ACCC account - wmontgom
* CS 385 - Fall 2013
* Homework 1 - statsh
*
*/
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <iostream>
#include "child.h"
using namespace std;
/*!
* \brief ... | true |
8c2315fceb85f0440190c52c1ee5bf26a4240223 | C++ | LenchMay/Practice | /9_Square.cpp | UTF-8 | 327 | 3.65625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main() {
cout << "Difference between 1^2 + 2^2 + ... + 100^2 and (1 + 2 + ... + 100)^2 is:\n";
int sum1 = 0, sum2 = 0;
for (int i = 1; i <= 100; i++) {
sum1 = sum1 + i * i;
sum2 += i;
}
int prod = abs(sum1 - sum2 * sum2);
cout << prod << endl;
return ... | true |
dd6de7001b454615d86f8b485e8ec0afcbba2c2c | C++ | arnoud67/disruptorcpp | /test/support/long_event.h | UTF-8 | 504 | 2.875 | 3 | [] | no_license | #ifndef DISRUPTOR_TEST_LONG_EVENT_H_
#define DISRUPTOR_TEST_LONG_EVENT_H_
class LongEvent {
public:
LongEvent(int64_t value = 0) :
value_(value) {
}
int64_t value() const {
return value_;
}
void set_value(int64_t value) {
value_ = value;
}
private:
int64_t value_;
};
class LongEventFactory {
public... | true |
2ae5375ac1e58b52117678bad607ffc71a821165 | C++ | Kadzugi/projectToDoList | /ProjectMertex/ProjectMertex.cpp | UTF-8 | 8,018 | 3 | 3 | [] | no_license | // ProjectMertex.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <vector>
#include <String>
#include <regex>
using namespace std;
struct MyToDo
{
string description;
string date;
void print() {
cout << date << " - ... | true |
89995998a69047affd445a9ffb46f8370c91f246 | C++ | RyanAlameddine/Cpp-Data-Structures | /Graphs/Graphs/UUVertex.tpp | UTF-8 | 162 | 2.640625 | 3 | [] | no_license |
template<typename TValue>
void UUVertex<TValue>::Connect(UUVertex<TValue>* target)
{
this->connections.push_back(target);
target.connections.push_back(this);
} | true |
b2f31e8e53bd76f4e2469dcdc6614da4a86031c5 | C++ | yangcyself/CS385cpp | /cnn/layers.h | UTF-8 | 3,449 | 2.875 | 3 | [] | no_license | #ifndef LAYERS_H_
#define LAYERS_H_
#include <cnn/basicOps.h>
#include <Eigen/Dense>
#include <Eigen/Core>
#include <memory> //std::shared_ptr
namespace convnn{
/**
* layers are also operators, but with more complex functions
* implemented layers are:
* conv layer
* fc layer
* relu layer
* max pooling lay... | true |
af8758136da0f67f8c50cf88191416b338bbd3f8 | C++ | p4plus2/shex | /character_mapper.cpp | UTF-8 | 2,692 | 2.765625 | 3 | [] | no_license | #include <QFile>
#include <QRegExp>
#include "character_mapper.h"
#include "debug.h"
bool character_mapper::load_map(QString map_file_path)
{
if(map == nullptr){
map = new QMap<unsigned char, unsigned char>();
}else{
map->clear();
}
QFile map_file(map_file_path);
if(!map_file.open(QIODevice::ReadOnly | QIODe... | true |
51283f2ad028a20f4bf1f43772c02d6f695981c0 | C++ | Sanket-Mathur/100-days-of-code | /Language Fundamental/RandomNumbers.cpp | UTF-8 | 1,142 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <random>
#include <time.h>
#include <string.h>
using namespace std;
int main() {
// simple pseudo random number generator
srand(time(NULL));
for(int i = 0; i < 10; i++) {
cout << rand() % 10 << " ";
}
cout << endl;
// true random number generator
rando... | true |
75a1f9284d33a94176acb87e74c4b4d20f6da495 | C++ | royvandewater/arduino-countdown-timer | /src/countdown-timer.ino | UTF-8 | 1,013 | 3.125 | 3 | [
"MIT"
] | permissive | #define ONE_MINUTE (1 * 10 * 1000)
#define ON true
#define OFF false
void setup()
{
for(int i = 0; i < 13; i++) {
pinMode(i, OUTPUT);
}
}
void blink_for_one_second(int pin) {
digitalWrite(pin, LOW);
delay(900);
digitalWrite(pin, HIGH);
delay(100);
}
void blink_all_lights_for_one_second() {
for(int ... | true |
28ed07cb7ea3b928618c09d4d1775e1c3d76a676 | C++ | yzq986/cntt2016-hw1 | /TC-SRM-592-div1-300/yyt16384.cpp | UTF-8 | 587 | 3.765625 | 4 | [] | no_license | #include <string>
class LittleElephantAndBalls {
public:
int getNumber(std::string s);
};
int LittleElephantAndBalls::getNumber(std::string s)
{
int ans = 0;
int cr = 0;
int cg = 0;
int cb = 0;
for (auto c : s) {
// For every color, put the first ball in the left part and the
... | true |
ed5ff89aa50231221f551c162e4310923f287087 | C++ | taha7ussein007/The-Astronauts | /Space Ship_Rockets-launcher/Space Ship_Rockets-launcher/Stack.h | UTF-8 | 3,501 | 3.25 | 3 | [] | no_license | #pragma once
/////////////////////////////////////////////////////////////////////////
template<typename T> class Node{
/////////////////////////////////////////////////////////////////////
public:
T info;
//Node* next;
Node* prev;
/////////////////////////////////////////////////////////////////////
};
//////////... | true |
cda9b89ce2276c717e113d548426493a8a9d027f | C++ | dacuster/GameAI | /shared/DeanLib/PerformanceTracker.cpp | UTF-8 | 1,723 | 3.03125 | 3 | [] | no_license | #include "PerformanceTracker.h"
using namespace std;
PerformanceTracker::PerformanceTracker()
{
}
PerformanceTracker::~PerformanceTracker()
{
map<string,Timer*>::iterator iter;
for( iter = mTimers.begin(); iter != mTimers.end(); ++iter )
{
delete iter->second;
}
}
void PerformanceTracker::sta... | true |
188067829b14da6d77bee9f54e82a4e7358a1cca | C++ | Lancern/caf | /include/Infrastructure/Optional.h | UTF-8 | 4,179 | 3.921875 | 4 | [] | no_license | #ifndef CAF_OPTIONAL_H
#define CAF_OPTIONAL_H
#include <cassert>
#include <new>
#include <utility>
#include <type_traits>
namespace caf {
/**
* @brief A monad representing an optional value.
*
* This class resembles the `Maybe` type class in Haskell and `Option` enum in Rust.
*
* @tparam T the type of the objec... | true |
c8be33b634c7c4325a11957c48e70da83d6c6e5c | C++ | samanseifi/Tahoe | /toolbox/src/C1functions/CosinePlusT.cpp | UTF-8 | 6,129 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | /* $Id: CosinePlusT.cpp,v 1.4 2011/12/01 20:25:15 bcyansfn Exp $ */
#include "CosinePlusT.h"
#include "dArrayT.h"
#include <cmath>
using namespace Tahoe;
/* constructor */
CosinePlusT::CosinePlusT(double t0, double t1, double a, double b, double c, double d, double e, double f, double g,
double p, double q):
ft0(t... | true |
416b67b8ea3cc80b9ca68899527f616776dfe7e1 | C++ | maxidea1024/fun | /fun/sql/meta_column.h | UTF-8 | 2,879 | 2.828125 | 3 | [] | no_license | // TODO accessor �̸��� �����ؾ��ұ�??
#pragma once
#include <cstddef>
#include "fun/sql/sql.h"
namespace fun {
namespace sql {
/**
* MetaColumn class contains column metadata information.
*/
class FUN_SQL_API MetaColumn {
public:
enum ColumnDataType {
FDT_BOOL,
FDT_INT8,
FDT_UINT8,
FDT_INT16,
... | true |
d5e72024a8a644bd4f68f1b5ac9e99a870656613 | C++ | mangesh-kurambhatti/CPP | /CDAC_CPP_PRACTICE/DAY_7/Day_7.1_inheritance_without_inheriting/main.cpp | UTF-8 | 2,128 | 3.71875 | 4 | [] | no_license | /*
* main.cpp
*
* Created on: 11-Mar-2019
* Author: sunbeam
*/
#include<iostream>
#include<string>
using namespace std;
class Date
{
private:
int day;
int month;
int year;
public:
Date(void)
{
this->day=0;
this->month=0;
this->year=0;
}
Date(int day,int month,int year):day(day),month(month),y... | true |
6b6faa5ded7804101175e20efac4d59de3e71963 | C++ | d-nery/InfoBuraco | /InfoBuraco/DAO/UsuarioDAO.cpp | UTF-8 | 3,470 | 2.65625 | 3 | [] | no_license | #include <msclr/marshal_cppstd.h>
#include "MySQL.h"
#include "UsuarioDAO.h"
#include "CargoDAO.h"
namespace InfoBuraco {
UsuarioDAO::UsuarioDAO() {
}
Usuario* UsuarioDAO::getUser(std::string login, std::string password) {
CargoDAO cargoDAO;
Usuario* usuario = nullptr;
sql::Conne... | true |
062bb33526c7ad5357e15ca4c93114f185e58df8 | C++ | zhuhk/test-toys | /cpp/t_c11.cpp | UTF-8 | 23,491 | 2.59375 | 3 | [] | no_license | #include <iostream> // std::cout
#include <thread> // std::thread
#include <future> // std::promise, std::future
#include <unistd.h>
#include <vector>
#include <atomic>
#include <cstdio>
#include <memory>
#include <mutex>
#include <set>
#include <map>
#include <unordered_map>
#include <future>
#in... | true |
a27c9f77cae9ebfbc9922a0ed341abd718dfa3a8 | C++ | rohithrangaraju/MissionRnD-C-BinarySearchTree-Worksheet | /src/HeightofBST.cpp | UTF-8 | 1,999 | 3.71875 | 4 | [] | no_license |
/*
1)Given a BST ,Find its Maximum Height
Height of a NULL BST is 0
Height of a BST which has only one node is 1
Ex Input :
10
/\
5 80
/ /
2 50
\
4
Height of above Tree is 4
Ex Output : Return the Height of the Tree , -1 if Invalid
2) Get Sum of Left subtree gets the sum of all nodes ,in the left subtree of t... | true |
319797442937b0fe09cee4bd1bb3f8b8a376a8df | C++ | litcoderr/ALOHA_PS | /Lecture/day1/star.cpp | UTF-8 | 437 | 3.15625 | 3 | [] | no_license | #include <iostream>
using namespace std;
void somefunction(){
for(int i=0;i<10;i++){
printf("Hello world");
}
}
int main(){
int n = 0;
scanf("%d",&n);
for(int i=0;i<n;i++){
for(int j=0;j<(n-i-1);j++){ //print gong bak
printf(" ");
}
for(int j=0;j<(2*i+1... | true |
ce714546de307820f183ff077ce92b3a172e62f1 | C++ | Rose-code/C-Portfolio | /SumoCubes.cpp | UTF-8 | 721 | 3.6875 | 4 | [] | no_license | /*********************************************************************************
Morgan Hughes
CS 317
Dr. Brady Rimes
11 March 2019
Sum of Digits Program
This program calculates what three numbers can be represented by the sum of the
cubes of their digits.
*****************************************************... | true |
b600a7835a615d71c40a4c0b97535fdf1b40c073 | C++ | furkanicer/Programming-Principles-and-Practice-Using-Cpp- | /Part I The Basics/4. Computation/Exercises/10.cpp | UTF-8 | 3,393 | 3.921875 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
#include <vector>
using namespace std;
// gonna implement our own randomness system without using rand.
// it is not a "real" randomness function btw. it repeats itself.
enum class Move
{
rock = 1,
paper = 2,
scissors = 3
};
int get_seed() // getting seed for feeding our ... | true |
1c734c423441c6266d1ba2bb486e9f2bfc9b321e | C++ | kensou24/CppStandardV2 | /test/source/string/string3.cpp | UTF-8 | 1,349 | 2.96875 | 3 | [
"Unlicense"
] | permissive | /* The following code example is taken from the book
* "The C++ Standard Library - A Tutorial and Reference, 2nd Edition"
* by Nicolai M. Josuttis, Addison-Wesley, 2012
*
* (C) Copyright Nicolai M. Josuttis 2012.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyr... | true |
8f3a0906be5fd8c7d190f349ddbd7d05a1a0d84a | C++ | adityachoudharyclg/codingFinalYear | /Graphs/Graphs 1/bfs.cpp | UTF-8 | 1,131 | 3.0625 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
void printBFS(int **edges, int V, int sv) {
queue<int> pend;
bool *visited = new bool[V];
for (int i = 0; i < V; i++) {
visited[i] = false;
}
pend.push(sv);
visited[sv] = true;
while (!pend.empty()) {
int to... | true |
af79e5333fe713ac040eaf5e3fdba1b0ae3512a0 | C++ | OC-MCS/lab7-tasks-JLoganDick | /Retail/RetailItem.h | UTF-8 | 309 | 2.609375 | 3 | [] | no_license | #pragma once
#include<iostream>
#include <string>
using namespace std;
class RetailItem
{
private:
string description;
int unitsOnHand;
double price;
public:
RetailItem(string desc, int inv, double cost);
string getDescription();
int getUnitsOnHand();
double getPrice();
float getStockValue();
};
| true |
d196708715d9a3c9606d1ff90de78946a4efee78 | C++ | misterpink14/byu_course_work | /computer_science/142-intro_to_computer_programming/SmallInheritanceExample/blah/Animal.cpp | UTF-8 | 167 | 2.609375 | 3 | [] | no_license | #include "Animal.h"
Animal::Animal(string name)
{
this->name = name;
}
string Animal::getName()
{
return this->name;
}
Animal::~Animal(void)
{
}
| true |
bcb58679272bd617986254eb106d0627d8ee6b44 | C++ | Kevin-MN/CISC-205-CITY-Williams | /PA_11.cpp | UTF-8 | 10,944 | 3.828125 | 4 | [] | no_license |
/*
Kevin Morales Nguyen
Chapter 11 Programming assignment
3/22/2021
*/
#include <iostream>
#include <iomanip>
#include <string>
#include <limits>
using namespace std;
const int SIZE = 10;
//Customer struct used on place of parrallel arrays
struct Customer {
std::string name, boat_name; // string variables
... | true |
6936c5c29ae8b1a609223548826d13da70b1b1a9 | C++ | sizzle0121/leetcode | /Top 100 Liked Questions/p287-find the duplicate number.cpp | UTF-8 | 1,590 | 3.71875 | 4 | [] | no_license | /*
Solve by sorting or set is trivial (see solution 1 & 2)
Time complexity: O(nlogn) for sorting, O(n) for set
Space complexity: O(1) for sorting, O(n) for set
Solve by Floyd's Tortoise and Hare
Use two pointers, fast and slow, one moves two steps a time, the other moves one step a time
The value of array[i] ... | true |
afc9759ba4d87afac7f11050fc27d3e8114b2b55 | C++ | alextnlr/ProjectTacticalRPG | /main.cpp | UTF-8 | 5,058 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include "Character.h"
#include "Terrain.h"
#include "Display.h"
#include "Fight.h"
using namespace std;
//The main is commented a little too much to avoid annoying comments on the other more importants parts
int main(int argc, char** argv)
{
//Initialisation of the random see... | true |
2ef77c38f69d0dfda840ece93066af62426fa92d | C++ | PavelGubanov/Laba1_list | /ConventerFunctor.cpp | WINDOWS-1251 | 221 | 2.546875 | 3 | [] | no_license | #include "ConventerFunctor.h"
ConventerFunctor::ConventerFunctor(int sum)
{
_sum = sum;
}
//
void ConventerFunctor::operator()(int& x)
{
x -= _sum;
}
| true |
7acf111ed7767ce1991bf06ac7f99e2ed393bb4e | C++ | gkagm2/cpppractise | /cpptraining/ch1/ProgrammingForGameDeveloper/CToCPP_VirtualFunc.cpp | UTF-8 | 2,826 | 2.59375 | 3 | [] | no_license | #include <windows.h>
#include <iostream>
using namespace std;
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
////////////////////////// CObject
class CObject {
protected:
static WCHAR szAppName[];
HWND hwnd;
MSG msg;
WNDCLASSEX wndclass;
public:
void InitInstance(HINSTANCE hInsta... | true |
539449adfb979692c38cc62f2347605465ad42eb | C++ | revsolid/polyminis-game-server | /src/Game/SpaceExploration/PlanetManager.cpp | UTF-8 | 1,391 | 3.125 | 3 | [] | no_license | #include "PlanetManager.h"
Planet PlanetManager::USELESS = Planet(0, 0, -1);
PlanetManager::PlanetManager(const std::initializer_list<std::pair<float, float>>& list) : mNextPlanetId(0)
{
for (auto i : list)
{
unsigned int id = GetNextPlanetId();
mPlanets.push_back(Planet(i.first, i.second, id)... | true |
71eed83b10c18607bcb6aaeb4a12d42525e0d0ee | C++ | MarcoAurelioIrias/Trabajos | /Trabajo 5.cpp | UTF-8 | 304 | 3.09375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int numero;
/*
Ingresar un numero y determinar su rango 1-50,51-100 y mayor a 100
*/
int main()
cout << "Ingresar un Numero";
cin >> numero;
if ((numero >=1) and (numero<=50))
{cout<<"Numero esta entre 1-50";
}
else if (("Numero esta entre 51-100";
{cout<
}
| true |
a9d3b63636a523259bbbb18a3aa4b04efac63247 | C++ | QuocAnhLe935/GameEngine | /GameEngine/Engine/FX/LightSource.h | UTF-8 | 582 | 2.875 | 3 | [] | no_license | #ifndef LIGHTSOURCE_H
#define LIGHTSOURCE_H
#include <glm/glm.hpp>
class LightSource
{
public:
LightSource();
~LightSource();
float getAmbient() const;
float getDiffuse() const;
float getSpecular() const;
glm::vec3 getPosition() const;
glm::vec3 getLightColor() const;
void setAmbient(float Ambient_);
void s... | true |
d0d9b4c0e142fff6b467e3da09ed05fcf2e350c8 | C++ | JustWhit3/matrixop | /include/matrixop.h | UTF-8 | 924 | 2.671875 | 3 | [
"MIT"
] | permissive | #ifndef MATRIXOP_H
#define MATRIXOP_H
#include <iostream>
//MaxPtr template function declaration:
template <class A>
A MaxPtr (A *ptr, int a);
//Matrixop class declaration:
class matrixop
{
public:
matrixop () {};
matrixop (int);
~matrixop ();
void inverse ();
void reset ();
void trace ();
v... | true |