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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a3b4ee8308295acacc3452c192b68b3771e5ec0e | C++ | mengchun0120/interview | /src/counting_bits.cpp | UTF-8 | 2,098 | 3.6875 | 4 | [] | no_license | /*
Given a non negative integer num. For every numbers i in the range 0 <= i <=
num, calculate the number of 1's in their binary representation and return them
as an array.
Example 1: Input 2, Output [0, 1, 1]
Example 2: Input 5, Output [0, 1, 1, 2, 1, 2]
Follow up: It is very easy to come up with a solution with ru... | true |
ea2d77188c317e5030abf7fd23504c673c9d34fa | C++ | reysub/SNC | /src/configuration/constants/ConstantsManager.h | UTF-8 | 935 | 2.5625 | 3 | [] | no_license | #ifndef CONSTANTMANAGER_H_
#define CONSTANTMANAGER_H_
#include <string>
namespace GlobalConstants
{
const int MASTER = 0;
const int MAX_CHARS_PER_LINE = 4096;
const std::string EXECUTION_FOLDER = "_Execution/";
}
namespace ConfigurationConstants
{
const std::string FIELD_SEPARATION_SYMBOL = "=";
cons... | true |
f5d28ddf5fb7655d4f72b81d6afbaae55491e337 | C++ | mfkiwl/SLAM-KDQ | /SlamCodes/gauss_filter/app/test2.cpp | UTF-8 | 1,110 | 2.5625 | 3 | [] | no_license | //
// Created by kdq on 2021/6/22.
//
#include <stdio.h>
#include <stdlib.h>
#include "GslGaussFilter.hpp"
#include <gsl/gsl_math.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include "fstream"
int main(void)
{
const size_t N = 500; /* length of time series */
const size_t K = 51;... | true |
0b7178d972195fa444391310cd4c2cad8560fc80 | C++ | tonycar12002/leetcode | /Cpp/454. 4Sum II.cpp | UTF-8 | 692 | 3.015625 | 3 | [] | no_license | /*
Author: Tony Hsiao
Date: 2019/05/08
Topic: 454. 4Sum II
Speed: 148 ms, 28.6 MB
Note: Hash Table
*/
class Solution {
public:
int fourSumCount(vector<int>& A, vector<int>& B, vector<int>& C, vector<int>& D) {
unordered_map<int, int>numbers;
for(int a=0;a<A.size();a++){
for(int b=0;b<B.... | true |
bbd73a58861587a694b35a4e8a2d46646ce09063 | C++ | korca0220/Algorithm_study | /ACMICPC/SWtest/Problem/Review/a_ramp.cpp | UTF-8 | 1,465 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int N,L;
bool check(vector<int> &line){
vector<int> c(N, false);
for(int i=1; i<N; i++){
if(line[i-1] != line[i]){
int diff = abs(line[i-1] - line[i]);
if(diff != 1) return false;
if(line[i-1] < line[i]){
... | true |
a44b8a82cbc893d47d1308a17a32ed90b51bf6c9 | C++ | 1ln/solenoid-testing | /DelayState.cpp | UTF-8 | 394 | 2.515625 | 3 | [] | no_license | #include "Arduino.h"
#include "DelayState.h"
DelayState::DelayState() {
_limit = 0;
_limit_reached = false;
}
bool DelayState::wait_interval(unsigned long interval) {
if((millis() - _limit) >= interval) {
_limit = millis();
//Serial.println("on");
_limit_reached = true;
} else {
//Serial.pr... | true |
24c56d400284c13270c6f11ee86d318386f81f57 | C++ | MaryChek/Cpp | /White/four_week/Rational/class_Rational_4.cpp | UTF-8 | 2,993 | 3.53125 | 4 | [] | no_license | #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
# define abs(x) (x > 0) ? x : -x
using namespace std;
int GetGreatestCommonFactor(int a, int b) {
a = abs(a);
b = abs(b);
while (a > 0 && b > 0){
if (a > b)
a %= b;
else
b %= a;
}
return a + b;
}
class Rational {
public:
... | true |
a26631db70359beef0c11e9d4de0058c1f05f4b5 | C++ | tbouchik/Araignee | /jeu.h | UTF-8 | 1,840 | 2.625 | 3 | [] | no_license | #ifndef JEU_H
#define JEU_H
#include "piece.h"
#include "joueur.h"
#include "zonetext.h"
#include <string>
using namespace std ;
class jeu : public QObject //Permet l'intéraction avec l'interface graphique
{
Q_OBJECT
public:
explicit jeu(string nom_Joueur1, string nom_Joueur2, QObject *parent = 0) ... | true |
dc5fc41aa7ea5e43274aa2c57fe4d931e5192891 | C++ | namanworld/LeetCode-Solutions-Time-Complexity-Optimized- | /817. Linked List Components.cpp | UTF-8 | 995 | 2.9375 | 3 | [] | no_license | class Solution {
public:
int numComponents(ListNode* head, vector<int>& G) {
if(!head) return 0;
map<int, bool> seen;
for(auto &x:G) seen[x] = true;
int count = 0;
bool found = false;
while(head){
if(seen.count(head->val)>0) {
if(!... | true |
24e82e209da97df20746d2a24864d35f7eac811c | C++ | JakeMDuthie/BREAKOUT | /SRC/LevelLoader.h | UTF-8 | 594 | 2.640625 | 3 | [] | no_license | #pragma once
// This class contains a .csv parser for taking level data, creating blocks, and returning a vector of those blocks to the play state
#include "GameObjects/Blocks.h"
#include <vector>
// includes for file writing
#include <fstream>
#include <iostream>
struct blockData
{
float xPos;
float yPos;
int b... | true |
7c7acc5c617f8e8c57204649376173a325874dc9 | C++ | unflynaomi/algorithms | /3.BruteForceAndExhaustiveSearch/3.1SelectionSort.cpp | WINDOWS-1258 | 792 | 3.40625 | 3 | [] | no_license | /*selection sort*/
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
int main()
{
FILE *fp;
if((fp=fopen("sortdata.txt","r"))==NULL)
{
printf("Cannot open file !");
exit(1);
}
int data[MAX];
int size=0;
int tmp;
int minIndex;
while(!feof(fp)) //if it is not end of file
{
fscanf(fp,"%d",&data[size])... | true |
3e1d2d81da104f4df5f1c8eeb3abfb3a586ad264 | C++ | luksab/EZbuttonPresses | /EZbuttonPresses.cpp | UTF-8 | 1,115 | 2.59375 | 3 | [
"Unlicense"
] | permissive | // #############################################################################
// #
// # Scriptname : EZbuttonPresses.cpp
// # Author : Lukas Sabatschus
// # contact : lukas@luksab.de
// # Date : 06.08.2016
// # Description:
// # Sourcecode for the EZbuttonPresses Library
// #
// # Version ... | true |
5d5e341775701bac81d99ec0dea5baa652e90543 | C++ | songzhenglian/song_zhenglian | /chap07ex_09/main.cpp | GB18030 | 1,159 | 2.90625 | 3 | [] | no_license | a)#include<iostream>
#include<array>
using namespace
const size_t rows=2;
const size_t columns=3;
void printArray(const array<array<int,columns>,rows>&);
int main()
{
array<array<int,columns>,rows>t1;
array<array<int,columns>,rows>t2;
cout<<"Values in t1 by row are:"<<endl;
printArray(t1)... | true |
b55740b07272c18f238c625f13b50889a358b293 | C++ | murrdock/contests | /1359/A.cpp | UTF-8 | 362 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int n, m, k;
cin >> n >> m >> k;
int cards = n/k;
if(cards >= m) {
cout << m << endl;
} else {
m = m - cards;
cout << cards - ceil(double(m)/double(k-1... | true |
c0de2e7546a348b5cc1cedc1663f55905e64625e | C++ | dronperminov/LandscapeGenerator | /DiamondSquare.h | UTF-8 | 773 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <random>
#include <ctime>
class DiamondSquare {
int size; // размер поля (2^n + 1)
float R; // параметр для случайной величины
float min; // минимальное значение высоты
float max; // максимальное значение высоты
float maxHeight;
std::vector<std::vector<float>> fiel... | true |
3f16ff9faa1f202ed8c71cbc7ad73a34f42af011 | C++ | CSUDHACM/DroneProject | /AutonomousDrone/CoDroneTHings.ino | UTF-8 | 3,198 | 2.609375 | 3 | [] | no_license |
#include <CoDrone.h>
/*
* Created by Maria Perez [2017 - 2018]
* Modified By:
*
* Uses COM 7 & Rokit-SmartInventor-mega32_v2
* Sensors currently in use:
* 18 = Rise
* 14 = Spin widly
* 12 = Change color to blue
* 11 = Land
* 11 + 14 + 18 = Force Stop
*
*
*/
unsigned long Timer; // for... | true |
ac7665fa4736c39a6503caeba12207b6e6f6d2c6 | C++ | bishoyDHD/museMiniCkr | /src/plugins/MCpropagators/Geant4/detectorlib/include/spline_interp.h | UTF-8 | 7,774 | 3.15625 | 3 | [] | no_license | //
// Header containing the necessary spline interpolation classes for the magnetic
// field interpolation routines (also included some base class material in case
// we want to try other interpolation schemes)
//
// Created March 18, 2013
//
// Brian S. Henderson (bhender1@mit.edu)
//
// Based on the cubic spline rout... | true |
746ee93914482bdd98e00bea1b54764b41d43605 | C++ | Eric-Ma-C/PAT-Advanced | /Advanced/AA1024/main/main.cpp | GB18030 | 1,632 | 3.25 | 3 | [
"MIT"
] | permissive | #include<stdio.h>
#include<stdlib.h>
#include<algorithm>
int num[25];
//180min
typedef struct node{
int val,height;
node *left,*right;
}node;
node* newnode(int v){
node* n=(node*)malloc(sizeof(node));
n->height=1;
n->val=v;
n->left=NULL;
n->right=NULL;
return n;
}
int geth(node *&root){
if(root==NULL)
retur... | true |
0f61796fc73b3c4ce317ca353943fd18004af5b0 | C++ | preun/DirectX | /AStar/AStar.cpp | UHC | 6,856 | 2.625 | 3 | [] | no_license | #include "../../stdafx.h"
#include "AStar.h"
#include "PathFind.h"
#include "Cell.h"
AStar::AStar()
{
}
AStar::~AStar()
{
}
void AStar::SetCurrentCell(vector<D3DXVECTOR3> Vertex)
{
m_pPathFind = new PathFind;
m_pPathFind->Setup(Vertex);
m_vCurrentCell = m_pPathFind->GetNaviCell();
}
void AStar::SetCell(int M... | true |
6a4e853b65ea02b535572d8cbddae111a4858594 | C++ | manouti/c-shell | /Guolice/include/Node.h | UTF-8 | 6,531 | 2.953125 | 3 | [] | no_license | /** \file Node.h
* Node Class
*
*/
#ifndef NODE_H
#define NODE_H
#include <string>
#include <vector>
#include <AbstractGui.h>
#include <map>
#include <GuiCompare.h>
#include <Solution.h>
using namespace std;
/**
* \class Node
* \brief Node Strunture of Graph
* information: nodeType, dataType and... | true |
415a0752ca6ff5d6c6a12e9a51826f0c8927775c | C++ | ccappelle/PotatoProject | /synapse.cpp | UTF-8 | 1,293 | 2.84375 | 3 | [] | no_license | #ifndef _SYNAPSE_CPP
#define _SYNAPSE_CPP
#include "iostream"
#include "cmath"
#include "synapse.h"
SYNAPSE::SYNAPSE(void) {
std::cin >> sourceNeuronIndex;
std::cin >> targetNeuronIndex;
std::cin >> start_weight;
std::cin >> end_weight;
std::cin >> start_time;
std::cin >>... | true |
f46d979dd414e51e49054bb783be8d4097825bd0 | C++ | cristianvanherp/game_engine_1 | /game_engine_1/game_engine_1/Ambient.cpp | UTF-8 | 1,094 | 2.859375 | 3 | [] | no_license | #include "Ambient.h"
#include <cstdlib>
Ambient::Ambient(ShaderProgram *shaderProgram)
{
this->shaderProgram = shaderProgram;
this->camera = new Camera();
this->objects = std::vector<Object*>();
this->lightSources = std::vector<LightSource*>();
}
Ambient::~Ambient()
{
}
void Ambient::add_object(... | true |
5c29f65baff51a93208da6ccbd4324f786eea9db | C++ | marrod87/tecnologo | /PA/ob5/DateTime.cpp | UTF-8 | 10,222 | 3.8125 | 4 | [] | no_license | #include "DateTime.h"
using namespace std;
// Constructores
// Instancia DateTime con fecha y hora del sistema;
DateTime::DateTime(){
time_t t;
struct tm * now;
t = time(NULL);
now = localtime (&t);
y = now->tm_year + 1900;
m = now->tm_mon + 1;
d = now->tm_mday;
h = now->tm_hour;
i = now->t... | true |
7c1224d4314d70203966bb45da3027e3de15e168 | C++ | dv1990/hexabus | /hostsoftware/libhexabus/libhexabus/serialization.cpp | UTF-8 | 14,093 | 2.65625 | 3 | [] | no_license | #include <libhexabus/private/serialization.hpp>
#include <stdexcept>
#include <algorithm>
#include <arpa/inet.h>
#include "crc.hpp"
#include "error.hpp"
#include "../../../shared/hexabus_definitions.h"
using namespace hexabus;
// {{{ Binary serialization visitor
class BinarySerializer : public PacketVisitor {
pr... | true |
ae462d2929d5a14f77b30c3b6ed4f252773e956a | C++ | ameks94/PrataTasks | /10.1/main.cpp | UTF-8 | 507 | 2.828125 | 3 | [] | no_license | #include "bank.h"
void main ()
{
Bank *bank = new Bank("Alex","MyAccount2",9860);
cout << "Your information: " << endl;
bank->ShowInfo();
float summ;
input(&summ,"How much money would you like to put to your account: ");
bank->AddBalance(summ);
cout << "Your changed information: " << endl;
bank->ShowInfo();
i... | true |
b3a8b719980451f91365f499b8937523ad2275db | C++ | Inocustonner/controller-test-work | /src/RetranslatorActiveXLib/Hook.cpp | UTF-8 | 3,911 | 2.515625 | 3 | [] | no_license | #include "Hook.hpp"
#include <Windows.h>
#include <functional>
#include <magic_enum.hpp>
#include <thread>
#define WAIT_ONE FALSE
#define InterlockedRead(var) InterlockedExchangeAdd(&(var), 0)
extern "C" volatile long g_maxWeight;
extern "C" volatile long g_minWeight;
extern "C" volatile long g_corr;
extern "C" vol... | true |
27b0ca7e8a69f7b4bd56fdabb230ea800b05ca93 | C++ | thenumbernine/Common | /include/Common/Sequence.h | UTF-8 | 9,618 | 3 | 3 | [] | no_license | #pragma once
#include "Common/Variadic.h"
#include <utility> //integer_sequence<>
namespace Common {
// begin https://codereview.stackexchange.com/a/64702/265778
namespace details {
template<typename Int, typename, Int Begin, bool Increasing>
struct integer_range_impl;
template<typename Int, Int... N, Int Begi... | true |
64b57770676ab14c20e08f50848e45a83c2d7323 | C++ | Krstar233/krits-code-workplace | /Old-Code/题解代码/acm/未命名3.cpp | UTF-8 | 516 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
int n;
char table[] = "ABCDE";
char res[1024];
void solve(int cur)
{
if (cur == n)
{
res[n] = 0;
puts(res);
return;
}
for (int i = 0; i < n; i++)
{
bool ok = true;
for (int j = 0; j < cur; j++)
{
if (res[j] == table[i])
ok = false;
... | true |
7910b7a5fc87d1007566e83b95b9d9a797401fc4 | C++ | kenshimota/Learning-Cpp | /test6.cpp | UTF-8 | 533 | 3.09375 | 3 | [] | no_license | //es este esplica que una vriable externa y interna pueden tener un mismo nombre y no un mismo valor
#include <iostream>
using namespace std;
//bueno esto es una prueba
int main(){
int exp = 3;
while(exp){
cout << " Veamos cual es el valor de exp : " << exp << endl;
... | true |
f88a247ace9c98b9779eb7a677e920f73676fd37 | C++ | jpmartinezv/snake | /field.hpp | UTF-8 | 376 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #include <vector>
#pragma once
class Painter;
class Field
{
public:
enum { WIDTH = 32, HEIGHT = 24 };
enum Type { EMPTY, SNAKE_BLOCK, FRUIT, WALL};
Field();
void update(std::vector< std::pair<int, int> > walls);
void setBlock(Type type, int x, int y);
Type block(int x, int y) const;
void draw(Painter &) const;... | true |
1e08a5435a05fe6f19c82bde28005deaaab6bd6e | C++ | SachinSarin/Data_Structures_and_Algorithms | /Linked_List/Problem_4_Reverse_a_Linked_List.cpp | UTF-8 | 422 | 3.28125 | 3 | [] | no_license | //ITERATIVE APPROACH
struct Node* reverseList(struct Node *head)
{
struct Node* prev = NULL;
struct Node* curr = head;
struct Node* forward = head->next;
while(curr->next!=NULL)
{
curr->next=prev;
prev = curr;
curr = forward;
... | true |
c3793ddbd536b10a3bd6b957f900c5fe84ba3699 | C++ | maghoff/snygg | /src/gl-raii/texture.cpp | UTF-8 | 384 | 2.765625 | 3 | [] | no_license | #include <algorithm>
#include <GL/glew.h>
#include "texture.hpp"
namespace gl {
texture::texture() {
glGenTextures(1, &id);
}
texture::~texture() {
glDeleteTextures(1, &id);
}
texture::texture(texture&& rhs) {
std::swap(id, rhs.id);
}
texture& texture::operator = (texture&& rhs) {
std::swap(id, rhs.id);
retur... | true |
0a08f0fcee9e7d5741f74849258cde1144123152 | C++ | geegatomar/Algorithms | /ModularArithmetic/fast_exponentiation_exponents_in_logN.cpp | UTF-8 | 354 | 3.078125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int f(int a, int n)
{
if(n == 1)
return a;
if(n <= 0)
return 1;
int x = f(a, n/2);
if(n % 2 == 0)
return x*x;
else
return x*x*a;
}
int main()
{
int i, j, n, m, a;
cin >> a >> n; // calc a power n using divide and conquer ( fast eponentiation ) ( O (lo... | true |
7f7f9c6d4cf5a67cd30a0570e82f6967f86741dc | C++ | xyproto/spheremover | /include/points.hpp | UTF-8 | 2,049 | 3.328125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
using namespace std::string_literals;
using Points = std::vector<Vec3>;
// Implement support for the << operator, by calling the Vec3 str methods
inline std::ostream& operator<<(std::ostream& os, const Points& points)
{
boo... | true |
5d0231a39f6593e5f5bb0676d270c66c3abb1b22 | C++ | chrisoldwood/MDBL | /SQLParams.hpp | UTF-8 | 1,895 | 2.546875 | 3 | [
"MIT"
] | permissive | /******************************************************************************
**
** MODULE: SQLPARAMS.HPP
** COMPONENT: Memory Database Library.
** DESCRIPTION: The CSQLParams class declaration.
**
*******************************************************************************
*/
// Check for previous inclusion
#if... | true |
2059c8968a363e9841c89a8103f947b034dd53ba | C++ | nikolascm/pod-2018 | /t1-nmcorrea/ordenacao.hpp | UTF-8 | 885 | 2.5625 | 3 | [] | no_license | // Linha para compilação: g++ -std=c++11 ordenacao.cpp -o ordenacao
// Execução: ./ordenacao "exemplo_entrada.txt"
#include <vector>
#include <locale>
#include <string>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
struct Arquivo {
string buffer;
const int N = 200;
ifstream meuA... | true |
e5690fe19bf570acc2d22b8632dfc09d5398a135 | C++ | jgarzon94/SistemasDistribuidos | /conexion al servidor.ino | UTF-8 | 1,603 | 2.53125 | 3 | [] | no_license | #include <b64.h>
#include <HttpClient.h>
#include <UIPEthernet.h> // Used for Ethernet
// **** ETHERNET SETTING ****
// Arduino Uno pins: 10 = CS, 11 = MOSI, 12 = MISO, 13 = SCK
// Ethernet MAC address - must be unique on your network - MAC Reads T4A001 in hex (unique in your network)
byte mac[] = { 0x74,0x69... | true |
7e25e849b73fa6e55450504c9a71ec79944651e3 | C++ | MohammadRaziei/cuda-experiments | /cppHelper.cpp | UTF-8 | 1,235 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <chrono>
#include <complex>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#define cat(x, y) x##y
#define seeType(TYPE, arr, len) \
std::vector<TYPE> cat(seeVec_, arr)(arr, arr + len)
#define seeComplex16(arr, len) seeType(complex16, arr, len)
#define seeFloat(... | true |
bce3c9d7171943cfd4eec48e9e1b9bba0c7f6024 | C++ | OC-MCS/lab10tasks-KobeBracey | /Employee/ProductionWorker.cpp | UTF-8 | 436 | 2.796875 | 3 | [] | no_license | #include "ProductionWorker.h"
#include "Employee.h"
ProductionWorker::ProductionWorker(string n, string num, string date, int s, double pay) : Employee(n, num, date)
{
shift = s;
payRate = pay;
}
int ProductionWorker::getShift()
{
return shift;
}
double ProductionWorker::getPayRate()
{
return payRate;
}
void P... | true |
c76961e1f71db296c9cb8fc3d5ee8af07cd4ec21 | C++ | petyorusanov/Diablo_0.5 | /Diablo_0.5/Source.cpp | UTF-8 | 3,627 | 3.234375 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
#include<cstring>
#include<cassert>
#include<cstdlib>
#include "Character.h"
#include "Barbarian.h"
#include "BountyHunter.h"
#include "Sorcerer.h"
#include "Map.h"
#include "PlayerTurn.h"
using namespace std;
class Enemy;
class Character;
void pickCharacter(int& c... | true |
ccb195e094c705983d3f73e6df686669a093de17 | C++ | SDIdo/SOLID_Principles | /MatrixTester.h | UTF-8 | 620 | 2.625 | 3 | [] | no_license | //
// Created by roy on 1/15/19.
//
#ifndef PROJECTPART2_MATRIXTESTER_H
#define PROJECTPART2_MATRIXTESTER_H
//
// Created by idox on 1/14/19.
//
#include <iostream>
#include <vector>
#include <string>
#include "Entry.h"
using namespace std;
class MatrixTester {
private:
vector<vector<int>> goalIsDest = {{1, ... | true |
9b45c62c5d01c07545b307c1acc074890dd1ab29 | C++ | mcc12357/acm- | /ny 15括号匹配.cpp | UTF-8 | 928 | 2.71875 | 3 | [] | no_license | #include<iostream>
using namespace std;
#include<string.h>
#include<stdio.h>
const int aa = 1<<10;
int min(int x,int y)
{
if(x<y) return x;
else return y;
}
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
char a[105];
int dp[105][105];
scanf("%s",a);
int len = strlen(a);
int i,j,k;
for(i=0;i<len;i++... | true |
fab7f02523a7f6b0d793a445937fbfc67e772210 | C++ | MASLAB/TAMProxy-Firmware | /src/Color.cpp | UTF-8 | 2,291 | 2.75 | 3 | [
"MIT"
] | permissive | #include "Color.h"
#include <cstdint>
#include "Adafruit_TCS34725.h"
#include "config.h"
namespace tamproxy {
Color::Color(int integrationTime, int gain) {
init = false;
tcs34725IntegrationTime_t it;
if (integrationTime == 1) {
it = TCS34725_INTEGRATIONTIME_2_4MS;
}
else if (integrationTime == 2) {
... | true |
fc44d82b3318ae96f77f2e4eca1684344a0eb0fd | C++ | marvinklimke/rwth-prit1 | /Versuch05Teil2/main.cpp | ISO-8859-2 | 4,029 | 3.28125 | 3 | [
"MIT"
] | permissive | /**
* @file main.cpp
* \brief content: main routine
*/
/**
* @mainpage
*
* Praktikum Informatik 1 MMXVI@n
* Versuch 5.2: Dynamische Datenstrukturen
*
*/
#include <iostream>
#include <string>
#include "List.h"
#include "Student.h"
int main()
{
List testListe;
Student stud1;
char abfrage;
std... | true |
edfd65404e2f2e5ee8bb0604bd2e937ff5c06f25 | C++ | ZibeSun/DS-CodeTemplateCollection | /排序/基数排序.cpp | GB18030 | 1,730 | 3.625 | 4 | [] | no_license | #include<iostream>
using namespace std;
//
//ȶ
class RadixSort
{
private:
int* data; //Ҫ
int len; //Ҫ鳤
//ݵλ
int maxbit()
{
int maxData = data[0];
for (int i = 1; i < len; i++)
{
if (maxData < data[i])
maxData = data[i];
}
int d = 1;
while (maxData >= 10)
{
maxData /= 10;
d++;
}
ret... | true |
10f85aeab383040463f08624cf8f816a30d76f07 | C++ | mouhssinelghazzali/50-programs-langage-c | /9 - Premier - Non premier.cpp | ISO-8859-1 | 566 | 2.75 | 3 | [] | no_license | #include <conio.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
system("title Premier / Non premier");
long n,i;
bool pnp;
printf("Entrez une Valeur :");
scanf("%d",&n);
pnp = true ;
for ( i=2 ; i < n ; i++ )
{
if ( n % i == 0 )
pnp = false ;
}
i... | true |
62a185b7d14a337523b9885fa68f292233b5d1e1 | C++ | CodeRex7/CodingPractice | /geekforgeeks/Top 10 Algorithms/Array/zigag.cpp | UTF-8 | 682 | 3.921875 | 4 | [] | no_license | /*
* Rearrange the elements of array in zig-zag fashion in O(n) time.
* The converted array should be in form a < b > c < d > e < f
*/
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
void zigzag(vector<int> &arr){
bool flag=true;
for(int i=0;i<arr.size()-1;i++){
//< expected if not then swap
i... | true |
b09a5d25218fbcaad077afa13e9fd70905acea0c | C++ | Jony635/Commando-1985-NES-Edition_v2 | /Comando versión definitiva/Enemy.h | UTF-8 | 1,275 | 2.609375 | 3 | [] | no_license | #ifndef __ENEMY_H__
#define __ENEMY_H__
#include "p2Point.h"
#include "Animation.h"
#include "Path.h"
struct SDL_Texture;
struct Collider;
enum ENEMY_TYPES
{
NO_TYPE,
WHITEGUARD,
CAPTURERGUARD,
BOSSLVL1,
KNIFE,
BOSSGRENADE,
RUNNER,
MOTORBIKE,
HOLE,
ROCKET,
BUNKER,
CAR,
TRUCK,
PATHWHITEGUARD
};
enum MOV... | true |
0710724f2661921070d22c9af0d56364c2f01061 | C++ | ryuspace/Algorithm | /Codeforces/Codeforces Round #547 (Div. 3)/D - Colored Boots.cpp | UTF-8 | 1,881 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
using namespace std;
queue<int> l[500];
queue<int> r[500];
vector<pair<int, int> > v;
int l_cnt[500];
int r_cnt[500];
//알파벳끼리 매칭, 위쪽 ?와 아랫쪽 알파벳과 매칭, 위쪽 알파벳과 아래쪽 ?과 매칭, 위쪽 ?와 아랫쪽 ?과 매칭
int main()
{
ios_base::sync_with_stdio(... | true |
19f6f915c1ebbf766e3a0590c330934aacaf4f9d | C++ | pidddgy/competitive-programming | /codeforces/connect.cpp | UTF-8 | 2,379 | 2.828125 | 3 | [] | no_license | // http://codeforces.com/contest/1130/problem/C
#include <bits/stdc++.h>
#define pii pair<int, int>
#define row first
#define col second
#define mp make_pair
using namespace std;
vector<pii> s;
vector<pii> d;
int N;
void bfs(int R, int C, vector<vector<char>> A, char w) {
queue<int> rQ;
queue<int> cQ;
bo... | true |
2608b569879e9b04398540c8552120afebdc4347 | C++ | pwestrich/csc_2100 | /lab_05/lab5part2.cpp | UTF-8 | 603 | 3.421875 | 3 | [
"MIT"
] | permissive | //Lab 5 Part 2
//For-Loop Practice
//by Philip Westrich
//CSC-2101
//Tuesday, October 2, 2012
#include <iostream>
int main(){
int count = 0;
std::cout << "Please enter an integer between 1 and 30: ";
std::cin >> count;
std::cin.ignore(80, '\n');
while (count <=1 || count >= ... | true |
820699f06502bbe233776a26794030243e66ae69 | C++ | TylerBrock/books | /C++ Primer Plus/ch16/party.cpp | UTF-8 | 1,359 | 3.265625 | 3 | [] | no_license | // party.cpp -- merge two sets of party invitees
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <iterator>
#include <algorithm>
using std::set;
using std::vector;
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::inserter;
using std::set_union;
void print... | true |
f91f8ff5df0e48d2490db092bd28f275b7d03d94 | C++ | wwwkkkp/Algorithm | /Leetcode/5304. 子数组异或查询_二分_位运算.cpp | UTF-8 | 2,319 | 3.546875 | 4 | [] | no_license | /* 5304. 子数组异或查询
有一个正整数数组 arr,现给你一个对应的查询数组 queries,其中 queries[i] = [Li, Ri]。
对于每个查询 i,请你计算从 Li 到 Ri 的 XOR 值(即 arr[Li] xor arr[Li+1] xor ... xor arr[Ri])作为本次查询的结果。
并返回一个包含给定查询 queries 所有结果的数组。
示例 1:
输入:arr = [1,3,4,8], queries = [[0,1],[1,2],[0,3],[3,3]]
输出:[2,7,14,8]
解释:
数组中元素的二进制表示形式是:
1 = 0001
3 = 0011
4 = 010... | true |
378209ae2cfc34fc59917e09d8299e11b44c6efe | C++ | exp111/ADHS | /P2.3/TreeNode.cpp | UTF-8 | 1,111 | 3.0625 | 3 | [] | no_license | #include "TreeNode.h"
using namespace std;
TreeNode::TreeNode()
{
}
TreeNode::TreeNode(string Name, int Alter, double Einkommen, int PLZ)
{
this->Name = Name;
this->Alter = Alter;
this->Einkommen = Einkommen;
this->PLZ = PLZ;
this->NodePosID = Alter + PLZ + int(Einkommen);
}
TreeNode::~TreeNode()
{
}
string... | true |
398a6f06c111efa53b18e9b1771839b595b6fae2 | C++ | arlm/pseudo | /Pseudo/TextWriter.hpp | UTF-8 | 873 | 2.6875 | 3 | [] | no_license | // Copyright (c) John Lyon-Smith. All rights reserved.
#pragma once
#ifndef __PSEUDO_TEXT_WRITER_HPP__
#define __PSEUDO_TEXT_WRITER_HPP__
#pragma warning(push)
#include <Pseudo\ValueType.hpp>
#include <Pseudo\String.hpp>
namespace Pseudo
{
/// <summary>
/// TextWriter for writing encoded text
//... | true |
a5da423462bbc546f571e3a5a8963b968d45e881 | C++ | hessamg/random-Cpp-projects | /Random coding exercises/palindrom difference.cpp | UTF-8 | 1,559 | 3.4375 | 3 | [] | no_license | //To do this exercise, follows two rules:
//
//You can only reduce the value of a letter by , i.e. he can change d to c, but he cannot change c to d or d to b.
//The letter a may not be reduced any further.
//Each reduction in the value of any letter is counted as a single operation. Find the minimum number of operati... | true |
515ec62e68c00629d5c03a3181ab0ad87b22b604 | C++ | jucrs/Monster | /home.cpp | UTF-8 | 1,003 | 2.59375 | 3 | [] | no_license | #include "home.h"
void inithome(SDL_Surface *home, SDL_Surface *screen,SDL_Surface *home2, bool &play, bool &game,bool &quit)
{
applySurface(0,0,home,screen,NULL);
SDL_Event event;
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
quit =... | true |
7d33a5971b73fe7b6f34d4681479aa8cc55a8cd9 | C++ | moriarty/Team2AMR | /src/plan/pathexecuter.cpp | UTF-8 | 5,032 | 2.96875 | 3 | [
"MIT"
] | permissive | #include "pathexecuter.h"
CREATE_LOGGER("PathExecuter");
PathExecuter::PathExecuter(Motor& motor) {
this->motor = &motor;
this->alreadyFound = false;
this->path = NULL;
LOG_CTOR << "Constructed." << std::endl;
}
PathExecuter::~PathExecuter() {
abandonPath();
LOG_DTOR << "Destructed." << std::... | true |
bedd5c6c74ff9f7bd648af6a95681d53179849da | C++ | jasonpfi/AlgoProject1b | /fitsmu-1b/fitsmu-1b/response.h | UTF-8 | 616 | 3.125 | 3 | [] | no_license | // Project 1b
//
// Team: fitsmu
// Jason Fitch
// Sam Smucny
// response.h: Header file defining the Response class
//
// This class holds the response to a guess:
// - The number correct
// - The number incorrect
#include <iostream>
class response
{
public:
// Constructors
response(const int& numberCorrect, c... | true |
41ccfc38dec3d8bc7487fa7e076120286fef5e6d | C++ | mars0522/Coding-Ninjas | /FamilyStructure.cpp | UTF-8 | 489 | 2.875 | 3 | [] | no_license | string fun(int n, long long int k)
{
if (n == 1 or k == 1)
return "Male";
else
{
long long int p = (k + 1) / 2;
string ans = fun(n - 1, p);
if (k == 2 * p - 1)
return ans;
else
{
if (ans == "Male")
return "Female";
... | true |
225ba764a0728ecf9e4a51a9b25d3ae80e57ddb6 | C++ | asutosh97/college-labs | /6th-sem/OS/lab4/generalized.cpp | UTF-8 | 3,790 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int greater(int a,int b) {
return a > b;
}
class Process {
public:
int id, burst_time, arrival_time, waiting_time, turn_around_time, time_left, rr_priority, priority_value;
// Process Const... | true |
cb0dfeecffc52ba3eb745e903b65804ab4836a47 | C++ | hantingt/Demo_PWA | /GPUPWA/GPUPWA/GPUTensor.h | UTF-8 | 1,069 | 3.5625 | 4 | [] | no_license | /// \file GPUTensor.h
#pragma once
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <vector>
///Base class for GPU based Tensors
/** This is the base class for all GPU based Tensor calculations, it mainly serves as an
abstraction for calculation input, in order to allow for the operater notation in ... | true |
152b2c65213e949253368a3161c145ba23053333 | C++ | KitwareMedical/SlicerSkeletalRepresentation | /SRep/MRML/vtkMRMLSRepStorageNode.h | UTF-8 | 2,388 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef __vtkMRMLSRepJsonStorageNode_h
#define __vtkMRMLSRepJsonStorageNode_h
#include "vtkSlicerSRepModuleMRMLExport.h"
#include "vtkMRMLStorageNode.h"
#include "vtkMRMLSRepNode.h"
class VTK_SLICER_SREP_MODULE_MRML_EXPORT vtkMRMLSRepStorageNode : public vtkMRMLStorageNode
{
public:
static vtkMRMLSRepStorageNode *N... | true |
74dacd9970ed7839f781a7d8ccda3bf8b945136c | C++ | hsmsek2019/CENG101 | /Dosya islemleri/main.cpp | ISO-8859-9 | 1,528 | 2.828125 | 3 | [] | no_license | #include<stdio.h>
int main(){
/*
FILE *fptr;
int deger;
fptr = fopen("deneme.txt", "r");
//fprintf(fptr, "\n%d", deger);
fscanf(fptr, "%d", °er);
printf("Dosyadan okunan deger: %d\n", deger);
fclose(fptr);
*/
// sayilar1.txt oluturalm.
// ine 100 adet int atayalm
/*
FILE *fptr;
fptr = ... | true |
b63af0670a27de1e24f73cce511fafa28033cacf | C++ | hishamcse/CSE-203_204_DSAlgoI | /CSE 204/Week 8/1805004_C++/MissionController.h | UTF-8 | 2,989 | 3.125 | 3 | [] | no_license | #ifndef INC_1805004_C___MISSIONCONTROLLER_H
#define INC_1805004_C___MISSIONCONTROLLER_H
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class MissionController {
CustomGraph *graph;
vector<Location> locations;
vector<Friend> friends;
int noOfFriends;
int noOfTotalPiec... | true |
6cc010621259d95cf28ab272a89da573b13459c1 | C++ | gaurav1620/CodeChef-1 | /START01.cpp | UTF-8 | 220 | 2.578125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(0 <= n && n <= 100000)
cout<<n<<endl;
else
cout<<"Constraints do not match ( 0 <= n <= 10^5)"<<endl;
return 0;
} | true |
0c2699be2c338248d4a9d110125bf4ff3cf641eb | C++ | anubhav-pandey1/Recursion | /Backtracking/sudokusolver.cpp | UTF-8 | 14,560 | 3.8125 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool checkInsertion(vector<vector<char>>& board, int row, int col, char test) {
int topRow = 3 * (row / 3); // Top-row of a subgrid for a given value of rowCheck
int leftCol = 3 * (col / 3); ... | true |
93fa50960aa274b935200342a70317d8086bc953 | C++ | swertz/MEMcpp | /interface/binnedTF.h | UTF-8 | 1,642 | 2.65625 | 3 | [] | no_license | #ifndef _INC_BINNEDTF
#define _INC_BINNEDTF
#include <string>
#include <algorithm>
#include "TH2.h"
#include "TFile.h"
class BinnedTF{
public:
BinnedTF(const std::string particleName, const std::string histName, TFile* file);
~BinnedTF();
inline double Evaluate(const double &Erec, const double &Egen) const;... | true |
91426933e555c216373c44185607efbcaf82324b | C++ | SR-Sunny-Raj/Hacktoberfest2021-DSA | /05. Searching/jump_search.cpp | UTF-8 | 1,114 | 3.40625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cmath>
using namespace std;
#define MAX 100
int search(int key);
int a[MAX],n;
int main()
{
int i,key,result;
cout<<"\nEnter the number of elements: ";
cin>>n;
cout<<"\nEnter the elements of array: \n";
for(i=0;i<n;i++)
{
cin>>a[i];
}
c... | true |
b85d5073d7aff7f4d974f5a89a547764bab3582c | C++ | ShanzhongXinzhijie/DemolisherWeapon | /DemolisherWeapon/system/GameObject.h | SHIFT_JIS | 15,149 | 2.75 | 3 | [] | no_license | #pragma once
#include <unordered_map>
#include "../util/Util.h"
namespace DemolisherWeapon {
class IGameObject;
class GameObjectManager;
class GONewDeleteManager;
class GOStatusReceiver;
//Q[IuWFNgXe[^X
struct GOStatus {
bool m_isDead = false;//ɂ܂?
};
//Xe[^XLX^[
class GOStatusCaster {
public:
GOStatusCaster(GOSta... | true |
a30ea1f9a275a925e1bab398dd1623b3bacfe532 | C++ | sunlanchang/Accepted | /search/hrbust1143.cpp | UTF-8 | 1,236 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int maxn = 1e3 + 10;
bool vst[maxn][maxn];
int pic[maxn][maxn];
int M, N, SX, SY, ANS;
int dir[4][2] = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
bool check(int x, int y)
{
//注意状态检测先检测边界!如果先检测vst会有数组越界的危险
if (x > 0 && x <= M && y > 0 &... | true |
445695e2effe69b141eb70d183d01c4f654c088f | C++ | chengyoude00/cstudy | /jingtai/jingtai/linklist.h | GB18030 | 2,703 | 3.71875 | 4 | [] | no_license | #pragma once
#include "node.h" //Ҫʹ
#include <iostream>
using namespace std;
class Linklist
{
public:
Linklist(int i, char c); //캯
Linklist(Linklist &l); //캯
~Linklist(); //
bool Locate(int i); //ҽ
bool Locate(char c); //ַҽ
bool Insert(int i = 0, char c = '0');//ڵǰ֮
bool Delete(); //ɾǰ
v... | true |
52bd288e2fcdf4dcfb256b22a287fe1664eeda85 | C++ | kelby-amerson/binarytree | /ItemType.cpp | UTF-8 | 924 | 3.875 | 4 | [] | no_license | #include "ItemType.h"
#include <cstdlib>
#include <iostream>
using namespace std;
/**
* Constructor for ItemType
* Post-Condition: ItemType object is created
*/
ItemType::ItemType(){}
/**
* * Constructor for ItemType
* * Post-Condition: ItemType object is created with value instantiated
* */
ItemType::Ite... | true |
5f261cce7de27f33881cae8dbf5465669c93f4fd | C++ | HenVanGogh/emptyVessel | /EmptyVessel.ino | UTF-8 | 12,600 | 2.625 | 3 | [] | no_license | #include "MPU6050.h"
#include "Adafruit_VL53L0X.h"
#include "KalmanFilter.h"
KalmanFilter kalmanX1(0.001, 0.003, 0.03);
KalmanFilter kalmanY1(0.001, 0.003, 0.03);
KalmanFilter kalmanX2(0.001, 0.003, 0.03);
KalmanFilter kalmanY2(0.001, 0.003, 0.03);
KalmanFilter kalmanX3(0.001, 0.003, 0.03);
KalmanFilter kalmanY3(0.0... | true |
292d66dc2bfc463f6f0964ac6dd03129a821e133 | C++ | James51332/Papaya | /main/core/Input.cpp | UTF-8 | 6,062 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #include "papayapch.h"
#include "Input.h"
namespace Papaya
{
int Input::m_MouseX;
int Input::m_MouseY;
bool Input::s_KeyState[PAPAYA_TOTAL_KEYCODES];
bool Input::s_LastKeyState[PAPAYA_TOTAL_KEYCODES];
bool Input::s_MouseState[PAPAYA_TOTAL_MOUSECODES];
bool Input::s_LastMouseState[PAPAYA_TOTAL_MOUSECODE... | true |
4b2b3ca11de3f89c94b59156f0ef72c05adee4a4 | C++ | WeyrSDev/Game-Menu | /src/gamewindow.cpp | UTF-8 | 2,108 | 2.71875 | 3 | [
"MIT"
] | permissive | #include "SFML/Graphics.hpp"
#include "gamewindow.hpp"
const GameWindow::ResolutionSetting GameWindow::w640h480 = GameWindow::ResolutionSetting(640, 480);
const GameWindow::ResolutionSetting GameWindow::w1600h900 = GameWindow::ResolutionSetting(1600, 900);
const GameWindow::ResolutionSetting GameWindow::w1920h1080 = G... | true |
8a1a333c7bd874758b0defb7c460bd6e262fae82 | C++ | landylan/BlueErgo_Protype | /7_trackball/keyboard_with_trackball/direction.cpp | UTF-8 | 963 | 2.765625 | 3 | [] | no_license | #include "direction.h"
Direction::Direction(int pin1, int pin2) {
pins[0] = pin1;
pins[1] = pin2;
pinMode(pins[0], INPUT);
pinMode(pins[1], INPUT);
}
int Direction::read_action() {
for(int i = 0; i < 2; ++i) {
current_actions[i] = digitalRead(pins[i]);
current_action_times[i] = millis(... | true |
5ce43d2509de74710caa5f8c5ecf38cee09c235d | C++ | AnishGRao/LeetCode | /leetcode_problems/zigzag_conversion/non_repeating_substring/main.cpp | UTF-8 | 859 | 3.234375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int lengthOfLongestSubstring(string s)
{
int longest = -1;
unordered_map<char, int> check = {};
int i = 0;
for (int itr = 0; itr < s.size(); itr++)
{
char character = s[itr];
int size_start = check.size();
check[character] = 0;
... | true |
300739879d41fc4d6f52cc4eb0a57b9975b7a5f2 | C++ | Crtl-F5/F5RC-Kernel | /src/main/cpp/Math/PIDController.cpp | UTF-8 | 1,018 | 2.6875 | 3 | [
"MIT"
] | permissive | #include <time.h>
#include <MathExtensions.hpp>
#include <PIDController.hpp>
namespace MathExtensions
{
PIDController::PIDController(float P, float I, float D, float loopLength)
{
this.P = P;
this.I = I;
this.D = D;
this.loopLength = loopLength;
this.integral = 0;
... | true |
196f5cf52a1419042d2cdf0c466319d375e8f8df | C++ | djpetti/CSCI4230-DES | /key_exchange/client_node.cc | UTF-8 | 3,891 | 2.953125 | 3 | [
"MIT"
] | permissive | #include "client_node.h"
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include "constants.h"
namespace hw1 {
namespace key_exchange {
namespace {
// Dummy key we use when we set up the client. We'll set the right key later
// when we have it.
const uint8_t kDummyKey[] = {0, 0};
... | true |
174558dd0079f9bbe884a4c0c4aefc1948c06f57 | C++ | tabahi/IoT-Arduino | /SyncBlutooth_HC05_AnB/Sync30Jan_simple/Serial/Serial.ino | UTF-8 | 449 | 2.65625 | 3 | [
"MIT"
] | permissive | const int ledPin = 13;
const int scopePin = 12;
uint8_t Buffer[768];
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(scopePin, OUTPUT);
Serial.begin(9600);
Serial.flush();
}
void loop()
{
uint16_t length = Serial.available();
if (length > 0)
{
digitalWrite(ledPin, HIGH);
Serial.readBytes((... | true |
ab49180e6b4c97aefe1325a87bc0daec3fdd26b2 | C++ | kicks2kill/C-plus-plus_practice | /practice/classes.cpp | UTF-8 | 1,082 | 2.609375 | 3 | [] | no_license | class A {
typedef int I;
I f();
friend I g(I);
static I x;
template<int> struct Q;
template<int> friend struct R;
protected:
struct B {};
};
A::I A::f() {return 0;}
A::I g(A::I p = A::x);
A::I g(A::I p) {return 0;}
A::I A::x = 0; //why would we want to define this way? Just use int A::x = ... | true |
2a4effefbb7ab3f742ac176c7421ab4550a0e574 | C++ | 0V/simple-raytracer | /src/include/objects/flip_normals.h | UTF-8 | 743 | 2.640625 | 3 | [
"MIT"
] | permissive | #ifndef RAYTRACER_OBJECTS_FLIP_NORMALS_H_
#define RAYTRACER_OBJECTS_FLIP_NORMALS_H_
#include "vector_utility.h"
#include "objects/hitable_base.h"
class FlipNormals : public HitableBase
{
private:
HitablePtr ptr_;
public:
FlipNormals(const HitablePtr &ptr) : ptr_(ptr){};
virtual bool hit(const Ra... | true |
aba8ac803569717b8145ff96faccbb42465a7512 | C++ | danish-7627/Sorting_c-_graphics | /main.cpp | UTF-8 | 4,889 | 3.21875 | 3 | [] | no_license | #include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<time.h>
#include<graphics.h>
#include<windows.h>
using namespace std;
// Class containing of all the sorting algorithms and the array
class sorting_algo
{
private:
vector<int>arr; // Array is private
publ... | true |
3a3debe3a81691790a2ebb0f30e25ee0b632029c | C++ | MarceloGennari/TextureGen | /Camera/camera.cpp | UTF-8 | 9,156 | 2.84375 | 3 | [] | no_license | #include <../model.h>
#include "camera.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <glm/gtc/type_ptr.hpp>
Camera* Camera::cam;
void Camera::keyBoardInput(unsigned char key, int x, int y){
/*
* This is an FPS style of camera
* wasd/zx controls your position
... | true |
4a2053190620c523d763f9182a8bc5efea99bfde | C++ | shadow-paw/cat | /libcat/src/cat_util_string.cpp | UTF-8 | 3,331 | 3.046875 | 3 | [
"MIT"
] | permissive | #include "cat_util_string.h"
#include <algorithm>
#include <cctype>
using namespace cat;
// ----------------------------------------------------------------------------
std::string StringUtil::trim(const std::string& s) {
std::string result = s;
result.erase(result.begin(), std::find_if(result.begin(), result... | true |
718d5ce71ebd8f0e819c6012e29374a5fe39480e | C++ | Anubhav12345678/competitive-programming | /EfficientSearchInA2DMatrix.cpp | UTF-8 | 1,596 | 3.03125 | 3 | [] | no_license | class Solution {
public:
bool binsearch(vector<vector<int>> &v,int x,int i,int jl,int jh)
{
while(jl<=jh)
{
int jm = (jl+jh)/2;
if(v[i][jm]==x)
return true;
else if(v[i][jm]>x)
jh=jm-1;
else
jl = jm+1... | true |
2a2b52c2ee4758fce71899e5785913ce9c7e3342 | C++ | kuwt/miscTest | /misc/imageWrapper/imageWrapper.h | UTF-8 | 405 | 2.96875 | 3 | [] | no_license | #pragma once
class ImageWrapper
{
public:
ImageWrapper(int width, int height);
virtual ~ImageWrapper();
ImageWrapper(const ImageWrapper&other);
ImageWrapper& operator=(const ImageWrapper& other);
ImageWrapper(ImageWrapper&& other);
ImageWrapper& operator=(ImageWrapper&& other);
int getImageSize();
unsigned ... | true |
dfa5810b7790fa95fc7a83ec3eb28fc40167a156 | C++ | Stasqq/Roulette_Game | /Player.cpp | UTF-8 | 5,761 | 3.359375 | 3 | [] | no_license | //
// Created by Stasiek on 2018-12-16.
//
#include "Player.h"
Player::Player() {
money = 0;
bets = CyclicList<Bet>();
name = " ";
}
void Player::addBet(int howMuch, enum betType typ) {
bets.pushBack(Bet(typ, howMuch));
money -= howMuch;
}
void Player::addBet(int howMuch, enum betType typ, int *... | true |
1268e285bd426e121209bb6c1ad4eb453b6edc95 | C++ | john-ababa/ProjectEuler | /020/022.cpp | UTF-8 | 1,622 | 3.703125 | 4 | [] | no_license | //////////////////////////////////////////////////////////////////////
// Problem 22
//
// 5000個以上の名前が書かれている46Kのテキストファイルnames.txt を用いる.
// http://projecteuler.net/project/names.txt
//
// まずアルファベット順にソートせよ.
// のち, 各名前についてアルファベットに値を割り振り,
// リスト中の出現順の数と掛け合わせることで, 名前のスコアを計算する.
//
// たとえば, リストがアルファベット順にソートされているとすると, COL... | true |
d9e4dba1d549ee9f41ca726a049d818a718afcd8 | C++ | Rickym72/cpsc323ass2 | /main.cpp | UTF-8 | 2,199 | 2.984375 | 3 | [] | no_license |
/*
- Use g++ -Wall -c -g main.cpp -o main.o
followed by g++ main.o -o main
- Run the program with ./main
*/
// Include Libraries and header files
#include <iostream>
#include "FSM.h"
#include "syntax.h"
using namespace std;
int main(int argc, char *argv[])
{
//initalizing variables
vector<stri... | true |
3f8c5ca7508e119ef529604f4741c13b6b0edc97 | C++ | hfloresr/connect4 | /search_settings.h | UTF-8 | 233 | 2.703125 | 3 | [] | no_license | class SearchSettings {
public:
SearchSettings() : timeLimit(0) {}
void SetTimeLimit(int timeInSeconds) {
timeLimit = timeInSeconds;
}
int GetTimeLimit() const {
return timeLimit;
}
private:
int timeLimit;
}; | true |
62d0cbd38dc2a469a9c489bfb767f591b43ae394 | C++ | Verdax97/Pongherillo | /pong.ino | UTF-8 | 11,531 | 2.734375 | 3 | [] | no_license | #include <Wire.h> // This library allows you to communicate with I2C
#include <Adafruit_GFX.h> // Adafruit GFX graphics core library
#include <Adafruit_SSD1306.h> // Driver library for 'monochrome' 128x64 and 128x32 OLEDs
/*
Showing number 0-9 on a Common Anode 7-segment LED displ... | true |
4e74bdba3d28e4704a4d4d57c218fc671b794013 | C++ | rintujrajan/DesignPattern | /PatternsCompunded/Vending_Machine/States/ReadyToTakeOrderState.cpp | UTF-8 | 1,842 | 3.1875 | 3 | [] | no_license | #include "ReadyToTakeOrderState.h"
#include <iostream>
#include "../VendingMachine.h"
ReadyToTakeOrderState::ReadyToTakeOrderState(VendingMachine* vendingMachine)
{
vendingMachineInstance = vendingMachine;
}
void ReadyToTakeOrderState::readyToTakeOrder()
{
int coffeeType = -1;
int beverageSize = -1;
f... | true |
186266deae9eb8d7c71adffd64b73dbe1c6af2fc | C++ | maikel1991p3/AlgoritmosClustering | /algoritmos/AlgMultiArranque.cpp | UTF-8 | 3,869 | 2.8125 | 3 | [] | no_license | /*
* AlgMultiArranque.cpp
*
* Created on: 12/04/2014
* Author: maikel
*/
#include "AlgMultiArranque.h"
AlgMultiArranque::AlgMultiArranque(vector<Cluster*>& clusters, vector<Objeto*>& objetos) {
setNombreAlgoritmo(" Técnica MultiArranque ");
setObjetos(objetos);
setClusters(clusters);
setDimension(getCl... | true |
8189fd2984d9df9b032715dc79ebebd7b1dc05a1 | C++ | legobridge/opengl-water-simulation | /src/scene.cpp | UTF-8 | 13,613 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include "glad/glad.h"
#include "GLFW/glfw3.h"
#include "scene.h"
using namespace std;
// Constructor
Scene::Scene()
: modelShader("../src/shader/model.vs", "../src/shader/model.fs")
, terrainModel("../model/terrain/terrain.obj", modelShader)
, treeModel("../model/tree/tree.obj", modelShader)
... | true |
495f2cd708f5dcb4ee00aae7f4cb7cc21f1b923a | C++ | Modifying/Algorithm | /PointToLine/main.cpp | GB18030 | 955 | 3.328125 | 3 | [] | no_license | // һƽϵn, ҳֱϵĵ.
#include <vector>
#include <map>
#include <algorithm>
#include <list>
struct Point
{
int x;
int y;
Point() : x(0), y(0) {}
Point(int a, int b) : x(a), y(b) {}
};
int MaxPoints(std::vector<Point> &points)
{
if (points.size() < 2)
return points.size();
int size = points.size();
int ret = 0... | true |
74272c21f072a7102fef6bbc1b0d4ac1d78aa068 | C++ | LaylaHirsh/Victor | /Energy/Sources/RapdfPotential.h | UTF-8 | 2,775 | 2.90625 | 3 | [] | no_license | /**
* @Class RapdfPotential
* @Project Victor
**/
#ifndef _RAPDFPOTENTIAL_H_
#define _RAPDFPOTENTIAL_H_
// Includes:
#include <vector>
#include <Potential.h>
// Global constants, typedefs, etc. (to avoid):
const unsigned int MAX_BINS = 18;
const unsigned int MAX_TYPES = 168;
namespace Biopool {... | true |
96a832151b02f6620bbe3d964ea24eab4b498de2 | C++ | marcbejerano/cpp-tools | /libProperties/properties.cc | UTF-8 | 3,483 | 3.21875 | 3 | [
"BSD-3-Clause"
] | permissive | #include <Properties>
#include <Tools>
#include <sstream>
using namespace hslib;
/**
* Set a new property or update an existing property.
* \param key Property key
* \param value Property value
* \return Reference to this object
*/
Properties& Properties::setProperty(const std::string& key, const std::string& va... | true |
d7f8350ae2738cb390e859914b96ff5618f55683 | C++ | JackDrogon/ProgrammingSamples | /cpp/test/move_test.cc | UTF-8 | 645 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <memory>
#include <string>
using namespace std;
struct Type {
Type(int pi) : i(pi) { cout << "Ctor " << i << endl; }
Type(Type &&t) : i(t.i)
{
t.i = 0;
cout << "Move ctor " << i << endl;
}
~Type() { cout << "dctor " << i << endl; }
int i;
};
// void f(string &&s) { cout << s + "... | true |