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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5a269f4928cfba2cc808a1c4d58c0e8e5bb0d2c4 | C++ | lukaszjanus/CPP-various-programs-and-algorithmes | /CS-Science Club/OOP calculator XI 2017/kalkulator/variables.h | UTF-8 | 1,127 | 2.5625 | 3 | [] | no_license | /***************************************************************************************************************
*"variables.h"
*
*
*CONTENTS:
* "Variables for cBasic class"
*HISTORY:
*version Date Changes Author/Programmer
*1.0 07.12.2017 Orginal design Lukasz Janus
*
*... | true |
6c4da86f5d8281e3a7199da455e4a974fea13b72 | C++ | acm-icpc-training/acm-icpc-training | /aoj/1244/main.cpp | UTF-8 | 2,209 | 3.546875 | 4 | [
"MIT"
] | permissive | #include <cassert>
#include <iostream>
#include <unordered_map>
using namespace std;
unordered_map<string, int> atom_to_weight;
class Parser {
string str;
int cur;
bool IsDigit(char c) {
return '0' <= c && c <= '9';
}
bool IsUpperCase(char c) {
return 'A' <= c && c <= 'Z';
}
bool IsLowerCase... | true |
2e01058c3e70fa05b0748f261f450ee552e26ed1 | C++ | JUNGEEYOU/algorithm | /5.stack/2_stl_stack.cpp | UTF-8 | 485 | 3.296875 | 3 | [] | no_license | // stl stack 사용하기
#include <bits/stdc++.h>
using namespace std;
int main(void) {
stack<int> S;
S.push(10);
S.push(20);
S.push(30);
cout << S.size() << '\n';
if(S.empty()) cout << "S is empty \n";
else cout << "S is not empty \n";
S.pop();
cout << S.top() << '\n';
S.pop();
cout << S.top() << '\n';... | true |
cfde0c8739c97704d4883058227e45cdb54b49c5 | C++ | spartanPAGE/spartsi-deprecated- | /spartsi/test/builder/ref-nodes.cpp | UTF-8 | 1,392 | 2.875 | 3 | [
"MIT"
] | permissive | #include "catch/catch.hpp"
#include "builder/tree-builder.hpp"
TEST_CASE("Ref nodes", "[spartsi::builder]") {
using namespace spartsi::builder;
auto tree = build()
.treestructinfo("2.0").name("ref nodes")
("foo")
.req_node("refnode")
.end_tree()
("bar")
... | true |
03cdc3c041b4e0362acec7945b3bc3ce146a74dd | C++ | shtanriverdi/Full-Time-Interviews-Preparation-Process | /Weekly Questions/767. Reorganize String.cpp | UTF-8 | 1,200 | 3.390625 | 3 | [] | no_license | // Question Link ---> https://leetcode.com/problems/reorganize-string/
class Solution {
public:
string reorganizeString(string S) {
if (S.size() <= 1) {
return S;
}
unordered_map<char, int> letterFreqMP;
for (char c : S) {
letterFreqMP[c]++;
}
... | true |
a95ac61111535b761a64946c8fea59e894258ddf | C++ | gabrielfsil/estrutura-de-dados-2 | /NoAVL.h | UTF-8 | 582 | 2.625 | 3 | [] | no_license | #ifndef NoAVL_H_INCLUDED
#define NoAVL_H_INCLUDED
class NoAVL
{
public:
NoAVL();
~NoAVL();
void setEsq(NoAVL *p);
void setInfo(int val);
void setDir(NoAVL *p);
void setAltura(int k);
void setFB(int k);
NoAVL* getEsq();
int getInfo();
NoAVL* getDir();
int getAltu... | true |
9573985a7e9e835d166a1591a7955a32e5fff55f | C++ | jobrittain/ball-sim | /Source/Influencer.cpp | UTF-8 | 2,417 | 2.875 | 3 | [
"MIT"
] | permissive | #include "Influencer.h"
Influencer::Influencer() : _influentialForce(0), _online(false)
{
}
Influencer::~Influencer()
{
}
void Influencer::SetRadius(float radius)
{
_radius = radius;
}
void Influencer::SetSightRadius(float sightRadius)
{
_sightRadius = sightRadius;
}
void Influencer::SetMovementSpeed(float spe... | true |
54bafdabebe82337c30d8c03c0fb866e1385b34a | C++ | fviel/projetos_arduino | /Códigos/UltrassomComMotor/baseRobo/baseRobo.ino | UTF-8 | 1,757 | 3.125 | 3 | [] | no_license |
#include <Stepper.h>
#define trigPin 13
#define echoPin 12
#define blockedLedPin 5
#define cleanLedPin 6
//define a quantidade de passos por volta
const int passosPorVolta = 200;
//inicializa o motor e seus pinos
Stepper motor(passosPorVolta, 8,9,10,11);
//inicializa o contador de voltas
int contaGiro = 0; ... | true |
bf409d8a704a734d6dba9ae95c09e7eb94dd35d0 | C++ | tdm1223/Algorithm | /programmers/source/1-27.cpp | UTF-8 | 458 | 3.359375 | 3 | [
"MIT"
] | permissive | //문자열 내림차순으로 배치하기
// sort(s.begin(), s.end(), greater<char>());
// sort(s.rbegin(),s.rend());
// 2019.03.08
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
string solution(string s)
{
string answer = "";
vector<char> v;
for (int i = 0; i<s.size(); i++)
{
v.push_back(s[i]);
}
sort(v.... | true |
82b5c5659bce516bbf66183120911fb799598dc0 | C++ | Strongc/MyBase | /Common/Thread.h | UTF-8 | 1,486 | 2.640625 | 3 | [] | no_license | #ifndef __SYNCHRONIZATION_THREAD_H__
#define __SYNCHRONIZATION_THREAD_H__
#include "Type.h"
#ifdef WIN32
typedef UINT THREAD_ID;
typedef UINT THREAD_FUNC_RET_TYPE;
#else
typedef pthread_t THREAD_ID;
typedef VOID * THREAD_FUNC_RET_TYPE;
#endif
typedef enum _ThreadStatus{
eNone,
eActive,
eSuspend
}emTh... | true |
c41c65f2466e8d38e3df2d8772cf85b42ccc8b8c | C++ | murilobnt/vulnus | /src/playermousecontrol.cpp | UTF-8 | 282 | 2.53125 | 3 | [
"CC-BY-3.0",
"MIT"
] | permissive | #include "structures/playermousecontrol.hpp"
void PlayerMouseControl::controlEntityByMouse(sf::Event event, SpritedEntity& spritedEntity, sf::Vector2f mousePos){
switch(event.type){
case sf::Event::MouseButtonPressed :
spritedEntity.setSpritePosition(mousePos);
break;
}
} | true |
a1443ca42e6764c54af6bc1cc5e10144e0dc7dca | C++ | asu126/summary | /src/374_guessNumber.cpp | UTF-8 | 630 | 3.671875 | 4 | [] | no_license | // Forward declaration of guess API.
// @param num, your guess
// @return -1 if my number is lower, 1 if my number is higher, otherwise return 0
int guess(int num);
class Solution {
public:
int guessNumber(int n) {
int low = 1;
int higt = n;
int mid = low + (higt-low)/2;
while(low ... | true |
4ef08eb1111998225f275463ae1d3971b428dc7d | C++ | XapiMa/procon | /prac/first/ABC_081_B-Shift_Only.cpp | UTF-8 | 577 | 2.875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int N;
int A[200];
cin >> N;
for(int i = 0; i<N; i++) cin >> A[i];
int res = 0;
while(true) {
bool exist_odd = false;
for (int i = 0; i < N; i++) {
if(A[i]%2 != ... | true |
aa9576fba9fadadfc7bcef1850d113efbc6a9d60 | C++ | HU-R2D2/adt | /source/include/ADT_Base.hpp | UTF-8 | 5,753 | 2.625 | 3 | [] | no_license | // ++--++
// @file <ADT_Base.hpp>
// @date Created: <5-3-16>
// @version <0.0.1>
//
//
// @section LICENSE
// License: newBSD
//
// Copyright © 2016, HU University of Applied Sciences Utrecht.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted pr... | true |
9a30d3899723459b95bb738fc7edcfed9db5dc53 | C++ | eindacor/OpenGL-Calculator | /keypress.cpp | UTF-8 | 8,930 | 2.734375 | 3 | [] | no_license | #include "keypress.h"
bool key_handler::checkPress(int key, GLFWwindow* window)
{
int state = glfwGetKey(window, key);
//check list of keys pressed for a match, acts according to the press state
for (list<int>::iterator i = keysPressed.begin(); i != keysPressed.end(); ++i)
{
if (*i == key)
{
if (state == G... | true |
bd481b1b7f245842c9a0725fad737f41d474ffc8 | C++ | JLUCProject2020/cproject2020-group6 | /tb.cpp | GB18030 | 9,116 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define N 6 //֧
#define ATTN 11 //
int Player[N][ATTN];
int n_player = -1;
// ս
const int ZD_HP = 0;//Ѫ
const int ZD_DEX = 1;//ս
const int ZD_FANJI = 2;//
const int ZD_SHANBI = 3;//ս
const int ZD_YILIAO = 4;// ҽ
const int ZD_... | true |
8a779fd3d6c2aad42d9bbde0993373c0b9adb97e | C++ | btcup/sb-admin | /exams/2559/02204111/2/midterm/4_2_835_5820551567.cpp | UTF-8 | 500 | 2.953125 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int main()
{
int n,i,m,j,t;
cout<<"Enter a positive integer : ";
cin>>n;
if(n>0)
{
i=0;
do
{
n=n/10;
i++;
}
while(n>0);
cout<<"\n\n";
cout<<"Number of digit is "<<i<<endl;
cout<<"Factor of "<<n<<" are : \n";
j=1;
do
{
... | true |
b176c129ef4569b34419c607c74c6dd30baab2d4 | C++ | raulMrello/BspManagers | /FSManager/FSManager.cpp | ISO-8859-1 | 6,426 | 2.640625 | 3 | [] | no_license | /*
* FSManager.cpp
*
* Created on: Sep 2017
* Author: raulMrello
*/
#include "FSManager.h"
//------------------------------------------------------------------------------------
//--- EXTERN TYPES ------------------------------------------------------------------
//----------------------------------------... | true |
f98500ced529816e6a20cfcc7267d2d8df964001 | C++ | srxdev0619/eos-expression-aware-proxy | /3rdparty/toml11/tests/test_get_or.cpp | UTF-8 | 3,547 | 2.71875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | #define BOOST_TEST_MODULE "test_get_or"
#ifdef UNITTEST_FRAMEWORK_LIBRARY_EXIST
#include <boost/test/unit_test.hpp>
#else
#define BOOST_TEST_NO_LIB
#include <boost/test/included/unit_test.hpp>
#endif
#include <toml.hpp>
#include <map>
#include <unordered_map>
#include <list>
#include <deque>
#include <array>
BOOST_AU... | true |
dda600c54b800bddda5a12fb3f97accb13b69d40 | C++ | nursakzhol/Algorithms | /new.cpp | UTF-8 | 3,144 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Node {
public:
int data;
Node *left, *right;
Node(int data){
this->data = data;
left = NULL;
right = NULL;
}
};
class BST {
public:
vector<int> ct;
Node *root;
BST(){
root = NULL;
... | true |
6c72d2a576d678da11a93624640210bd7c9eeabe | C++ | LeonardoADS08/Repositorio | /Validaciones C++.cpp | UTF-8 | 865 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <limits>
using namespace std;
bool verif_solo_numeros(char cad[])
{
bool k = true;
int i = 0;
while(i < strlen(cad) && k==true)
{
if((cad[i] >= '0') && (cad[i] <= '9'))
i++;
else
k = false;
}
if (strlen(cad)==0)
k = false;
return k;
}
int leerNumeros(... | true |
3f80b692a6224365056db3fc80bddba990e9618d | C++ | zlaval/ELTE_Prog | /objektum_elvu_programozas/bead2/AnglerEnumerator.h | UTF-8 | 540 | 2.53125 | 3 | [] | no_license | #include "ContestEnumerator.h"
#ifndef OOP_ANGLERENUMERATOR_H
#define OOP_ANGLERENUMERATOR_H
struct Angler {
std::string name;
bool catchOnlyCarp = true;
};
class AnglerEnumerator {
private:
Angler cur;
ContestEnumerator contCur;
bool eof;
public:
AnglerEnumerator(const std::string &file) : ... | true |
cd7fb02911e5452a70c9f326dc3eba9e3c89031f | C++ | Aditya-013/Hackerrank-Stuff | /DP/FrodulentNotification.cpp | UTF-8 | 920 | 2.6875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
// int arr[] = {2, 1, 4, 3, 4};
int arr[] = {2, 3, 4, 2, 3, 6, 8, 4, 5};
int cnt[210];
int median(int d){
int p = 0;
for(int i=0; i<210; i++){
p += cnt[i];
if(2*p > d){
return 2*i;
}else if(2*p == d){
for(int j=i+1;;j+... | true |
2360d998566a53dac27b9456e943b4909b51e7ed | C++ | InvictusInnovations/keyhotee | /qtreusable/LoginInputBox.cpp | UTF-8 | 827 | 2.609375 | 3 | [] | no_license | #include "LoginInputBox.hpp"
#include "ui_LoginInputBox.h"
LoginInputBox::LoginInputBox(QWidget *parent, const QString& title,
QString* userName, QString* password) :
QDialog(parent),
ui(new Ui::LoginInputBox),
_userName(userName),
_password(password)
{
ui->setupUi(thi... | true |
82052af0a647eed709edcffcb81efb3aed64d3fe | C++ | mshicom/wolf | /src/sensor_gps.cpp | UTF-8 | 2,391 | 2.546875 | 3 | [] | no_license |
#include "sensor_gps.h"
#include "state_block.h"
#include "state_quaternion.h"
namespace wolf {
SensorGPS::SensorGPS(StateBlock* _p_ptr, //GPS sensor position with respect to the car frame (base frame)
StateBlock* _o_ptr, //GPS sensor orientation with respect to the car frame (base frame)
... | true |
6452f2da55f5fe7a888e66622f057d8e7a38342e | C++ | kjnh10/pcw | /work/atcoder/arc/arc072/F/answers/237760_es.cpp | UTF-8 | 1,046 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <deque>
#include <cstdio>
using namespace std;
int main(){
int N, L;
while(cin >> N >> L){
deque< pair<double, double> > dq;
int t, v; cin >> t >> v;
dq.push_back(make_pair(t, v));
printf("%.8lf\n", (double)t);
double sumT = t * (double)v;
for(int i=1;i<N;i... | true |
c38942742170906d218b06ffec774c611d48d344 | C++ | rjtshrm/point-normals-upsampling | /sampling/sampling.cpp | UTF-8 | 3,052 | 2.671875 | 3 | [
"MIT"
] | permissive | #include <torch/extension.h>
#include <iostream>
// CUDA forward declarations
at::Tensor furthest_sampling_cuda_forward(
int b, int n, int m,
at::Tensor input,
at::Tensor temp,
at::Tensor idx);
at::Tensor gather_points_cuda_forward(int b, int c, int n, int npoints,
... | true |
ce5a059d773a68bf0f0267ca7a9b72225ff0fd37 | C++ | BackupTheBerlios/wsjt-svn | /branches/wsjtx_w/Detector.hpp | UTF-8 | 2,012 | 2.796875 | 3 | [
"BSD-2-Clause",
"BSD-2-Clause-Views"
] | permissive | #ifndef DETECTOR_HPP__
#define DETECTOR_HPP__
#include "AudioDevice.hpp"
#include <QScopedArrayPointer>
//
// output device that distributes data in predefined chunks via a signal
//
// the underlying device for this abstraction is just the buffer that
// stores samples throughout a receiving period
//
class Detecto... | true |
4df852fc25e6c0432bd718a99e171e0bd5835a47 | C++ | ill/illEngine | /Input/serial/InputContextStack.cpp | UTF-8 | 1,421 | 2.6875 | 3 | [] | no_license | #include <cstdlib>
#include "InputContextStack.h"
#include "InputContext.h"
#include "InputBinding.h"
namespace illInput {
InputContext * InputContextStack::popInputContext() {
InputContext * res = m_stack.back();
//reset states of all input listeners
res->resetListeners();
m_stack.pop_back();
... | true |
d580a9af2fd77c101eff36a007953f36ce06cb88 | C++ | deathcat05/CS450HW4 | /FlatPageTable.cpp | UTF-8 | 900 | 2.9375 | 3 | [] | no_license | #include<iomanip> // for setw if needed
#include<iostream>
#include "FlatPageTable.hpp"
// my assumption here is that each array will be size 4
// so I'm going to set a const variable to 4 for the size
static const int defaultSize = 4;
FPTable::FPTable(): size(defaultSize)
{
fpTable = new int[defaultSize];
}
FPTab... | true |
382c2b53bc5113ff898b47338df8e0a5d1325853 | C++ | zhanying26252625/leetcode | /MedianOfTwoSortedArrays.h | UTF-8 | 1,009 | 3.65625 | 4 | [] | no_license | /*
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
*/
class Solution {
public:
double findMedianSortedArrays(int A[], int m, int B[], int n) {
int t = m + n;
if(!t)
retur... | true |
3f2220f88b305c94f14c033841304a40e3e6232a | C++ | SvenJo/demo_mandelbrot | /include/easy/picture.h | UTF-8 | 764 | 3.3125 | 3 | [
"MIT"
] | permissive | #pragma once
namespace easy
{
template<typename RES_TYPE>
struct Picture
{
Picture(int x, int y)
: width_(x)
, height_(y)
, data_(size_t(x*y))
{}
void resize(int w, int h)
{
width_ = w;
height_ = h;
data_.resize(size_t(w*h));
}
int width() const { re... | true |
2c3ac4f403099ae97f22ca858509e10a4ba4a311 | C++ | piash76/Linked-List | /linked_list_2_insert_at_first.cpp | UTF-8 | 1,089 | 3.21875 | 3 | [] | no_license |
///Bismillahir Rahmanir Rahim
///ALLAHU AKBAR
#include<bits/stdc++.h>
using namespace std;
int a[50];
int n;
struct node ///self referential structure
{
int data;
struct node *next; ///pointing to next node
};
struct node *head=NULL,*last;
void creation()
{
int i;
struct nod... | true |
850f4b34309d1cd775f14cd215128cb60c0f7083 | C++ | Jerrybubbles/RPGgame | /RPGgame/battle.cpp | UTF-8 | 6,917 | 3.015625 | 3 | [] | no_license | #include "battle.h"
#include "enemy.h"
#include <vector>
#include <experimental/random>
#include <stdlib.h>
#include <time.h>
#include <sstream>
#include <fstream>
#include <string>
void menu(){
cout << "a) attack\nb) heal\nUw keuze:" << endl;
}
Battle::Battle(string path): path{path}
{
loadMo... | true |
913ed185b7c2de83189a48f9a8ec12b338508a4a | C++ | kgadgil/block_sparse | /include/print_funcs.h | UTF-8 | 227 | 2.671875 | 3 | [] | no_license | /*
Print Functions Header file
*/
#include <iostream>
#include <vector>
void printVec (const std::vector<auto> vec) {
for (auto i : vec){ //pythonic range-based for loops
std::cout << i << "\t";
}
std::cout << std::endl;
} | true |
7aad141ce01d7b130279998059bc50c4c571b1dd | C++ | naskapal/cPlusPlus | /assignment1/main.cpp | UTF-8 | 2,773 | 3.1875 | 3 | [] | no_license | /*
* Created by : Rizky Agung Saputro
* E1200267
* Assignment 1 C++ */
#include <cstdlib>
#include <iostream>
using namespace std;
struct node{
int num[6];
char name[3];
struct node *next;
};
typedef node *nodeptr;
void insert(nodeptr &head, int data[], char name[]);
nodeptr head = NULL;
int holder;
int ma... | true |
6b17269a1614e9ba887158c03440ece790c34aac | C++ | komiga/hord | /src/Hord/Cmd/Object/CmdObjectSetParent.cpp | UTF-8 | 2,157 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
@copyright MIT license; see @ref index or the accompanying LICENSE file.
*/
#include <Hord/aux.hpp>
#include <Hord/utility.hpp>
#include <Hord/Log.hpp>
#include <Hord/IO/Defs.hpp>
#include <Hord/Object/Defs.hpp>
#include <Hord/Object/Unit.hpp>
#include <Hord/Object/Ops.hpp>
#include <Hord/Cmd/Object.hpp>
#include... | true |
d6cf33e3b5459104c21b035efe105da41918f5d6 | C++ | bmonte/2018.2 | /LP1/lista_1/soma_pares.cpp | UTF-8 | 359 | 3 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int x;
while (cin >> x) {
int inicio, quantidade, fim, soma = 0;
cout << "Insira dois pares: " << endl;
cin >> inicio >> quantidade;
fim = inicio + quantidade;
for (inicio; inicio < fim; inicio++) {
soma += inicio;
}
std::cout << "Soma... | true |
6a82bec1e37f167dba41f91ff03a7cf8c79e4a72 | C++ | mplucinski/TialVFS | /TialVFS/src/MemoryDriver.cpp | UTF-8 | 6,223 | 2.640625 | 3 | [
"BSD-2-Clause"
] | permissive | #include "MemoryDriver.hpp"
#include "Exception.hpp"
#include <TialUtility/TialUtility.hpp>
#define TIAL_MODULE "Tial::VFS::MemoryDriver"
Tial::VFS::MemoryDriver::Node::Node(bool directory): directory(directory) {
LOGN3;
}
Tial::VFS::MemoryDriver::FileEntry
Tial::VFS::MemoryDriver::Node::get(const Path &path) {
... | true |
17b3362ca5ae4ba0b0ab03873204ec3c7bc828c6 | C++ | TazzerLabs/Interpreter | /Range.cpp | UTF-8 | 3,329 | 3.140625 | 3 | [
"MIT"
] | permissive | /*
* Created by Tyler Gearing 3/14/19
*
*/
#include "Range.hpp"
Range::Range(): _start{0}, _end{0}, _step{0} {}
Range::Range( int start, int end, int step ):
_start{start}, _end{end}, _step{step} {}
Range::Range(std::string const &varName,
std::vector<std::shared_ptr<ExprNode>> rangeList,
SymTab &symTab... | true |
e09aae6c37653addb076c03fb8c414dc2dc3ebe7 | C++ | oymin2001/DataStructure | /pre/Object-Oriented Programming/Inheritance/Virtual Function/Shape.h | UTF-8 | 613 | 3.09375 | 3 | [] | no_license | #ifndef SHAPE_H
#define SHAPE_H
#include<string>
#include"Position.h"
using namespace std;
enum COLORS{RED,BLUE,BLACK,ORANGE};
extern const char* shapeColor[];
class Shape
{
friend ostream& operator<<(ostream& S, Shape&);
public:
Shape();
Shape(Position p, COLORS color, string name);
virtual ~Shape();
virtua... | true |
b61041893dd1926aa5c6240d4ff0e24ce12219fd | C++ | NUC-NCE/algorithm-codes | /codes - ac/HDU/1263/18632852_AC_15ms_1476kB.cpp | UTF-8 | 1,161 | 2.6875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
struct info
{
string name;
string place;
int weight;
}m[250];
bool cmp(info a,info b)
{
if(a.place!=b.place)
return a.place<b.place;
if(a.place==b.place)
return a.name<b.name;
}
int main()
{
i... | true |
b4acd6742991f704178e18f5503bc859f696c184 | C++ | Maxerum/yo_avp_loot | /mainwindow.cpp | UTF-8 | 3,400 | 2.8125 | 3 | [] | no_license | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include <windows.h>
#include <iostream>
#include <iomanip>
#include <intrin.h>
#pragma intrinsic(__rdtsc)
struct CacheSize
{
size_t size;
size_t lineSize;
};
int* arrray;
int offset = 1 * 1024 * 1024;
int const maxWay = 20;
CacheSize getCacheSize(int leve... | true |
ead4ed9252cd3d14b77a288c423ec382803d4240 | C++ | WeiningLi/Object_Oriented_Programming | /mastermindGame/mastermind.h | UTF-8 | 783 | 2.90625 | 3 | [
"MIT"
] | permissive | #ifndef _MASTERMIND_H_
#define _MASTERMIND_H_
#include <random>
struct Mastermind {
int seed;
int codeLength;
int guessLimit;
char* code;
// You may add any data members you require
// as well as any member functions you like.
// So long as all the methods below are properly
// implemen... | true |
a228230f78be3652883152b508859b4a6960c55b | C++ | sarthak5620/Data-structures-and-Algorithms | /Geeks for Geeks/Arrays/01-maximum in an array.cpp | UTF-8 | 855 | 3.5 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct Height {
int feet;
int inches;
};
int findMax(Height arr[], int n);
int main()
{
int t;
cin>>t;
while(t--)
{
int n, tmp1, tmp2;
cin>>n;
Height arr[n];
for(int i=0; i<n; i++)
{
cin>>tmp1>>tmp2;
arr[i]={tmp1, tmp2};
... | true |
6f48501a5f11c2077c9fec19362ce8502fc119b3 | C++ | cvora23/CodingInterviewQ | /BitManipulation/CheckSetCountFind/LittleOrBigEndian.cpp | UTF-8 | 1,974 | 4.3125 | 4 | [] | no_license | /*
* LittleOrBigEndian.cpp
*
* Created on: Aug 28, 2013
* Author: cvora
*/
#include <stdio.h>
/**
* Little and big endian are two ways of storing multibyte data-types
* ( int, float, etc). In little endian machines, last byte of binary
* representation of the multibyte data-type is stored first.
*... | true |
bd112cfa5a070ecbe1ab7816345e49ae567c5728 | C++ | phartley1/PA1 | /PA1Q2.cpp | UTF-8 | 2,118 | 3.78125 | 4 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
struct pt
{
float x;
float y;
};
pt rightcoord(pt, float);
bool dooverlap(pt, pt, pt, pt);
int main()
{
float x1;
float y1;
float a1;
float x2;
float y2;
float a2;
pt r1;
pt r2;
pt l1;
pt l2;
cout << "enter the upper... | true |
1fa0bc581d134fc49e42ba2e45972cbc6c1119d2 | C++ | alfaisallly/Lectures | /Phd/METU_EEE_ComputerGraphics_642/workshop/EE642Project/ee642_sent_5/LoftedSurfaceContext.cpp | UTF-8 | 2,967 | 2.53125 | 3 | [] | no_license | #include "stdafx.h"
#include "642Manager.h"
#include "userContext.h"
CLoftedSurfaceContext* CLoftedSurfaceContext::m_context = 0;
CLoftedSurfaceContext::CLoftedSurfaceContext()
{
recentInputPointCount = 0;
m_contextName = "Main Menu";
m_contextInfo = "Main Menu -- You can select an action from the upper right but... | true |
b91d07d21dc59813529692e8d15ffa2172550d41 | C++ | KevinMathewT/Competitive-Programming | /BrokenClock.cpp | UTF-8 | 2,079 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define F0(i,n) for (ll i = 0; i < n; i++)
#define F1(i,n) for (ll i = 1; i <= n; i++)
#define CL(a,x... | true |
ad5060fe1a2368c3d17b7538f92e105bb953d767 | C++ | jrmrjnck/jrmrmine | /Radix.cpp | UTF-8 | 3,999 | 3.0625 | 3 | [
"Unlicense"
] | permissive | /**
* This is free and unencumbered software released into the public domain.
**/
#include "Radix.h"
#include "Sha256.h"
#include <cassert>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iostream>
#include <iomanip>
const int ALPHABET_INVALID_LETTER = -1;
// The "system radix" corresponds to th... | true |
365b5ef018dd61e7b296c2dd2a7d84be44a341d2 | C++ | loveyacper/ananas | /net/http/HttpServer.h | UTF-8 | 1,694 | 2.734375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
#include "HttpParser.h"
namespace ananas {
class Connection;
class HttpContext;
class HttpServer {
public:
using Handler = std::function<std::unique_ptr<HttpResponse>(const HttpRequest&, std::shared_ptr<HttpContext>)>... | true |
8b683787992fb8a0be8de63f8ab99679b33c51cc | C++ | zhongxinghong/LeetCode | /submissions/169-多数元素-90511379.cpp | UTF-8 | 719 | 3.140625 | 3 | [
"MIT"
] | permissive | /**
* Submission ID: 90511379
* Question ID: 169
* Question Title: 多数元素
* Question URL: https://leetcode-cn.com/problems/majority-element/
* Solution Time: 2020-07-22 22:52:27
* Solution Test Result: 46 / 46
* Solution Status: Accepted
* Solution Memory: 8.7 MB
* Solution Runtime: 20 ms
*/
class Solution {
... | true |
54109e825973ed3e301b526675d0db2f38a61376 | C++ | SChen1024/COJ | /Contest/code1.cpp | UTF-8 | 1,687 | 2.859375 | 3 | [] | no_license | /*****************************************************************/
// 包含必须的头文件
#include <iostream>
#include <vector>
#include <queue>
#include <limits.h>
#include <bits/stdc++.h>
using namespace std;
// 定义本地
#define LOCAL_ 1
typedef vector<int> Vint;
typedef vector<string> Vstr;
typedef vector<... | true |
776cf8cebb9631c383b5fb3570961392844d14eb | C++ | anonymokata/ae85d9b8-4c15-11ea-90ff-52e448637004 | /PencilPoint.h | UTF-8 | 451 | 2.609375 | 3 | [] | no_license | #ifndef PENCILDURABILITYKATA_PENCILPOINT_H
#define PENCILDURABILITYKATA_PENCILPOINT_H
#include <string>
class PencilPoint
{
public:
explicit PencilPoint(size_t durability = 20, size_t length = 10);
std::string write(const std::string& to_write);
void sharpen();
private:
char write(char character);
... | true |
2732a8d29ba9e0c946ac14e9e54932cda9218c74 | C++ | joann8/CPP | /C04/ex00/Cat.hpp | UTF-8 | 266 | 2.578125 | 3 | [] | no_license | #ifndef CAT_HPP
#define CAT_HPP
#include <string>
#include <iostream>
#include "Animal.hpp"
class Cat : public Animal
{
public:
Cat(void);
Cat(Cat const & src);
~Cat(void);
Cat & operator=(Cat const & src);
void makeSound(void) const;
};
#endif
| true |
3f29760a50bf4ba409f87bc35c7d3bf3aba02e8d | C++ | soomrack/MR2020 | /PanteleevMD/Sorting_Algorithms/insertionsort.cpp | UTF-8 | 537 | 3.75 | 4 | [
"MIT"
] | permissive | #include <iostream>
void insertion_sort(int* array, int length)
{
for (int i = 1; i < length; i++) //iterates through
{
for (int j = i; j>0 && array[j-1]>array[j]; j--) // looks for a A[i]'s place in the sorted part of the list
std::swap(array[j], array[j-1]); // ... | true |
4fcfc986752cd6bc0d7000e6640947a53701b443 | C++ | dzt2/MSGen | /MSGen/ctrace.h | UTF-8 | 6,143 | 2.734375 | 3 | [] | no_license | #pragma once
/*
-File : ctrace.h
-Arth : Lin Huan
-Date : May 15th 2017
-Purp : to define interfaces for coverage
-Clas :
[1] LineCoverage
[2] FileCoverage
[3] CoverageSpace
[4] CoverageSource
[5] CoverageLoader
[6] CTrace
*/
#include "bitseq.h"
#include "cerror.h"
#include "cfile.h"
#include "ctest.h"
#include <map>... | true |
a12827b8f2d00a54068d8e1f5d5af4a2a07dedf7 | C++ | 657122411/LidarBathymetry | /cpp/LevmarDemo.cpp | UTF-8 | 3,810 | 2.8125 | 3 | [] | no_license | #include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <levmar.h>
#ifndef LM_DBL_PREC
#error Example program assumes that levmar has been compiled with double precision, see LM_DBL_PREC!
#endif
#define M_PI 3.14
/* the following macros concern the initialization of a ... | true |
d6be3f108f5744d8c715d8454a1ea19a1e5574de | C++ | gibule/gibule | /gblthread.cpp | UTF-8 | 341 | 2.578125 | 3 | [] | no_license | #include "gblthread.h"
GBLThread::GBLThread()
{
}
GBLThread::~GBLThread()
{
}
void GBLThread::start()
{
running=true;
thr=thread(&GBLThread::run,this);
}
void GBLThread::stop()
{
running=false;
}
bool GBLThread::isRunning()
{
return running;
}
void GBLThread::run()
{
}
void GBLThread::wait()... | true |
b6527197ad4858d3ef15210dcd51aebcd3e8dfd5 | C++ | extinguish/Cpp17CompleteGuide | /cpp_move/src/generic/universaltype.cpp | UTF-8 | 1,687 | 3.4375 | 3 | [] | no_license | //********************************************************
// The following code example is taken from the book
// C++ Move Semantics - The Complete Guide
// by Nicolai M. Josuttis (www.josuttis.com)
// http://www.cppmove.com
//
// The code is licensed under a
// Creative Commons Attribution 4.0 International Licen... | true |
bbac29a9961a6f970966d843497fc1c559a2f58b | C++ | Paranauerj/Crosswords | /Source/Classes/jogador.cpp | MacCentralEurope | 4,011 | 2.734375 | 3 | [
"MIT"
] | permissive | #include "imports.h"
#include "ponto.h"
#include "letra.h"
#include "palavra.h"
#include "tabuleiro.h"
#include "jogador.h"
Jogador::Jogador() {
this->nome = "a";
this->idade = 0;
this->pontos = 0;
}
Jogador::~Jogador() {
}
Jogador::Jogador(string nomeP, int idadeP, int pontosP) {
this->nome =... | true |
48b0c63842728a8855b9b0bbea68ba5ddac34488 | C++ | watashi/AlgoSolution | /leetcode/weekly-261/2027.cpp | UTF-8 | 233 | 2.875 | 3 | [] | no_license | class Solution {
public:
int minimumMoves(string s) {
int x = 0, y = 0;
for (char c : s) {
if (c != 'O') {
if (x <= 0) {
x = 3;
++y;
}
}
--x;
}
return y;
}
};
| true |
079d0be2613044d7bda9467a72207fc55689e52f | C++ | ultrablox/ultra_planner | /src/core/bit_container.cpp | UTF-8 | 3,644 | 2.5625 | 3 | [] | no_license |
#include "bit_container.h"
#include "UError.h"
//#include <vld.h>
//#include <intrin.h>
#include <type_traits>
#include <assert.h>
//========================Bitset==========================
bit_vector::bit_vector(const std::initializer_list<bool> & _value)
{
resize(_value.size());
size_t i = 0;
for (auto _bit : _... | true |
df7d542ad41fd199f98dcb98810eed698c7d314f | C++ | mfkiwl/HDRView | /src/MultiGraph.h | UTF-8 | 3,150 | 2.578125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | //
// Copyright (C) Wojciech Jarosz <wjarosz@gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE.txt file.
//
#pragma once
#include <nanogui/widget.h>
using namespace nanogui;
/**
* \class MultiGraph multigraph.h
*
* \brief A generali... | true |
9473f39c961edecbf6e3c58ea433baf40f61ebe6 | C++ | jpollock0010/TheGameCostCalculator | /Game Cost Calculator/Game Cost Calculator.cpp | UTF-8 | 12,344 | 3.1875 | 3 | [] | no_license | /*Game Cost Calculator
Author: Jamie Pollock
Date: 7/8/2016 3:51 PM Eastern Time
Edited: 7/9/2016 8:11 AM Eastern Time
Edited 2: 7/29/2016 11:05 AM Eastern Time*/
#include <iomanip> // Allows the output of monetary values to contain only TWO (2) decimal points.
#include <istream>
#include <string>
#include <... | true |
ef5a20b67607a3be4746ec11d575ead2922ed0f4 | C++ | trinhlehainam/ASO_3rd_year_GameArchitecture | /ProgramStudy/Source/Component/SpriteComponent.cpp | UTF-8 | 3,702 | 2.515625 | 3 | [] | no_license | #include "SpriteComponent.h"
#include <DxLib.h>
#include "../_debug/_DebugConOut.h"
#include "../Math/MathHelper.h"
#include "../Systems/AnimationMng.h"
#include "../GameObject/Entity.h"
#include "TransformComponent.h"
SpriteComponent::SpriteComponent(const std::shared_ptr<Entity>& owner):
IComponent(owner), m_tra... | true |
dbb1440abbb6bf7d8dc5e98e66747e50132d29d3 | C++ | Junotja/httpservertest | /httpservertest/httpservertest/Guard.h | UTF-8 | 1,998 | 3.15625 | 3 | [] | no_license | #ifndef GUARD_H
#define GUARD_H
#include <windows.h>
#include <memory>
#include <vector>
#include "config.h"
namespace GUARD
{
//mutex
class Lock
{
private:
CRITICAL_SECTION _cs;
public:
Lock()
{
InitializeCriticalSection(&_cs);
}
~Lock()
{
DeleteCriticalSection(&_cs);
}
void lock()
{
... | true |
dd54204c747130b9a53051a09b6af7d2d16ec6c0 | C++ | Abraham1314/My_code | /编程程序/C++/text/text2/text2.cpp | UTF-8 | 609 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<cstring>
#define NCE 3
using namespace std ;
void sorenameNo(string p[] , int n) ;
int main(){
int i ;
string name[]={"张三","李四","王麻子"};
string no[]={"1811010001","1811010002","1811010003"};
sorenameNo(name,NCE);
for(i=0;i<NCE;i++)
{
cout << name[i] ;
... | true |
30501a40dc40b8b284e30cf9e411ecc174d953ed | C++ | gwkdgwkd/leetcode | /c_c++/array/differentialarray/面试题1610生存人数.cpp | UTF-8 | 2,043 | 3.625 | 4 | [] | no_license | /*
给定N个人的出生年份和死亡年份,第i个人的出生年份为birth[i],
死亡年份为death[i],实现一个方法以计算生存人数最多的年份。
你可以假设所有人都出生于1900年至2000年(含1900和2000)之间。
如果一个人在某一年的任意时期处于生存状态,那么他应该被纳入那一年的统计中。
例如,生于1908年、死于1909年的人应当被列入1908年和1909年的计数。
如果有多个年份生存人数相同且均为最大值,输出其中最小的年份。
示例:
输入:
birth = {1900, 1901, 1950}
death = {1948, 1951, 2000}
输出: 1901
提示:
0 < birth.length ==... | true |
8d0163aefe4f3337b850ae1777ddb43469b9bebf | C++ | AnirudhaKulkarni-prog/MyPrograms | /BOLT_codechef.cpp | UTF-8 | 491 | 2.71875 | 3 | [] | no_license | #include<iostream>
using namespace std;
double rnd(double x)
{
double val=long(x*100+0.5);
return double(val/100);
}
int main()
{
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long t;
double a,b,c,v;
cin>>t;
while(t--)
{
cin>>a;
cin>>b;
cin>>c;
cin>>v;
... | true |
88d92fc0a922f719ffe5e751cc0ce328816906ce | C++ | NaTaes/Algorithm | /백준/Software_CodingTest/15685번 드래곤 커브.cpp | UTF-8 | 2,260 | 3.5 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
bool Map[101][101];
vector<pair<int, int>> vec; //선분의 (x,y)값을 저장하는 vector
int dx[4] = {-1, 0, 1, 0}; //←, ↑, →, ↓방향일때 시계방향 90도
int dy[4] = {0, 1, 0, -1};
int x, y, d, g;
void Dragon(int gen)
{
int index = vec.size() - 1; //현재 세대의 선분의 크기를 index값에 저장한다.
int di... | true |
cac2bb2c3dcde8cef9edb9d2867a977265ab2895 | C++ | harjotscs/cpp-programmes | /exception at home.cpp | UTF-8 | 258 | 3.015625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Enter two Numbers\n";
cin>>a>>b;
int x=a-b;
try{
if(x!=0)
{
cout<<"Result(a/x)="<<a/x;
}
else {
throw(x);
}
}
catch(int j)
{
cout<<"Exception found "<<x;
}
}
| true |
814035563fb1d96763ffc5f1e7bc822235428d31 | C++ | Lundar/IIAG-Script | /Arbiter.cpp | UTF-8 | 5,595 | 2.78125 | 3 | [] | no_license | #include "Arbiter.h"
#include "Predef.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
Arbiter::Arbiter() {
predef["]"]= new EndList();
predef["["]= new BList();
predef["print"]= new Print();
predef["func"]= new Func();
predef["class"]= new ClassKey(this);
predef... | true |
e5b043ffb32a909b1132661442e481cf4582f41f | C++ | FrankieV/Fondamenti-di-Informatica | /ProvaIntermedia Es.2/main.cpp | WINDOWS-1252 | 1,062 | 3.578125 | 4 | [] | no_license | /* Esercizio 2. Si scriva in C++ un programma che, letta da input una sequenza di naturali terminata dal tappo 0 0
(ZERO ZERO), ed evitando luso degli array, stampi su standard output la stringa TROVATO se nella sequenza
presente almeno un elemento il cui valore pari alla posizione che occupa nella sequenza (si noti ... | true |
56d0b497bfc725d5d24a184f72c553e9fd25b050 | C++ | saibulusu/Data-Structures | /LinkedList/Test.cpp | UTF-8 | 4,299 | 3.75 | 4 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <exception>
#include <gtest/gtest.h>
#include <string>
#include "LinkedList.cpp"
/** Fixture class **/
class LinkedListTest : public ::testing::Test {
protected:
virtual void SetUp() {
list = new LinkedList<int>;
}
virtual void TearDown() {
... | true |
5297ea88298cdc9746f3f75f1fe820940591b7f8 | C++ | lakshaywadhwacse/Leetcode-Solutions | /sriram_asteroidcollision.cpp | UTF-8 | 1,402 | 2.96875 | 3 | [] | no_license | class Solution {
public:
vector<int> asteroidCollision(vector<int>& asteroids) {
stack<int>s;
for(int i=0;i<asteroids.size();i++)
{
//collison condition
if(!s.empty() and s.top()>0 and asteroids[i]<0)
{
bool flag=false;
whil... | true |
8fc80822bc5e74829642fffd247f39c14ab33a8d | C++ | Tanisha03-cyber/C_codes | /14_half pyramid using numbers.cpp | UTF-8 | 274 | 2.984375 | 3 | [] | no_license | //half pyramid using numbers
#include<iostream>
using namespace std;
int main()
{
int row,col,i,j;
cout<<"enter number of row and columns";
cin>>row>>col;
for(int i=1;i<=row;i++)
{
for(j=1;j<=i;j++)
{
cout<<i;
}
cout<<"\n";
}
return 0;
}
| true |
1012f3c91f74eb5c22a5d4f65832391376a42d41 | C++ | 13besebali/APAssignment1 | /CP_RefCount/Source.cpp | UTF-8 | 925 | 3.84375 | 4 | [] | no_license |
#include "StringBuffer.h"
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
//create a smart string with const char*
char* hello = "hello";
StringBuffer* object = new StringBuffer("Testing", 7);
StringBuffer* object2 = new StringBuffer();
*object2 ... | true |
f475c280712a2bce842bd9b7d15a6068449bc5f7 | C++ | abhay123lp/online-image-clustering-project | /kmedroid/src/distance_matrix.cc | UTF-8 | 1,059 | 2.9375 | 3 | [] | no_license | // HERC 2012
// zhangf@email.sc.edu
#include <cassert>
#include <utility>
#include <iostream>
#include "distance_matrix.h"
namespace kmedroid {
using std::make_pair;
using std::cerr;
using std::endl;
float DistanceMatrix::Get(int x, int y) const {
// Always set the point with smaller number in the front of the p... | true |
05fd21d8ad49d82e891c41f75a3203506792a2e9 | C++ | adam4321/CS-162_Programming_2 | /Lab3- loaded dice game/LoadedDie.cpp | UTF-8 | 1,486 | 3.171875 | 3 | [] | no_license | /*********************************************************************
** Program name: War Game
** Author: Adam Wright
** Date: 4/17/2019
** Description: Derived class of Die that implements the Loaded Die
*********************************************************************/
#include "LoadedDi... | true |
ef547d4f593803bd8beb6be63ce02cbc12a66ebc | C++ | daniel-m-campos/grid-mapper | /test/test_grid_mapper.cpp | UTF-8 | 2,295 | 2.71875 | 3 | [] | no_license | #include <cmath>
#include <fstream>
#include "grid_mapper.h"
#include "grid_mapper_io.h"
#include "gtest/gtest.h"
using namespace grid_mapper;
using namespace grid_mapper_io;
class MapperFixture : public ::testing::Test {
public:
static constexpr double range_max = 5000, range_min = 170;
static constexpr double... | true |
199cea1dede7c1397430bbee780c14459e370ff2 | C++ | yongjianmu/leetcode | /TEMP/getCallID/sol2.cpp | UTF-8 | 3,621 | 2.78125 | 3 | [] | no_license | #include "../../second/include/header.h"
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
static int gCnt = 0;
vector<int> get_ids()
{
vector<int> ret(10, 0);
for(int i = 0; i < 10; ++i)
{
ret[i] = gCnt++;
}
usleep(3000);
return ret;
}
class Solution
{
private:
stat... | true |
dacec1b39d35c4b9d2e4ace82acc9a46bf5b003a | C++ | cocealx/Code_cpp | /容器适配器实现栈和队列/容器适配器实现栈和队列/Seqlist.h | GB18030 | 1,552 | 3.578125 | 4 | [] | no_license | #pragma
#include<iostream>
#include<assert.h>
using namespace std;
template<class T>
struct ListNode
{
ListNode(const T x = 0) :data (x), next( NULL), prev ( NULL){}
T data;
ListNode<T>*next;
ListNode<T>*prev;
};
template<class T>
class Seqlist
{
public:
typedef ListNode<T> Node;
Seqlist();
~Seqlist();
void... | true |
b306eaf97a7d8fee1e50190243d6092881d8356d | C++ | luningcowboy/DesignPatternTest | /DesignPattern/Composite.cpp | UTF-8 | 598 | 2.828125 | 3 | [] | no_license | #include "Com.h"
#include "Composite.h"
Composite::Composite()
{}
Composite::~Composite()
{}
void Composite::Operation()
{
vector<Com*>::iterator comIter = comVec.begin();
for (; comIter != comVec.end();comIter++)
{
(*comIter)->Operation();
}
}
void Composite::Add(Com * com)
{
comVec.push_back(com);
}
void Co... | true |
7f491b32183db05d25ef752b4282412370de8afb | C++ | Dugy/memory_mapped_file | /memory_mapped_file_base.cpp | UTF-8 | 1,275 | 2.84375 | 3 | [
"MIT"
] | permissive | #include "memory_mapped_file_base.hpp"
MemoryMappedFileBase::MemoryMappedFileBase(const std::string &fileName) :
modified_(false),
fileName_(fileName),
loadedUntil_(0),
fileSize_(-1)
{
}
MemoryMappedFileBase::~MemoryMappedFileBase()
{
}
const std::string &MemoryMappedFileBase::fileName() const
{
return fileName... | true |
36461e7a60eca556941d40ea311db4367e776d6a | C++ | dianestar/CSP | /hw8-1/number.cc | UTF-8 | 274 | 2.609375 | 3 | [] | no_license | #include "number.h"
void Number::setNumber(int num){
_num=num;
}
int Number::getNumber(){
return _num;
}
int Square::getSquare(){
int square_num=_num*_num;
return square_num;
}
int Cube::getCube(){
int cube_num=_num*_num*_num;
return cube_num;
}
| true |
71890cf15f35d156c9e0dd2679907a61538d3433 | C++ | wuQAQ/Algorithms | /NowCoder_2017/P01_TheChoir_DP/main.cpp | UTF-8 | 1,013 | 2.8125 | 3 | [] | no_license | #include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define MAXN 50
const long long minn = -1e17;
struct DP {
long long mins;
long long maxs;
}dp[MAXN][10];
void GetMaxValue(int a[], int n, int k, int d);
int main()
{
int n;
int a[MAXN];
int k, d;
cin >> n;
for (int i = 0; i <... | true |
1bfebbf4b382bdfc97d0386777035b652b374de1 | C++ | ssnyder2525/Educational | /C/CS 235 Lab 6/Lab6/Tree.h | UTF-8 | 12,723 | 3.453125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
#include <queue>
using namespace std;
template <typename ItemType>
class Tree {
private:
struct Node
{ //struct simply makes everything public.
ItemType item;
Node* left = NULL;
Node* right = NULL;
Node* parent = NULL;
int height = 0;
};
public... | true |
447ba70338a64373952055ec324169217396b226 | C++ | huangshen/Leet | /src/SumOfTwoIntegers.cpp | UTF-8 | 306 | 2.921875 | 3 | [] | no_license | #include "SumOfTwoIntegers.h"
Solution::Solution() {
}
Solution::~Solution() {
}
int Solution::getSum(int a, int b) {
//return a+b;
int tmp_or, tmp_and;
do {
tmp_or = a ^ b;
tmp_and = a & b;
a = tmp_or;
b = tmp_and << 1;
} while(tmp_and);
return tmp_or;
}
| true |
726e0be2a86c8ec0f4b9f222eae71cba1e3e0888 | C++ | ybouret/yocto4 | /src/mk/yocto/math/stat/recursive-sum.hpp | UTF-8 | 2,293 | 2.625 | 3 | [] | no_license | #ifndef YOCTO_RECURSIVE_SUM_INCLUDED
#define YOCTO_RECURSIVE_SUM_INCLUDED 1
#include "yocto/sequence/vector.hpp"
#include "yocto/sequence/list.hpp"
#include "yocto/math/math.hpp"
namespace yocto
{
namespace math {
namespace kernel
{
//! recursive sum subroutine
/**
T must accept T temp=0;' ... | true |
53873af3e77dd0d26a18c247a1fb50dec8f4fefc | C++ | solanik/testowe | /heapsort.h | UTF-8 | 458 | 2.671875 | 3 | [] | no_license | //
// Created by filwo on 03.10.2018.
//
#pragma once
#include "SortingFactory.h"
class HeapSort : public RegisteredInFactory<HeapSort>
{
public:
static std::string getAlgorithmName();
static void sort(std::vector<unsigned>& values);
private:
HeapSort()
{
(void)RegisteredInFactory<HeapSort>::... | true |
cd9caca262144786b684829b183f72a69052837f | C++ | edonyzpc/PLC | /pat/pairprime.cc | UTF-8 | 1,970 | 2.703125 | 3 | [] | no_license | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
... | true |
12b862c2e9134f3860ceb66c9c5d8fc0a701a396 | C++ | Dakshi1/dp-problems | /Dynamic Programming/max_path/main.cpp | UTF-8 | 1,096 | 2.96875 | 3 | [] | no_license | // You can do it bro
#include<bits/stdc++.h>
using namespace std;
int max(int x, int y, int z)
{
return max(max(x, y), z);
}
int max_cost(int n, int cost[][20])
{
int helper[n+1][n+2];
for(int i=0;i<n+1;i++)
{
helper[i][n+1]=0;
}
for(int i=0;i<=n;i++)
{
for(int j=0;j<=n;j++)... | true |
dcf23cbcafd2a27d2755d8e1db9b3b1cca3d956b | C++ | DrKend/Week-1-Introduction | /Program21_SmallestElement/Program21_SmallestElement/Program21_SmallestElement.cpp | UTF-8 | 615 | 3.90625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int numberList[10];
int numberChoice;
for (int i = 0; i < 10; i++)
{
cout << "Enter a number" << endl;
cin >> numberChoice;
numberList[i] = numberChoice;
}
int min = numberList[0];
int post = 1;
for (int i ... | true |
67adceee4200bff6f6bd7974266ab9e25650c450 | C++ | AlbertMakesGames/UPC_SCHOOL_TEST | /zork-master/world.cpp | UTF-8 | 5,513 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include "globals.h"
#include "entity.h"
#include "creature.h"
#include "item.h"
#include "exit.h"
#include "room.h"
#include "player.h"
#include "world.h"
// ----------------------------------------------------
World::World()
{
tick_timer = clock();
// Rooms ----
Room* forest = new Room("Fores... | true |
659bf0dd48f825591f4baf4bb9fc39bdd6b083a2 | C++ | signhuwei/node-jvt | /includes/win/ia32/API/GESS/PeerSDK_IPAddress.h | UTF-8 | 1,464 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#ifndef PEERSDK_PROTECT
#pragma message("please include PeerSDK.h instead of me")
#endif
/**
* @brief Provides an Internet Protocol (IP) address.
*/
class PEERSDK_API IPAddress
{
PEERSDK_DECLARE_IMPL()
public:
/** @name Constructors
*/
//@{
/**
* @private
*/
IPAddress();... | true |
8c0566056fd118dfdc0dbf6da912a251bd4cbc51 | C++ | Garanyan/made | /advanced-algorithms/HW8/HW8_task_A.cpp | UTF-8 | 6,379 | 3.203125 | 3 | [] | no_license | //
// A. Просто поток
// ограничение по времени на тест 5 секунд
// ограничение по памяти на тест 1024 мегабайта
// ввод стандартный ввод
// вывод стандартный вывод
//
// Дана система из узлов и труб, по которым может течь вода.
// Для каждой трубы известна наибольшая скорость,... | true |
0f4a813e2b2ab6a0a4c997997172bab39ec15c20 | C++ | Graphics-Physics-Libraries/Tiny3D | /Win32Project1/shader/shadermanager.cpp | UTF-8 | 910 | 2.9375 | 3 | [] | no_license | #include "shadermanager.h"
using namespace std;
ShaderManager::ShaderManager() {}
ShaderManager::~ShaderManager() {
map<string,Shader*>::iterator itor;
for(itor=shaders.begin();itor!=shaders.end();itor++)
delete itor->second;
shaders.clear();
}
Shader* ShaderManager::addShader(const char* name,const... | true |
645b86029f7ca33d91e81e5fd988db394a755f42 | C++ | rcamejo01/data-structures-class | /VecExpense/expense.h | UTF-8 | 2,080 | 3.3125 | 3 | [] | no_license | #ifndef EXPENSE_H_
#define EXPENSE_H_
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
// const array to remember days of month (not doing leap year)
// start with 0 so months start at 1
const int mday[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
// expense class
clas... | true |
9785a0e15a96ccfbc6a23a52f2be15d3319864e0 | C++ | readex-eu/readex-apps | /production_apps/BEM4I/WavePreconditioner.cpp | UTF-8 | 15,768 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | /*!
* @file WavePreconditioner.cpp
* @author Michal Merta
* @date March 14, 2014
*
*/
#ifdef WAVEPRECONDITIONER_H
namespace bem4i {
template<class LO, class SC>
WavePreconditioner<LO, SC>::WavePreconditioner( ) {
this->sysMatrix = nullptr;
this->preconditioner = nullptr;
this->sysMatrixMPI = null... | true |