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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4111b619bfd0b4daa4c78c12ca788755f5698ac3 | C++ | orlinhristov/cportlib | /tests/event_ut.cpp | UTF-8 | 3,076 | 3.21875 | 3 | [] | no_license | #include <catch.hpp>
#include <cport/util/event.hpp>
#include <cport/util/thread_group.hpp>
#include <algorithm>
#include <atomic>
using namespace cport::util;
TEST_CASE("Block current thread on wait_for(), until timed out", "[event]")
{
event e;
REQUIRE_FALSE(e.signaled());
const auto result = e.wait_f... | true |
af9d42f96f342be3d6a58d73b9a3e6f0caf66377 | C++ | rohitganda/ScheduleFinder | /ScheduleFinder/ScheduleFinder/ScheduleEntry.h | UTF-8 | 453 | 2.65625 | 3 | [] | no_license | #ifndef __SCHEDULE_ENTRY__
#define __SCHEDULE_ENTRY__
#include <string>
#include "Constants.h"
using std::string;
struct ScheduleEntry{
string title;
size_t duration;
bool isVisited;
bool isIncluded;
ScheduleEntry(string name, size_t dur) :title(name), duration(dur)
{isVisited = false; isIncluded ... | true |
752a54b56f039be3a39e0fc736d573c788cc9eab | C++ | You-Yeon/Algorithm | /algorithm/algorithm/stack1.cpp | UTF-8 | 937 | 3.703125 | 4 | [] | no_license | #include <iostream>
#define MAXSIZE 100
using namespace std;
template<typename T>
class Stack
{
public:
int top;
int size;
T* values;
Stack()
{
size = MAXSIZE;
values = new T[size];
top = -1;
}
~Stack()
{
delete[] values;
}
void push(T value)... | true |
91d1ecf52700dd408a861ac80a071208ad6f99d6 | C++ | Gaurav047/CPP_STL_Competitive | /Samsung/DP/LIS.cpp | UTF-8 | 1,458 | 3.859375 | 4 | [] | no_license | // Optimal Substructure of a LIS problem:
/**
* Let arr[0...n-1] be the input array and L(i) be
* the length of the LIS ending at index i such that
* arr[i] is the last element of LIS.
* Then we can write L(i) as:
* L(i) = 1+max(L(j)) where 0<j<i and arr[j] < arr[i] ;
* L(i) = 1, if no such j exists.
... | true |
6929caf73c8a71a0da10aa228b74724a0a88ead7 | C++ | rocking-around/PoL1.62.002 | /src/shared/mll_fs/src/zip_eocd.h | UTF-8 | 2,120 | 2.515625 | 3 | [] | no_license | #if !defined(__ZIP_EOCD_H_INCLUDED_7552370787048739__)
#define __ZIP_EOCD_H_INCLUDED_7552370787048739__
namespace mll
{
namespace ml_encrypted_zip
{
#pragma pack(push,1)
//=====================================================================================//
// struct zip_EOCD_heade... | true |
3e40ff7147711bf4e8fb8fafd0deb8cdaa50bb92 | C++ | vesy53/SoftUni | /Programming Basics - C++/LabEndExercises/04.ComplexCondition/OnTimeForExam/OnTimeForExam.cpp | UTF-8 | 1,515 | 3.46875 | 3 | [
"MIT"
] | permissive | // OnTimeForExam.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int exam_hour, exam_minutes, arrival_hour, arrival_minutes;
cin >> exam_hour >> exam_minutes >> arrival_hour >> arrival_minutes;
int exam_tota... | true |
871db4a4889329e11022c225c63c4258d20499fd | C++ | Vlattte/kmbo-19 | /main.cpp | UTF-8 | 395 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <LinkedList.h>
using namespace std;
int main()
{
LinkedList l;
l.pushBack(1);
l.pushFront(0);
l.pushBack(2);
cout << "Stage 1: "; l.write(); cout << endl;
l.insert(1, 10);
cout << "Stage 2: "; l.write(); cout << endl;
l.erase(1);
cout << "Stage 2: "; l.write(); cout << endl;
... | true |
59c0a35d27a32338e10fdac09e829425dca712cf | C++ | NelsonTorres/gpu | /SimpleFannData.cpp | UTF-8 | 627 | 2.828125 | 3 | [] | no_license | /*
* SimpleFannData.cpp
*
* Created on: 05/12/2017
* Author: nelson
*/
#include "SimpleFannData.h"
#include <stdio.h>
#include <stdlib.h>
unsigned readData(const char *path, float* input, float* output) {
unsigned num_data, num_input, num_output, i, j;
std::ifstream file;
file.open(path, std::ifstr... | true |
26ff17778cb79353fe8538709f856f1d21096cdf | C++ | nishchay121/Scaler-Academy-1 | /Contest/smallest_XOR.cpp | UTF-8 | 815 | 3.46875 | 3 | [] | no_license | // Given two Integer A and B. Find a number X such that A xor X is minimum possible and number of set bits in X equals to B.
int Solution::solve(int A, int B) {
int X = A;
int number_of_set = 0;
for(int i=0;i<=31;i++) {
if(X & (1 << i))
number_of_set++;
}
if(number_of_set =... | true |
2f76907352eb9bb722661e1f2634d79a5a076bda | C++ | Yenjamin/nibbler | /src/main.cpp | UTF-8 | 1,453 | 2.875 | 3 | [] | no_license | #include <dlfcn.h>
#include <iostream>
#include "Header.hpp"
#include "IGraphic.hpp"
void checkdimension(std::string width, std::string height)
{
std::regex num("^\\d+$");
if (std::regex_match(width, num) == true && std::regex_match(height, num) == true)
{
return ;
}
else
throw errors::typeError();
}
void c... | true |
1dccb0379e4956f42da504ea95fc5fad4e44bfca | C++ | codegauravg/Basic_Programs | /main.cpp | UTF-8 | 494 | 3.3125 | 3 | [] | no_license | /* Author : Gaurav Gunjan
* Created By: Dexter's Lab
* Timestamp [16/01/2016 17:19]
* */
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
long int x=0,i=0,fact=1;
cout<<"Enter a number x to find the factorial of: ";
cin>>x;
if(x==0){
cout<<"The Fac... | true |
fa15a978a5bacd61db2c4ef992700875071ed68b | C++ | syed/tc | /profitcalculator-c++/ProfitCalculator.h | UTF-8 | 656 | 2.59375 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(... | true |
aba079e9522df880e97eeaba6bb7f75e01db75af | C++ | TakuyaI/FPSGame | /GameTemplate/Game/graphics/SkinModel.h | SHIFT_JIS | 5,647 | 2.765625 | 3 | [] | no_license | #pragma once
#include "Skeleton.h"
#include "SkinModelEffect.h"
/*!
*@brief FBX̏B
*/
enum EnFbxUpAxis {
enFbxUpAxisY, //Y-up
enFbxUpAxisZ, //Z-up
};
/*!
*@brief XLfNXB
*/
class SkinModel
{
public:
//bVƂ̃R[obNB
using OnFindMesh = std::function<void(const std::unique_ptr<DirectX::ModelMeshPart>&)>;
/*!
*@br... | true |
fd794d74c978d95ff17b41230fafc282e45cca2c | C++ | JeremyVun1/smart-plants-arduino | /WaterPump.cpp | UTF-8 | 1,477 | 2.9375 | 3 | [] | no_license | #include "WaterPump.h"
WaterPump::WaterPump(int pin, int dir1, int dir2, int mSpeed)
: _pin(pin), _dir1(dir1), _dir2(dir2), _mSpeed(mSpeed), _mode(AUTO), _isOn(false), stateChanged(false) {
pinMode(_pin, OUTPUT);
pinMode(_dir1, OUTPUT);
pinMode(_dir2, OUTPUT);
this->off();
};
void WaterPump::autoMode() {
... | true |
34bc3163df1a84393c720fba2d41e42224251879 | C++ | AllenLiuX/My-LeetCode | /leetcode-cpp/1-99/#75 颜色分类.cpp | UTF-8 | 1,377 | 3.8125 | 4 | [] | no_license | Tags: 排序
给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。
此题中,我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。
注意:
不能使用代码库中的排序函数来解决这道题。
示例:
输入: [2,0,2,1,1,0]
输出: [0,0,1,1,2,2]
进阶:
一个直观的解决方案是使用计数排序的两趟扫描算法。
首先,迭代计算出0、1 和 2 元素的个数,然后按照0、1、2的排序,重写当前数组。
你能想出一个仅使用常数空间的一趟扫描算法吗?
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/p... | true |
66567bf5e1d80e061589d75a442dd55718f4b8f6 | C++ | pierrelux/aquaviz | /src/util/QuaternionToRotationMatrix.h | UTF-8 | 1,825 | 2.84375 | 3 | [] | no_license | /**
* @author Pierre-Luc Bacon <pbacon@cim.mcgill.ca>
*/
#ifndef QUATERNIONTOROTATIONMATRIX_H_
#define QUATERNIONTOROTATIONMATRIX_H_
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#... | true |
3d194665adbe562c4c122aaee719eac755d9f05f | C++ | rishuverma/Solution | /Kingdom Division.cpp | UTF-8 | 2,410 | 3.375 | 3 | [] | no_license | /**
* https://www.hackerrank.com/challenges/construct-the-array/problem
*/
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'countArray' function below.
*
* The function is expected to return a LONG_I... | true |
5e695f9f9b562660e733e08a5288cfc71acdd0b3 | C++ | greenveg/arduinoRepo | /Wordomat archive/Wordomat3/storage.ino | UTF-8 | 956 | 3.078125 | 3 | [] | no_license |
void loadFromEeprom() {
int address = 0;
float floatValue = 0.0;
int intValue = 0;
for (int i = 0; i < NUMBER_OF_SLOTS; i++) {
EEPROM.get(address, floatValue);
prices[i] = floatValue;
address += sizeof(floatValue);
}
for (int i = 0; i < NUMBER_OF_SLOTS; i++) {
EEPROM.get(address, intValue... | true |
c0bd1b0ee02a98ba9ca03c77b5f0c1ba0ef083ed | C++ | Athos06/SkyPlatforms | /src/BossAnimation.cpp | UTF-8 | 1,677 | 2.921875 | 3 | [] | no_license | #include "BossAnimation.h"
BossAnimation::BossAnimation(Ogre::Entity* entity){
m_pEntity = entity;
m_pActiveAnimation = 0;
activeAnimID = ANIM_NONE;
}
BossAnimation::~BossAnimation(){
m_pEntity = 0;
}
void BossAnimation::setupAnimations(){
m_pAnimations[ANIM_IDLE] = m_pEntity->getAnimationState("Idle");
m_pAni... | true |
22960ffc0e6ff2c62aee2cabbf3cb894c6df9ca8 | C++ | ddt-sawa/meikai_cpp_sawa | /6-19.cpp | UTF-8 | 1,689 | 3.75 | 4 | [] | no_license | /*
* 6-19.cpp
*
* Created on: 2018/06/24
* Author: syuka
*/
/*演習6-19 List6-21の関数rを、不正な添え字に対して安全に動作するものに書き換えよ。
*静的記憶域期間をもつint型の変数を関数内部で定義して、idxが0以上a_size未満でなければ、
*その変数への参照を返却すること
*/
#include<iostream>
using namespace std;
//配列の要素数
const int arraySize = 5;
/**
*引数として受け取った配列の要素への参照を返却する
* @param arrayIn... | true |
27768928d6861d2bd748519ccdcbe1e48814e943 | C++ | haruto-k/PC-Same-party | /C++/やさしいC++/Sample/練習/4_2.cpp | SHIFT_JIS | 351 | 3.390625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
double height,width;
cout << "Op`̍͂ĂB\n";
cin >> height;
cout << "Op`̒ӂ͂ĂB\n";
cin >> width;
cout << "Op`̖ʐς" << height * width / 2 << "łB\n";
return 0;
}
| true |
11f99fa4a756e8ae607d9b27b824a748d2cb81b4 | C++ | AlbertoTrapiello/LAB | /Tema4_inicial_2012/Pang/src/Esfera.cpp | UTF-8 | 1,322 | 3.171875 | 3 | [] | no_license | #include "Esfera.h"
#include "glut.h"
#include <math.h>
Esfera::Esfera()
{
rojo = verde = azul = 255; //blanco
radio = 1.0f;
aceleration.y = -9.8f;
velocity.x = 5;
velocity.y = 20;
}
Esfera::Esfera(float rad, float x, float y, float vx, float vy)
{
radio = rad;
position.x = x;
position.y = y;
velocity.x = v... | true |
9981e7d5dd516d413c949e84cb4bf2fbe74bd396 | C++ | Lukemtesta/Cpp-openCV---Rendering-a-Scene-Described-by-a-File | /Code/CairoDisplay.cpp | UTF-8 | 3,916 | 2.65625 | 3 | [] | no_license | #include "CairoDisplay.h"
#include <math.h>
#include <iostream>
namespace SceneDisplay {
using namespace std;
//CairoDisplay::CairoDisplay() : display(NULL), surface(NULL), record(NULL), context(NULL) {}
CairoDisplay::CairoDisplay(int width, int height) throw(DisplayException) : display(XOpenDisplay(NULL)), surf... | true |
79a73e78fb70718094a69fba14bf101b092021f1 | C++ | michaelbzms/System-Programming-Final-Project | /webcrawler/jobExecutor/src/textfiles_parsing.cpp | UTF-8 | 8,993 | 3.03125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cstring>
#include <fstream>
#include <dirent.h> // for directory traversing
#include "../headers/inverted_index.h"
#include "../headers/util.h"
#include "../headers/textfiles_parsing.h"
#include "../headers/map.h"
using namespace std;
/* Global variables */
extern char **... | true |
6e86577b934d1e0cbe2014f0acde80b733752f9f | C++ | R0dri/Arduino | /sketch_mar04a/sketch_mar04a.ino | UTF-8 | 1,898 | 2.625 | 3 | [] | no_license | /*
* Simple demo, should work with any driver board
*
* Connect STEP, DIR as indicated
*
* Copyright (C)2015-2017 Laurentiu Badea
*
* This file may be redistributed under the terms of the MIT license.
* A copy of this license has been included with this distribution in the file LICENSE.
*/
#include <Arduino.h>... | true |
0a41f0dd8ffd280d3fcdb9e298460afa57409a44 | C++ | JohannesLaier/jit-compiler | /src/js/jslexem.cpp | UTF-8 | 386 | 2.609375 | 3 | [
"MIT"
] | permissive | #include "jslexem.h"
#include <iostream>
JSLexem::JSLexem() {}
JSLexem::JSLexem(LexemType t) {
type = t;
}
LexemType JSLexem::getType() {
return type;
}
void JSLexem::setValue(std::string value) {
s_value = value;
}
void JSLexem::setValue(long value) {
n_value = value;
}
std::string JSLexem::getStrValue() {
... | true |
dc926959bbaac17452945a867a557ac7aba1f388 | C++ | s0217391/DifferentProjects | /SimCode/include/particle.h | UTF-8 | 1,756 | 2.96875 | 3 | [] | no_license | #ifndef PARTICLE_H
#define PARTICLE_H
#include <vector>
#include "ngl/VAOPrimitives.h"
class Particle
{
public:
inline Particle(float _rad, float _mass, ngl::Vec3 _pos, ngl::Vec3 _vel = ngl::Vec3(0, 0, 0)) :
m_radius(_rad),
... | true |
b710975557eb5fa28c5695b90d61d8caa2987b02 | C++ | mateuscgc/maratonas | /ProgBase 2015/H.cpp | UTF-8 | 2,598 | 3.046875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int tickets[3][3];
int tickets2[3][3];
int diagonais(){
int total = 0;
int max_d = min(tickets[0][0], min(tickets[1][1], tickets[2][2]));
total += max_d;
for(int i = 0; i < 3; i++){
tickets[i][i] -= max_d;
}
// segunda diagonal
max_d = min(tickets[0][1], min(tic... | true |
a54c10066b5c8d32f7d5f91f5671f42b7b279c0c | C++ | mehrdad-shokri/wiki-2 | /src/Algorithms/Algorithms/Files/longest_increasing_subsequence.cc | UTF-8 | 611 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int LIS(const vector<int> &vec) {
int n = vec.size();
int lis[n];
int max_lis = 0;
int i, j;
for (i = 0; i < n; ++i) {
lis[i] = 1;
}
for (i = 1; i < n; ++i) {
for(j = 0; j < i; ++j) {
if (vec[i] > vec[j] && lis[i] < lis[j] + 1) {... | true |
050dc015dced6aa71a3ce3ba2d44964ee3166abd | C++ | punyawat-jar/Lab-Time-punyawat-jar | /Time.h | UTF-8 | 880 | 3.59375 | 4 | [] | no_license | class Time{
private:
int m,h,s;
public:
void getTime();
Time operator-(Time);
void display();
};
void Time::getTime(){
do{
cout << "Input hours :";
cin >> h;
if(h >=24){
cout << "--- Please input hours in (0-23) ---" << endl;
... | true |
29078901f4d38a468dfa56ed43335f9fec13a607 | C++ | moevm/oop | /8383/Larin_Anton/Proj/main.cpp | UTF-8 | 402 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <clocale>
#include <iostream>
#include"Game.h"
#include "Vector.h"
int main() {
std::setlocale(LC_ALL, "xx_XX.UTF-8");
std::cout << "Hello, World!" << std::endl;
Game* game = new Game(8,8);
game->run();
Vector<int> vec;
vec.push(5);
vec.push(6);
vec.push... | true |
8aaa87b7879b2c2a089a9fd38b19f503ba71e304 | C++ | EmielBon/nintendo-ds-framework | /code/arm9/include/ViewPort.h | UTF-8 | 816 | 2.734375 | 3 | [] | no_license | #pragma once
#include "types.h"
#include "fixed.h"
namespace Graphics
{
struct ViewPort
{
public:
///
ViewPort();
///
ViewPort(int x, int y, int width, int height);
///
fx12 AspectRatio();
public:
int X, Y, Width, Height;
};
//-----------------------------------------------------------------... | true |
39119a542aac3ddb5d6193c819a839ff278445b5 | C++ | asleonova/cpp | /.history/D06/ex01/main_20210316150835.cpp | UTF-8 | 2,843 | 3.296875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | true |
02fde607f1a0992011b4738097aca130eecd0100 | C++ | DarinM223/breakout | /src/PostProcessor.h | UTF-8 | 1,590 | 2.765625 | 3 | [] | no_license | #ifndef POSTPROCESSOR_H
#define POSTPROCESSOR_H
#include <GL/glew.h>
#include <exception>
#include "Shader.h"
#include "Texture.h"
struct MsfboInitException : public std::exception {
const char* what() const noexcept override {
return "Failed to initialize MSFBO";
}
};
struct FboInitException : public std::e... | true |
526c01fc65c93be2b30e3dfb531ec7f2d8207ef6 | C++ | aczech17/serial_read | /cmake-build-debug/Port.cpp | UTF-8 | 2,927 | 2.828125 | 3 | [] | no_license | #include "Port.h"
std::string Port::readLine()
{
char tempChar;
std::string buffer;
DWORD countBytesRead = 0;
do
{
ReadFile(hComm, //file handle
&tempChar, //char buffer
sizeof(tempChar), //number of ... | true |
95258b63d2ff6fa88838abc171ec1d33ae0eacb4 | C++ | PubFork/SoftRenderSample | /WindowsGraphics/WindowsGraphics/Vector4.cpp | UTF-8 | 3,204 | 3.40625 | 3 | [] | no_license | #include <math.h>
#include "Vector4.h"
//w = 0时表示向量 w = 1时表示点
Vector4::Vector4()
: mX(0), mY(0), mZ(0), mW(0)
{/*empty*/}
Vector4::Vector4(double _x, double _y, double _z, double _w)
: mX(_x), mY(_y), mZ(_z), mW(_w)
{/*empty*/}
Vector4::Vector4(const Vector4& _other)
: mX(_other.mX),
mY(_other.mY),
... | true |
c74a76f4c35d8ded1b89c8f9eb6f82ce883a95ba | C++ | chrwoizi/ssh-raytracing | /SkyboxMaterial.hpp | UTF-8 | 1,312 | 2.78125 | 3 | [] | no_license | #ifndef SKYBOXMATERIAL_HPP
#define SKYBOXMATERIAL_HPP
#include "Material.hpp"
#define MAX(a,b) ((a)>(b)?(a):(b))
class SkyboxMaterial : public Material
{
public:
SkyboxMaterial() : Material(false, false, 0, vec(1,1,1), vec(1,1,1)) {}
virtual void shade(vec& destination, const vec& contribution, int level, std::ve... | true |
61d170f5d2028dd1c13e8219ce22d5bb2eeb82e9 | C++ | xih108/Math155B | /Project4/DataStructs/Stack.h | UTF-8 | 3,266 | 3.28125 | 3 | [] | no_license |
// Stack.h. release 3.2. May 3, 2007.
//
// A general purpose dynamically resizable stack.
// Implemented with templates.
// Items are stored contiguously, for quick accessing.
// However, allocation may require the stack to be copied into
// new memory locations.
//
// Usage: Stack<T> or Stack<T,IdxVal>
//... | true |
9d2acd8572deb65f98a1a23ebed8dd423ba2d92c | C++ | eth42/MetagraphMatchingBenchmark | /include/Job.h | UTF-8 | 915 | 2.59375 | 3 | [] | no_license | #pragma once
#include <vector>
#include <sstream>
#include "GraphSource.h"
#include "TypeEnums.h"
namespace maxmatching {
/* Wrapper class to add additional information to a graph source */
class Job {
private:
GraphSource* source;
public:
unsigned long seed;
bool shuffle;
unsigned int iterat... | true |
8aea91acffb456d9e663f4679394de14019a73f6 | C++ | Cartoonman/hash-table-qq | /Source Code/hashTable.h | UTF-8 | 3,069 | 3.671875 | 4 | [] | no_license | #include <iostream> // Necessary for any type of I/O interface
/** very basic I/O functions for input and output **/
using std::string;
using std::cout;
using std::endl;
/** Description: This is the main file that contains both the string hash
function and the hash table class. This is the core of the program.**/
/... | true |
47e78b0504c897015f1e6d10e5f55074a01cd845 | C++ | apfitzen/Wireframes-Calc | /Wireframes Calc/VerticesManager.h | UTF-8 | 608 | 2.5625 | 3 | [] | no_license | //
// VerticesManager.h
// Wireframes Calc 4.5
//
// Created by Aaron Pfitzenmaier on 4/26/15.
// Copyright (c) 2015 Aaron Pfitzenmaier. All rights reserved.
//
#ifndef __Wireframes_Calc_4_5__VerticesManager__
#define __Wireframes_Calc_4_5__VerticesManager__
#include <vector>
#include "basicshapes.h"
class Point... | true |
a14a3ca8ac94d10be49230e9ac7e874171a3ca20 | C++ | VJecheva/SoftTech_070421 | /SoftTechTest/SoftTechTest/Header.cpp | UTF-8 | 448 | 2.640625 | 3 | [] | no_license | #include "Header.h"
int suma(int a[], int n)
{
int s = 0;
for (int i = 0; i < n; i++)
s += a[i];
return s;
}
int max(int a[], int n)
{
int m = a[0];
for (int i = 1; i < n; i++)
if (m < a[i]) m = a[i];
return m;
}
int min(int a[], int n)
{
int m = a[0];
for (int i = 1; ... | true |
7187a06051b4e81f8f5e1e3d1d9a9e09a3db09ad | C++ | k-ishiguro/CPP_BoostMPITest | /testBroadcast.cpp | UTF-8 | 1,081 | 2.671875 | 3 | [] | no_license | /**
* Written by Katsuhiko Ishiguro <k.ishiguro.jp@ieee.org>
* Last Update: 02/09, 2016 (dd/mm, yyyy)
*/
#include <boost/mpi.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/collectives.hpp>
#include <iostream>
#include <vector>
#include <string>
#include <algorith... | true |
14f91ff1ce14d4d96f9e56bbf7c2e2654df194e3 | C++ | AlexKent3141/OnePunchGo | /src/core/BitSet.h | UTF-8 | 2,593 | 3.390625 | 3 | [
"MIT"
] | permissive | #ifndef __BITSET_H__
#define __BITSET_H__
#include <cassert>
#include <cstdint>
#include <string>
typedef uint64_t Word;
const Word One = 1;
// Bit set class which is used for quick board-wise operations.
class BitSet
{
public:
BitSet() = delete;
BitSet(int);
BitSet(const BitSet&);
~BitSet();
i... | true |
290661480b2d7951dd9a05262997eaab2109cecc | C++ | jaimelay/competitive-programming | /Reference/math/FactorsAndDivisors.cpp | UTF-8 | 703 | 3.375 | 3 | [] | no_license | // For number greater than 9*10^14 see Pollard Rho Algorithm.
// Complexity: O(sqrt(n))
vector<long long> getFactors(long long n) {
vector<long long> factors;
for (long long d = 2; d * d <= n; d++) {
while (n % d == 0) {
factors.push_back(d);
n /= d;
}
}
if (n >... | true |
f312ca11f35707bc6a93f3011416ddbb9637f341 | C++ | manideep1821/pscp-lab | /lab/4/problem5.cpp | UTF-8 | 1,406 | 3.46875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"enter the number :"<<endl;
cin>>n;
int r;
int count =0;
int count1=0;
int count2=0;
int count3=0;
int count4=0;
int count5=0;
int count6=0;
int count7=0;
int count8=0;
while(n>0)... | true |
3dd8d272104a30b8fe006b6d6ae2069010cd46cf | C++ | mathieuherbert/ClavierHero | /Applications/SuperPong/Raquette.h | UTF-8 | 489 | 3.0625 | 3 | [] | no_license | #ifndef RAQUETTE_H
#define RAQUETTE_H
/**
* @file Raquette.h
* @class Raquette
* @brief Une raquette du jeu pouvant se déplacer verticalement.
*/
class Raquette {
int y;//Coordonnée
int bas,haut;//haut et bas de la raquette
public :
//Accesseurs
Raquette();
Raquette(int,int);
void init(int,int);
int getY();... | true |
b7117cdf731c21279bff282145fe2fb9443af10a | C++ | bb2002/cpp-study | /StartingCPP/110302.cpp | UTF-8 | 938 | 3.546875 | 4 | [] | no_license | #include <iostream>
class Base {
int state;
public:
Base() : state(0) {
}
Base(int a) : state(a) {
}
virtual int dummy() {
std::cout << "Base dummy() called" << std::endl;
return state;
}
};
class Derived : public Base {
public:
Derived(int i) : Base(i) {
}
void setNumber(int a) {
number = a;
... | true |
5a9f4062681ac86d836666620f3d223252a131e0 | C++ | Roozbeh-Bazargani/twin-prime-conjecture | /Source.cpp | UTF-8 | 732 | 3.203125 | 3 | [] | no_license | #include<iostream>
#include<fstream>
bool primary(long long n);
int main()
{
std::ofstream of{ "n,n-2 are primary.txt" };
long long n{}, m{}, cnt{}, N{}, dist{};
std::cout << "n , N , cnt" << std::endl;
std::cin >> n >> N >> cnt;
m = n - 2;
while (n < N)
{
if (primary(n) && primary(m))
{
cnt++;
dist ... | true |
bb98887f28dcaa3c804a02c5ee561aac03714b61 | C++ | allwak/basics-of-c-plus-plus-development-white-belt | /Week_2/06 Programming Assignment/Solution/reverse.cpp | UTF-8 | 859 | 3.625 | 4 | [
"Unlicense"
] | permissive | //#include <iostream>
//#include <vector>
//-------------------------------------------------------------------------------------------------
//void Reverse(std::vector<int> & input);
//-------------------------------------------------------------------------------------------------
//int main()
//{
// std::vector<int... | true |
60bc27f9bdb427241cc2e6beb08c308e640f06fc | C++ | chebcia/Loty---Projekt- | /Drzewo.h | WINDOWS-1250 | 1,084 | 2.765625 | 3 | [] | no_license |
#include <iostream>
#include <fstream>
#include "Pasazer.h"
#ifndef STRUCT_DRZEWO
#define STRUCT_DRZEWO
/**
@param pasazerPrzechowywanyWDrzewie zmienna stuktury pasazer zawieraja informacje o pasazerze
@param lewylisc wskaznik na lewa strone drzewa
@param prawylisc wskaznik na prawa strone drzewa
*/
struc... | true |
8cd3b6f1ce3aa5645ec4f9397f7761ab4c54d279 | C++ | gpudev0517/Fire-Simulator | /NVIS/NDYN_Debug/include/Core/Utility/NEAABB.h | UTF-8 | 3,415 | 3.0625 | 3 | [] | no_license | #pragma once
//! Axis aligned bounding box.
/*!
This is used for fast collision detection.
*/
struct AABB
{
private:
vec3f m_MinPos;
vec3f m_MaxPos;
//bool m_Empty;
public:
AABB()
{
m_MinPos = vec3f(FLT_MAX,FLT_MAX,FLT_MAX);
m_MaxPos = vec3f(-FLT_MAX,-FLT_MAX,-FLT_MAX);
}
AABB(const vec3f& min, const v... | true |
bf575c3d2cd1b4491062ee73ce7f691c9e69b00d | C++ | wakairo/cutb | /include/cutb/parser/core.h | UTF-8 | 4,241 | 2.84375 | 3 | [
"MIT"
] | permissive | #ifndef CUTB_PARSER_CORE_H
#define CUTB_PARSER_CORE_H
#include <cstddef>
#include <list>
#include "cutb/exceptions.h"
/** @file
* API for parsing CUTB tests.
*/
namespace cutb {
/**
* API class for parsing CUTB tests.
*
* To parse tests, first define a subclass of Parser overriding callback
* functions, and ... | true |
32b1a646f0ebad6501f557bbb2f49dc9defa40c8 | C++ | hua19971997/Computer-vision | /cse576_sp20_hw1-master/src/test/test0.cpp | UTF-8 | 3,546 | 2.796875 | 3 | [] | no_license | #include "../image.h"
#include "../utils.h"
#include <string>
#include <iostream>
using namespace std;
void test_get_pixel()
{
Image im = load_image("data/dots.png");
// Test within image
TEST(within_eps(0, im.clamped_pixel(0,0,0)));
TEST(within_eps(1, im.clamped_pixel(1,0,1)));
TEST(within_eps(0, im.clam... | true |
2e63faaaf18064d1f42e4c6ba40fe088b3e3e423 | C++ | Caceresenzo/42 | /webserv/source/json/JsonArray.hpp | UTF-8 | 2,040 | 2.796875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* JsonArray.hpp :+: :+: :+: ... | true |
3d504439a5b2222187b7b2a6b46d478d4cc7c84b | C++ | HolySmoke86/blobs | /src/ui/Widget.hpp | UTF-8 | 1,243 | 2.71875 | 3 | [] | no_license | #ifndef BLOBS_UI_WIDGET_HPP_
#define BLOBS_UI_WIDGET_HPP_
#include "../math/glm.hpp"
namespace blobs {
namespace app {
struct Assets;
}
namespace graphics {
class Viewport;
}
namespace ui {
class Widget {
public:
Widget();
virtual ~Widget();
Widget(const Widget &) = delete;
Widget &operator =(const Widget &... | true |
6188621ad0bf0e65223094593a6581bdfd6230e4 | C++ | HarukaFujisawa/themetraining2017 | /Arduino/TangibleCube/nzVector.cpp | UTF-8 | 2,667 | 2.890625 | 3 | [] | no_license |
#include "nzVector.h"
template<typename TYPE>
bool nzIntersection(const _nzVector3<TYPE> &ptLine1, const _nzVector3<TYPE> &ptLine2, const _nzVector3<TYPE> &ptPlane1, const _nzVector3<TYPE> &ptPlane2, const _nzVector3<TYPE> &ptPlane3, _nzVector3<TYPE> &ptIntersection)
{
bool err = false;
_nzVector3<TYPE> planeNorma... | true |
614a3705cea453c2e7332dc8e185889a840f1f53 | C++ | c00188916/Data-Structures-and-Algorithms | /templates/templates/NodeSearchCostComparer.h | UTF-8 | 308 | 2.828125 | 3 | [] | no_license | #pragma once
#include "GraphNode.h"
typedef GraphNode<std::pair<std::string, int>, int> Node;
class NodeSearchCostComparer {
public:
bool operator()(Node * n1, Node * n2) {
std::pair<std::string, int> p1 = n1->data();
std::pair<std::string, int> p2 = n2->data();
return p1.second > p2.second;
}
}; | true |
4115d25fe175473378743aad230366213c4a49c0 | C++ | deneb42/lemme | /tp2/src/station.hpp | UTF-8 | 2,399 | 3.109375 | 3 | [] | no_license |
#ifndef __STATION_HPP__
#define __STATION_HPP_
/*!
* \file station.hpp
* \brief Classe representant une station
* \author {Jean BADIE, Benjamin BLOIS}
* \date 17 janvier 2013
*/
#include <vector>
#include <string>
#include "transition.hpp"
class Station {
public :
Station(std::string name, int age); /... | true |
f92fcfcf72209d5b793e74e64d4ebf9a4f476ea6 | C++ | minigo/simpleai | /src/ai/aggro/AggroMgr.h | UTF-8 | 1,514 | 3.328125 | 3 | [
"Zlib"
] | permissive | #pragma once
#include <vector>
#include <aggro/Entry.h>
namespace ai {
class AI;
typedef std::shared_ptr<AI> AIPtr;
/**
* @brief Manages the aggro values for one @c AI instance. There are several ways to degrade the aggro values.
*/
class AggroMgr {
public:
typedef std::vector<Entry> Entries;
typedef Entries::i... | true |
dc9f54d407722749f933452e5c0ee6698a1cba8c | C++ | Mati5/Sea-Battle-game | /SeaBattle/CheckboxBtn.cpp | UTF-8 | 1,024 | 2.921875 | 3 | [] | no_license | #include "CheckboxBtn.h"
CheckboxBtn::CheckboxBtn():GridField()
{
m_width = 45;
m_height = 45;
m_isChecked = false;
loadTexture("../images/field.png");
if (!m_checkedTexture.loadFromFile("../images/checked.png"))
std::cout << "Error load craft texture!" << std::endl;
}
CheckboxBtn::CheckboxBtn(bo... | true |
5571708b01a75f2c8b8d9fd2aac2ac4c02f76ff0 | C++ | j-ss-h/ProjectRobot | /Project Roomba/driver.cpp | UTF-8 | 4,462 | 3.015625 | 3 | [] | no_license | #include "States.h"
#include <iostream>
#include <fstream>// for input file
using namespace std;
/*
These are the probabilities for each negatively impacting category for the robot.
The user can modify these through the menu.
*/
void menu(StateMachine& bot);
void probability(StateMachine& bot);
int main()
{
Sta... | true |
5ef291e139bb2c39370132120606782d5b740218 | C++ | Shakadak/cpp | /pool/d03/ex01/ScavTrap.hpp | UTF-8 | 1,656 | 3.109375 | 3 | [] | no_license | #ifndef SCAVTRAP_HPP
# define SCAVTRAP_HPP
# include <string>
class ScavTrap {
public:
ScavTrap(std::string Name);
ScavTrap(ScavTrap const & src);
~ScavTrap(void);
ScavTrap & operator=(ScavTrap const & rhs);
void rangedAttack(std::string const & target);
void ... | true |
9047c80b1bde648a52b7cf01214b2e089d985db0 | C++ | peng53/failure | /chunkreader/ireader_extf.cpp | UTF-8 | 1,106 | 2.953125 | 3 | [] | no_license | #include "ireader_extf.h"
#include <stack>
using std::stack;
void reader2stdout(IReader* reader,ostream& out){
while (!reader->empty()){
out << reader->get();
reader->advance();
}
out << '\n';
}
static unordered_map<char,char> BRACKETS = {
{'[',']'}, {']','['},
{'{','}'}, {'}','{'},
{'"','"'},
};
templat... | true |
8207170c7038d3bd7f726fed81339338ba756761 | C++ | yaoweiliu/work | /widora/BoardService/Appl/Process.cpp | UTF-8 | 1,029 | 2.71875 | 3 | [] | no_license | #include "Process.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
extern char **environ;
Process::Process()
{
}
Process::~Process()
{
}
/*
* param: path is file's path
*
* return 0 is success, -1 is failed.
*/
int Process::run(const char *path)
{
return execBin(path);
}
/*
* param: path is f... | true |
984a69187fa30c601bfc672f3da708ec7dea0209 | C++ | divsriv111/semester-programs | /sem1/lab 13/lab13 10.cpp | UTF-8 | 196 | 2.546875 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
int main()
{
char a[100],i;
printf("enter a string\n");
gets(a);
for(i=0;a[i]!='\0';++i){
if(a[i]==' ')
a[i]=a[i+1];}
a[i]='\0';
printf("%s",a);
}
| true |
de5a63dc9fbe4ed64c10530256cc0a714dcb9b43 | C++ | njuHan/OJcodes | /nowcoder/coding-interviews/不用加减乘除做加法.cpp | UTF-8 | 382 | 2.578125 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<set>
#include<list>
#include<ctime>
using namespace std;
class Solution {
public:
int Add(int num1, int num2)
{
if (num2 == 0) return num1;
int a = num1^... | true |
e9be202e5df766985bd3092aff9c9c7a261a4867 | C++ | alexsunday/espush-dc1 | /lib/espush/os_impl.cpp | UTF-8 | 1,878 | 2.5625 | 3 | [] | no_license | #include <Arduino.h>
#include <Esp.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include "frame.h"
#include "board.h"
static char chip_imei[32];
/*
signal to espush-rssi ,signal 的值,为 0~5 共 6 个等级,返回 0~31 的 平台值
平台rssi值与信号等级对应关系
0 => 0
1 => 1
[2, 15] => 2
[16, 25] => 3
[26, 30] =... | true |
5dac64b9e760c2d2cfcb83110feee7a700b8e5e7 | C++ | WZC961007/Clanguage | /eex5-9.cpp | UTF-8 | 266 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
int a[50];
int fun(int m)
{
int n=0;
for(int i=1;i<=m;i++)
{
if((i%7==0)||(i%11==0))
{
a[n]=i;
n++;
}
}
return n;
}
main()
{
int m;
scanf("%d",&m);
for(int i=0;i<fun(m);i++)
{
printf("%d\n",a[i]);
}
} | true |
1f036a3a7a88ba84151534fccd869c3e4d7e2438 | C++ | kokfahad/Problems-Solving- | /Special__Interview Questions/Array Interview questions/02_negative_first_element.cpp | UTF-8 | 366 | 2.671875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[]={-1,2,-3,4,-5};
int n=sizeof(arr)/sizeof(arr[0]);
int j=0;
for(int i=0;i<n;i++)
{
if(arr[i]<0)
{
if(i!=j)
swap(arr[i],arr[j]);
j++;
}
}
for(int j=0;j<n;j++)
... | true |
6a5b97fb0c3a893aef70559aca0aeda9383de22a | C++ | qiulx026/leetcode | /tic toc toe.cpp | UTF-8 | 5,079 | 3.578125 | 4 | [] | no_license | // ConsoleApplication7.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include <iostream>
using namespace std;
class Board { //For each game, there is only one Board object.
public:
void show(); //To show the board
int judge(); //judge whether ... | true |
03050888a9ca9ab5d24731f53a7c2338a579985c | C++ | odganzorig/Binary_tree_lab | /binary_tree_tests.cpp | UTF-8 | 11,469 | 3.203125 | 3 | [] | no_license | // FILE: binary_tree_tests.cpp
// CS 223 Winter 2018, Lab 8
// Tree tests for a binary tree class
//
// Barb Wahl & Theresa Wilson, 4-3-18
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <vector>
#include "binary_tree.h" // provides both node classes, plus tree class
#include "gtest/gtest.h" // de... | true |
1987e2c824702b19ef363f8998eb4d9dc6a79d7c | C++ | TheNsBhasin/CodeChef | /GERMANDE/main.cpp | UTF-8 | 807 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
using namespace std;
int printPresident(int arr[],int n,int k)
{
int d=n*k;
int counter=0;
int cases[k];
for(int i=0;i<k;i++)
{
cases[i]=0;
if(arr[i]==1)
counter++;
}
if(counter>k/2)
cases[0]++;
for(int i=k;i<d+k... | true |
a01a06d645b675c77398942c65476cc9479ab211 | C++ | GuAntunes/excercises-language-C | /Lista 6 (STRUCT)/Exercicio_09.cpp | WINDOWS-1250 | 1,970 | 3.203125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <iostream>
using namespace std;
typedef struct info{
char nome[30],sexo,cargo[30];
int idade,CPF,nascimento,setor,salario;
};
int main(){
setlocale(LC_ALL,"portuguese");
FILE *file;
info *dados;
int n;
printf("Digite quan... | true |
734648543a2231de59c484f220565e1a8e97751c | C++ | vivekzhere/learning_cpp | /SAPS/Assorted/patrn1.cpp | UTF-8 | 238 | 2.75 | 3 | [] | no_license | #include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
void pat(int);
cout<<"Enter limit : ";
int n;
cin>>n;
pat(n);
getch();
}
void pat(int n)
{
for(int i=n;i>0;i--)
cout<<i<<"\t";
cout<<"\n";
if(n>1)
pat(n-1);
}
| true |
8e9e6514ca251bcecaf8b5ddd787e9295670e2c2 | C++ | likegreen/algocourse | /9/sieve.cc | UTF-8 | 493 | 3.21875 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int LIM = 100001;
bool prime[LIM];
void sieve(int n) {
prime[1] = false;
for (int i = 2; i <= n; ++i) {
prime[i] = true;
}
for (int i = 2; i * i <= n; ++i) {
if (prime[i]) {
for (int j = i * i; j <= n; j += i) {
prime[j] = false;
... | true |
2ac539f86dde089c83bbcc331bf968b7eef76dc5 | C++ | Saurabh2711/Code | /spojISELECT.cpp | UTF-8 | 776 | 2.703125 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
using namespace std;
int fun_take(bool tof,int energy,int i,bool f);
int a[1001],b[1001];
int n;
main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++)
{
scanf("%d",&b[i... | true |
d0bb51b2162b133b267d2df4e0b63fccb34fa831 | C++ | esenti/labshooter | /src/Entities/Explosion.cpp | UTF-8 | 1,854 | 3 | 3 | [
"MIT"
] | permissive | //
// Explosion.cpp
// labshooter
//
// Created by Pawel Miniszewski on 08.12.2014.
// Copyright (c) 2014 Pawel Miniszewski. All rights reserved.
//
#include "Explosion.h"
#include "ResourceCache.h"
#include <time.h>
Explosion::Explosion()
{
}
Explosion::~Explosion()
{
}
void Explosion::Draw(sf::RenderWind... | true |
161522d484a7f44fb9f9a9c66a6a5adcbae83a6b | C++ | bennybroseph/aie-FuzzyLogic | /BehaviouralAI/UtilityNPC.cpp | UTF-8 | 2,092 | 2.65625 | 3 | [] | no_license | #include "UtilityNPC.h"
namespace UtilitySystem
{
UtilityNPC::UtilityNPC(World *pWorld) : BaseNPC(pWorld)
{
m_waterValue.setNormalizationType(UtilityValue::INVERSE_LINEAR);
m_waterValue.setMinMaxValues(0, 15);
m_waterValue.setValue(getWaterValue());
auto pWaterScore = new UtilityScore();
pWaterScore->add... | true |
4397bc1e3e0f43d3f0380202002912855cdc922e | C++ | BFavier/GameEngine | /src/GameEngine/graphics/RGB.cpp | UTF-8 | 1,012 | 3.546875 | 4 | [] | no_license | #include <GameEngine/graphics/RGB.hpp>
using namespace GameEngine;
RGB::RGB()
{
}
RGB::RGB(unsigned char r, unsigned char g, unsigned char b)
{
R = r;
G = g;
B = b;
}
RGB::RGB(const RGB& other)
{
*this = other;
}
RGB::RGB(const std::initializer_list<unsigned char>& init)
{
if (init.size() != 3)
... | true |
5865c0cde1baee44cf29cb7062da3c0305f2923d | C++ | ramaym13/Arduino | /Modul 7/Kasus_Percobaan/Kasus_Percobaan.ino | UTF-8 | 4,251 | 2.5625 | 3 | [] | no_license | const int ledPin4 = 4;
const int ledPin3 = 3;
const int ledPin2 = 2;
const int pingPin = 13;
const int echoPin = 12;
const int buzzerPin = A4;
void setup(){
Serial.begin(9600);
Serial.print ("___________PBS 2019___________");
Serial.println ();
Serial.print ("________NIM:6706174021________");
Serial.println (... | true |
012ac42b89d2e60259706ec6a576ba191a96bd8d | C++ | jtran93/AIAssignment1 | /Genetic.cpp | UTF-8 | 2,587 | 3.203125 | 3 | [] | no_license | #include "Genetic.h"
void Genetic::createInitialPopulation(std::vector< std::vector<int> > &chromosomePopulation)
{
int m = 20, n = 10;
chromosomePopulation.resize(m);
for(int i =0; i < m; i++)
{
chromosomePopulation[i].resize(n);
}
for( int i = 0; i < m; i++)
{
//std::cout<<i<<": ";
for( int j = 0; j ... | true |
dbea4b2c41b16d3159ab92f3142aed76445404dc | C++ | kester-lin/acm_backup | /src/ZOJ/ZOJ1260 POJ1364 HDU1531 King.cpp | GB18030 | 2,184 | 2.59375 | 3 | [] | no_license | /*******************************************************************************
# Author : Neo Fung
# Email : neosfung@gmail.com
# Last modified: 2012-04-24 20:35
# Filename: ZOJ1260 POJ1364 HDU1531 King.cpp
# Description :
******************************************************************************/
#ifdef _... | true |
dd49c0d2dbfd4f752ae39dd3b7ca4425ca228b84 | C++ | cealvar/Lab-Work | /lab02/MysteryDuck.h | UTF-8 | 342 | 2.515625 | 3 | [] | no_license | #ifndef LAB02_MYSTERYDUCK_H_
#define LAB02_MYSTERYDUCK_H_
#include <string>
#include "Duck.h"
class MysteryDuck : public Duck {
private:
std::string sound;
std::string description;
public:
MysteryDuck(std::string inputDescription, std::string inputSound);
std::string getDescription();
void perfo... | true |
5a4f7bbf2958e31e18ea0e32fa7a4403109fddd6 | C++ | SwansonRoss/infix-evaluator | /proj5.h | UTF-8 | 2,114 | 2.890625 | 3 | [] | no_license | /* This file contains the user interface code for the Infix Evaluation Project
* Project 5 for CS 211 for Fall 2017
*
* Date: 10/21/17
*
* Author: Pat Troy
*
*/
/**************************************************************/
/* */
/* The Code below t... | true |
16d5169f7b5abbc622c557282d0d3a0f4ec85dd9 | C++ | Jia-Joe/OJ_hihoCoder_LeetCode_Sword2Offer | /LeetCode28_83_101_141_142/L101.cpp | UTF-8 | 1,222 | 3.453125 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
//Recursive
class Solution {
public:
bool isSymmetric(TreeNode* root) {
if(!root) return true;
else
... | true |
ad9732426672218ddf6d88796909be8b985e5e38 | C++ | CzechMateQQ/IntroToCpp | /DeepShallowCopyTutorial/DeepClass.h | UTF-8 | 269 | 2.90625 | 3 | [] | no_license | #pragma once
class DeepClass
{
public:
DeepClass();
DeepClass(int value);
DeepClass(const DeepClass& other);
~DeepClass();
DeepClass& operator = (const DeepClass& other);
void print();
void setValue(int value) { *m_data = value; }
private:
int* m_data;
};
| true |
28253471fb49e5d470bdd64e59177dc98befd102 | C++ | nohhyeonjin/BOJ | /그래프/2623.cpp | UTF-8 | 1,060 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n,m;
int inDegree[1001];
vector<int> edges[1001];
void topologySort(){
queue<int> q;
vector<int> result;
for(int i=1;i<=n;i++) if(inDegree[i]==0) q.push(i);
while(!q.empty()){
int cur=q.front();
q.pop();
result.push_back(cur);
... | true |
d02c1e864b634bd9d9729d7949508da5de339dad | C++ | py4/instagholam | /parser/node.h | UTF-8 | 748 | 2.796875 | 3 | [] | no_license | #ifndef NODE_H_
#define NODE_H_
#include <string>
#include <map>
#include <vector>
#include "parser.h"
using namespace std;
class Node
{
friend class XML;
friend class DB;
public:
Node() : depth(0) {}
Node(string, string = "", int = -1);
Node* add_node(Node*);
Node* add_node(string, string = "", int = -1);
stri... | true |
b26a5c835fb1080fd86c162f321ee633dd726f98 | C++ | wildstang/2018_robot_software | /libs/libwshardware/src/simulation/outputs/WsSimulatedOutput.cpp | UTF-8 | 1,030 | 2.8125 | 3 | [] | no_license | #include "WsSimulatedOutput.h"
#include "WsSimulation.h"
#ifndef __WSSIMULATEDOUTPUT_H__TEMPLATE__
WsSimulatedOutput::WsSimulatedOutput( std::string name )
: a_simulatedName( name )
, a_simulatorEnabled( true )
{
WsSimulation* p_sim = WsSimulation::getInstance();
p_sim->addSimulatedOutput( this );
}
... | true |
1bc68490bac9781d04037ecd57ecaeaffe9e73f4 | C++ | cms-ttH/BoostedTTH | /BoostedAnalyzer/src/ResourceMonitor.cpp | UTF-8 | 2,721 | 2.578125 | 3 | [] | no_license | #include "BoostedTTH/BoostedAnalyzer/interface/ResourceMonitor.hpp"
ResourceMonitor::ResourceMonitor(){
PID=(long)getpid();
std::cout<<"this process pid" << PID<<std::endl;
procfilename="/proc/";
procfilename+=std::to_string(PID);
procfilename+="/status";
}
ResourceMonitor::~ResourceMonitor(){}
void Resour... | true |
88fcd020e0b1b07b94fd506b4774174f5b8911ca | C++ | Abhinav1997/josephus-algorithm | /josephus-cpp.cpp | UTF-8 | 1,789 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
std::vector<int> eliminate(std::vector<int> nPeople, int kill, int nSurvivor) {
unsigned int left = 0, num;
while(nPeople.size() > nSurvivor) {
num = kill - left;
if(num > nPeople.size()) {
while(num > nPeople.size()) {
... | true |
19afbbe61b50507bdd2e9c532eb2a83f37daa7ac | C++ | ricardofdc/CAL_20-21 | /src/Utils/exceptions.h | UTF-8 | 367 | 2.578125 | 3 | [] | no_license | #ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
// Generic Exception Class
class Exception {
public:
Exception() {}
};
// Exception Class that represents an invalid node ID
class GraphLoadFailed : public Exception {
public:
GraphLoadFailed(const std::string & fileName) : fileName(fileName) {}
std... | true |
c37d330b65254ae1a5d977e2c15161492d41e289 | C++ | tekikesyo/PAT | /PAT乙级/1051. 复数乘法 (15).cpp | GB18030 | 1,185 | 3.625 | 4 | [] | no_license | /*
1051. ˷ (15)
д(A + Bi)ijʽAʵB鲿iλi2 = -1
Ҳдɼµָʽ(R*e(Pi))RǸģPǷǣiλȼʽ R(cos(P) + isin(P))
ָRPҪ˻ijʽ
ʽ
һθR1, P1, R2, P2ּԿոָ
ʽ
һаաA+Biĸʽ˻ijʽʵ鲿2λСע⣺BǸӦдɡA-|B|iʽ
2.3 3.5 5.2 0.4
-8.68-8.23i
*/
//A=(R1*R2)cos(P1+P2)B=(R1*R2)sin(P1+P2)
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <... | true |
4b1b7b3aa825df4ff0f955d85911723ed967fb1b | C++ | ueane/my_code_repository | /my data structure/string/kmp.cpp | UTF-8 | 1,336 | 2.90625 | 3 | [] | no_license | /*************************************************************************
> File Name: kmp.cpp
> Author:
> Mail:
> Created Time: 二 8/15 08:05:58 2017
************************************************************************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void get_next(char *t, int *... | true |
97558fd3242c2c918962a5deb6bb84bbe6623f3e | C++ | zzhyzzh/MiniSQL | /minisql/Interpreter.h | GB18030 | 1,437 | 2.640625 | 3 | [] | no_license | #pragma once
#include<string>
using namespace std;
#include"stdafx.h"
//ָ룺
//create table 1 index 2
//drop table 3,drop index 4
//select * 5 select ԣΪԣ 6
//insert 7
//delete 8 where 9
//execfile 10
//quit 0
//error 99
class Interpret {
public:
friend class API;
int m_iOp; //ҪִеIJ
... | true |
6d15d09edd35fb382b8cd42ace5a123879d07dac | C++ | nannz/cci-advanced-physical-computing | /week2-sensor/test-IRreceiveDemo/test-IRreceiveDemo.ino | UTF-8 | 1,957 | 2.578125 | 3 | [] | no_license | /*
IRremote: IRreceiveDemo - demonstrates receiving IR codes with IRrecv
An IR detector/demodulator must be connected to the input RECV_PIN.
Initially coded 2009 Ken Shirriff http://www.righto.com/
*/
#include <IRremote.h>
#if defined(ESP32)
int IR_RECEIVE_PIN = 15;
#elif defined(ARDUINO_AVR_PROMICRO)
int IR... | true |
0f48bccb9b48beb5b772cde95accc043c5c313bc | C++ | Forrest-Z/Carbrain | /res/example/ros_node_example1.cpp | UTF-8 | 1,148 | 3.046875 | 3 | [] | no_license | /**
* @file ros_node_example.cpp
*
* @brief This file is an small example of a ROS node with a publisher and subscriber.
*
* The chatter_subscriber subscribes to the topic of the chatter_publisher.
* Usually a node does not subscribe to its own topic, but to topics of other nodes.
*/
#include "ros/ros.h"
#incl... | true |
c1cdfc9a687d4b9b9fee1a8fbac58def18f1269d | C++ | qxuan521/Coding | /YFileOS/YFileOS/y_tool.cpp | UTF-8 | 3,451 | 2.875 | 3 | [] | no_license | #include "y_tool.h"
#include <regex>
#include<sstream>
namespace YPathRegex
{
std::regex rRealPathRegex("^[@][. ]*");
};
std::vector<std::string> splitStrByCharacter(const std::string& srcStr, char spliter)
{
size_t startIndex = 0;
std::vector<std::string> resultArr;
for (size_t index = 0; index < srcStr.size(); ++... | true |
5450153803811b81e3821fe8f5ab7fbefdf913cd | C++ | conchino/C-_study | /__编程练习__/运算符重载/类-运算符重载/main.cpp | GB18030 | 2,157 | 4 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
/*
// Ա
[] operator[]([]& );
// dzԱ
[] operator[] ([]& [], []& []);
*/
class Person{
int aa;
int bb;
public:
Person();
Person(int aa,int bb);
Person(int aa);
int getA() const{
return aa;
}
int g... | true |