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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a3306b230aa3082705a6a08873f44a95343ef0e2 | C++ | denofiend/acm | /pku/1157/5036244_CE.cc | UTF-8 | 1,467 | 2.65625 | 3 | [] | no_license | // 1157(pku)
#include <iostream>
#define INF -200
#define MAXN 110
using namespace std;
template <class T> void out(T x, int n){ for (int i = 0; i < n; i ++) cout << x[i] << ' '; cout << endl; }
template <class T> void out(T x, int n, int m){ for (int i = 0; i < n; i ++) out(x[i], m); cout << endl; ... | true |
fa131bd78fd43c0223d4143a3e197d2413cac9a0 | C++ | MariosKoni/4InARow | /Game/Game.hh | UTF-8 | 1,812 | 2.703125 | 3 | [] | no_license | #pragma once
#include "../Player/Player.hh"
#include "../Data/getData.hh"
#include "../NPC/NPC.hh"
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string>
#include <list>
#include <utility>
#include <vector>
#include <memory>
#include <filesystem>
#include <thread>
class Game {
priv... | true |
0da28d483f6cc4636de7d40f3ce633d06edbc1d2 | C++ | ajunlonglive/Hands-On-Design-Patterns-with-Qt-5 | /ch02/MySkipIterator/main.cpp | UTF-8 | 807 | 3.3125 | 3 | [
"MIT"
] | permissive | #include <QCoreApplication>
#include <QDebug>
#include "MySkipIterator.h"
int main(int argc, char *argv[])
{
Q_UNUSED(argc)
Q_UNUSED(argv)
// create our list
QList<int> list {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
// Create a SkipIterator for the list
MySkipIterator<int>... | true |
b6c191aad1f9a8a11980c539a0fe3efc7d825f18 | C++ | bragalucas1/ED | /pratica1/teste.cpp | UTF-8 | 880 | 3.25 | 3 | [] | no_license | #include <iostream>
using namespace std;
void encontraPosicoes(const int numeros[],int posicoes[], int n){
for(int i=0;i<n;i++){ //para cada numero i, descobre em qual posicao de numeros[] ele se encontra
for(int j=0;j<n;j++){//varre o array procurando a posicao onde i se encontra
if(numeros[j]==i){
pos... | true |
b9b73e90511b2ccdb8450a9a5937bd54bc88e6fa | C++ | rezavai92/Dimikoj-Problem-Solutions | /PerfectNumber2.cpp | UTF-8 | 780 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
bool IsPrime (long int n){
if (n>1){
for (int i=2;i <= sqrt(n);i++){
if (n%i==0){
return false;
}
}
}
else {
return false;
}
return true;
}
bool IsPerfect ( long int n){
long int sum=1;
for ( long int i=2;i<=sqrt(n) ;i++ ){
if ... | true |
b86cf9bf5daffe318834a86b4829272313414b1e | C++ | ckanibal/InertialSensors | /BMP085.cpp | UTF-8 | 2,115 | 2.546875 | 3 | [
"MIT"
] | permissive | // BMP085.cpp
#include "BMP085.h"
void initBMP085(int device, BMP085 *data) {
data->ac1 = readRegisterInt(device, 0xAA);
data->ac2 = readRegisterInt(device, 0xAC);
data->ac3 = readRegisterInt(device, 0xAE);
data->ac4 = readRegisterInt(device, 0xB0);
data->ac5 = readRegisterInt(device, 0xB2);
data->ac6 = r... | true |
552712900081ad0c1063c9b1a78e2a07132d8cc8 | C++ | ermahechap/Algorithms | /Homeworks/Fibonnacci/Fibo.cpp | UTF-8 | 1,460 | 3.3125 | 3 | [] | no_license | #include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename Type>
Type fibo(Type n){
Type a=0,b=1,temp;
for(Type i = 0 ;i<n;i++){
temp = b;//temp swap
b = a+b;
a = temp;
}
return a;
}
template<typename Type>
bool overflow(Type n){
return n<0;
}
int main(){
ll n;
cout<<"Fibo tester... | true |
7ff7b12e15bea2f1eecf0d9d30593cc7f52e08f6 | C++ | vereddassa/HW9_CPP | /field.cpp | UTF-8 | 1,259 | 3.28125 | 3 | [] | no_license | /* Includes */
#include "field.h"
#include "ip.h"
#include "port.h"
#include <iostream>
#include <cstring>
Field::Field(String pattern, field_type type ) : pattern(pattern), type(type){
}
Field::Field(String pattern) {
this->pattern = pattern ;
this ->type = GENERIC;
}
Field::~Field() {}
field_type Field::get_ty... | true |
38bdc27a93b4e702dceaff3b6b626dbfb5606c65 | C++ | redheli/g2o_frontend | /g2o_frontend/sensor_data/sensor_handler.h | UTF-8 | 530 | 2.8125 | 3 | [] | no_license | #ifndef SENSORHANDLER_H_
#define SENSORHANDLER_H_
#include "sensor.h"
#include "priority_data_queue.h"
class SensorHandler {
public:
SensorHandler();
virtual Sensor* sensor() { return _sensor;}
virtual const Sensor* sensor() const { return _sensor;}
virtual bool setQueue(PriorityDataQueue* queue_) = 0;
... | true |
c2790a61a1e02c0b8dec77cc56cf47c2e033a7e7 | C++ | cucxabong/algorithm | /c-cpp/basics/Algorithms/dijkstra.cpp | UTF-8 | 1,394 | 3.359375 | 3 | [] | no_license | // Simple Dijkstra implementation in C++
#include <iostream>
#include <queue>
using namespace std;
const int INF = 1e9;
typedef pair<int, int> pii;
void init(int *&path, int *&dist, int v) {
if (dist)
delete dist;
if (path)
delete path;
dist = new int[v];
path = new int[v];
for (int i = 0; i < v; i++) {
... | true |
cb5eb9d8fefa406c9481ff80bdcc8d36d74843e1 | C++ | DevonPW/ConsoleStuff | /ConsoleStuff/main.cpp | UTF-8 | 865 | 3.015625 | 3 | [] | no_license | #include <stdlib.h>
#include <Windows.h>
#include <Tchar.h>
HANDLE wHnd; // Handle to write to the console.
HANDLE rHnd; // Handle to read from the console.
void main() {
// Set up the handles for reading/writing:
wHnd = GetStdHandle(STD_OUTPUT_HANDLE);
rHnd = GetStdHandle(STD_INPUT_HANDLE);
// Change the... | true |
c577738deaf051ad24ed99c849d2d4c7939b234a | C++ | nob13/smallcalc | /libsmallcalc/smallcalc/types.h | UTF-8 | 1,899 | 3 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <boost/foreach.hpp>
#include "MathFunctions.h"
namespace sc {
using boost::shared_ptr;
using boost::unordered_map;
using boost::function;
typedef std::string String;
/// Small extensions to unorder... | true |
d30420416d1047b4391ff494a0ff6ec0a6dc2201 | C++ | pine/BestDocumenter | /src/github/response/author.h | UTF-8 | 1,284 | 2.515625 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | #pragma once
#include <string>
#include <picojson.h>
#include "util.h"
using namespace picojson;
namespace github {
namespace response {
class Author;
using AuthorPtr = util::Ptr<Author>;
using AuthorArrayPtr = util::ArrayPtr<Author>;
class Author {
public:
... | true |
f57c65faf41aea8a3e5ea4fc4831c107335537b9 | C++ | hexahedron74/C--Practice | /구조체를 이용한 친구 관리 프로그램.cpp | UHC | 1,970 | 3.609375 | 4 | [] | no_license | #include <stdio.h>
#define MAX_COUNT 6
typedef struct People
{
char name[14];
unsigned short int age;
float height;
float weight;
} Person;
int AddFriend(Person *p_friend, int count)
{
if(count < MAX_COUNT) {
p_friend = p_friend + count;
printf("\nο ģ Էϼ\n");
printf("1. ̸ : ");
scanf("%s... | true |
98b2725fad2d49af646c83030d685e9605c6467c | C++ | floriandotorg/MinecraftCpp | /abstract_block.hpp | UTF-8 | 269 | 2.625 | 3 | [] | no_license | #pragma once
#include <memory>
#include <glm/vec3.hpp>
class abstract_block
{
public:
typedef std::shared_ptr<abstract_block> ptr;
virtual ~abstract_block() {}
virtual void update(double dt) {}
virtual void draw(const glm::vec3 &pos) const = 0;
};
| true |
f99305b57b72c9d8ef331357157f8a571887d784 | C++ | BITERP/PinkRabbitMQ | /src/amqpcpp/reliable.h | UTF-8 | 8,634 | 2.703125 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | /**
* Reliable.h
*
* A channel wrapper based on AMQP::Throttle that allows message callbacks to be installed
* on the publishes, to be called when they are confirmed by the message broker.
*
* @author Michael van der Werve <michael.vanderwerve@mailerq.com>
* @copyright 2020 Copernica BV
*/
/**
* Hea... | true |
f28394d16097eb2b60b396cd6b989b29f4ab163d | C++ | alpha74/iIB | /Programming/Linked_List/Remove_Duplicates_from_Sorted_List.cpp | UTF-8 | 905 | 3.390625 | 3 | [] | no_license | // Check for curr and next element val. Iterate to next only when next is not equal to curr.
// Take care when node is NULL.
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
ListNode* Solution::deleteDuplicate... | true |
278e84f6642c0d8d04497b775979f64290fe2392 | C++ | zszyellow/leetcode | /Cpp/1213.intersection-of-three-sorted-arrays.cpp | UTF-8 | 536 | 2.65625 | 3 | [
"MIT"
] | permissive | class Solution {
public:
vector<int> arraysIntersection(vector<int>& arr1, vector<int>& arr2, vector<int>& arr3) {
vector<int> res;
vector<int> counts(2002, 0);
for (int i = 0; i < arr1.size(); i++){
counts[arr1[i]]++;
}
for (int i = 0; i < arr2.size(); i... | true |
d9caf27c309930bf4177302343089826f4540895 | C++ | Tudor67/Competitive-Programming | /LeetCode/Problems/Algorithms/#210_CourseScheduleII_sol3_40ms_13.6MB.cpp | UTF-8 | 1,898 | 3.15625 | 3 | [
"MIT"
] | permissive | class Solution {
public:
vector<int> findOrder(int numCourses, vector<vector<int>>& prerequisites) {
// build the graph
vector<vector<int>> next_nodes(numCourses);
for(const vector<int>& v: prerequisites){
next_nodes[v[1]].push_back(v[0]);
}
// ... | true |
51a1750f49dc1e96bcbf92c553de42ede4cea078 | C++ | tarn1902/AIE-Bootstrap-Projects | /OpenGL Direct Lighting/Source/GraphicsEngine/Mesh.cpp | UTF-8 | 16,791 | 3.140625 | 3 | [
"MIT"
] | permissive | /*----------------------------------------
File Name: Mesh.cpp
Purpose: Functions of mesh class
Author: Tarn Cooper
Modified: 19 April 2020
------------------------------------------
Copyright 2020 Tarn Cooper.
-----------------------------------*/
#include "Mesh.h"
#include <gl_core_4_4.h>
#include <glm/glm.hpp>
#incl... | true |
2a98a84109dc9defaf93ced87053234a100cd8f7 | C++ | MarkMan0/MotionPlanner1D | /Tests/StepperTests.cpp | UTF-8 | 1,029 | 2.59375 | 3 | [] | no_license | #include "CppUnitTest.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
#include "../MotionPlanner1D/Stepper.h"
#include "../MotionPlanner1D/Stepper.cpp"
namespace MotionPlannerTests {
TEST_CLASS(StepperTests) {
TEST_METHOD(TestStepper) {
Stepper stepper(1.0/100);
... | true |
4009f9696f21b74456fba506c0d69d629b66c30f | C++ | SayHey/MiniFlow | /MiniFlow/TensorScalar.h | UTF-8 | 2,795 | 3.375 | 3 | [] | no_license | #pragma once
#include "Common.h"
namespace miniflow
{
class TensorScalar
{
/*
PLACEHOLDER CLASS for the purpose of debugginc of the computational graph.
Is basically a Scalar that supports all the functions of generic Tensor.
*/
public:
Scalar value_;
TensorScalar() :
value_(0)
{}
Tenso... | true |
ba7b3ead16e513849d677fa5a7f1a4ae06e3679f | C++ | mubashir-dev/DataStructures | /Random Text String Generator.cpp | ISO-8859-3 | 1,104 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <windows.h>
#include <ctime>
using namespace std;
char genRandom(){
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int stringLength = sizeof(alphanum) - 1;
return alphanum[rand() % stringLength];
}
int main(){
SetConsoleTitle("Random tex... | true |
db1b285ca7f31e6bb36fa4bd07001b54e1cab2d8 | C++ | linwenb/leetcode | /pascals-triangle.cpp | UTF-8 | 890 | 3.765625 | 4 | [] | no_license | /*
Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]
*/
class Solution {
public:
vector<vector<int> > generate(int numRows) {
vector<vector<int>> ans;
if ... | true |
06d97068c04ec9c250703b21e1978c6b48dd87a6 | C++ | MathProgrammer/CodeChef | /Contests/Long Challenge/2012 09 September SEP12/Programs/Queries About Numbers.cpp | UTF-8 | 3,180 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
const int MAX_N = 1e6;
vector <int> primes;
void sieve()
{
vector <int> is_prime(MAX_N, true);
is_prime[0] = is_prime[1] = false;
for(int i = 2; i < MAX_N; i++)
{
if(is_prime[i])
{
... | true |
00a24bcae06d35bb34fee13f0ed3dead6af75f27 | C++ | shipduck/cham-cham-cham | /cli/src/cbes/sample_component.cpp | UTF-8 | 3,870 | 2.6875 | 3 | [] | no_license | // Ŭnicode please
#include "stdafx.h"
#include "sample_component.h"
CompHealthProxy::CompHealthProxy()
: Active(false)
{
std::fill(InitialHP.begin(), InitialHP.end(), nullptr);
std::fill(CurrentHP.begin(), CurrentHP.end(), nullptr);
}
CompHealthList::CompHealthList(int poolSize)
: Parent(poolSize)
{
InitialHP... | true |
d68516ee0feda1bfebced678c9175769f1dee973 | C++ | raychen1155/program-problem-3-alan-lee-and-rahul-singh | /program problem 3/program problem 3/Alan_lee program problem 3.cpp | UTF-8 | 1,151 | 3.375 | 3 | [] | no_license | /*
/*
Rahul Singh and Alan Lee - 1st period
Program Problem 3
Using a 3 digit number to put create separate varibles
*/
// Libraries
#include <iostream> // gives access to cin, cout, endl, <<, >>, boolalpha, noboolalpha
#include <conio.h> // gives access to _khbit, (), and _getch () for pause ()
// namespace
... | true |
6b9182456c7ee1e3869a472410c972df61926d71 | C++ | Snaked96/computerNetworksProject-2-2016 | /libs/CRC16.hpp | UTF-8 | 1,661 | 3 | 3 | [] | no_license | #ifndef _CRC16_HPP_
#define _CRC16_HPP_
//Librer�as
#include "Protocol.hpp"
#define POLY bitset<5>(string("11000000000000101"))
//10011
template <const size_t MAX_CHAR_PER_MSG, const size_t TAM_TRAMA>
class CRC16 : public Protocol< MAX_CHAR_PER_MSG, TAM_TRAMA >
{
public:
... | true |
113e419f2862ad204304d6b1345f944477aed1cc | C++ | lsiddiqsunny/programming-contest | /Codeforces/Hello 2019/2.cpp | UTF-8 | 1,042 | 2.71875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int Set(int N,int pos)
{
return N=N | (1<<pos);
}
int reset(int N,int pos)
{
return N= N & ~(1<<pos);
}
bool check(int N,int pos)
{
return (bool)(N & (1<<pos));
}
int main()
{
int n;
cin>>n;
int a[n];
int sum=0;
for(int i... | true |
32faacd55e359296a6348ecb733f633f9120ca7c | C++ | NizaVolair/C-Plus-Plus_Fantasy_Tournament | /Blue.cpp | UTF-8 | 2,537 | 3.296875 | 3 | [] | no_license | /****************************************************************************************
**Program Filename: Blue.cpp
**Author: Niza Volair
**Date: 05-06-15
**Description: Blue class inplimentation files
**Input: none
**Output: integer representing damage
*********************************************************... | true |
493887a547fe0858e9f1c96c3818b2a1ad5e2245 | C++ | d8euAI8sMs/util-cpp-common | /include/util/common/geom/point.h | UTF-8 | 8,292 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <afxwin.h>
#include <util/common/ptr.h>
#include <util/common/math/scalar.h>
#include <util/common/geom/geom_fwd.h>
#include <type_traits>
#include <iostream>
namespace geom
{
/*****************************************************/
/* some common operations ... | true |
79e27ade55d101be6c45fdedaa1414b67968a62c | C++ | Dragonfire3900/forward-fitting | /headers/Asimov.h | UTF-8 | 112,603 | 2.515625 | 3 | [] | no_license | //
// Asimov.h
// Erin Conley (erin.conley@duke.edu)
//
#ifndef Asimov_h
#define Asimov_h
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InterpolateChi2Hist: Outputs an TH2D objects with number of row/column bins
// equal to numBins. Interpolates the bin con... | true |
c401af0191d89acfc58b37043be804992c054977 | C++ | nealjmc/OldSchoolWork | /Files/Assignment1-Comp1100-master/assignment1CarModel.cpp | UTF-8 | 1,905 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
//Neal McAneney
/*
Start Date 09/29/17
End Date 09/29/17
Assignment 1
Write a program that analyzes a car’s fuel usage. The program asks the user to input the type of car (i.e. model), the
number of litres of gas in the tank, and the fue... | true |
d528492839ca4eb8beb9f4f86a82bc4b5c285ecf | C++ | iRobot42/Deitels-Cpp-10e | /05 - Control Statements Part II. Logical Operators/05.30 - DollarAmount Constructor with Two Parameters/DollarAmount.h | UTF-8 | 978 | 3.484375 | 3 | [] | no_license | // Exercise 5.30: DollarAmount.h
#include <cmath>
#include <string>
class DollarAmount {
public:
explicit DollarAmount( int64_t dollars, int64_t cents ) {
amount = dollars * 100 + ( cents >= 0 && cents < 100 ? cents
: throw ( "Incorrect number of cents" ) );
... | true |
22494fc9d9cae23769ced2b2f6cb3ee3be44a0cd | C++ | mfirmin/c5sc | /src/envAction.cpp | UTF-8 | 924 | 2.515625 | 3 | [
"MIT"
] | permissive |
#include "envAction.h"
#include "environment.h"
#include "object.h"
#include "entity.h"
void toggleVisible(std::string s)
{
Entity* ent = (env->getEntities().find(s)->second);
ent->setVisible(!(ent->isVisible()));
for (std::vector<Object*>::iterator iter = ent->getBodies().begin(); iter != ent->getBodie... | true |
84f72cc85c4437201417a8d49d3e346ae6d942c3 | C++ | seidlman1029/AdventOfCode2019 | /Day1.h | UTF-8 | 625 | 3.203125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "Util.h"
namespace AOC {
void Part1()
{
const auto masses = ReadLines("Inputs/day1pt1.txt");
int fuel = 0;
for (const int& mass : masses)
fuel += (mass / 3) - 2;
std::cout << fuel << std::endl;
}
void Part2()
{
const auto masses = ReadLines("Inputs/day1pt1.txt");
i... | true |
5ad040e8460b0ca672ca67f2d368f258f92bfcb7 | C++ | TyrantDA/2DGraphics | /Enemy.cpp | UTF-8 | 929 | 2.703125 | 3 | [] | no_license | #include "Enemy.h"
#include "Engine.h"
Enemy::Enemy(float x, float y, float h, float w, float distance)
{
xpos = x;
ypos = y;
height = h;
width = w;
originX = x;
originY = y;
moveDistance = distance;
speed = 500;
textureFix();
}
bool Enemy::drop()
{
if (ypos < 1000)
{
ypos = originY;
xpos -= speed * d... | true |
1f65b61daaad605b87b19fab4eb06a984ced3afd | C++ | WooLyung/Blue | /Input.h | UHC | 869 | 2.5625 | 3 | [] | no_license | #pragma once
#include"Math.h"
#include"KeyCode.h"
//TODO: rawinput
#define KEY_MAXCOUNT 256
class Input
{
private:
LPDIRECTINPUT8A directInput_;
LPDIRECTINPUTDEVICE8A keyboard_;
LPDIRECTINPUTDEVICE8A mouse_;
BYTE keyStateL_[KEY_MAXCOUNT];
BYTE keyStateR_[KEY_MAXCOUNT];
DIMOUSESTATE mouseState_;
BYTE rgbButt... | true |
499e9e81dad3ac9878df0ee445a6f86301138b64 | C++ | cr7as7/coding1 | /matrixexponentiation.cpp | UTF-8 | 664 | 2.75 | 3 | [] | no_license | void mult(vector<vector<int>> &p,vector<vector<int>> &q,int m)
{vector<vector<int>> c(3,vector<int> (3,0));
int a11,a12,a13,a21,a22,a23,a31,a32,a33;
int i,j,k,sum;
for (i = 0; i <= 2; i++) {
for (j = 0; j <= 2; j++) {
sum = 0;
for (k = 0; k <= 2; k++) {
sum = (sum+(p[i][k]... | true |
d1a616a727f8217c7b5d7f0d6fea8d832d829c1b | C++ | jeanyves-b/projet_nachos | /code/network/nettest.cc | UTF-8 | 4,300 | 2.84375 | 3 | [
"MIT-Modern-Variant"
] | permissive | // nettest.cc
// Test out message delivery between two "Nachos" machines,
// using the Post Office to coordinate delivery.
//
// Two caveats:
// 1. Two copies of Nachos must be running, with machine ID's 0 and 1:
// ./nachos -m 0 -o 1 &
// ./nachos -m 1 -o 0 &
//
// 2. You need an implementation of condition var... | true |
13c0e608588dc6e071bb770d99dac101a43cd9d1 | C++ | yukti99/Data-Structures-and-Algorithms | /Hashing/hash.cpp | UTF-8 | 2,098 | 4.03125 | 4 | [] | no_license | /*
Hash Table in C
- Collisions resolved using chaining (Linked list)
*/
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
struct Node{
int key;
struct Node* next;
};
struct Hash{
struct Node* head;
int count;
};
struct Hash *hash_table = NULL ;
int hashFunc(int key){
return (key % SIZE);
}
stru... | true |
f6bb16b12d233420ab66eabd845dd4a13b0c7bac | C++ | ckgod/algorithmCpp | /고속도로 설계하기.cpp | UTF-8 | 1,411 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct edge {
int a, b;
int weight;
bool already;
};
bool comp(edge e1, edge e2) {
return e1.weight < e2.weight;
}
int n;
int board[202][202];
vector<edge> edgeList;
vector<edge> mst;
int parent[202];
int sumCost, cnt;
int find(int ... | true |
bb85d9a4eae0ea12c5e9e4dd542dcb2394674a0e | C++ | kritirikhi/DataStructuresAndAlgorithms | /RemoveDuplicates.cpp | UTF-8 | 566 | 3.34375 | 3 | [] | no_license | #include<iostream>
using namespace std;
void removeDuplicate(char input[],int i,char output[],int j){
// base case
if(input[i]=='\0'){
output[j]='\0';
cout<<output;
return;
}
// recursive case
if(input[i]==input[i+1]){
output[j]=input[i];
removeDuplicate(inp... | true |
35e9b59c7c20cfd1d1a0ac1be25130a8a70b427f | C++ | AABHINAAV/InterviewPrep | /Queue/Deque_Using_Circular_Array.cpp | UTF-8 | 2,900 | 3.875 | 4 | [
"MIT"
] | permissive | //Circular linked list using Array
#include<iostream>
#include<vector>
using namespace std;
struct CLL{
vector<int> arr;
int rear = -1;
int beg = -1;
int n = 0;
CLL(int n){
arr.resize(n);
this->n = n;
}
};
bool isFull(CLL* head){
if( head->beg == head->rear+1 ||
head->beg == 0 && head->rear == head->n-1)... | true |
a5f46acdd27cda28caaadd1a29f8350c06225e28 | C++ | codelibra/comp-programming | /c-programs/subsetsum2.cpp | UTF-8 | 736 | 2.96875 | 3 | [] | no_license | //shivi..coding is adictive!!
#include<shiviheaders.h>
using namespace std;
void Generate(int arr[],int ans[],int N,int sz,int index,int sum,int target)
{
if(index>N) return;
if(sum==target)
{
for(int i=0;i<sz;++i)
cout<<ans[i]<<" ";
cout<<endl;
Generate(arr,ans,N,sz-1,index+1,sum-ans[sz-1],target);
}
... | true |
f7a82401e81899dcfac97f6538313268e5ca0532 | C++ | Group-3/Pacman | /code/Pacman/BlueEffect.cpp | UTF-8 | 372 | 2.6875 | 3 | [] | no_license | #include "BlueEffect.h"
BlueEffect::BlueEffect()
: BuffEffect(300)
{
counter = 10.0f;
}
void BlueEffect::update(double dt)
{
//make the owner invernable to ghosts
BuffEffect::setMultiplier(2.0f);
counter -= dt;
}
BlueEffect::~BlueEffect()
{
//this will not work if the effectlist has multiple
//instances of... | true |
750f4cbc2c305f5b68950bcec1599ede8451566e | C++ | imnhk/problem-solving | /baekjoon/1931_meeting_room_alloc.cpp | UTF-8 | 659 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Meeting {
int begin, end;
};
bool CompareEndTime(Meeting a, Meeting b) {
if (a.end == b.end)
return a.begin < b.begin;
return a.end < b.end;
}
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
int N, lastMeetEnd = 0, answe... | true |
232214d684c69f9f4f6fc05b390603dcfad02639 | C++ | SmileGobo/CPPFactoryAndConfigure | /app/src/Factory.cpp | UTF-8 | 723 | 2.90625 | 3 | [
"BSL-1.0"
] | permissive | #include "Factory.h"
#include <stdexcept>
#include "Serial.h"
#include "Ethernet.h"
template <typename T>
struct Creator{
Transport::Ptr operator() (std::uint32_t id){
return std::make_shared<T>(id);
}
};
constexpr std::size_t type2index(Transport::Type t){
return static_cast<std::size_t>(t);
}
F... | true |
ebcc5736b5247d3d580beb8a20b2096c66f75c70 | C++ | cty41/Titan | /TitanCore/include/TiRenderQueueGroup.h | UTF-8 | 1,944 | 2.875 | 3 | [] | no_license | #ifndef __TITAN_RENDERQUEUE_GROUP__HH
#define __TITAN_RENDERQUEUE_GROUP__HH
#include "TiPrerequisites.h"
#include "TiRenderQueue.h"
#include "TiIteratorWrapper.h"
namespace Titan
{
class _DllExport RenderQueueGroup : public GeneralAlloc
{
public:
struct RenderQueueEntry
{
uint64 sortKey;
Renderable* rend... | true |
c5c9fa78d7a346d421e412a85ec93f6fd25a2bd7 | C++ | yzq986/cntt2016-hw1 | /TC-SRM-590-div1-500/oysq.cpp | UTF-8 | 1,553 | 2.53125 | 3 | [] | no_license | #line 2 "XorCards.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ui unsigned
#define ll long long
#define pii std::pair<int,int>
#define mp std::make_pair
#define fi first
#define se second
#define SZ(x) (int)(x).size()
#define pb push_back
template<class T>inline void chkmax(T &x, const T &y) {if... | true |
10a817e67798d0b10d990f42c6118368c90195cc | C++ | antongulikov/cpp-cgdk | /model/Player.cpp | UTF-8 | 752 | 2.6875 | 3 | [] | no_license | #include "Player.h"
using namespace model;
Player::Player()
: id(-1), me(false), strategyCrashed(false), score(-1), remainingActionCooldownTicks(-1) { }
Player::Player(long long id, bool me, bool strategyCrashed, int score, int remainingActionCooldownTicks)
: id(id), me(me), strategyCrashed(strategyC... | true |
f197abeaff934a926e5239099b2c8711570fc46c | C++ | victorh1705/Trabalho02_CG | /CG/src/src/AbstractGeom.cpp | UTF-8 | 606 | 2.515625 | 3 | [] | no_license | #include "AbstractGeom.h"
AbstractGeom::AbstractGeom()
{
//ctor
}
AbstractGeom::~AbstractGeom()
{
//dtor
}
bool AbstractGeom::colisaoX(float var){
if(this->GetalturaInicialX() > var && var < this->GetalturaFinalX()){
return true;
}
return false;
}
bool AbstractGeom::colisaoY(float var){... | true |
548e17771391fb7f8246a8501811fa3500c53ea4 | C++ | scotty3785/ssrt-quadcopter | /motor_test.ino | UTF-8 | 2,683 | 2.90625 | 3 | [] | no_license | /*
Two Prop Power Adjust
Two ESCs are connected to the Ardupilot.
The Throttle channel is used to set the power to each motor
The roll channel is used to slightly offset the power from
the left or right motor.
If the roll level is moved to the left the right motor will
be given more power and the left motor less, til... | true |
6a0270114d7347e78fda157d23a4b31b77732b70 | C++ | MeowningMaster-Study/threaded_eval | /main.cpp | UTF-8 | 3,223 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <thread>
#include <mutex>
#include <chrono>
#include <cmath>
using namespace std;
void f(double x, double &ret, mutex &m) {
lock_guard<mutex> g(m); // блокируем доступ к ret для других потоков
this_thread::sleep_for(chrono::seconds(5 + rand()%15)); // "засыпает" на 5-20 (случайно) ... | true |
2c299064603790a46085b83319309e7e5ba3dffa | C++ | xulzee/LeetCodeProjectCPP | /source/autumn-recruitment/300. Longest Increasing Subsequence.cpp | UTF-8 | 1,441 | 3.375 | 3 | [] | no_license | //
// Created by liuze.xlz on 2019-08-26.
//
#include "utils.h"
class Solution {
public:
// [10,9,2,5,3,7,101,18] -> [2,3,7,101]
int lengthOfLIS(vector<int> &nums) {
return BinaryDynamicProcess(nums);
}
int process(vector<int> &nums, int cur) {
int ret = 1;
for (int i = cur - 1... | true |
a5d63fe243d1910ee4f1b2ced7e9878ff661cb64 | C++ | hoatuno/runningpet | /box.cpp | UTF-8 | 3,343 | 2.53125 | 3 | [] | no_license | #include <SDL.h>
#include <string>
#include <time.h>
#include "box.h"
#include "utils.h"
const int GROUND = 500;
void Jumping( SDL_Renderer* &renderer, SDL_Rect& pet,int &foot,bool &StartJump){ // Hàm giúp nhảy lên 100px rồi rơi xuống
int boxstep ;
foot+=1; ... | true |
6a62c979c209d25423a0d7b11a779c632bed7687 | C++ | jordsti/stipersist | /StiPersist/FieldsObject.h | UTF-8 | 2,741 | 2.890625 | 3 | [] | no_license | #ifndef FIELDSOBJECT_H
#define FIELDSOBJECT_H
#include "Persistable.h"
namespace StiPersist
{
/// \class FieldsObject
/// \brief Implementation of Persistable. This class is used to populate container element has a FieldsObject
class FieldsObject :
public Persistable
{
public:
/// \brief Constructor
Fields... | true |
48e6c06725c19c59510ed0275dcdadf09c1d510d | C++ | azyabugoff/CPP_42_pool | /CPP_module_03/frag_trap_ex02/ClapTrap.hpp | UTF-8 | 1,473 | 2.6875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ClapTrap.hpp :+: :+: :+: ... | true |
0050dd3b2d419cd6bd4ab41de55b40c5bba9ca22 | C++ | shivral/cf | /0300/70/379a.cpp | UTF-8 | 347 | 2.984375 | 3 | [
"Unlicense"
] | permissive | #include <iostream>
void answer(unsigned v)
{
std::cout << v << '\n';
}
void solve(unsigned a, unsigned b)
{
unsigned c = 0, d = 0;
while (a != 0) {
c += a;
d += a;
a = d / b;
d %= b;
}
answer(c);
}
int main()
{
unsigned a, b;
std::cin >> a >> b;
solv... | true |
0aff08a31e9b9bb70024065628689aa79c3d1f4e | C++ | lud99/botw-unexplored | /source/Graphics/BasicVertices.h | UTF-8 | 4,892 | 2.953125 | 3 | [] | no_license | #pragma once
#include <glm/vec3.hpp>
#include <glm/gtc/type_precision.hpp>
namespace BasicVertices {
namespace Cube {
enum Faces {
Left,
Right,
Bottom,
Top,
Back,
Front
};
const static glm::u8vec3 TopVertices[4] = {
glm::u8vec3(0, 1, 1),
glm::u8vec3(1, 1, 1),
glm::u8vec3(1, 1, 0),... | true |
eb9b5c28a89ef45ec7841414d1353fb0510a2139 | C++ | frnkthtnk101/redisticting_game | /cpp/Tract.h | UTF-8 | 2,193 | 2.78125 | 3 | [] | no_license | /*
* Tract.h
*
* Author: scarbors, frnkthtnk100
*/
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
#ifndef TRACT_H_
#define TRACT_H_
using namespace std;
namespace AIProj
{
typedef size_t tractId; //fid
typedef std::string tractMetric;
class Tr... | true |
63302f088124b0cd1f5cd3c2c76b8765008cb4cf | C++ | sergiyilnytsky/Black-Jack | /Black Jack/Deck.cpp | UTF-8 | 789 | 3.609375 | 4 | [] | no_license | #include "Deck.h"
#include <iostream>
#include <algorithm>
#include <cassert>
Deck::Deck()
{
int card = 0;
for (int suit = 0; suit < Card::MAX_SUITS; ++suit)
{
for (int rank = 0; rank < Card::MAX_RANKS; ++rank)
{
m_deck[card] = Card(static_cast<Card::CardRank>(rank), static_cast<Card::CardSuit>(suit));
+... | true |
65d881394095b31d4ef343be5706853a3e4b1fe9 | C++ | panda3d/panda3d | /panda/src/express/virtualFileMount.cxx | UTF-8 | 9,644 | 2.578125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | /**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file virtualFileMount.cxx
*... | true |
978247ddb76bfefd01267e92ede20fcad25a3c9b | C++ | viaduct/telim_tmsd | /value_event.h | UTF-8 | 884 | 2.640625 | 3 | [] | no_license | #pragma once
#include "value_alias.h"
namespace telimtmsd {
template <typename T> class Value;
template <typename T> class ValueSubject;
enum class ValueEventType : char
{
Set_B,
Set_A
};
template <typename T>
class ValueEvent
{
public:
using Type = ValueEventType;
ValueEvent(Value<T>* value, ValueSubject<T>* ... | true |
9b1e45b37d0bde6aae4be62954364397863c1f90 | C++ | G-Reg26/TetrisCPP | /TetrisCPP/game.cpp | UTF-8 | 5,466 | 2.65625 | 3 | [] | no_license | #include "game.h"
Game::Game(int board[22][12], unsigned int boardHeight, unsigned int boardWidth, sf::Vector2f blockSize)
{
this->boardHeight = boardHeight;
this->boardWidth = boardWidth;
this->blockSize = blockSize;
for (int i = 0; i < this->boardHeight; i++) {
for (int j = 0; j < this->boardWidth; j++) {
... | true |
6401695c30b4cef55e4e2bbdb0514fe971d299e5 | C++ | SantoshDardige5121/Data-Structure-Assignment | /Assignment_8_Queue/8.cpp | UTF-8 | 1,699 | 4.21875 | 4 | [] | no_license | /*8. Write a program to implement queue using array. Implement functions for below operations.
a. Insert element in queue
b. Remove element from queue.
c. Print elements of queue.
d. Check if queue is full
e. Check if queue is empty.*/
#include<iostream>
using namespace std;
class Queue
{
int size;
int front,rear;
... | true |
f20f4441b9b888718f6321dc5ed9e33ac81e35d8 | C++ | ambroseL/Architecture_Pattern | /New/Classes/Controller/ObjSpawner.h | GB18030 | 664 | 2.703125 | 3 | [] | no_license | #ifndef _ObjSpawner_H_
#define _ObjSpawner_H_
#include "EntityObj.h"
/**
*
*
*#include "EntityObj.h"
*-llib
*
* ʵ
*
* @seesomething
*/
class ObjSpawner
{
EntityObj* prototype; /* ԭ */
public:
// ڿƺ
/**
*ι캯
*/
ObjSpawner(EntityObj* prototype);
/**
*
*/
~ObjSpawner();
... | true |
e230c858c0f70a9848d92dcd167b52d579848f82 | C++ | wzx140/slice_image | /include/ImageRender.h | UTF-8 | 1,438 | 2.578125 | 3 | [] | no_license | //
// Created by wzx on 18-11-5.
//
#ifndef RELICE_MOUSE_IMAGERENDER_H
#define RELICE_MOUSE_IMAGERENDER_H
#include <vtkRenderWindowInteractor.h>
#include <vtkSmartPointer.h>
#include <vtkImageReslice.h>
#include "ImageInteractionCallback.h"
/**
* render the image
*/
class ImageRender : public vtkObject {
private:... | true |
a77b4fe53c5b8d498ac5f6685af7145146bbdc84 | C++ | sachinsinghsk13/Data-Structures-And-Algorithms-C-CPP-2020 | /dsa.cpp | UTF-8 | 382 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include "tree/splay-tree.h"
using namespace std;
int main()
{
splay_tree t;
t.insert(24, 10);
t.insert(13, 11);
t.insert(17, 12);
t.insert(25, 13);
t.insert(34, 14);
t.insert(22, 15);
t.insert(20, 16);
t.insert(14, 17);
t.insert(29, 18);
cout << t.get_top() << endl; // 29
cout << t.... | true |
edd63b9722e149d4d55dead5f9d6274b48e22795 | C++ | pushpender673/GKSSudoPlacementSolutions | /painterPartitionProblem_binarySearch/painterPartitionProblem.cpp | UTF-8 | 910 | 2.796875 | 3 | [] | no_license |
#include<bits/stdc++.h>
using namespace std;
#define nl printf("\n")
int painterPartitionB(int a[], int n,int k){
int hi = accumulate(a,a+n,0);
int lo = *max_element(a,a+n);
// printf("low : %d hi:%d\n",lo,hi);
while(lo<hi){
int x = lo+(hi-lo)/2;
int required_worker=... | true |
63ce28962e42a609df766d1c9b20f8919b0fa580 | C++ | jinto/fakesat | /fsat.cpp | UTF-8 | 1,211 | 2.890625 | 3 | [] | no_license | /*
* Fake Sat
*/
#include <QApplication>
#include <QPushButton>
#include <QWidget>
#include <QTimer>
#include <QMouseEvent>
#include "sky.h"
#define TIMER_GAP (10)
Sky::Sky(int atimer_gap, char* imgfile, QWidget *parent) : QWidget(parent)
{
QPalette palette;
palette.setBrush(this->backgroundRole(), QBrush(QImage... | true |
097c506b32370fcf78b91fe46432bb025f175aed | C++ | atonmbiak/projects | /praktikum9/websocketclient.h | UTF-8 | 1,126 | 2.546875 | 3 | [] | no_license | #ifndef WEBSOCKETCLIENT_H
#define WEBSOCKETCLIENT_H
#include <QTCore>
#include <QtWebSockets/QtWebSockets>
class WebSocketClient : public QObject
{
Q_OBJECT
Q_PROPERTY(bool connecting READ connecting NOTIFY stateChanged)
Q_PROPERTY(bool connected READ connected NOTIFY stateChanged)
Q_PROPERTY(QString ... | true |
e25d37ce75fa96a765907da4eea94e3ba56c9583 | C++ | Greenclonk/World-of-Files | /WorldOfFiles/FileWorld.cpp | UTF-8 | 1,302 | 2.890625 | 3 | [] | no_license | #include "pch.h"
#include "Gameplay/FileWorld.h"
#include <fstream>
FileWorld::FileWorld()
{
name = L"invalid";
places = std::vector<Place>();
}
FileWorld::FileWorld(String _name, std::vector<Place> _places)
{
name = _name;
places = std::vector<Place>(_places);
}
String FileWorld::GetWorldName()
{
return name;
... | true |
6357ba16b0e58ccd7ba849fb412b99425c91b3e3 | C++ | CJunette/CPP_Learning | /008/课程/8.2_OperatorOverload_001/8.2_OperatorOverload_001/8.2_OperatorOverload_001.cpp | UTF-8 | 2,359 | 4.0625 | 4 | [] | no_license | // 8.2_OperatorOverload_001.cpp : This file contains the 'main' function. Program execution begins and ends there.
//运算符重载的相关内容
//运算符重载只能重载已有的运算符。重载不会改变运算符的优先级。
//另外成员访问运算符“.”、成员指针运算符“.*”、作用域分辨符“::”、三目运算符“?:”不能被重载。
//重载可以将运算符重载为类的非静态成员函数,也可以重载为类外的非成员函数。
//首先讨论将双目运算符重载为类的非静态成员函数。
//对于任意双目操作符B,有表达式“oprd1 B oprd2”,其中op... | true |
810f82a89d894b3333098d09bb43ff16a604cdf5 | C++ | CharLLCH/works_of_CPlusPlus | /build_qsort/build_qsort.hpp | UTF-8 | 21,987 | 3.421875 | 3 | [] | no_license | /**
* @file build_qsort.hpp
* trying to build a better quick sort.
*/
#ifndef _build_qsort_mm_h_
#define _build_qsort_mm_h_ 1
#include <functional>
#include <algorithm>
#include <iterator>
/****************************************************************************
* the quick sort algorithm is conceptually ver... | true |
fec467bcbb2a5893010560c2a305048530aa4113 | C++ | youlive789/AlgorithmStudy | /BackJoon/sort/11931.cpp | UTF-8 | 429 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int count;
cin >> count;
vector<int> container;
while (count--) {
int tmp;
cin >> tmp;
container.push_back(tmp);
}
sort(container.begin(), container.end(), ... | true |
243dbe7b6d5fe603a8b5b7ecf627f743a29740d5 | C++ | hbrulin/CPP_Modules | /tests/operator/main.cpp | UTF-8 | 860 | 3.40625 | 3 | [] | no_license | #include "duree.hpp"
using namespace std;
int main()
{
Duree duree1(0, 10, 28), duree2(0, 15, 2);
if (duree1 == duree2)
{
cout << "Les durees sont égales" << endl;
}
else
{
cout << "Les durees ne sont pas égales" << endl;
}
if (duree1 != duree2)
{
cout <... | true |
1f063259056eca0c409f76950dc4195f97694b39 | C++ | macczy/SceneBuilder | /SceneBuilder/Objects/TernaryExpression.h | UTF-8 | 846 | 2.953125 | 3 | [] | no_license | #pragma once
#include <string>
#include "../Util/Token.h"
#include "LogicalExpression.h"
#include "Expression.h"
class TernaryExpression {
public:
TernaryExpression(const Position& position, LogicalSubExpressionPtr& condition, Expression& ifTrue, Expression& ifFalse)
: condition(std::move(condition)), expressionIfT... | true |
d758c32f1ac7b1565f8afbace58e92a8ca1023e1 | C++ | evchin/sql | /includes/bplustree/multimap.h | UTF-8 | 4,937 | 3.3125 | 3 | [] | no_license | /*
* Author: Evelyn Chin
* Project: Map + Multimap
* Project Purpose: A Map / Multimap Class built up from a BPlusTree class.
* File Purpose: Multimap Interface.
*/
#ifndef MULTIMAP_H
#define MULTIMAP_H
#include "bplustree.h"
template <typename K, typename V>
struct MPair
{
K key;
vector<V> value_list;... | true |
579d8b3180ef2b0ea2d76b8eefad197a14b13f66 | C++ | mge-engine/mge | /src/mge/graphics/swap_chain.hpp | UTF-8 | 686 | 2.609375 | 3 | [
"MIT"
] | permissive | // mge - Modern Game Engine
// Copyright (c) 2017-2023 by Alexander Schroeder
// All rights reserved.
#pragma once
#include "mge/graphics/context_object.hpp"
namespace mge {
/**
* @brief A swap chain is a series of virtual frame buffers.
*
* Commonly, a swap chain is used for frame rate stabilizatio... | true |
f1ca49006eb91d0517ef044f6ede3151b078b3ff | C++ | Fuma13/CPHEngineProject | /Project01/FourDirectionsMovement.cpp | UTF-8 | 1,730 | 2.984375 | 3 | [] | no_license | #include "FourDirectionsMovement_InputWord.h"
FourDirectionsMovement_InputWord::FourDirectionsMovement_InputWord(int count_gameStates) : InputWord(count_gameStates)
{
x_velocity = 0;
y_velocity = 0;
}
InputEvent* FourDirectionsMovement_InputWord::update(SDL_Event _event)
{
FourDirectionsMovement_InputEvent* fourD... | true |
7e417265fc5dcb2df0aea6e24993b30b46969708 | C++ | Coffier/SoftRender | /SoftRender/Draw.h | GB18030 | 9,468 | 2.703125 | 3 | [] | no_license |
#ifndef DRAW_H
#define DRAW_H
#include "FrameBuffer.h"
#include "Model.h"
#include "Camera.h"
#include "Clip.h"
#include "BlinnPhongShader.h"
enum RenderMode {
Line,
Fill
};
enum Face {
Back,
Front
};
//Ⱦ
//ͼԪ
class Draw {
private:
int Width;
int Height;
FrameBuffer *FrontBuffer;
std::vector<glm::vec4>... | true |
9a1993ec1efd5fba03f173c7c022cf4285729772 | C++ | fly8wo/Code---- | /code/试图变a.cpp | UTF-8 | 129 | 3.0625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int a = 34;
a=a*5;
cout<<a<<endl;
return 0;
}
| true |
93b8b46914bff22231ef3502d125484ab0d1322a | C++ | waghaditya/SmartPal | /Arduino/MQTT.ino | UTF-8 | 1,849 | 2.859375 | 3 | [] | no_license |
char* string2char(String command){
if(command.length()!=0){
char *p = const_cast<char*>(command.c_str());
return p;
}
}
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < lengt... | true |
e212d0518ecf596b721a20f3420e8a01f42e413e | C++ | giaosame/LeetCode | /solutions1-50/problem21.cpp | UTF-8 | 456 | 3.5625 | 4 | [] | no_license | // 21. Merge Two Sorted Lists
#include "../utils.h"
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode pre_head(0);
ListNode * pre = &pre_head;
while (l1 && l2)
{
if (l1->val < l2->val)
{
pre->next = l1;
l1 = l1->next;
}
else
{
pre->next = l2;
... | true |
1bfacc7fae17aaabecd5c2857ff0acc7cf101364 | C++ | donhenton/code-attic | /cpp/micropather/ModelManager.cpp | UTF-8 | 4,150 | 2.546875 | 3 | [] | no_license | #include "StdAfx.h"
#include ".\modelmanager.h"
#include "XYTrace.h"
#include <stdio.h>
#include <math.h>
#include <vector>
CModelManager::CModelManager(void)
{
m_quads = NULL;
int m_width = 0;
int m_height = 0;
m_currentStartIdx = m_currentEndIdx = -1;
}
CModelManager::~CModelManager(void)
{
i... | true |
3084c0edefa5b79b5c2d6bc938b45186080c6c94 | C++ | dragonfly9113/learn_advanced_cpluplus_programming | /Sec8_C++11_Amazing_Features/Object.cpp | UTF-8 | 259 | 3.125 | 3 | [
"MIT"
] | permissive | // Name : Object.cpp
#include <iostream>
using namespace std;
class Test {
int id{3};
string name{"Mike"};
public:
void print() {
cout << id << ": " << name << endl;
}
};
int main() {
Test test;
test.print();
return 0;
}
| true |
11fd3c25fd484e740e1846b910a8fd7510df6790 | C++ | jgillham/AwesomeRobot | /exp/armCTRL/armctrl.cpp | UTF-8 | 2,761 | 2.59375 | 3 | [] | no_license | /**
Notes:
Is this arduino code? No
Sends angles down through the serial port to the arduino.
*/
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <cmath>
#include <SerialStream.h>
using namespace LibSerial;
using namespace std;
u... | true |
6fc7e1a39b71595bfed331284e13280195481ea3 | C++ | cfleveratto/networkTowers | /List.h | UTF-8 | 2,475 | 3.84375 | 4 | [] | no_license | #ifndef INCLUDED_LIST
#define INCLUDED_LIST
#include <iostream>
using namespace std;
template <class T>
class List {
//Class Invarient(CI): elements points to an array of
//numElements objects allocated on the heap where
//numElements > 0;
//Otherwise elements points to NULL
private:
T * elements; //this... | true |
f620eb99c1d1044e1b80e0207feb382faf4b7243 | C++ | omni-compiler/ClangXcodeML | /tests/run/new_array.src.cpp | UTF-8 | 270 | 3.09375 | 3 | [] | no_license | #include <stdio.h>
class ClassA {
public:
int member_i;
};
int
main() {
ClassA *pa = new ClassA[10];
for (int i = 0; i < 10; ++i) {
pa[i].member_i = i;
}
for (int i = 0; i < 10; ++i) {
printf("%d\n", pa[i].member_i);
}
delete[] pa;
return 0;
}
| true |
a6b30ff3336edc0b8b408bef4a679605e137dc1c | C++ | showmic96/Online-Judge-Solution | /LightOJ/1186/12168699_AC_4ms_1688kB.cpp | UTF-8 | 755 | 2.859375 | 3 | [] | no_license | // In the name of Allah the Most Merciful.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
int t , c = 0;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
vector<int>v1 , v2;
for(int i=0;i<n;i++){
int in;
sca... | true |
0a46adf12cc93ac547dc69ab5025e57ca1197bac | C++ | abhishek0410/Opencv | /04_Accessing_Pixels/main.cpp | UTF-8 | 1,845 | 3.1875 | 3 | [] | no_license | //In this experiment ,we are going to play with the individual pixels of the image.
#include<opencv2/opencv.hpp>
#include<stdint.h>
using namespace std;
using namespace cv ;
int main(){
/* //********UNCOMMENT TO SEE PART 1 ************
//Part 1 : In this part ,we are going to :
//1a : Load the image... | true |
5bb62ad1dafc6b74c74c511a10307a3cebe701e4 | C++ | Fajcon/JIMP | /lab7/arrayfill/ArrayFill.cpp | UTF-8 | 970 | 3.359375 | 3 | [] | no_license | //
// Created by ficon on 17.04.18.
//
#include <cstdlib>
#include "ArrayFill.h"
namespace arrays {
IncrementalFill::IncrementalFill(int start, int step) : start(start), step(step) {}
int IncrementalFill::Value(int index) const {
int result = start + index*step;
return result;
}
int ... | true |
a6e21dbc2125f35e3ac4dddacbb84e467b0eba22 | C++ | alexmaraval/projecteuler | /project_euler_cpp/project_euler_cpp/pb023.cpp | UTF-8 | 1,985 | 3.84375 | 4 | [] | no_license | //
// pb023.cpp
// project_euler_cpp
//
// Created by Alexandre Maraval on 13.12.17.
// Copyright © 2017 Alexandre Maraval. All rights reserved.
//
#include "pb023.hpp"
bool is_abundant(int n)
{
// first find divisors and sum them
int sum = 0;
for(int i=1; i<n; i++)
{
if(n%i == 0)
... | true |
043f4ceb9dcc5963958b284d720a6f5e754ef416 | C++ | khanna7/BARS | /transmission_model/src/TestingConfigurator.cpp | UTF-8 | 3,941 | 2.53125 | 3 | [] | no_license | /*
* TestingConfigurator.cpp
*
* Created on: Oct 11, 2017
* Author: nick
*/
#include <vector>
#include <exception>
#include "boost/algorithm/string.hpp"
#include "Parameters.h"
#include "TestingConfigurator.h"
using namespace std;
namespace TransModel {
repast::NumberGenerator* create_gen(float rate) {... | true |
1a327bfb3e5e78fdde007a87c813446680cd61fe | C++ | TheMarlboroMan/cheap-shooter | /class/aplicacion/proyectil/proyectil.h | UTF-8 | 1,939 | 2.96875 | 3 | [] | no_license | #ifndef PROYECTIL_H
#define PROYECTIL_H
#include "../no_jugador/no_jugador.h"
class Proyectil:public No_jugador
{
private:
const Actor * origen;
/*
Cuando un proyecil es de una facción NO chocará con ella.
*/
unsigned short int potencia;
unsigned short int color;
unsigned short int faccion;
float velocidad... | true |
b8da9ac63b5a0e04dc6fba01c4c71529bfb3c413 | C++ | AlbertoCasasOrtiz/UCM-Informatica_grafica-Practica_3 | /Cilindro.h | ISO-8859-2 | 1,282 | 3.109375 | 3 | [] | no_license | #ifndef CILINDRO_H
#define CILINDRO_H
#include "ObjetoCompuesto3D.h"
#include "Color.h"
/*
Clase cilindro. Genera un cilindro.
*/
class Cilindro : public ObjetoCompuesto3D{
private:
/*Objeto cuadratico generado para el cilindro.*/
GLUquadricObj *quadratic;
/*Parmetros del cilindro.*/
GLfloat baseRadius, topRadi... | true |
d44e4a686d9b3a6af349d7ecd1489649d525ee11 | C++ | yuqi-lee/program-design | /oj_ex/Analyzing_algorithm.cpp | UTF-8 | 852 | 3.28125 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
void _counter(long* arraylist, long n, long i);
int main()
{
long i, j;
while (scanf("%ld %ld", &i, &j) != EOF)
{
long num = j - i + 1;
long arraylist[num];
long counter = 0;
for (long k = 0; k < num; k++)
{
_coun... | true |
4eb068d046a7afc5ae773de3e4d5aaaac3cee384 | C++ | gilbertoalexsantos/judgesolutions | /Solved/UVA/@UVA 10806 - Dijkstra, Dijkstra./10806 - Dijkstra, Dijkstra..cpp | UTF-8 | 2,335 | 2.578125 | 3 | [] | no_license | //Author: Gilberto A. dos Santos
//Website: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1747
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
typedef pair<int,int> i... | true |
9b3d7a97aff0438db5165342a983d63ed678a638 | C++ | inbei/smf | /src/framework/primitives/SMFSystemMemoryBufferFactory.cpp | UTF-8 | 1,481 | 2.546875 | 3 | [] | no_license |
#include "SMFSystemMemoryBufferFactory.h"
namespace surveon
{
namespace mf
{
static SystemMemoryMediaBufferFactory s_SystemMemoryMediaBufferFactory;
IMediaBufferFactory* getSystemMemoryMediaBufferFactory(void)
{
return &s_SystemMemoryMediaBufferFactory;
}
//==================================================... | true |