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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fabd578a51c54cb21a6f2903916ac0207e412d50 | C++ | rybcom/circular_buffer | /tools/utilities/public/MemoryProfiler.h | UTF-8 | 680 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | #pragma once
#include <iostream>
struct memory_profiler_t
{
std::size_t all_reservation_count;
std::size_t all_releasing_count;
std::size_t current_reservated_size;
std::size_t current_reservated_count;
};
inline memory_profiler_t memory_profiler;
inline void * operator new(std::size_t size)
{
++memory_profil... | true |
dfdb28a697781eda388cb5e3ff74d63ba24925cd | C++ | SPontadit/LuxUmbra | /Luxumbra/source/rhi/RHI_ComputePipeline.cpp | UTF-8 | 2,457 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #include "rhi\RHI.h"
namespace lux::rhi
{
ComputePipeline::ComputePipeline() noexcept
: pipeline(VK_NULL_HANDLE), pipelineLayout(VK_NULL_HANDLE), descriptorSetLayout(VK_NULL_HANDLE)
{
}
void RHI::CreateComputePipeline(const ComputePipelineCreateInfo& luxComputePipelineCI, ComputePipeline& computePipeline) noex... | true |
9f658a7b19a7d1990890235f69ccb2ee6ba5ed4d | C++ | Anri-Lombard/cpp | /calebCurry/multifiles/math_utils.cpp | UTF-8 | 420 | 3.140625 | 3 | [] | no_license | #include "math_utils.h"
double area(int side) {
return side * side;
}
double area(int length, int width) {
return length * width;
}
double area(Rectangle rectangle) {
return rectangle.length * rectangle.width;
}
double pow(double base, int pow) {
int total = 1;
for (int i = 0; i < pow; i++) {
... | true |
1b49698b27b002318616aa7cd9eaa73f4ad31163 | C++ | AlexanderPVl/Labs-2curs1sem- | /lab1/Class.cpp | UTF-8 | 1,720 | 3.296875 | 3 | [] | no_license | #include "Class.h"
#include <math.h>
//CUBE================================
int Cube::Deg3(int n) const{
return n*n*n;
}
Cube::Cube(int x, int y){
X = x;
Y = y;
}
int Cube::GetX() const{
return X;
}
int Cube::GetY() const{
return Y;
}
void Cube::SetX(int x){
X = x;
}
void Cube::SetY(int y){
Y = y;
}
int Cube::M... | true |
176887da4d186250c6fd593294bb2bd877e1ac0c | C++ | Arindam8282/data-structure | /recursions/power.cpp | UTF-8 | 317 | 3.84375 | 4 | [] | no_license | #include<iostream>
using namespace std;
int powerOf(int num,int power) {
if(power>0) return num*powerOf(num,power-1);
else return 1;
}
int main() {
int num,power;
cout<<"Enter a number : ";
cin>>num;
cout<<"Enter power : ";
cin>>power;
cout<<num<<" to the power "<<power<<" is "<<powerOf(num,power);
} | true |
d7138f93be50840c204c860e74ac176169c945dd | C++ | lenomirei/C-C- | /使用类模板编写的双向链表/使用类模板编写的双向链表/标头.h | GB18030 | 1,486 | 3.390625 | 3 | [] | no_license | #pragma once
#include<iostream>
using namespace std;
template<class T>
struct ListNode
{
T _data;
ListNode *_next;
ListNode *_prev;
ListNode(T x)
:_data(x)
,_next(NULL)
,_prev(NULL)
{
}
};
template<class T>
class SXList
{
public:
SXList()
:_head(NULL)
,_end(_head)
{
}
SXList(SXList& l)
:_head... | true |
bd7a0c7f0bbec233a5469cfbc46749b323748698 | C++ | dyh1265/Assignment05 | /rt/integrators/castingdist.cpp | UTF-8 | 1,040 | 2.609375 | 3 | [] | no_license | #include "castingdist.h"
#include <rt/world.h>
#include <rt/intersection.h>
#include <core/color.h>
#include <core/vector.h>
#include <cmath>
namespace rt{
RayCastingDistIntegrator::RayCastingDistIntegrator(World* world, const RGBColor& nearColor, float nearDist, const RGBColor& farColor, float farDist): nearColor... | true |
ffd658b409ea260574b4bfa9ec71d1469eceb374 | C++ | pombredanne/ska_fft | /cpp/check_output.cc | UTF-8 | 1,087 | 2.78125 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include "helpers.h"
using namespace std;
typedef pair<int, int> location;
int main(int argc, char** argv) {
// read program options
if (argc != 4) {
printf("Wrong number of arguments.\n");
return 1;
}
con... | true |
b9d9ae47e275b69f42cd82d8070444299c57394b | C++ | Mustafamemon/SEM_THREE | /DS LAB/Lab 3/task 1.cpp | UTF-8 | 369 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <new>
#include <cstdlib>
using namespace std;
int fib1(int n)
{
return n;
}
int fib(int n, int a , int b,int sum)
{
if (n>2)
{
sum=a+b;
cout<<fib1(sum)<<" ";
a=b;
b=sum;
}
else
return 0;
fib(--n,a,b,0);
}
int main()
{
int n;
cout<<"Enter the number... | true |
ea578947dd921dd2cc926ed328c89571678c12f0 | C++ | Richard-coder-Nai/OJ | /acwing/1329.cpp | UTF-8 | 389 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <string>
using namespace std;
string dirs[1005];
int father[1005];
int counter(int x) {
if(father[x]==0) return dirs[x].size()+1;
return dirs[x].size()+1+counter(father[x]);
}
int main(void) {
int n;
cin>>n;
for(int i=1; i<=n; i++) {
cin>>father[i];
cin>>dirs[i];
}
int res = ... | true |
e1dccca2f74041e2879ce202bca5aafe18026b7a | C++ | penolove/MystupidC | /11063.cpp | UTF-8 | 825 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
bool b2seq(int n, int arr[]){
int temp[20001]={0};
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(temp[arr[i]+arr[j]]==0){
temp[arr[i]+arr[j]]=1;
}else{
return 0;
}
}
}
return 1;
}
//B2-... | true |
540d8df4a570f002f54f0178d189175940f50643 | C++ | hmehta095/MarkinItus | /markingItus.ino | UTF-8 | 2,238 | 2.609375 | 3 | [] | no_license | // This #include statement was automatically added by the Particle IDE.
#include <InternetButton.h>
InternetButton button = InternetButton();
int DELAY = 200;
void setup() {
button.begin();
Particle.function("hppy0",Happy0);
Particle.function("hppy",Happy);
Particle.function("hppy1",Happy1);
Particle.function("hppy2"... | true |
d836573db696e4fa4206a4e5d592aa33c29a99b4 | C++ | neloe/cs401_graphfinal | /lorenz.cpp | UTF-8 | 2,967 | 3.09375 | 3 | [] | no_license | //
/// \file lorenz.cpp
/// \author Nathan Eloe
/// \brief Implementation of lorenz system threadiness
//
#include "lorenz.h"
#include <iostream>
using namespace std;
const int SLEEP_TIME = 0;
point operator* (const double & s, const point& p)
{
return {s * p.x, s * p.y, s * p.z};
}
point operator+ (const point& ... | true |
afc727eabb3f0f59ec43714054182729143c289d | C++ | th3v0ice/Dwarf_Fortress_Clone | /Inventory.h | UTF-8 | 1,606 | 3.203125 | 3 | [] | no_license | #include <vector>
#include <memory>
#include "Item.h"
#include "Weapon.h"
#include "Armor.h"
#include "Consumable.h"
#include "Map.h"
#pragma once
class Inventory
{
public:
Inventory() : selected_item_idx(0), limit(3) { inventory.reserve(3); }
Inventory(int l): selected_item_idx(0), limit(l) { invento... | true |
77bbfc1c5849a93fb2f113c18d448136dad852cc | C++ | vynaloze/FoP-assignment | /Person.cpp | UTF-8 | 660 | 3.390625 | 3 | [] | no_license | #include "stdafx.h"
#include "Person.h"
Person::Person()
{
}
Person::Person(string name1, string name2, string name3) {
this->name1 = name1;
this->name2 = name2;
this->name3 = name3;
}
Person::~Person()
{
}
void Person::setName(int whichOne, string value) throw (out_of_range)
{
switch (whichOne) {
case 1:
na... | true |
39b43838dfcdec5f51c970145ec6b1671de63312 | C++ | EricAOlson/Text_Adventure | /security.hpp | UTF-8 | 564 | 2.59375 | 3 | [] | no_license | /********************
* Author: Eric Olson
* Assignment: CS162 - Final Project: Train Riddle
* Last Updated: 12/8/14
* Design: Header file for the security car class, derived from the car class.
********************/
#ifndef OLSON_SECURITY_HPP
#define OLSON_SECURITY_HPP
#include <iostream>
#include <algorithm>
#... | true |
7a2f9482342c8aa742e6b66d451683f660df2ecf | C++ | peaceminusones/ZYL-Leetcode | /剑指offer/JZ32_PrintMinNumber.cpp | UTF-8 | 842 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
static bool cmp(int a, int b)
{
string s1 = "", s2 = "";
s1 += to_string(a) + to_string(b);
s2 += to_string(b) + to_string(a);
return s1 < s2;
}
string PrintMinNu... | true |
9d79b9c1ff3aca1ad8307452883c1a413cc15c45 | C++ | Amrojano/UD3 | /ecuacion2_modular.cpp | UTF-8 | 797 | 3.953125 | 4 | [] | no_license | //Vamos a realizar un programa con modulos para calcular ecuaciones de segundo grado.
#include <iostream>
#include <cmath>
using namespace std;
// Declaramos la siguiente funcion antes del MAIN.
void ecuacion(double &x1, double &x2) {
double a, b, c;
if (a != 0) {
x1 = (-b + sqrt ( pow(b,2)-4*a*c) ) / (2*a);
x2 = (... | true |
b5eabffdf3dcba65017b6f09a89e85a354872d8c | C++ | CobaltSoixante/QTSlotMachine | /QTSlotMachine/EgmQTGui.cpp | UTF-8 | 8,726 | 2.671875 | 3 | [] | no_license | #include "EgmQTGui.h"
#include "EgmQTThreadWorkerObject.h"
#include <boost/lexical_cast.hpp> // string s = boost::lexical_cast<string>( number );
#include <QHBoxLayout>
#include <QGroupBox>
#include <QMessageBox>
// CREATE THE GUI:
EgmQTGui::EgmQTGui(QWidget *parent, Egm& egm) :
QWidget(parent), m_egm(egm), m_nu... | true |
5c5de317ab3c1733cd8c6336b3a3405acebae67c | C++ | Ivan19Aldana/Parcial-2-Programaci-n | /Serie 3 Inciso 1.cpp | ISO-8859-3 | 2,688 | 3.34375 | 3 | [] | no_license | // Mynor Ivan Aldana Marin
//0909-20-5400
// serie 3 Inciso 1
// Declaracin de Librerias
#include <iostream>
#include <conio.h>
using namespace std;
// Declaracin de Variables y Vectores
int alfa[3][3]; // Filas y Columnas
int total[3]; // Filas
int e, h, op; // Variables y opcion
// Estructura pa... | true |
2dc18deca32175e2ab9a15d187fb5607790ecfaf | C++ | McStasMcXtrace/NJOY21 | /src/njoy21/input/HEATR/Card1/test/Card1.test.cpp | UTF-8 | 3,038 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | #define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "njoy21.hpp"
using namespace njoy::njoy21::input;
SCENARIO( "Validating HEATR Card1 inputs",
"[HEATR], [Card1]"){
GIVEN( "valid HEATR Card1 inputs" ){
WHEN( "all inputs are provided" ){
iRecordStream<char> iss1( std::istringstream("20 21 22 23\n") ... | true |
06af68e36540b95533729d332ad19b1eec2ddf3b | C++ | DaEunKim/111Coding | /조세퍼스문제/조세퍼스문제/main.cpp | UTF-8 | 753 | 2.734375 | 3 | [] | no_license | //
// main.cpp
// 조세퍼스문제
//
// Created by 김다은 on 2017. 2. 15..
// Copyright © 2017년 김다은. All rights reserved.
//
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
int main(void){
int N; //사람 수
int M; //M번째 수
scanf("%d %d", &N, &M);
//int arr[] ={0, };
queue<int... | true |
4231b2e509dc0ab9da81f4a0eed53163afc8fa88 | C++ | Paolo5150/397Project | /Engine/src/Components/Animator.h | UTF-8 | 2,729 | 2.84375 | 3 | [] | no_license | #pragma once
#include "..\Graphics\AnimatedModel.h"
#include "..\Graphics\ModelAnimation.h"
#include "..\GameObject\Component.h"
#include <set>
/**
* @class Animator
* @brief Specialized class for animator component
*
* Manages animations for an animated model
*
* @author Paolo Ferri
* @version 01
* @date 1/05/2019
* ... | true |
2edc4707bb96aa63451a7398b4b27aea9911bf81 | C++ | Ayuyuyu/EasyWindowTool | /ColourPin/ColourBase.cpp | UTF-8 | 1,486 | 3.03125 | 3 | [] | no_license | #include "StdAfx.h"
#include "ColourBase.h"
CColourBase::CColourBase(void)
{
memset(RGBList,0,sizeof(RGBList));
}
CColourBase::~CColourBase(void)
{
}
CString CColourBase::RGBto16(DWORD rgb[3])
{
TCHAR szR[3]={0},szG[3]={0},szB[3]={0};
_itot(rgb[0],szR,16);
_itot(rgb[1],szG,16);
_itot(rgb[2],szB,16);
CStri... | true |
e623bb0c5313d7da4139988d9840cc1605e92d64 | C++ | VoIlAlex/nyann | /nyann-tests/test_drafts.cpp | UTF-8 | 5,705 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "pch.h"
#include "../nyann/nyann/drafts.h"
#include "..//nyann/nyann.h"
namespace {
using namespace nyann;
TEST(DataSet_draft, Construction)
{
DataSet_draft<double> dataset_0({ 3, 3, 3 });
DataSet_draft<double> dataset_1 = { 1,2,3,4 };
DataSet_draft<double> dataset_2 = {
{1, 2, 3, 4},
{1, 2, 3,... | true |
3d52bf4b2db6d3cec0d9ea03a0009171a444b70e | C++ | philippds-learn/Programming-Principles-and-Practice-Using-Cpp_Bjarne-Stroustrup_Chapter-02-11 | /p301_9_priceTimesWeight.cpp | UTF-8 | 1,437 | 3.546875 | 4 | [] | no_license | // Philipp Siedler
// Bjarne Stroustrup's PP
// Chapter 8 Exercise 9
#include "std_lib_facilities.h"
vector<double> price;
vector<double> weight;
class indexCalc {
vector<double> p;
vector<double> w;
public:
indexCalc(vector<double> _p, vector<double> _w) :p(_p), w(_w) { };
void readPrice();
void readWeight();... | true |
248caefd9877edbf3ecb84c7c2ca2aeda63d57b0 | C++ | kalaharileeu/TestSDL2 | /main.cpp | UTF-8 | 870 | 3.015625 | 3 | [] | no_license | #include<SDL.h>
SDL_Window* _gWindow = 0;
SDL_Renderer* _gRenderer = 0;
int main(int argc, char* args[])
{
// initialize SDL
if (SDL_Init(SDL_INIT_EVERYTHING) >= 0)
{
// if succeeded create our window
_gWindow = SDL_CreateWindow("Hello SDL2",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, 480, SDL_... | true |
08e06cd5f54f3f0ebc1ebfa7370c72ff7dfc6b6a | C++ | Trey0303/IntroToCpp | /IntroductionToCpp/Pointers/pointercpp.cpp | UTF-8 | 656 | 3.421875 | 3 | [
"MIT"
] | permissive | #include <cstdlib>
#include <iostream>
#include "pointerh.h"
void printFloats(float* arr, size_t size)
{
for (size_t i = 0; i < size; i++)
{
std::cout << arr[i];
}
}
int arraySum(int* arr, size_t size)
{
int total = 0;
for (size_t i = 0; i < size; i++)
{
total += arr[i];
}
std::cout << std::endl << ... | true |
27f9d728a9b86dd9f8a1cd2eb4735b75401e2eb0 | C++ | parambedi1453/ADI | /dp/reduceNum.cpp | UTF-8 | 1,681 | 3.734375 | 4 | [] | no_license | /* Given a number we need to reduce it to 1 in min number of stpes
given number of operation as divide by 3,divide by 2,sub 1
eg 21
op 4
eg 10
op 3
*/
#include<iostream>
#include<cmath>
using namespace std;
const int inf = (int)1e9;
// In this function we cannot compute 1000 because overlapping re... | true |
e6b7c7e355bcf6fedc9a17b5ba4454839fc3b0d4 | C++ | guilhermelonde/projetos-pequenos | /C++ - Qt Creator/IdiomMaster/Projeto/registrodb.h | UTF-8 | 333 | 2.5625 | 3 | [] | no_license | #ifndef REGISTRODB_H
#define REGISTRODB_H
#include <string>
using namespace std;
class RegistroDB
{
public:
string A; // chave primária
string B;
int praticado;
RegistroDB(string _A, string _B, int _praticado)
{
A = _A;
B = _B;
praticado = _praticado;
}
};
#endif // R... | true |
d89fcc7a7b95e7cb09b0438272600b7d591ecdf6 | C++ | DDreher/OpenCLSandbox | /src/HashTable/HashTable.cpp | UTF-8 | 12,347 | 3.015625 | 3 | [
"BSL-1.0"
] | permissive | #include "HashTable/HashTable.h"
#include <Base\OpenCLManager.h>
#include "assert.h"
#include "Base\Definitions.h"
#include "Base\Utilities.h"
HashTable::HashTable()
{
// Init random seed
srand(random_seed_);
}
HashTable::~HashTable()
{
// Release buffers
cl_int status = 0;
if(table_buffer_ != 0)
... | true |
f9fa57f964d0ef51be5c1b02f8a2d12f063d9782 | C++ | rotanov/way-station | /cpp-course/re-stl/src/dtl_Allocator.h | UTF-8 | 4,844 | 3.375 | 3 | [] | no_license | #ifndef _ALLOCATOR_H_
#define _ALLOCATOR_H_
#include <cstdlib>
#include <cassert>
#include <malloc.h>
/**
* CSomeAllocator:
* GetPointer(): returns pointer to allocated memory.
* Resize(n): Stands for Allocate + Reallocate + Deallocate at the same time.
* i.e. first time invokation Allocates memory, next ... | true |
3eef578df803ec92b2e38b754ced01b82da9272d | C++ | agriic/chess-vr | /src/Utils.cpp | UTF-8 | 1,400 | 3.015625 | 3 | [
"Unlicense"
] | permissive | #include "Utils.hpp"
#include <sys/stat.h>
std::string aic::getAlphaNumeric(std::string input)
{
for (int i = 0; i < input.size(); i++) {
auto c = input[i];
if (!((c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z'))) {
input[i] = '.';
... | true |
1776f35dac9500bde96fde7bb13b7bfc4227b9c3 | C++ | KleinFourGroup/cilk_tre_tests | /fib.cc | UTF-8 | 2,429 | 3.1875 | 3 | [] | no_license | #include <cilk/cilk.h>
#include <atomic>
#include <iostream>
#include <time.h>
int fib(int n) {
if (n < 2) return n;
int x,y;
x = fib(n - 1);
y = fib(n - 2);
return x + y;
}
int cfib(int n) {
if (n < 2) return n;
int x,y;
x = cilk_spawn cfib(n - 1);
y = cfib(n - 2);
cilk_sync;
return x + y;
}
i... | true |
072fa43e10f22434126df9a85392c76ae5a037b2 | C++ | zhushh/cplusplus | /play_code/huffman_code.cpp | UTF-8 | 2,449 | 3.578125 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct huffman_leaf {
int weight;
char ch;
};
struct huffman_root {
int sum_weight;
struct huffman_leaf * data;
struct huffman_root * left;
struct huffman_root * right;
huffman_root() : sum_weight(0), data(NULL), left(NULL), right(NULL) {}
};
struct... | true |
c4595ca22bd5b3c8f2f1a7130ac2103eaaebd96b | C++ | hs-krispy/BOJ | /N&M(9).cpp | UTF-8 | 788 | 2.78125 | 3 | [] | no_license | //
// Created by 0864h on 2020-03-12.
//
#include<iostream>
#include<cstdio>
#include <algorithm>
using namespace std;
int arr[9], ans[9];
bool check[9];
int n, m;
void seq(int count)
{
if(count == m)
{
for(int j = 0;j < count;j++)
printf("%d ", ans[j]);
printf("\n");
return;... | true |
0a91696b0f1885d3366171c747129a090441ff87 | C++ | thompsonsed/rfsim | /rfsim/lib/Fox.cpp | UTF-8 | 563 | 3.046875 | 3 | [] | no_license | /**
* @brief Contains the Fox class and behaviours.
*/
#include "Fox.h"
void Fox::catchRabbit(vector<Rabbit> &rabbits, shared_ptr<RNGController> random)
{
if(!rabbits.empty())
{
unsigned long index = random->i0(rabbits.size() - 1);
energy += rabbits[index].getEnergy()*0.5;
rabbits[in... | true |
d724c8baac1f04fd4dd2cad00dc8b62f25415bac | C++ | AnusreeK-2000/ADA_1BM18CS017 | /ins_sort.cpp | UTF-8 | 956 | 3.75 | 4 | [] | no_license | /* Sort a given set of N integer elements using Insertion Sort technique and compute its time taken. */
#include<iostream>
#include<chrono>
using namespace std::chrono;
using namespace std;
void insertion(int a[],int n)
{
for(int i=1;i<n;i++)
{
int item=a[i];
int j=i-1;
while(j>=0 && a[j]>item)
{
a[j+1]... | true |
c1a7edf9567251f810eb20798a90ac4f0cb86f44 | C++ | jrthebish4/C867-class-roster-hw | /student.h | UTF-8 | 869 | 2.796875 | 3 | [] | no_license | //
// Created by Jakob Bishop on 2019-04-01.
//
#ifndef C867_STUDENT_H
#define C867_STUDENT_H
#include <string>
#include "degree.h"
using namespace std;
class Student {
public:
Student(string, string, string, string, int, Degree, int[3]);
~Student();
string getStudentID();
string getFirstName();... | true |
753b16626f24124141fa355eee9562ad44b91ffa | C++ | xen/nwc-toolkit | /lib/token-trie-tracer.cc | UTF-8 | 2,009 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2010 Susumu Yata <syata@acm.org>
#include <nwc-toolkit/token-trie-tracer.h>
#include <algorithm>
namespace nwc_toolkit {
TokenTrieTracer::TokenTrieTracer()
: token_trie_(NULL),
table_(),
current_node_id_(0),
next_node_id_(0) {}
void TokenTrieTracer::Clear() {
token_trie_ = NULL... | true |
fa86f43f9a81ec7b5289e9b20358e98d3f4b2910 | C++ | longneicool/jian_zhi_offer | /chap2/6_recreateBinaryTree/testcase/testcase.cpp | UTF-8 | 361 | 2.734375 | 3 | [] | no_license | #include "gtest/gtest.h"
#include "tree.h"
#include "testfixture.h"
TEST_F(BinaryTreeCreaterTest, test_normal_case)
{
int preOrderArray[] = {1, 2, 4, 7, 3, 5, 6, 8};
int inOrderArray[] = {4, 7, 2, 1, 5, 3, 8, 6};
BinaryTreeNodePtr head = construct(preOrderArray, inOrderArray, sizeof(inOrderArray)/sizeof(int));
... | true |
a7a75b13d05fe8288345b2fa6a632941dfc4364d | C++ | tterrag1098/COSC482 | /Homework03/Bubbles/GraphicsEngine.h | UTF-8 | 1,200 | 2.6875 | 3 | [] | no_license | #ifndef GRAPHICSENGINE_H_INCLUDED
#define GRAPHICSENGINE_H_INCLUDED
#include <GL/glew.h>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <string>
#include <stdio.h>
#include "LoadShaders.h"
#include "Bubble.h"
#include "ProgramDefines.h"
/**
\file Graph... | true |
b277f27fbe30a2ef611483615d860f90c45b9c54 | C++ | andreyvro/SMT-GA | /GA_ST_CORE/Individuo.h | UTF-8 | 2,247 | 2.796875 | 3 | [] | no_license | #ifndef INDIVIDUO_H
#define INDIVIDUO_H
#include <vector>
#include <algorithm>
#include <omp.h>
#include "Grafo.h"
#include "Aux.h"
using namespace std;
class Individuo {
private:
Grafo *grafo;
unsigned int qtdPontosSteiner = 0; // Quantidade de Pontos steiner
vector<Ve... | true |
28fbb4a66510e3a97c0bb34f350b5de9b532ad1c | C++ | WhyteNoise/rWhyteMultiplayerSystemsMidterm | /rWhyteMSMidterm/rWhyteMSMidterm/Player.cpp | UTF-8 | 1,818 | 3.140625 | 3 | [] | no_license | #include "Player.h"
PlayerChar::PlayerChar()
{
userName = "Peasant";
thisType = Peasant;
}
PlayerChar::PlayerChar(std::string name, ClassType classType, int uid)
{
userName = name;
thisType = classType;
userID = uid;
if (classType == BattleMaster)
{
health = 10;
attack = 3;
healVal = 2;
}
else if (cla... | true |
acdcba177ce6312beaaa3a226f846dbed91b9e2a | C++ | pes-magic/procon | /GCJ/2020-Round3/A.cpp | UTF-8 | 1,578 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <cstdio>
using namespace std;
string solve(const string& S, const string& T){
int n = S.size();
int m = T.size();
vector<vector<int>> dp(n+1, vector<int>(m+1, 100000000));
vector<vector<pair<int, int>>> prev(n+1, vector<pair<int, int>>(m... | true |
d635b6e92fa7e284b46ffd6b847eed1fdd510fa8 | C++ | esharp054/Networks | /des.cpp | UTF-8 | 4,860 | 3.171875 | 3 | [] | no_license | //
// eventsim.cpp
//
//
// Created by Yeem Diallo on 9/30/16.
//
//
int min_w = 15;
#include <stdio.h>
#include <algorithm> // for random_shuffle()
#include <iostream> // for cout
#include <list> // for queue
#include <vector> // for vector
#include <time.h>
// Execution event in a descrete event... | true |
b0379c7ae377cec6b092b2bb19d8488dde90de24 | C++ | karoldabek/gitrepo | /cpp/funkcje.cpp | UTF-8 | 287 | 3.171875 | 3 | [] | no_license | /*
* funkcje.cpp
*/
#include <iostream>
using namespace std;
void sumuj(int a, int b) {
cout << "Suma: " << a+b << endl;
}
int main(int argc, char **argv)
{
int a, b;
cout << "Podaj liczby: " << endl;
cin >> a >> b;
sumuj(a, b);
sumuj(b, a);
return 0;
}
| true |
97227cbf68361aad2f6b516b27e70a34e47f8502 | C++ | prettyboyucas/Leetcode | /Leetcode/106ConstructBinaryTreefrominorderandPostorderTraversal.cpp | GB18030 | 779 | 3.3125 | 3 | [
"MIT"
] | permissive |
//ǰһֻȡһͬǰһ
class Solution {
public:
typedef vector<int>::iterator Iter;
TreeNode *buildTreeRecur(Iter istart, Iter iend, Iter pstart, Iter pend)
{
if (istart == iend)return NULL;
int rootval = *(pend - 1);
Iter iterroot = find(istart, iend, rootval);
TreeNode *res = new TreeNode(rootval);
res->left = bui... | true |
07cc9e3a0e2c979419dec80c6f77f2c223c6bc2f | C++ | Mariam819/my-project | /Pir.ino | UTF-8 | 364 | 2.671875 | 3 | [] | no_license | void Pir()
{
LightSensorVal = analogRead(A0);
PIRSensorVal = digitalRead(2);
RelayOutputVal = 8;
if (LightSensorVal < 600) {
if (PIRSensorVal == HIGH) {
digitalWrite(8, HIGH);
delay(5000); // Wait for 5000 millisecond(s)
} else {
digitalWrite(8, LOW);
delay(1000); // W... | true |
56341d645fa971260777fdc2ade3f69b1d8c9038 | C++ | ahnaf22/algoCode | /dijkstra.cpp | UTF-8 | 1,405 | 2.90625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
vector<int> edge[100], cost[100];
const int infinity =999999;
struct data
{
int city, dist;
bool operator < (const data &p) const
{
return dist > p.dist;
}
};
int dijkstra(int source, int destination)
{
int d[100];
for(int i... | true |
94f9f0008187d864245378f89f80db9f725109fa | C++ | clwyatt/CTC | /Code/SlicerModules/VirtualColon/CSVReader.cpp | UTF-8 | 4,074 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* CSVReader.cpp
*
* Created on: Oct 11, 2008
* Author: haxu
*/
#include "CSVReader.hpp"
#include <fstream>
#include <iostream>
#include "boost/spirit/core.hpp"
#include "boost/spirit/utility/loops.hpp"
#include "boost/spirit/dynamic/stored_rule.hpp"
using namespace boost::spirit;
// constructor
CSVRea... | true |
ffc278979f2b8b7962ac9d4152fedaa33924fbe0 | C++ | duyquan071299/CastlevaniaUit | /CastlevaniaUit/AnimationDatabase.cpp | UTF-8 | 1,279 | 2.640625 | 3 | [] | no_license | #include"AnimationDatabase.h"
CAnimationDatabase * CAnimationDatabase::instance = NULL;
CAnimationDatabase * CAnimationDatabase::GetInstance()
{
if (instance == NULL) instance = new CAnimationDatabase();
return instance;
}
void CAnimationDatabase::Add(AniType type,unordered_map<State, LPANIMATION> temp)
{... | true |
90533540b10c3d0e08573cfbc20f2eaca262534b | C++ | BJas/InterviewBit | /hashing/anagrams.cpp | UTF-8 | 671 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;
int main() {
int n;
cin>>n;
string x;
vector<string> str;
for(int i=0; i<n; i++) {
cin>>x;
str.push_back(x);
}
unordered_map<string, vector<int> > m;
for(int i=0; i<n; i++) {
x = str[i];
sort(x.begin(), x.en... | true |
b3678112e5dc0131f284dba72757bb853a35e471 | C++ | iiSky101/rmsk2 | /object_registry.h | UTF-8 | 18,236 | 2.53125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | /***************************************************************************
* Copyright 2017 Martin Grap
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org... | true |
3f81329f64257e55a795ff2287130ea48e2127f5 | C++ | log-m/post-office-thread-sim | /LinkedList.h | UTF-8 | 390 | 2.921875 | 3 | [] | no_license | #ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include <iostream>
using namespace std;
struct node
{
int val; //Customer number, worker number, or job
node * next;
};
class LinkedList
{
public:
LinkedList();
virtual ~LinkedList();
bool enqueue(int item);
int dequeue();
pro... | true |
e6ec005f9ba5e13a8b9e30c5319743cddaaa8fb2 | C++ | de-passage/parsers.cpp | /include/parsers/description/construct.hpp | UTF-8 | 1,824 | 2.703125 | 3 | [
"MIT"
] | permissive | #ifndef GUARD_PARSERS_DESCRIPTION_CONSTRUCT_HPP
#define GUARD_PARSERS_DESCRIPTION_CONSTRUCT_HPP
#include "./modifiers.hpp"
#include "./sequence.hpp"
#include "../interpreters/make_parser.hpp"
#include "../interpreters/object_parser.hpp"
namespace parsers::description {
template <class T, class... Ps>
struct construc... | true |
dae231c81761d377ecfb141bda6d1d3b17baa20a | C++ | jhormanpa/Udea-informatica2 | /Ejercicio16/main.cpp | UTF-8 | 988 | 3.484375 | 3 | [] | no_license | #include <iostream>
using namespace std;
/* Este programa realiza el promedio de las veces que se ingresa un número hasta que se
* ingresa el número cero y esta no entra en el promedio*/
int main(){
float numero, suma=0, cont=0, prom=0; /* declaramos las variables como float en caso que el
... | true |
723f0be01f64eb85c4be9ef9b097b170d89c079f | C++ | KmMnJn/awewa | /algo_hw2_bfs.cpp | UTF-8 | 1,933 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <queue>
using namespace std;
int p[] = {20,30,35,12,3};
int w[] = {2, 5, 7, 3, 1};
int W = 13;
int n = 4;
int maxprofit = 0;
int pcount;
int ncount;
struct node{
int level;
int profit;
int weight;
};
void knapsack();
float bound(node u);
int main(){
cout <<endl;
cout << ... | true |
a24bd52e2d9d992aaad0584602cb207f0c3e15d0 | C++ | SnowDawn933/algorithm-learning-notes | /ACM/basic algorithm/merge+sort.cpp | UTF-8 | 1,693 | 3.96875 | 4 | [] | no_license | //归并排序的实现方法:递归实现 在合并子列(merge函数)时使用了 two pointer 的思想
#include <cstdio>
void merge(int a[], int l1, int r1, int l2, int r2);
void mergesort(int a[], int left, int right);
int main(void)
{
int a[110];
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
mergesort... | true |
3ff685c0166f4103917aa5ea05ca9f08a2f9bf4e | C++ | Iqra350/krock2_traversability | /core/simulation/env/webots/krock/krock2_ros/controllers/Tem_controller/source/controller_misc.cpp | UTF-8 | 2,229 | 2.609375 | 3 | [] | no_license | #include "controller.hpp"
using namespace std;
using namespace Eigen;
MatrixXd
Controller :: transformation_Ikin_Webots(MatrixXd joint_angles_in, int direction, int shifts)
{
shifts=shifts==0?0:1;
if(direction<0){
//WEBOTS 2 ROBOT
for(int i=0;i<NUM_MOTORS;i++){
joint_angles_in(i... | true |
d940d7b71117b0cd2aa4d7c5e5a61d7d1e239282 | C++ | CarlosDeg/EjerciciosC | /c+++++/num imparesfor.cpp | UTF-8 | 606 | 3.046875 | 3 | [] | no_license | //capturar numero impar y sumar numero par FOR
#include <iostream>
#include <stdio.h>
using namespace std;
int main ()
{
/*int resultado,cantidad;
int y, Suma=0,Num;
cout<<"Capturar Total de cantidad "; cin>>resultado;
for(y=1;y<=resultado;y++) {
cout<<"Captrurar cantidad ";
cout<<y;
cout<<"\n";... | true |
6a08cb00e3066cdcf3c529ce3ba2d18f3555f59f | C++ | hackerlank/XEffect2D | /engine/XEffeEngine/XControl/XCalendar.h | GB18030 | 4,496 | 2.609375 | 3 | [] | no_license | #ifndef _JIA_XCALENDAR_
#define _JIA_XCALENDAR_
//++++++++++++++++++++++++++++++++
//Author: ʤ(JiaShengHua)
//Version: 1.0.0
//Date: 2014.6.30
//--------------------------------
#include "XButton.h"
#include "XTimer.h"
#include "../XXml.h"
namespace XE{
//һѡ
//עĿǰĴҪŻ
//Ŀǰռûƶ
class XCalendar:public XControlBasic
{
pri... | true |
ee0f6503949ff25cf8a47138d6ffd60c40206ae0 | C++ | Freddie-Cooke/Random | /storage.cpp | UTF-8 | 203 | 2.96875 | 3 | [] | no_license | // storage.cpp
// learning about different storage types
#include <iostream>
using namespace std;
int main() {
register int x = 2147483647;
auto y = 1;
cout << x << endl;
cout << y;
return 0;
} | true |
0493d94c16f8ff047b4a17fefbe14ea68b65fe72 | C++ | shidenggui/cplusplusprimer-answer | /5.21.cpp | UTF-8 | 380 | 2.90625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
string s1;
string s2;
unsigned cnt = 1;
cin>>s1;
while(cin>>s2){
if(s1 == s2){
if(isupper(s1[0])){
++cnt;
cout<<s1;
break;
}
}else{
if(1 < cnt){
cout<<"string: "<<s1<<" count: "<<cnt<<endl;
cnt = 1;
}
s1 = s2;
}
}
if(1... | true |
1a2b3b31b89d28898768bf8011a2c082df83a6cd | C++ | sachinsinha26/arduino-based-smartphone-controlled-vehicle | /arduino_code_for_smartphone_controlled_vehicle.ino | UTF-8 | 4,784 | 3.109375 | 3 | [] | no_license | /*
* Arduino based Smartphone controlled vehicle using Bluetooth Module HC-06, Arduino Board, L293D motor controller integrated circuit
Written by: Sachin Kumar Sinha, Indian Institute of Information Technology Senapati, Manipur
Date: 29th November 2017
• The Bluetooth module (HC-06) is having four pi... | true |
b66990538c7bbbd06bd4197124899fe687a793f7 | C++ | ha-yujin/algorithm | /baekjoon/C++/q2751.cpp | UHC | 1,278 | 4.0625 | 4 | [] | no_license | // ϱ 2
/* պ ؼ */
#include <iostream>
// 迭 ij ϴ Լ
void merge(int *arr, int *arr2, int left, int right) {
int low = left;
int mid = (left + right) / 2;
int high = mid + 1;
int x = left;
while (low <= mid && high <= right) {
if (arr[low] <= arr[high]) {
arr2[x] = arr[low];
low++;
}
else {
arr2[x]... | true |
9236b2eab3c1b8b375b02867f562794098aafb58 | C++ | kakanikatija/amx | /Arduino/amx/gps.ino | UTF-8 | 6,165 | 2.53125 | 3 | [] | no_license | #define maxChar 256
char gpsStream[maxChar];
int streamPos;
void gps(byte incomingByte){
char temp2[2];
char temp3[3];
char temp5[5];
char temp7[7];
char temp12[12];
// check for start of new message
// if a $, start it at Pos 0, and continue until next G
if(incomingByte=='$') {
// Serial.print("S... | true |
56f14f1431356118e8e101f9988ba7ae5817cfff | C++ | BiEchi/Algorithms | /CommonDS/LinkedList(DList)/dlist.h | UTF-8 | 3,102 | 2.671875 | 3 | [] | no_license | /* tab:8
*
* dlist.cpp - source file for CS225 Linked List.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the... | true |
2091ce530c98cce025070a044159db990c981215 | C++ | wingyiu/ndelvor | /DelaunayVoronoi/DataParser.cpp | UTF-8 | 1,002 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | #include "DataParser.h"
bool DataParser::hasNext()
{
if(feof(m_file) == 0)
{
return true;
}
else
{
return false;
}
}
Point* DataParser::getNext()
{
double *coord = new double[m_dimension];
for(int i=0; i<m_dimension; i++)
{
fscanf(m_file, "%lf", coord+i)... | true |
2579ee6b597e4d7518a18fcabe1107cc99fea237 | C++ | HJPyo/C | /boj19845.cpp | UTF-8 | 519 | 2.796875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int n, m, ar[2555555] = {};
int f(int x, int y)
{
if(ar[x] < y) return 0;
int L = 1, R = n, Ans;
while(L <= R){
int M = (L+R)/2;
if(L >= R){
Ans = (ar[M] < y) ? L-1 : L;
break;
}
if(ar[M] >= y) L = M+1;
else R = M;
}
return Ans-x + ar[x]-y+1;
}
int... | true |
d78ccd7414582813c2500a07120466a0b2464a61 | C++ | SRAM/RacerMateDLL | /glib/mru.h | UTF-8 | 2,163 | 2.8125 | 3 | [
"MIT"
] | permissive | #ifndef _MRU_H_
#define _MRU_H_
#ifdef WIN32
#pragma warning(disable:4101 4786) // "str" unreferenced
#include <windows.h>
#else
#include <string.h>
#endif
#include <assert.h>
#ifdef USE_LIST
#error "USE_LIST is already defined"
#endif
#define USE_LIST
#ifdef USE_LIST
#include <list>
#... | true |
8a11ab7614a7fb0f35966a4dd3057daec6e8502e | C++ | Shani-Rabi/Server-and-client---online-movie-rental-service | /Client/src/task.cpp | UTF-8 | 801 | 2.640625 | 3 | [] | no_license | //
// Created by shani on 1/9/18.
//
#include <stdlib.h>
#include "../include/ConnectionHandler.h"
#include "../include/task.h"
task::task(ConnectionHandler & connectionHandler):_connectionHandler(connectionHandler){
}
// this task will be taken by the second thread.
//his job is to read from the user and forward t... | true |
8da046331c149650e73b3b3eb3bea541759bc832 | C++ | naordahan/Task-7 | /TicTacToe.cpp | UTF-8 | 6,845 | 2.65625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/mman.h>
#include <assert.h>
#include <iostream>
#include "TicTacToe.h"
using namespace std;
// Player& TicTacToe::winner()const
// {
// uint xCount=0;
// uint oCount=0;
... | true |
1e62efb7cefb5187d3b6c6c81c247b78c8a01d8d | C++ | EduFill/hbrs-ros-pkg | /hbrs_common/hbrs_algorithms/statistics/means.hpp | UTF-8 | 697 | 2.640625 | 3 | [] | no_license | /*
* means.hpp
*
* Created on: 14.04.2011
* Author: Frederik Hegger
*/
#ifndef MEANS_HPP_
#define MEANS_HPP_
#include <ros/ros.h>
#include <pcl/point_types.h>
#include <pcl/filters/passthrough.h>
class Means
{
public:
template <typename PointT>
static void determineArithmeticMean3D(const pcl::PointCloud... | true |
f650f1013503ea9c73ba9d3ac51a3c59b0f8331a | C++ | negibokken/sandbox | /code-interview/chapter3/question4/main.cc | UTF-8 | 1,135 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
template <typename T>
class MyQueue {
private:
vector<T> s1, s2;
public:
void add(T x) { s1.push_back(x); }
void remove()
{
if (s1.size() == 0) {
throw "QUEUE_EMPTY_ERROR";
}
while (!s1.empty()) {
// Remove Last one
i... | true |
ffd32944bd3feb14929bf74e059f958fab742028 | C++ | MuhammadFadhilArkan/vending-machine | /Coding/I2C_LCD_TUTORIAL/I2C_LCD_TUTORIAL/I2C_LCD_TUTORIAL.ino | UTF-8 | 785 | 2.953125 | 3 | [] | no_license | #include <LiquidCrystal_I2C.h>
/* www.electronicsprojectshub.com */
/*Import following Libraries*/
//I2C pins declaration
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
lcd.begin();//Defining 16 columns and 2 rows of lcd display
lcd.backlight();//To Power ON the back light
//lcd.backlight();// To Powe... | true |
f2a68a96df4f7e2d7257ff4afb5a30e9a5c8cf7d | C++ | jameskumar/Online-Judge-Solutions | /SPOJ/CLASSICAL/HERDING.cpp | UTF-8 | 810 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;
int n,m,ans;
char grid[1009][1009];
int visited[1009][1009];
bool dfs(int i, int j, int pid)
{
while(1)
{
if(visited[i][j])
{
if(visited[i][j]==pid)
return true;
else
return false;
}
visited[i][j]=p... | true |
95c8222df71476b224acec21497aae81f197f6b7 | C++ | AuditoryBiophysicsLab/EarLab | /tags/release-2.0/Modules/Fanout/Fanout.cpp | UTF-8 | 3,638 | 2.53125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "Fanout.h"
#include "CParameterFile.h"
#include "ParameterStatus.h"
#include "Earlab.h"
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include "EarlabException.h"
using namespace std;
Fanout::Fanout()
{
memset(this, 0, sizeof(Fanout));
mLogger = new Logger();... | true |
39aaec26077227bf125c83ef92783b30282749d0 | C++ | parkjungeun/Algorithm-Problem-Code | /BOJ/[BOJ]1157_단어 공부.cpp | UTF-8 | 594 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
pair<char, int> alpha[26];
bool cmp(pair<char, int> &a, pair<char, int> &b) {
return a.second > b.second ? true : false;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
for (char c = 'A'; c <= 'Z'; c++)
alpha[c - 'A'].first = c;
s... | true |
96d8d239ad8542c19620fcf63079a4569c7b55ee | C++ | sicongzhao/cht_Duke_courses | /ECE551-cpp/自主练习课/test_signed.cpp | UTF-8 | 263 | 3 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <stdlib.h>
int main(void) {
int a = -1;
unsigned int b = 0;
if(a + b > 0) { //did we get -1 or 4billion?
printf("Unsigned %d\n", a + b);
}
else {
printf("Signed %d\n", a + b);
}
return EXIT_SUCCESS;
}
| true |
bb7978fd162e7aa4228fbd3c58e8f876f898bbfc | C++ | goodpaperman/template | /11.chapter/BartonNackman/BartonNackman.cpp | GB18030 | 453 | 2.609375 | 3 | [] | no_license | // BartonNackman.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <typeinfo.h>
class S
{
};
template <typename T>
class Wrapper
{
public:
Wrapper(T obj) : object(obj)
{
}
friend void f(Wrapper<T> const& a)
{
printf("void f(Wrapper<%s> const& a)\n", typeid(T).name());
}
private:
T object;
};
int ... | true |
2fe88d8948218bc1a6654f80791bd97714f7d0d2 | C++ | himanshu-code/C-Cpp | /elabstack.cpp | UTF-8 | 626 | 3.03125 | 3 | [] | no_license | #include<stdio.h>
#define capacity 10
int queue[capacity];
int front=0;
int rear=0;
void push(int x)
{
queue[rear]=x;
rear++;
}
void dequeue()
{ if(front==rear)
{
printf("Underflow");
}
else
front++;
}
void display()
{
int i;
if(rear==0)
{ printf("Underflow");
}
else{
for(i=front;i<rea... | true |
a60a83cb1d8f2de99e4a64b6ae0d18c445c7fa04 | C++ | aranoy15/embedded-software | /app/lib/stream/actions.cpp | UTF-8 | 7,873 | 3.046875 | 3 | [] | no_license | #include <lib/stream/actions.hpp>
#include <cstring>
namespace
{
char digital_char_by_index(int index)
{
static const char* digits = "0123456789ABCDEF";
//O_ASSERT(index < 16);
return digits[index];
}
}
using namespace lib::stream;
IntegerFormatAction::IntegerFormatAction(uint64_t data)
: _data(data), _is_... | true |
e7b3364972c9807aab53cfc35534f3c694fb8396 | C++ | kjgonzalez/codefiles | /cpp_sandbox/vector_array/check.cpp | UTF-8 | 620 | 3.78125 | 4 | [
"MIT"
] | permissive | /*
objective: understand how a silly array of vector of ints works.
*/
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> sample[3];
sample[0].push_back(0);
sample[0].push_back(1);
sample[0].push_back(2);
sample[1].push_back(3);
sample[1].push_back(4);
samp... | true |
dbd101de694b271cb65036aa6b3b66dad6c79a12 | C++ | hedinasr/Interpol | /view/src/Animation.cpp | UTF-8 | 2,413 | 3.015625 | 3 | [
"MIT"
] | permissive | #include "opengl.h"
#include "Vec3f.h"
#include <time.h>
#include "Animation.h"
#include <cassert>
const int NBPB=10; // NomBre de Points de Bezier (entre 2 points de Contr il y aura NPB points)
float temps()
{
return float(clock())/CLOCKS_PER_SEC;
}
/** Fonction de calcul
pc[0..3] sont les 4 po... | true |
b7df90bc16689567371ffb85de9797963a08cec8 | C++ | gzgreg/ACM | /2017-12-29/D.cpp | UTF-8 | 1,621 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct rational_t { ll nu, de;
rational_t(const ll &n = 0, const ll &d = 1) {
ll g = __gcd(abs(n), abs(d)); nu = n / g; de = d / g;
if (de < 0) { nu = -nu; de = -de... | true |
c40eb0f00fe4400fccfea487802478113a89cffc | C++ | zackluckyf/codechefeasy | /divisors-product.cpp | UTF-8 | 1,472 | 3.890625 | 4 | [] | no_license | //
// main.cpp
// divisors-product
//
// Created by Zack Fanning on 9/23/15.
// Copyright © 2015 Zackluckyf. All rights reserved.
//
/*
Being in love with number theory, Johnny decided to take a number theory course. On the first day, he was challenged by his teacher with the following problem: given a number N, ... | true |
6b98e9e3a43ccb596498fa820967a2051a6c31a5 | C++ | hushpe/leetcode | /Num_092.cpp | UTF-8 | 1,474 | 3.65625 | 4 | [] | no_license | #include<iostream>
using namespace std;
// https://leetcode-cn.com/problems/reverse-linked-list-ii
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution {... | true |
729dd39af57bc604abfdb10a59aa9ab16a9f757d | C++ | jgonfroy42/CPP_piscine | /module00/ex01/ClassContact.cpp | UTF-8 | 2,081 | 3.03125 | 3 | [] | no_license | #include "phonebook.hpp"
contact::contact(void) {}
void contact::get_all(void) const
{
std::cout << this->_f_name << std::endl;
std::cout << this->_l_name << std::endl;
std::cout << this->_nickname << std::endl;
std::cout << this->_login << std::endl;
std::cout << this->_address << std::endl;
std::cout << this-... | true |
14ff3e93b709c6bb7150317a3deb8cb1e8815fc0 | C++ | HK-FLYE/Annotated_STL_Sources | /test/lconfig_null_template_arguments.cpp | UTF-8 | 1,487 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <cstddef>
// 类模板的某个具体实现与其友元函数模板的某个实现有一一对应的关系
using namespace std;
class alloc {
};
template <class T, class Alloc = alloc, size_t BufSiz = 0>
class deque {
public:
deque() { cout << "deque" << ' '; }
};
template <class T, class Sequence = deque<T> >
class stack {
te... | true |
91e17f918b2e35b9008c42e1303eadf8def602a6 | C++ | aerdo/tg_mpei_course | /Range Sum of BST.cpp | UTF-8 | 343 | 3.3125 | 3 | [] | no_license | //https://leetcode.com/problems/range-sum-of-bst/
class Solution {
public:
int rangeSumBST(TreeNode* root, int L, int R) {
if (!root) return 0;
int res=0;
if (root->val>=L&&root->val<=R)res+=root->val;
res+=rangeSumBST(root->right,L,R);
res+=rangeSumBST(root->left,L,R);
... | true |
d6ec6bd85b5910bdfae5466920781c33eca9ebf6 | C++ | goltango/parallel-programming | /MatrixMult1.cpp | UTF-8 | 975 | 2.84375 | 3 | [] | no_license | #include <stdio.h>
#include <ctime>
#define BUFFSIZE 800
int main(int argc, char *argv[]) {
int i, j, k;
int M = BUFFSIZE;
int K = BUFFSIZE;
int N = BUFFSIZE;
float matA[BUFFSIZE][BUFFSIZE];
float matB[BUFFSIZE][BUFFSIZE];
float matC[BUFFSIZE][BUFFSIZE];
for(i=0;i<M;i++){
for(j... | true |
f7a245d37c41a19d4101fa3cfb35dc91b332606f | C++ | aman-aman/Leetcode | /34. Search for a Range.cpp | UTF-8 | 646 | 2.9375 | 3 | [] | no_license | //aman kumar jha
class Solution {
public:
vector<int> searchRange(vector<int>& a, int target)
{
int n=a.size();
vector<int> r(2,-1);
if(n==0)
return r;
int i=0,j=n-1;
while(i<j)
{
int m=(i+j)/2;
if(a[m]<target)
... | true |
e4dd1a3d9949ad0490634fd03d42b534f3dc6747 | C++ | aryankh1409/Misc-Programs | /Competitive/expression.cpp | UTF-8 | 197 | 2.515625 | 3 | [
"MIT"
] | permissive | #include<stdio.h>
#include<math.h>
int main() {
int x,y;
scanf("%d%d",&y,&x);
int negative = 5 * pow(x,3) - 4 * pow(x,2) + 3 * x + 2;
int ans = y - negative;
printf("%d",ans);
} | true |
e1b63173c37efd5b36b976ae83464be6e8536732 | C++ | MajickTek/hesperus2 | /source/engine/core/hesp/io/files/OnionTreeFile.tpp | UTF-8 | 1,619 | 2.75 | 3 | [] | no_license | /***
* hesperus: OnionTreeFile.tpp
* Copyright Stuart Golodetz, 2009. All rights reserved.
***/
#include <fstream>
#include <hesp/exceptions/Exception.h>
#include <hesp/io/sections/OnionTreeSection.h>
#include <hesp/io/sections/PolygonsSection.h>
namespace hesp {
//#################### LOADING METHO... | true |
d9f2a0fce5f0df0e8e3b78b534de4df821d612d7 | C++ | sanchi191/Plagiarism | /plag-project/plagproject/media1/emma/27_mEcUQyQ.cpp | UTF-8 | 5,139 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int min(int a, int b){ return (a<b)?a:b; }
int mergeSort(int a[], int s, int e);
int merge(int a[], int s, int e);
bool cmp(int ri, int rj);
bool mergeSortCheck(int a[], int s, int e);
bool mergeCheck(int a[], int s, int e);
class Judge{
... | true |
33b8ef88f3e6fab33ab4ef89249ab98ea16b639b | C++ | msrLi/portingSources | /ACE/ACE_wrappers/apps/drwho/server.cpp | UTF-8 | 2,486 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive |
//=============================================================================
/**
* @file server.cpp
*
* Driver program for the server. Note that it is easy to reuse the
* server for other distributed programs. Pretty much all that must
* change are the functions registered with the communciations
* mana... | true |
59a06ff586eaae44b41c9c3b9bba28431f1c62d7 | C++ | sailzeng/zcelib | /src/commlib/zcelib/zce/string/format.cpp | UTF-8 | 22,213 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #include "zce/predefine.h"
#include "zce/os_adapt/stdlib.h"
#include "zce/string/format.h"
#ifndef FMT_MIN
#define FMT_MIN(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef FMT_MAX
#define FMT_MAX(a,b) (((a)>(b))?(a):(b))
#endif
//我为了追求速度,dopr_outch,将函数dopr_outch 改写成了宏,
#ifndef FMT_DOPR_OUTCH
#define FMT_DOPR_OUTCH(a,b,c,d) ... | true |
7404e8fd586f523872c057887abb5ec44ef2adca | C++ | sofian/UM7-Arduino | /UM7.cpp | UTF-8 | 3,423 | 2.734375 | 3 | [] | no_license | #include "UM7.h"
#define DREG_QUAT_AB 0x6D // Packet address sent from the UM7 that contains quaternion values.
#define DREG_EULER_PHI_THETA 0x70 // Packet address sent from the UM7 that contains roll,pitch,yaw and rates.
#define DD 91.02222 // divider for degrees
#define DR 16.0 // divider for rate... | true |
cd213641ab06617ed3202f224f08a5aad7028273 | C++ | jackyhkust/OpenCV31-DemoVideoPlayer | /Frame.cpp | UTF-8 | 10,439 | 2.796875 | 3 | [] | no_license | #include "Frame.h"
#include "matMsgBox.h"
#include <array>
#include <cstdlib>
using namespace std;
Frame::Frame(){
}
Frame::Frame(const cv::Mat& src)
{
src.copyTo(*this);
}
Frame::~Frame()
{
}
//get Histogram data in vector form
vector<Mat> Frame::getHistVec(int iOutputChannel = RGB)
{
Mat channelPlanes[3];
b... | true |