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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c63c9c61b09e278c7b22d3be08ebd04cd2c864f2 | C++ | pmontalb/CudaLight | /CudaLight/Vector.tpp | UTF-8 | 7,600 | 2.6875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <type_traits>
#include <Types.h>
#include <Exception.h>
#include <Vector.h>
#include <HostRoutines/ForgeHelpers.h>
namespace cl
{
template<MemorySpace ms, MathDomain md>
Vector<ms, md>::Vector(const unsigned size)
: Buffer<Vector < ms, md>, ms, md>(true), _buffer(0, size, ms, md)
{
this... | true |
7572ff9aee94ce8ecf754e8386ed5f64eb7611d8 | C++ | kc345ws/Data | /数据结构上机题/第一次上机第二题.cpp | GB18030 | 2,420 | 3.859375 | 4 | [] | no_license | #include<iostream>
#include"һϻڶ.h"
using namespace std;
AStack<int> *astcktest;
void Menu();
int main()
{
Menu();
}
void Menu()
{
cout << "1.˳ջ" << endl;
cout << "2." << endl;
cout << "3.ɾ" << endl;
cout << "4.ȡ" << endl;
cout << "5.ӡջԪ" << endl;
int select;
int item;
cin >> select;
switch (select)
{
c... | true |
8054202aba8ef9b40752a9d7342dcdc69ab8fc53 | C++ | clayh7/Thesis | /Engine/RenderSystem/Uniform.hpp | UTF-8 | 936 | 2.890625 | 3 | [] | no_license | #pragma once
#include <string>
//-------------------------------------------------------------------------------------------------
class Uniform
{
//-------------------------------------------------------------------------------------------------
// Members
//---------------------------------------------------------... | true |
ed0e588eb979c6448169ccccc1cff6de1dfe92ea | C++ | haozx1997/C | /宣讲/函数 指针/指针/变量地址.cpp | GB18030 | 288 | 2.625 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int a = 1;
int c = 2;
int e = 3;
printf("aַ %lld\n",&a);
printf("cַ %lld\n",&c);
printf("eַ %lld\n",&e);
int *a_p = &a;
printf("a_p ֵָ%d a_pֵ %lld\n",*a_p,a_p);
printf("%lld\n",a_p-1);
printf("%d\n",*(a_p-1));
}
| true |
aa89696d43d40f40d8aa996163efa4223397c190 | C++ | IAM-WK/GCodePores | /src/GCodeTransform.cpp | WINDOWS-1252 | 6,596 | 2.796875 | 3 | [
"MIT"
] | permissive | #include "GCodeTransform.h"
GCodeTransform::GCodeTransform()
{
}
void GCodeTransform::setOrigin(const std::vector<float>& ImageOriginVal) noexcept
{
this->ImageOrigin = ImageOriginVal;
}
void GCodeTransform::setAngles(const float & ImageAngleGammaVal, const float & ImageAngleBetaVal, const float & Imag... | true |
2aab4ac13df4f5c74ef1487d81de5a33e184ad34 | C++ | itachi1101/Graphs_documented | /Directed Graph/isCyclic.cpp | UTF-8 | 1,027 | 2.578125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
vector<int>gr[100];
int cycle = 0;
void dfs(int src, set<int>s, vector<bool>&visited) {
visited[src] = true;
s.insert(src);
for (auto child : gr[src]) {
if (!visited[child]) {
dfs(child, s, visited);
}
else if ... | true |
4fa3e7d3518a21d90920cf3be4e5f0b3bb7ed67a | C++ | michellibera/Cplusplus | /19/main.cpp | UTF-8 | 1,620 | 3.296875 | 3 | [] | no_license | #include <iostream>
using namespace std;
float A[100];
float B[100];
void wczyt(int n);
void wypis (int n);
float iloczynab(int n);
float iloczynaa(int n);
float iloczynbb(int n);
float wyrazenia(int n);
int main()
{
int n;
float wyrazenie;
cout<<"podaj ilosc elementow wektorow A i B";... | true |
3ad660d058dd4352936668b1cc35ecd1540443a2 | C++ | ujdcodr/Parallel-Data-Compression | /final/serial/vafle_compress.cpp | UTF-8 | 3,225 | 2.6875 | 3 | [] | no_license | /*
This program is for compressing the file using the VaFLe algorithm
*/
#include"readfile.cpp"
#include"writefile.cpp"
using namespace std;
string comp(char* rFile,char* wFile)
{
float start=omp_get_wtime(),tim=0;
int minLength = 1;
string s1,s2;
string value,flag,length,interStr,zeroes;
... | true |
27d3c0bb03ad5a92c0eaf523e658a6c2e39cc939 | C++ | hieule22/truc | /src/scanner.cc | UTF-8 | 29,727 | 2.8125 | 3 | [] | no_license | // Implementation of Scanner class.
// @author Hieu Le
// @version September 30th, 2016
#include "scanner.h"
#include <vector>
Scanner::Scanner(char *filename) : buffer_(new Buffer(filename)) {}
Scanner::Scanner(Buffer *buffer) : buffer_(buffer) {}
Scanner::~Scanner() {
delete buffer_;
}
void Scanner::scanner_f... | true |
fbdab31baad20920cb085d764b2f81e921f51eef | C++ | EDRappaport/DSA | /Program 2/DSA_Proj2_firstAttmpt.cpp | UTF-8 | 5,638 | 3.0625 | 3 | [] | no_license | // THIS IS THE PROVIDED CODE FOR PROGRAM #2, DSA 1, SPRING 2012
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <vector>
#include <string>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <cstring>
#include <cctype>
#include <cstdlib>
using namespace std;
// A simple... | true |
b9b7201677d4d48f9b6eb46467d7e84901124f54 | C++ | BaherAbdelfatah/Object-Oriented-Programming-with-Cplusplus- | /OOP_MD_1/OOP_MD_1/Student.cpp | UTF-8 | 611 | 3.375 | 3 | [] | no_license | #include "Student.h"
Student::Student(string n, string g, float a, int l, float gp, string d):Person(n, g, a)
{
level = l;
GPA = gp;
depart = d;
}
void Student::set_level(int l)
{
level = l;
}
void Student::set_GPA(float g)
{
GPA = g;
}
void Student::set_depart(string d)
{
depart = d;
}
... | true |
afd99bbe8c6efa07e6d2475109f4a6ec7b7d20b4 | C++ | fantasia85/MyRPC | /myrpc/network/UThreadRuntime.h | UTF-8 | 1,260 | 2.78125 | 3 | [] | no_license | /* 封装了协程的调度,并用一个context_list_保存所有协程上下文 ,
* 每一个上下文被封装成一个ContextSlot.
* */
#pragma once
#include "UThreadContextBase.h"
#include <vector>
namespace myrpc {
class UThreadRuntime {
public:
UThreadRuntime(size_t stack_size, const bool need_stack_protect);
~UThreadRuntime();
//创建一个上下文
int Create(UThr... | true |
267e9e8e8772f512569f071c8b40ad41a4af26d4 | C++ | daniellemersch/libants | /statistics.h | UTF-8 | 2,514 | 3.375 | 3 | [] | no_license | /*
* statistics.h
*
* Created by Danielle Mersch
* Copyright Unil. All rights reserved.
*
*/
#ifndef __statistics__
#define __statistics__
#include <cmath>
#include <iostream>
#include <list>
#include <cstdlib>
using namespace std;
const double MAX_DOUBLE = 1.7e308; //< maximum value that can be e... | true |
69ab12cd92b6c6f3c16187a6edd0e363c0b0e2f7 | C++ | ashn01/algorithm | /MaximumBinaryTree.cpp | UTF-8 | 2,513 | 3.859375 | 4 | [] | no_license | //https://leetcode.com/problems/maximum-binary-tree/description/
//Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:
//
//The root is the maximum number in the array.
//The left subtree is the maximum tree constructed from left part subarray divided by the maximum nu... | true |
f9f402420ea6277f1242617387a74a2fcb1acad3 | C++ | ElderSix/my_leetcode | /tree/513_Find_Bottom_Left_Tree_Value.cpp | UTF-8 | 2,766 | 4.125 | 4 | [] | no_license | /*
Given a binary tree, find the leftmost value in the last row of the tree.
Example 1:
Input:
2
/ \
1 3
Output:
1
Example 2:
Input:
1
/ \
2 3
/ / \
4 5 6
/
7
Output:
7
*/
#include <iostream>
#include <vector>
using std::cin;
using std::cout;
using std... | true |
dcf1cd7fdce9ea336958d5d22f301fa95abfb439 | C++ | tomerr1212/MasterMindGame | /SmartGuesser.hpp | UTF-8 | 520 | 2.515625 | 3 | [] | no_license | #pragma once
#include "calculate.hpp"
#include "Guesser.hpp"
#include <string>
#include <list>
#include<iterator>
using std::string;
namespace bullpgia{
class SmartGuesser:public bullpgia::Guesser{
public:
string firstGuess="";
list <string> combination;
uint leng... | true |
d9cf9bb35a5ab9380c52e3fb44a677e62e4aa217 | C++ | rootid/fft | /2d/set-matrix-zeroes.cpp | UTF-8 | 4,785 | 3.59375 | 4 | [] | no_license | //Set Matrix Zeroes
//Given a m x n matrix, if an element is 0, set its entire row and column to 0.
//Do it in place.
//######################################### 2 traversals (L-R),(R-L) #########################################
public void setZeroes(int[][] matrix) {
int m = matrix.length, n = matrix[0].length, ... | true |
518db8626b7c9df97afe536aa49339a50c8cd738 | C++ | zsq001/oi-code | /7.20/source/Stu-12-张荣国/massage.cpp | UTF-8 | 1,280 | 2.546875 | 3 | [] | no_license | #include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;
int n,q,f[10][10][10][10],a[205][5],tot;
void read(int &x){
int t=0;x=0;char s=getchar();
while(s<'0'||s>'9') { if(s=='0') t=1; s=getchar();}
while(s>='0'&&s<='9') { x=(x<<3)+(x<<1)+(s^48);s=getchar();}
x=t?-x:x... | true |
b3da0dee7858cceee9ee90ab16f3ab1f736cb72b | C++ | alvas/ms_interview_100 | /leetcode/PowerOfTwo.cpp | UTF-8 | 366 | 3.390625 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Solution {
public:
bool isPowerOfTwo(int n) {
if (n <= 0)
{
return 0;
}
return (n & (n - 1)) == 0;
}
};
int main()
{
Solution sln;
int n = 0;
std::cout << "Please enter n: ";
cin >> n;
std::cout <<... | true |
26cd4c3e21d18b86e414df382617554166592664 | C++ | mulenatic/arduino | /arduinoAdventures/challenge1/challenge1.ino | UTF-8 | 384 | 2.6875 | 3 | [] | no_license | void setup() {
// setup serial port
Serial.begin(9600);
}
void loop() {
// set sensorValue to the reading on analog input 0
int sensorValue = analogRead(A0);
// set the mappedSensorValue to the value of the map() function
int mappedSensorValue = map(sensorValue, 0, 1023, 0, 9);
// send mappedSensorValue ... | true |
70e6b94c70f6065960b065bc5503c66258d1e985 | C++ | chiahsun/problem_solving | /UVA/APOAPC_2nd/12325 - Zombie's Treasure Chest/solve1.cc.not_clean.cxx | UTF-8 | 2,399 | 2.84375 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <algorithm>
const bool debug = false;
bool double_equal(double d1, double d2) {
return fabs(d1 - d2) < 1E-9;
}
long long solve(long long N, long long S1, long long V1, long long S2, long long V2) {
double per_value_s1 = double(... | true |
76fbdbb3af5b8feb24ada4acf8c575c9829e0438 | C++ | modern-cmake/buildit | /src/blocks/rce.cpp | UTF-8 | 3,553 | 2.578125 | 3 | [
"MIT"
] | permissive | #include "blocks/rce.h"
namespace block {
void check_side_effects::visit(assign_expr::Ptr) {
has_side_effects = true;
}
void check_side_effects::visit(function_call_expr::Ptr) {
has_side_effects = true;
}
void check_side_effects::visit(addr_of_expr::Ptr) {
has_side_effects = true;
}
void use_counter::visit(var_exp... | true |
ea7f87bcd995ff7bf002a1eede3ea299ec73c72c | C++ | chaithubk/qt_tcpserver | /mytcpserver.cpp | UTF-8 | 2,679 | 2.703125 | 3 | [] | no_license | #include "mytcpserver.h"
#include <QTime>
QString MyTcpServer::simData[VS_ID_LAST] =
{
"60", // 0 - Heart rate
"27" // 1 - Temperature
};
MyTcpServer::MyTcpServer(QObject *parent) :
QObject(parent)
, m_server()
, m_socket(NULL)
, m_delayTimer()
{
connect(&m_delayTim... | true |
f882fc31cddb286e09f1c9aafe612d25b70073d1 | C++ | carlostule/ESCOM | /Desarrollo de Sistemas Distribuidos/Practica5/PoligonoIrregular.cpp | UTF-8 | 859 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | /*
IPN - ESCOM
Desarrollo de Sistemas Distribuidos
4CM1
Equipo 5
=> Hernández Jiménez Enrique
=> Ortega Ortuño Eder
=> Fernandez Eduardo
multiaportes.com/sistemasdistribuidos
*/
#include <iostream>
#include "PoligonoIrregular.hpp"
int PoligonoIrregular::contadorVertices = 0;
PoligonoIrregular::PoligonoIrreg... | true |
ab3c67b61db3c40c9b1902e665bcedcfbc547bc0 | C++ | polatory/polatory | /include/polatory/point_cloud/sdf_data_generator.hpp | UTF-8 | 806 | 2.71875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <polatory/geometry/point3d.hpp>
#include <polatory/types.hpp>
namespace polatory::point_cloud {
// Generates signed distance function data from given points and normals.
class sdf_data_generator {
public:
sdf_data_generator(const geometry::points3d& points, const geometry::vectors3d& normals... | true |
5ba8a8e0df8838f4c094da989b6a3e7c1121840f | C++ | kennethpham/DungeonGameCpp | /assassin.h | UTF-8 | 459 | 3.078125 | 3 | [] | no_license | #include <string>
#include <vector>
#include "character.h"
class Assassin : public Character // A character that can critically strike for bonus damage, and evade attacks
{
private:
int critChance = 10; // % chance of critting
int critDamage = 2; // Factor that an attack increases in damage by when critting... | true |
3f95026fe404515e189f5f472deaea37d2c3279c | C++ | KalahariKanga/ooImages | /Expression.cpp | UTF-8 | 2,007 | 2.765625 | 3 | [] | no_license | #include "Expression.h"
ImageStore* const Expression::store = ImageStore::get();
Expression::Expression()
{
}
Expression::~Expression()
{
}
Variable Expression::getResult()
{
if (!constancyOptimisation)
return evaluate();
if (isConstant && optimisable)
{
if (!hasConstantValue)
{
hasConstantValue = 1;
... | true |
898255bbbc2f0e4734bdb0a49309ce8c94fe8df7 | C++ | scholtes/university | /scholtgt-cpp-basics-master/Triangle.h | UTF-8 | 784 | 3.53125 | 4 | [] | no_license | #ifndef TRIANGLE_H
#define TRIANGLE_H
/*
* Triangle.h
* Name: Garrett Scholtes
*
* May 27, 2014
*
* This class implements the Polygon interface to
* handle working with triangles.
*/
#include <iostream>
#include <cmath>
using namespace std;
class Triangle : public Polygon {
public:
// Constructor that take... | true |
e83237a0028e47ce4bf766dbfee357fd1ef742b8 | C++ | Seinjin4/sdl_rogue_like | /sdl_rogue_like/ADT/Vector2/Vector2.h | UTF-8 | 806 | 3.5 | 4 | [] | no_license | #pragma once
#include <iostream>
class Vector2
{
private:
double x,y;
public:
Vector2();
Vector2(double x, double y);
double get_x() const;
double get_y() const;
void set_x(double x);
void set_y(double y);
double magnitude() const;// return sqrt(x^2 + y^2)
void normalize(); //Make magnitude 0 w... | true |
3ef4060762dd3f37263d8af5ead9029ccdf49106 | C++ | romandion/Lab | /rbtree/Main.cpp | WINDOWS-1252 | 1,314 | 2.53125 | 3 | [] | no_license |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include "rbtree.h"
#include "test.h"
int main(int argc , char * argv[])
{
rb_root_t root = {NULL} ;
test_node_t * nodes = build_test_nodes(kMaxSize) ;
int elapse = ::test_insert(&root , nodes , kMaxSize) ;
::... | true |
729c2b93128aaa89b2959d1573d6e403c4cbdcba | C++ | AdamWelch1/CryptoPals | /rc4.h | UTF-8 | 848 | 3.015625 | 3 | [] | no_license | #ifndef RC4_H
#define RC4_H
#include <cstdint>
class RC4 {
public:
// Key-schedule
RC4(uint8_t *key, uint32_t length)
{
doKeySchedule(key, length);
}
void doKeySchedule(uint8_t *key, uint32_t length)
{
for(uint32_t i = 0; i < 256; i++)
iState[i] = i;
uint16_t j;
for(uint32_t i = 0; ... | true |
276247aee73d44eccf4ef30a3b9e7be299e3005e | C++ | ebogucka/venenum | /src/Venenum/Creature.cpp | UTF-8 | 7,309 | 2.9375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"BSD-3-Clause",
"Zlib",
"BSL-1.0"
] | permissive | #include "Creature.h"
#include "Player.h"
Creature::Creature(GameContext& context) : context(context), animation(false)
{
}
Creature::Creature(Creature::CreatureType type, GameContext& context, int id) : type(type), context(context), id(id), animation(false)
{
setProperties();
}
Creature::Creature(Creature::C... | true |
c6c16db2d98287d5e2d5a2f41e57d110fd1ba9b1 | C++ | hzarkov/LetyashtaGad | /LetyashtaGad/Drone.cpp | UTF-8 | 3,011 | 2.875 | 3 | [] | no_license | #include "Drone.h"
Drone::Drone() : motors({{9,3,FRONT_LEFT_MOTOR_BINARY},{10,1,FRONT_RIGHT_MOTOR_BINARY},{13,3,BACK_LEFT_MOTOR_BINARY},{14,1,BACK_RIGHT_MOTOR_BINARY}}){
}
int Drone::get_opposite_motor(int m_number){
return (m_number+2 > 3) ? (m_number-2):(m_number+2);
}
void Drone::change_position(char binary,int... | true |
0eba47244f6de389798e1e05904386a68d2476b8 | C++ | prathyushk/Interspace | /interspace-server/Enemy.cpp | UTF-8 | 2,074 | 2.578125 | 3 | [] | no_license | #include "Enemy.h"
#include <btBulletDynamicsCommon.h>
#include "PhysicsManager.h"
#include <BulletDynamics/Character/btKinematicCharacterController.h>
#include <BulletCollision/CollisionDispatch/btGhostObject.h>
#include <boost/thread/mutex.hpp>
#include <SimpleMutex.h>
#include "Client.h"
Enemy::Enemy(int i... | true |
f03dea2bcdcac4a4c347b4ad24515f4f9f3e79d0 | C++ | S-Hucks/cs2400 | /cube.cc | UTF-8 | 1,026 | 3.84375 | 4 | [] | no_license | /*
* File: cube.cc
* Author: Nasseef Abukamail
* Date: February 18, 2019
* Description: A program to demonstrate a value-returning functions
*/
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;
//function prototypes (Function Declaration)
int cube (int value);
void... | true |
303a75d7e6ae039efc0e5c931d9b80aa3ec164d0 | C++ | kavin23923/Leetcode | /contest/196/2.cpp | UTF-8 | 272 | 2.671875 | 3 | [] | no_license | class Solution {
public:
int getLastMoment(int n, vector<int>& left, vector<int>& right) {
int res = 0;
for (int ant : left) {
res = max(res, ant - 0);
}
for (int ant : right) {
res = max(res, n - ant);
}
return res;
}
};
| true |
4510c28e7f5306d18bbf04af9c7ac7b0c68d300a | C++ | purduerov/ROV-Maelstrom | /Software/TeensyPowerBoard/mainCode/thrusterPWMWrapper.cpp | UTF-8 | 758 | 2.90625 | 3 | [
"MIT"
] | permissive | #include "thrusterPWMWrapper.h"
thrusterPWMWrapper::thrusterPWMWrapper(int address, int pUsePWM)
{
if (!pUsePWM) {
//esc = new Arduino_I2C_ESC(address);
myaddress = address;
}
else
{
myservo.attach(address);
}
}
void thrusterPWMWrapper::set(int value)
{
if (!usePWM)
{
driver.setPWM(myadd... | true |
e1f262d1e2d202310521b96d6a11ae894df27f57 | C++ | atharvanan1/concurrent | /project/treiber_stack.h | UTF-8 | 363 | 2.71875 | 3 | [] | no_license | // sgl_stack.h
#ifndef TREIBER_STACK_H // include guard
#define TREIBER_STACK_H
#include <atomic>
#include <list>
using namespace std;
class t_stack{
public:
class node{
public:
node(int v):val(v){} //constructor
int val;
node *next;
};
list <node*> hazard_list;
atomic <node*> top;
void push(int val);
... | true |
18a3c6d26bb37bf3b8fcad98aa121d2d87bed994 | C++ | jhnaldo/problem-solving | /acmicpc/cpp/1002.cc | UTF-8 | 717 | 2.96875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int num, k;
int x1, y1, r1;
int x2, y2, r2;
int sq_dist, sq_add, sq_sub;
cin >> num;
while(num>0){
cin >> x1 >> y1 >> r1;
cin >> x2 >> y2 >> r2;
sq_add = (r1+r2) * (r1+r2);
sq_sub = (r1-r2) * (r1-r2);
... | true |
30ac728e6191ad20d7a4a83d3841315ad0af42b5 | C++ | mattialab/elastica | /source/RodExternalForces.h | UTF-8 | 23,669 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef RODEXTERNALFORCES_H_
#define RODEXTERNALFORCES_H_
#include <limits>
#include "Interaction.h"
#include "MathFunctions.h"
#include "Rod.h"
#include "RodBoundaryConditions.h"
#include "SplineProfileZeroEnds.h"
using namespace std;
// Abstract ExternalForce class representing some external force acting upon a
//... | true |
26a7246a4e124afa7a26f0ec31bca3131539cacc | C++ | ccoale/frisk | /inc/TestCollection.h | UTF-8 | 1,452 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | #ifndef _TEST_COLLECTION_H
#define _TEST_COLLECTION_H
#include "Test.h"
#include <functional>
#include "Reporter.h"
namespace Frisk
{
class Reporter;
class TestCollection
{
typedef struct _TestFuncPair {
Test test;
std::function<void(Frisk::Test &)> func;
} TestFuncPair;
protected:
/**
* The list ... | true |
9e84b8e5f799ccbc7cae78119e96d66c5ec8da7c | C++ | TomSmartBishop/avl | /inc/vec/v.inl | UTF-8 | 6,559 | 3.125 | 3 | [
"MIT"
] | permissive |
#ifndef AVL_V_INL
#define AVL_V_INL
#pragma once
/// avl: A Vector Library
/// \author Thomas Pollak
namespace avl
{
/// \defgroup Helper functions
/// \{
//Component type helper
avl_ainl_res constexpr auto cmp(const v& vec) noexcept -> rem_const_ref_t<decltype(vec[0])>
{
return vec[0];
}
/// \}
/// \... | true |
0902f220ed33142d4e6bed77c34cec2a887e2e41 | C++ | smfaisal/leetcode_problems | /reverse_bits.cc | UTF-8 | 481 | 3.34375 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t res = 0;
uint32_t mask = 1;
for (int i = 0; i < sizeof(uint32_t)*8; i++) {
if (n & mask<<i) {
res |= 1 << (sizeof(uint32_t)*8-1-i);
}
}
return res;
}
};
int main(... | true |
21ade384ea3d3379fc64cf6e3aa48da805227e3a | C++ | Barvius/oop_kursovoy | /Person.h | UTF-8 | 414 | 2.640625 | 3 | [] | no_license | #pragma once
#include <GL/glut.h>
#include<cmath>
#include "Coord.h"
class Person{
private:
Coord Position;
int Size = 30;
GLuint Texture;
bool lookLeft = false;
bool lookRight = true;
public:
int GetSize();
void LookLeft();
void LookRight();
void MovePositionX(int);
void SetPositionX(int);
void SetPosition... | true |
fcc82e468ec29fea9c27707cbfe1c2c8f8ba51bd | C++ | tareyza/Learning-CPP | /Chapter 1/Problem 1/main.cpp | UTF-8 | 249 | 3.21875 | 3 | [] | no_license | #include "stdafx.h"
#include <iostream>
int readNumber() {
int x;
std::cin >> x;
return x;
}
void writeAnswer(int x)
{
std::cout << "Sum: " << x;
}
int main()
{
int x = readNumber();
int y = readNumber();
writeAnswer(x + y);
return 0;
}
| true |
c2907b1802ba8dfe1ed2abe82fabf8f295016b65 | C++ | vlad-zhogolev/CG-Seminar12 | /CourseWork3/src/Objects/Object.cpp | UTF-8 | 419 | 2.6875 | 3 | [] | no_license | #include <Objects/Object.h>
glm::mat4 Object::getModelMatrix()
{
glm::mat4 model{};
// translate
model = glm::translate(model, _position);
// rotate model using quaternion
glm::quat quaternion(glm::vec3(glm::radians(_rotation.x), glm::radians(_rotation.y), glm::radians(_rotation.z)));
model = m... | true |
4a7083709482b3e99a067cf305415c1e20859e57 | C++ | 0x01111/ChSeg | /loadData.h | GB18030 | 4,576 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <fstream>
#include <sstream>
#include <stack>
#include <string>
using namespace std;
#define ATTR_NUM 1500
struct Data
{
//ù
int id;
string attr_string[ATTR_NUM];//ַ
double weight;
Data *next;
int len;
};
class... | true |
2ba908654ffbe303a0dc2bbb300367dfbcb6d054 | C++ | Sassafrass6/MyneCraft | /Source/Core/Perlin.cpp | UTF-8 | 1,717 | 3.21875 | 3 | [] | no_license | #include "Perlin.h"
/* PsuedoCode taken from https://en.wikipedia.org/wiki/Perlin_noise */
Perlin::Perlin(float dnsty) : density(dnsty) {
size = xMax * yMax;
density = (density > 0.0f ? density : 0.1f);
generateGradientTrivial();
}
void Perlin::generateGradientTrivial() {
for (int i = 0; i < xMax; i++) {
for (... | true |
452f0e22619917f3eadffccb1047600b40f3f825 | C++ | YazanZebak/Algorithms-and-DataStructures | /Misc/Elementary Math.cpp | UTF-8 | 1,820 | 3.046875 | 3 | [] | no_license | const double PI = acos(-1);
const double e = exp(1.0) ;
const double phi = (1.0 + sqrt(5.0))/2.0 ;
const double inf = std::numeric_limits<double>::infinity();
const double nan = std::numeric_limits<double>::quiet_NaN();
//! get length of digits before cycle of a/b
void solve(int a , int b) {
int result = a/b , re... | true |
c2ed9480e15d888333007ceb2c0dc1c660c66b75 | C++ | clzdl/BusinessUtil | /src/AmqpClient.cpp | UTF-8 | 3,022 | 2.78125 | 3 | [] | no_license | /*
* AmqpClient.cpp
*
* Created on: 2018年3月12日
* Author: chengl
*/
#include <AmqpClient.h>
#include <sstream>
namespace BusinessUtil{
AmqpClient::AmqpClient(std::string user , std::string pwd, std::string host , short port , std::string vhost)
:m_stop(false),
m_connection(nullptr),
m_tcpHandler(nullptr)... | true |
227d193555884fc22a3eb8c38bda02c4b9df78ab | C++ | Nikvand/others | /Source.cpp | UTF-8 | 8,032 | 2.921875 | 3 | [] | no_license | /*Commenting here*/
#include <ipp.h>
#include <string>
#include <vector>
#include <iostream>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <deque>
class member
{
public:
member(unsigned int joined_month)
:_joined_month(joined_month)
{
}
unsigned int joined_month(){return _joined_month;}
pr... | true |
bc509c4bb6ab867685fc022bca24224292c019d6 | C++ | RealLeonardoHuang/ISE209 | /Chapter 2/2-32/2-32(do-while版).cpp | ISO-8859-1 | 346 | 3.375 | 3 | [] | no_license | //2-32do-while棩
#include <iostream>
using namespace std;
int main()
{
int m = 56;
int n = 0;
do
{
cout << "Guess a number!(1~100)" << endl;
cin >> n;
if (n > m)
{
cout << "Too big!" << endl;
}
else if (n < m)
{
cout < "Too small!" << endl;
}
else
cout << "Bingo!" << endl;
} while (n != m... | true |
19e1a78da06ab1b0a7e36af9684467e6698dc78e | C++ | miscalculation53/typical90_source | /060_1.cpp | UTF-8 | 953 | 2.9375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int INF = 1 << 30;
int main()
{
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++)
{
cin >> A.at(i);
A.at(i) = N + 1 - A.at(i); // 単調減少 → 単調増加 を作る問題にする
}
vector<int> dp(N + 2, INF);
dp.at(0) = -INF;
for (auto a : A)
{
// 通常の LI... | true |
6bdcd98060b7c464bafc92e18e3d2ff9ac3ee0fc | C++ | d3roch4/storage | /storage/functions.cpp | UTF-8 | 1,069 | 2.75 | 3 | [] | no_license | #include "functions.h"
#include <string>
namespace storage {
std::string typeName(const std::type_info &ti, std::string& name, Entity* entity){
if(ti == typeid(std::string))
return "text";
else if(ti == typeid(char) || ti==typeid(unsigned char))
return "char";
else if(ti == typeid(shor... | true |
ca9a0e78d59682f9c31e2640687bb59c8407ab9b | C++ | zhangsdly/Effective_c_plus_plus | /hiding_names.cpp | UTF-8 | 1,299 | 3.5625 | 4 | [] | no_license | #include <iostream>
/*========== Avoid hiding inherited names ================================
Shakespeare had a thing about names. "What's in a name?" he asked,
"A rose by any other name would smell as sweet."
The Bard also wrote,
"he that filches from me my good name ... makes me poor indeed."
====================... | true |
4f9a53e8ceed45cacb06cc3c6b69ceb182930384 | C++ | arcogelderblom/AdventOfCode2019 | /05-december/main.cpp | UTF-8 | 868 | 3.265625 | 3 | [] | no_license | #include "FileLoader.hpp"
#include "IntcodeComputer.hpp"
#include <iostream>
int main() {
FileLoader fileLoader;
std::vector<std::string> codes = fileLoader.getCommaSeparatedVectorFromFile("05-december/input.txt");
std::vector<int> program;
for (std::string code : codes) {
program.push_back(st... | true |
a54a3cc5f10e3e92eb6bd7cec6dfb5cf4d27da19 | C++ | bbom16/study_algorithm | /algorithm_2020_cplus/b14499.cpp | UHC | 2,109 | 3.46875 | 3 | [] | no_license | //2020.02.03
//boj 14499
//ֻ
//ùķ̼
//ֻ ٴ ٲ ġ ã° ذ ٽ
// ٲ 迭 ̿ ؼ ذ
#include <iostream>
#include <cstdio>
using namespace std;
int N, M, x, y, K;
int map[21][21];
int current_location[6]; //ֻ ġ
int next_location[6] = { 6,3,4,2,5,1 }; //ֻ ű ġ ( ٴ 6 command ٲ ġ)
int dx[] = { 0,0,0,-1,1 };
int dy[] = { 0,1,-... | true |
2b3edc00a039a95ade09fd6a736d7f05237cdadd | C++ | LuciaRavazzi/TesiTriennale_Fisica | /Kohn-Sham/V_Diretto.h | UTF-8 | 883 | 2.546875 | 3 | [] | no_license | #ifndef V_Diretto_h
#define V_Diretto_h
#include "nr.h"
#include "function.h"
#include "density.h"
using namespace std;
//Tiene conto del potenziale di Hartree.
class V_Diretto: public Function {
public:
//Costruttore di potenziale nullo.
V_Diretto(const Vec_DP &x);
//Aggiorno dopo aver ricevuto ... | true |
5169151f8151cf05e055fb97d1217b95d37fa5bd | C++ | ilanolkies/metnum-tp2 | /src/knn.cpp | UTF-8 | 2,136 | 3.078125 | 3 | [] | no_license | #include <algorithm>
//#include <chrono>
#include <iostream>
#include "knn.h"
#include <limits>
#include <queue>
using namespace std;
KNNClassifier::KNNClassifier(unsigned int n_neighbors)
{
k = n_neighbors;
}
void KNNClassifier::fit(SparseMatrix X, Matrix y)
{
matrizX = X;
matrizY = y;
}
Vector KNNClassifie... | true |
a124abe01a641864ff1013ee7b3a144fc9938518 | C++ | flysaiah/583-possible-benchmarks | /loop_removal.cpp | UTF-8 | 36,490 | 2.703125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
Copyright 2007-2008 Adobe Systems Incorporated
Copyright 2018 Chris Cox
Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
or a copy at http://stlab.adobe.com/licenses.html )
Goal: Test compiler optimizations related to removing unnecessary loops.
Assumptions:
1) The ... | true |
90666951b884bf1a1229b41b67728978c69bfbed | C++ | dgalide/piscinecpp | /D05/ex04/main.cpp | UTF-8 | 758 | 2.53125 | 3 | [] | no_license | #include "Bureaucrat.hpp"
#include "Form.hpp"
#include "PresidentialPardonForm.hpp"
#include "RobotomyRequestForm.hpp"
#include "ShrubberyCreationForm.hpp"
#include "Intern.hpp"
#include "OfficeBlock.hpp"
class Form;
class Bureaucrat;
int main(void)
{
Intern *idiotOne = new Intern();
Bureau... | true |
1ea5fadbd84104cc76f73fab3318456dea03caf5 | C++ | srfilipek/savr | /tests/sys_clock/main.cpp | UTF-8 | 2,247 | 2.546875 | 3 | [
"MIT"
] | permissive | /*************************************************************//**
* @file main.c
*
* @author Stefan Filipek
******************************************************************/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#inclu... | true |
901e73d0976fefaf1aadbc5cbee14a2a3042dc38 | C++ | ojy0216/BOJ | /5430.cpp | UTF-8 | 1,448 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <deque>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
cin.tie(NULL);
cout.tie(NULL);
ios::sync_with_stdio(false);
int t;
cin >> t;
for(int i = 0; i < t; i++){
string s;
cin >> s;
int n;
c... | true |
90aec2b05034980a1fa6d70dd40be3694a25b529 | C++ | navitasinghal/College-Lab | /Network Programming Lab/Lab2/q3.cpp | UTF-8 | 2,253 | 3.34375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <list>
using namespace std;
struct Fragments
{
string data;
int serialNo; //set this -1 for the original data and 1,2,3... for the fragmented data
int frame[3];
};
Fragments *newFragment(string data, int serialNo, int frame_0, int frame_1, int frame_2)
{
Fragments... | true |
d5a9532513990892ea3749c70b40fc68a111ad9d | C++ | SE-OOP/Assignment_02 | /201816040119/Ex07_14.cpp | UTF-8 | 720 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int i,m;//i用于循环,m作为读取变量
int a=0;
vector<int> integer(1);//分配一个内存为一的vector数组
cin>>m;
integer[0]=m;//读取输入的第一个数存入
for(i=0;i<19;i++)
{
cin>>m;
for(size_t j=0;j<integer.size();j++)//循环判定是否已经有相同值存在
{
... | true |
9fefba9742e806b759ae9dff2efa59db6f03154e | C++ | kaaczmar/EZI-source | /MiOIB/projekty/ATSP/Parser.cpp | UTF-8 | 2,153 | 2.640625 | 3 | [] | no_license | /*
* Parser.cpp
*
* Created on: 2011-09-26
* Author: jawora
*/
#include <Parser.hpp>
#include <iostream>
#include <fstream>
#include <boost/tokenizer.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/lexical_cast.hpp>
#incl... | true |
941b1afd42bd2bbdb8dd32896e149cb153b6dea5 | C++ | Alex23013/ejercicios_casa | /prob_04_factoial.cpp | UTF-8 | 321 | 3.25 | 3 | [] | no_license | #include<iostream>
using namespace std;
float factorial=1,n,i;
int main()
{
int n;
cout<<"factorial de que numero ? " <<endl;
cin>>n;
int factorial =1;
for ( int i =2;i<n+1;i++)
{
factorial=factorial *i;
//cout << factorial <<endl;
}
cout << "factorial de " << n << " es " << factorial << endl;
}... | true |
6110f8e9e19d8203fbe29e8e63655e843b86f3f8 | C++ | guynir42/util | /+stat/sum_single.cpp | UTF-8 | 2,336 | 2.875 | 3 | [] | no_license | #include "mex.h"
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] ){
// check inputs!
if (nrhs==0){
mexPrintf("Usage: S = sum_singles(matrix)\n");
mexPrintf("Takes inputs of types double, single and uint16 and returns a sum along the 3rd dimension in single prec... | true |
609b6192d35f764e12923a2832790ef8e31a80de | C++ | LiisaLoog/pleistocene-wolves | /Data/neigh_inc.cpp | UTF-8 | 847 | 3.03125 | 3 | [] | no_license | //-----------------------------------------------------------------------------------
// Graph defining wolf regions
//
// 0: Europe
// 1: Central_North_Eurasia
// 2: Beringia
// 3: Middle_East
// 4: South_East_Asia
// 5: Arctic_North_America
// 6: North_America
//
//----------------------------------------------------... | true |
7440b72aae8d18627d56396725ef66fd75f98274 | C++ | eaguilerai/libagir | /include/agir/ui/console/abstract/menu.h | UTF-8 | 530 | 2.5625 | 3 | [] | no_license | /*!
* \file menu.h
* \brief Contains the definition of the agir::ui::console::abstract::Menu
* interface.
* \author Erasmo Aguilera
* \date April 19, 2015
*/
#ifndef AGIR__UI__CONSOLE__ABSTRACT__MENU_H
#define AGIR__UI__CONSOLE__ABSTRACT__MENU_H
namespace agir {
namespace ui {
namespace console {
... | true |
c4fa54d874cc40fd918de09a7f5744feb879e772 | C++ | calgagi/competitive_programming | /misc/hackerrank/hacktheinterview/maximum_streaks.cpp | UTF-8 | 1,782 | 3.5625 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'getMaxStreaks' function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts STRING_ARRAY toss as parameter.
*/
vector<int> getMaxStreaks(vector<string>... | true |
eaeed0e143cc67f6ccabf60806def30b5548396f | C++ | omelkonian/snap | /src/project_main/main_part1.cpp | UTF-8 | 6,968 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include "../graph_metrics/metrics.h"
#include "GraphLib.h"
#include "defines.h"
using namespace std;
#define PERSON_PROPERTIES_NUM 3
#define PERSON_REL_PROPERTIES_NUM 2
#define CHECK(text, actual, expected) \
... | true |
af0fd518370b41ee22564334e325333f8c75abfb | C++ | BreakChir/Algo | /Strings/L.cpp | UTF-8 | 2,652 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <map>
using namespace std;
int *len;
int *link;
int last, sizeGL;
long *countWays;
bool *was;
map<char, int> *nextTo;
void init(int size) {
len = new int[size];
link = new int[size];
countWays = new long[size];
was = new bool[size];
nextTo = new map<char, int>[size... | true |
76a18b502ce297d91c95818f04054752a79fabb0 | C++ | mcc12357/acm- | /nyoj 284(优先队列).cpp | GB18030 | 1,354 | 2.796875 | 3 | [] | no_license | #include<iostream>
using namespace std;
#include<stdio.h>
#include<string.h>
#include<queue>
int m,n;
int sx,sy;
int res;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
char map[305][305];
int visited[305][305];
struct node
{
int x,y,step;
friend bool operator < (const node &s1,const node &s2)//Ĭ<ȷԪȼϵ
{
return s1.... | true |
ee6c6a77481496b84ae58e573491c521ff718834 | C++ | CaseySingleton/42-cpp-piscine | /d00/ex02/Account.class.cpp | UTF-8 | 3,690 | 2.828125 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Account.class.cpp :+: :+: :+: ... | true |
846f42556354432f70d10f8ad4d93c97c5681060 | C++ | K7H64T15/game | /code/globalPhaseControl.cpp | UTF-8 | 2,589 | 2.671875 | 3 | [] | no_license | #include "globalPhaseControl.h"
globalPhaseControl::globalPhaseControl()
{
endFlag = false;
}
globalPhaseControl::~globalPhaseControl()
{
}
int globalPhaseControl::phaseSequence(Map ¤tMap, Player ¤tPlayer)
{
movePhase(currentMap, currentPlayer);
checkPosition(currentMap);
localEventPhase();
checkStat... | true |
684c72956ff12ee9728291a901431b73b455588e | C++ | Koukan/Grab | /common/libnet/src/SelectPolicy.cpp | UTF-8 | 3,124 | 2.578125 | 3 | [] | no_license | #include "SelectPolicy.hpp"
NET_USE_NAMESPACE
#include <iostream>
SelectPolicy::SelectPolicy() : _maxfd(0), _rsize(0), _wsize(0), _esize(0)
{
FD_ZERO(&_read_set);
FD_ZERO(&_write_set);
FD_ZERO(&_except_set);
}
SelectPolicy::~SelectPolicy()
{}
bool SelectPolicy::registerHandler(Socket &socket, EventHandler &handl... | true |
fb7c8cb7748d8ede68d87c45ac161e6e729117f2 | C++ | philipglazman/Kono-cpp | /src/player.cpp | UTF-8 | 39,409 | 3.3125 | 3 | [] | no_license | #include "stdafx.h"
#include "player.h"
#include "board.h"
player::player()
{
};
void player::play(std::vector< std::vector <char> > &boardTable)
{
};
/* *********************************************************************
Function Name: help
Purpose: Provide help strategy to the player dependent on conditions of... | true |
dd473185724977d614fad2c13baabf4c7602768f | C++ | steelriors/Informatika_Vajda | /gyakorlas1/main.cpp | ISO-8859-2 | 1,003 | 2.953125 | 3 | [] | no_license | #include <iostream>
using namespace std;
/*
int main()
{
//FELADAT: RJUNK PROGRAMOT, AMI MEGNZI,
//HOGY A HROMSZG VALBAN KIRAJZOLHAT E!
int a,b,c;
cout << "Kerem az 'a' oldalt: " << endl;
cin >> a;
cout << "Kerem a 'b' oldalt: " << endl;
cin >> b;
cout << "Kerem a 'c' oldalt: " << ... | true |
50b0f3388a9bdebf0848f409bdb2e13f6fe3273d | C++ | rcosnita/git-semantic-versioning | /include/semver.h | UTF-8 | 1,513 | 2.859375 | 3 | [] | no_license | #ifndef GITSEMVER_INCLUDE_SEMVER_H_
#define GITSEMVER_INCLUDE_SEMVER_H_
#include <exception>
#include <providers/provider.h>
namespace gitsemver {
/**
* Semver provides the logic for interacting with an underlining repository.
*/
class Semver {
public:
template<typename T>
Semver... | true |
43fc5e7bdea7c17e81f86a5dba464bb4781eb728 | C++ | BUCTdarkness/JiyiShen-s-Coding | /DataStruct/二叉树/自顶向下的赫夫曼编码.cpp | UTF-8 | 1,937 | 2.765625 | 3 | [] | no_license | #include<iostream>
#include<cstring>
#define MAX_LEN 500
using namespace std;
struct HaffmanTree
{
int weight;
int parent;
int lchild;
int rchild;
};
HaffmanTree t[MAX_LEN];
int n,m;
void initialize()
{
for(int i=1;i<=n;i++)
{
cin>>t[i].weight;
t[i].parent=-1;
t[i].lchild=-1;
t[i].rchild=-1;
}
m=n+n-1;
... | true |
b962010787c44ce75fe5b1aacd11c9155d6602f7 | C++ | elemenofi/twist | /src/paginator.cpp | UTF-8 | 3,703 | 2.609375 | 3 | [] | no_license | #include <Arduino.h>
#include "sequencer.h"
#include "paginator.h"
#include "step.h"
#include "controller.h"
#include "led.h"
Paginator::Paginator (Sequencer* sequencer) {
_sequencer = sequencer;
_currentEditPage = 0;
_createdPages = 0;
_currentPlaybackPage = 0;
};
int Paginator::getPage () {
return _curren... | true |
d3457126046792453ba88998a63ff6e4505f2a9b | C++ | liushengxi13689209566/Programming-language-learning | /C-pp/chapter10/10.3.2test.cpp | UTF-8 | 1,307 | 3.28125 | 3 | [] | no_license | /*************************************************************************
> File Name: 10.11.cpp
> Author:
> Mail:
> Created Time: 2018年01月28日 星期日 14时14分20秒
************************************************************************/
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using n... | true |
45e109534e51bee5d31434a9846efa9cdfb76fc1 | C++ | egosick196/heimaPractice_employeeManage | /Boss.cpp | UTF-8 | 391 | 2.71875 | 3 | [] | no_license | #include "Boss.h"
using namespace std;
Boss::Boss(int id, string name, int dId)
{
m_ID = id;
m_name = name;
m_deptID = dId;
}
void Boss::showInfo()
{
cout << "职工编号: " << m_ID << endl
<< "职工姓名: " << m_name << endl
<< "岗位: " << getDeptID() << endl
<< "职责:统管公司事务。\n" << endl;
}
string Boss::getDeptID()
{
ret... | true |
6e896a77c3a8031331f34e7f9acb03c5adebd9ce | C++ | davefutyan/common_sw | /utilities/tests/unit_test/src/TestUtc.cxx | UTF-8 | 7,094 | 2.921875 | 3 | [] | no_license | /** ****************************************************************************
* @file
*
* @ingroup utilities
* @brief unit_test of the UTC class
*
* @author Reiner Rohlfs UGE
*
* @version 5.1 2016-03-19 RRO the maximum year is now 2037
* @version 4.3 2015-10-27 RRO #9302 testing new operators
*... | true |
ccb79993357a8973f17efc3c369cfcee338e623b | C++ | linjw1008/common_algorithms | /sorting_algorithm/insert_sort.cpp | UTF-8 | 839 | 3.78125 | 4 | [] | no_license | //插入排序
#include <iostream>
using namespace std;
class InsertSort
{
public:
void sort_V1(int *array, int n)
{
for (int i = 1; i < n; i++)
{
int insertValue = array[i];
int j;
for (j = i - 1; j >= 0 && insertValue < array[j]; j... | true |
7e9b101c4fb846c532434bf939866293c1e762b7 | C++ | CognitiveModeling/snn-robotic-trunk | /src/SNN/Gradients/CurrentInputGradient.h | UTF-8 | 2,609 | 2.71875 | 3 | [
"MIT"
] | permissive | #ifndef __CURRENT_INPUT_GRADIENT_H__
#define __CURRENT_INPUT_GRADIENT_H__
#include "BasicGradient.h"
#include "BasicNetwork.h"
#include "BasicNetworkOptions.h"
#include "utils.h"
/**
* Gradient for firing rates
*/
namespace SNN {
namespace Gradients {
class CurrentInputGradient: public Interfaces::B... | true |
38cdffdb3ad52d971f82ad01112c72f36bd10a97 | C++ | wzsayiie/ob-mobile | /library/ctool/ctool/cpp/cqvalue.cpp | UTF-8 | 8,267 | 3.078125 | 3 | [] | no_license | #include "cqvalue.hh"
using namespace cq;
typedef std::string str_t ;
typedef std::vector<value> vector_t ;
typedef std::map<std::string, value> str_map_t;
typedef std::map<int64_t, value> int_map_t;
inline str_t &str (void *p) { return *(str_t *)p; }
inline vector_t &ve... | true |
6cb975c4676ec744c51e369b1ed543c360540a3d | C++ | ImageProcessing-ElectronicPublications/pngpaf | /src/twoDtree.h | UTF-8 | 5,603 | 3.359375 | 3 | [
"Unlicense"
] | permissive | #ifndef _TWODTREE_H_
#define _TWODTREE_H_
#include <limits.h>
#include <utility>
#include "util/PNG.h"
#include "util/RGBAPixel.h"
#include "stats.h"
using namespace std;
using namespace util;
/*
* This is a structure used in decomposing an image
* into rectangles of similarly colored pixels.
* This is a slight m... | true |
39e156f6674d7af869f0e132c563945b0f9be845 | C++ | defuyun/ACM | /excercise/word_sort.cpp | UTF-8 | 1,637 | 3.6875 | 4 | [] | no_license | // Q. you are given a list of words followed by ****** call it a dict
// then another list of random words, print out the words in dict that can be identified
// by reforming the new input words in alphabetical order, print :( if the new word cannot be found in the dict
/*
e.g. input: abcj kitty olleh hello ***** bcj... | true |
1a2ae54be3843ae83d4814378c9721be1ae03a97 | C++ | Issic47/muduo-x | /muduo/base/ThreadLocalSingleton.h | UTF-8 | 1,610 | 2.96875 | 3 | [] | no_license | // Use of this source code is governed by a BSD-style license
// that can be found in the License file.
//
// Author: Shuo Chen (chenshuo at chenshuo dot com), Bijin Chen
#ifndef MUDUO_BASE_THREADLOCALSINGLETON_H
#define MUDUO_BASE_THREADLOCALSINGLETON_H
#include <muduo/base/Types.h>
#include <boost/noncopyable.hpp>
... | true |
c855a246d69fc31982fdbb246a710f08ca5d68b5 | C++ | mikolajmale/Cpp_sample_with_tests | /src/Device.cpp | UTF-8 | 2,384 | 3.046875 | 3 | [] | no_license | #include "Device.h"
Device::Device(const int samples)
{
createSampleDataBase(samples);
std::array<std::string, 3> message;
std::string line;
std::ifstream data_file("data.txt");
if (data_file.is_open())
{
while (std::getline(data_file , line))
{
size_t pos = 0;
std::string token;
in... | true |
d768c47eb3049fac3719f2ee0ea1917500991e69 | C++ | toAlice/CO004_MUST_Project | /policy.h | UTF-8 | 810 | 2.640625 | 3 | [] | no_license | #pragma once
#include <string>
#include <utility>
#include "schedulerutils.h"
class Policy {
private:
static const std::string LABEL;
static const std::string FCFS;
static const std::string RR;
static const std::string PRIORITY;
static const std::string SJF;
using State = u8;
static con... | true |
f4d643b1c5dad9889425cc7942047300a0515a09 | C++ | b-it-bots/mas_perception | /mcr_linear_regression/common/src/laser_scan_linear_regression.cpp | UTF-8 | 2,633 | 2.890625 | 3 | [] | no_license | #include <vector>
#include <math.h>
#include <iostream>
#include "mcr_linear_regression/laser_scan_linear_regression.h"
namespace LaserScanLinearRegression
{
std::vector<ScanItem> ScanItemFilter::filterByDistance(std::vector<ScanItem> items, double minDistance, double maxDistance)
{
std::vector<ScanItem> filtere... | true |
11edda205d66fd6c919ef754efa52e311c83a53e | C++ | thejosess/Informatica-UGR | /2ºAÑO/1ºCuatrimestre/ED/Practicas/practica3/duda sobre cola.cpp | UTF-8 | 4,926 | 3.765625 | 4 | [] | no_license | #include<stack>
#include<iostream>
using namespace std ;
template<typename T>
struct celda_cola{
T valor ;
T maximo ;
} ;
template<typename T>
class Cola_max{
private:
stack<celda_cola<T> > pila_cola, auxiliar ;
public:
/*Una cola dispone de front*, back*, push*, po... | true |
dc05109e6d24cb705db295a980fbaae9972f9191 | C++ | nagraw01/ads1 | /pr4/Project4/Project4/Project4/FindPack/FindPack.cpp | UTF-8 | 1,297 | 3.078125 | 3 | [] | no_license |
#include "FindPack.h"
using namespace std;
void FindPack::readPackages(string s)
{
std::string PATH = s;
DIR *dir = opendir(PATH);
struct dirent *entry = readdir(dir);// reading the directory
while (entry != NULL)// for each content of directory
{
if (entry->d_type == DT_DIR) {// checking if it is a fold... | true |
4bc46156e21a0810d400b6788bd4864160f89aa2 | C++ | madeso/infofile | /src/infofile/infofile.test.cc | UTF-8 | 28,571 | 2.859375 | 3 | [
"Zlib",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <cstring>
#include "catch.hpp"
#include "catchy/stringeq.h"
#include "infofile/infofile.h"
using namespace infofile;
TEST_CASE("testparsing", "[infofile]")
{
std::vector<std::string> errors;
std::shared_ptr<infofile::Node> val = infofile::Parse("inline", "{key=value;}", &errors);
REQUIRE(catchy... | true |
d09192af1899e3dbd49e08ede09e8a55223504a6 | C++ | erikwilson/CactusCon7 | /badge/badge/WiFi.ino | UTF-8 | 400 | 2.578125 | 3 | [] | no_license | bool turnWiFiOnAndConnect() {
WiFi.mode(WIFI_STA);
WiFi.begin(WLAN_SSID, WLAN_PASSWD);
Serial.print(F("Bringing up wifi please wait"));
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
IPAddress ip = WiFi.localIP();
Serial.println(F("DONE"));
Serial.print(F("My IP addr... | true |
de726da21202748fc75064b2c8cec8895d7f5503 | C++ | DChang87/Competitive-Programming-Solutions | /Cow Photography Bronze.cpp | UTF-8 | 3,981 | 3.625 | 4 | [] | no_license | /*Utilizing sorting function in C++
The cows are in a particularly mischievous mood today! All Farmer John wants to do is take a photograph of
the cows standing in a line, but they keep moving right before he has a chance to snap the picture.
Specifically, FJ's N (1 <= N <= 20,000) cows are tagged with ID numbers 1.... | true |
9dc18bb840edf24aad82376a7c37b53c13c0cffd | C++ | karmazynow-a/dijkstraMPI | /Dijkstra/DijkstraCommon/DijkstraAlgorithmBackend.cpp | UTF-8 | 2,379 | 2.703125 | 3 | [
"MIT"
] | permissive | #include "DijkstraAlgorithmBackend.h"
#include <utility>
DijkstraAlgorithmBackend::DijkstraAlgorithmBackend(const std::pair<int, int>& verticesToHandleRange, int totalNumberOfVertices, int sourceVertexIndex) :
verticesToHandleRange(verticesToHandleRange),
distances(verticesToHandleRange.second - verticesT... | true |