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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ebcf1636c0931043f35eb7dfc3e04fa22e213ea8 | C++ | Saqib-Sizan-Khan/Data_Structure | /Stack/Postfix Expression.cpp | UTF-8 | 2,091 | 3.625 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
string ConvertPostfix(string exp);
bool IsOperator(char c);
bool IsOperand(char c);
int Priority(char op1,char op2);
int GetWeight(char op);
int IsRightAssociative(char op);
int main()
{
string exp;
cout<<"Enter an Infix Expression:"<<endl;
getline(cin,exp);
... | true |
403ebb359177a62a9e903ed3e5ff91715b643b94 | C++ | TobyNartowski/AllegroEngine | /src/Drawer.cpp | UTF-8 | 6,879 | 2.953125 | 3 | [] | no_license | #include "Drawer.hpp"
#include "Logger.hpp"
#include <allegro5/allegro_primitives.h>
#include <cmath>
Drawer::Drawer(ALLEGRO_DISPLAY *display, int width, int height) {
this->width = width;
this->height = height;
this->display = display;
background = al_load_bitmap(BACKGROUND_PATH);
if (!background) {
Logger::... | true |
8140b7662cf0ebc148063fb35d712f1d4c8dffc3 | C++ | cibercitizen1/zmqHelper | /examples/01-REQ-REP/clientREQ.cpp | UTF-8 | 1,197 | 2.671875 | 3 | [
"MIT"
] | permissive |
// -----------------------------------------------------------------
// clientREQ.cpp
// -----------------------------------------------------------------
#include <zmq.hpp>
#include <string>
#include <iostream>
#include "../../zmqHelper.hpp"
// -----------------------------------------------------------------
// -... | true |
ae8c8b73b4496f0d7606ef8e75aedee1d7f44f33 | C++ | patsko-loo/Snake | /Header Files/cell.h | UTF-8 | 302 | 2.640625 | 3 | [] | no_license | #ifndef _CELL_H_
#define _CELL_H_
#include "info.h" //info.h contains Row and Col of a cell, pluss the enum statetype: {Snake,empty,food}
class Cell {
private:
Info info;
public:
Cell(Info temp);
Info getInfo();
void setInfo(Info s);
};
#endif | true |
2b6bbd6810852581dcb1af6cba3f0e28118b397c | C++ | jlubea/propelize | /src/propelize/algorithms/gpu/dilation.cpp | UTF-8 | 3,366 | 2.5625 | 3 | [] | no_license | #include "propelize/algorithms/gpu/dilation.h"
#include "propelize/algorithms/color_channels.h"
#include "substasics/platform/exceptions.h"
namespace cn = concurrency;
namespace sp = substasics::platform;
namespace propelize { namespace algorithms { namespace gpu {
void Dilation::operator()(concurrency::array<uint3... | true |
540e2197bf6013ebeb3058e347c709927da88bfc | C++ | JanneRemes/janityengine | /JanneRemesEngine/Libraries/JanityMath/Source/Point.cpp | UTF-8 | 2,090 | 3.4375 | 3 | [] | no_license | #include <JanityMath\Point.h>
#include <JanityMath\MathUtils.h>
using namespace JanityMath;
Point::Point() : x(0), y(0){}
Point::Point(float X, float Y) : x(X), y(Y){}
Point::~Point(){}
Point::Point(const Point& other) : x(other.x), y(other.y){}
// Public
Point Point::maximum(const Point& point) const
{
const int _... | true |
4282542728bed57d6ceae8d55f198ead243581ac | C++ | Sayaten/StudyCPP | /DesignPattern/CommandPattern/CPStereo.cpp | UTF-8 | 587 | 2.9375 | 3 | [] | no_license | #include "CPStereo.hpp"
#include <iostream>
#include <string>
using namespace std;
Stereo::Stereo(string place)
{
vol = 0;
this -> place = place;
}
void Stereo::on()
{
cout << place << " Stereo On" << endl;
}
void Stereo::off()
{
cout << place << " Stereo Off" << endl;
}
void Stereo::setCD()
{
cout << place <... | true |
81895a3d2639b285bc628b4e9bc11a92c8e60c15 | C++ | TrevorNewell/RayTracer | /MyVectorClass/Vector/Point/Point.h | UTF-8 | 806 | 2.875 | 3 | [] | no_license | // Point.h
// Author: Trevor Newell
// 11/6/2016
#pragma once
#ifndef stdio_h_Included
#define stdio_h_Included
#include <stdio.h>
#endif // !stdio.h_Included
#ifndef tchar_h_Included
#define tchar_h_Included
#include <tchar.h>
#endif // !tchar.h_Included
#ifndef iostream_Included
#define iostream_Included
#include... | true |
1ef7639d7e06d3216fd53cf5da231f4ea9e0f063 | C++ | mady4ever/Preparation | /revision/questions/huffman-coding.cpp | UTF-8 | 2,914 | 3.515625 | 4 | [] | no_license | /*
https://www.geeksforgeeks.org/huffman-coding-greedy-algo-3/
use max heap to get the elements with there frquency.
create max heap with frequency and elements.
while heap is not empty insert root/top node to the binary tree.
now travers the tree and create huffman code.
*/
#include<bits/stdc++.h>
using name... | true |
d00b474c04033c82c285bdc074de56067312f35d | C++ | USArmyResearchLab/Fusion3D | /include/Fusion3D/osus_image_store_class.h | UTF-8 | 917 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef _osus_image_store_class_h_
#define _osus_image_store_class_h_
#ifdef __cplusplus
/**
Provides storage for images that are defined in screen coordinates (always staying same size regardless of zoom).
Images are created and stored internally. They can then be retrieved by image index.
*/
clas... | true |
72136c8c9c91a2ce7995c92ef781d1be1b04306d | C++ | kanha95/SPOJ-solutions | /IITKWPCB.cpp | UTF-8 | 322 | 2.609375 | 3 | [] | no_license | #include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
int main()
{
long long t;
cin>>t;
while(t--)
{
long long n;
cin>>n;
if(n==1)
cout<<"0"<<endl;
else
{
long long i;
for(i=n/2;i>=1;i--)
{
if(__gcd(n,i)==1)
break;
}
cout<<i<<endl;
}
}
}... | true |
520e679005511cf1fa32fdde3244a8f0f375ad92 | C++ | cshung/Competition | /Competition/LEET_GOAT_LATIN.cpp | UTF-8 | 2,100 | 3.203125 | 3 | [] | no_license | #include "stdafx.h"
// https://leetcode.com/problems/goat-latin/
#include "LEET_GOAT_LATIN.h"
#include <map>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
using namespace std;
namespace _LEET_GOAT_LATIN
{
class Solution
{
public:
string toGoatLatin(string S)
... | true |
a2f9231eca46053338c2d9aad302bdb8b7dfe08c | C++ | KORYUOH/koryuohproject-svn-server | /2013TGS07班/TGS_Team7_Projects_Ver1.17/TGS_Team7_Projects/Souse/Managers/Food.h | SHIFT_JIS | 2,672 | 2.9375 | 3 | [] | no_license | /******************************************************************************
* File Name : FoodManager.h Ver : 1.00 Date : 2013-05-13
*
* Description :
*
* HǗ҃NXD
*
******************************************************************************/
#ifndef _FOOD_MANAGER_H_
#define _FOOD_... | true |
10605862ed0404f14c89039f031734a27b9b39ee | C++ | nvladimus/ArduinoRotaryEncoderPCB | /examples/RotaryEncoder_PushButton/RotaryEncoder_PushButton.ino | UTF-8 | 1,001 | 2.78125 | 3 | [
"MIT"
] | permissive | #include <Encoder.h> //encoder library https://www.pjrc.com/teensy/td_libs_Encoder.html
// Change these two numbers to the pins connected to your encoder.
// Best Performance: both pins have interrupt capability
// Good Performance: only the first pin has interrupt capability
// Low Performance: neither pin has... | true |
335df224eccecb15dc007d82bc21c63c395e3996 | C++ | wbpcode/simplecache | /scache/cache-base.h | UTF-8 | 1,061 | 2.953125 | 3 | [] | no_license | #pragma once
#include <string>
enum CacheType { DictType, ListType, LongType, StringType };
using int64 = long long;
class CacheBase {
private:
const CacheType m_type;
protected:
CacheBase(CacheType t) :m_type(t) { ; }
virtual ~CacheBase() = default;
public:
CacheType getType();
friend void de... | true |
bd4355e6f2327c72149efd7d19fb867fb35681ab | C++ | greenfox-zerda-sparta/nagyzsuska | /week6/Day-1/09/MyStack.h | UTF-8 | 366 | 3 | 3 | [] | no_license | #ifndef MYSTACK_H_
#define MYSTACK_H_
#include <string>
const int m_index = 5;
class MyStack {
private:
int m_top = -1;
int m_stack[m_index];
public:
MyStack();
~MyStack();
enum MyErrorMessages {
STACK_IS_FULL,
STACK_IS_EMPTY
};
void Push(int x);
void Pop();
std::string interpretException(M... | true |
e24e495a0a4b13fa44b4a387f4bf8c4d0e10747b | C++ | ljordan51/odysseus | /ZeroingTest/ZeroingTest.ino | UTF-8 | 3,747 | 2.546875 | 3 | [] | no_license | #include <EEPROM.h>
#include "FlexyStepper.h"
//
// pin assignments
//
const int LED_PIN = 13;
const int MOTOR_X_STEP = 2;
const int MOTOR_Y_STEP = 3;
const int MOTOR_Z_STEP = 4;
const int MOTOR_X_DIR = 5;
const int MOTOR_Y_DIR = 6;
const int MOTOR_Z_DIR = 7;
const int STEPPERS_ENABLE = 8;
const int LIMIT_SWITCH_X = ... | true |
c45dad018a52e7755bc72fe08a2f5d3ce6d0a64c | C++ | EliseyDev/CPP-Primer-Plus-Exercises | /stephen_prata/chapter_05/programming_exercises/hw2.cpp | UTF-8 | 402 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <array>
const int ARRAY_SIZE = 101;
int main() {
std::array<long double, ARRAY_SIZE> factorials{};
factorials[0] = factorials[1] = 1;
for (int i = 2; i < ARRAY_SIZE; i++) {
factorials[i] = factorials[i - 1] * i;
}
for (int j = 0; j < ARRAY_SIZE; j++) {
... | true |
20cda8df159f42ea19f2cc085096598bf2952de2 | C++ | omarzandona/omar_code | /2.3.12.0b/src/imgserver.cpp | IBM852 | 77,980 | 2.671875 | 3 | [] | no_license | /*!
\file imgserver.cpp
\brief Sorgente principale dell'imgserver: contiene le inizializzazioni di variabili,
la creazione dei thread ed, infine, il ciclo in cui il server resta in ascolto del client.
Si tratta del file principale del progetto dove risiede il main all'interno del quale viene fatto quanto segue... | true |
e1d9d617bdf8b18a51842aef4a865490c349ea47 | C++ | mitchellharvey/cryptopals | /challenge3.cpp | UTF-8 | 907 | 2.96875 | 3 | [] | no_license | #include "Utils.h"
#include <iostream>
int main(int argc, char** argv) {
std::string encoded_string = "1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736";
std::string bytes = hex::decode(encoded_string);
std::cout << "Attempt to decode: " << encoded_string << std::endl;
std::str... | true |
a31caa98db648d934c5268659e62ea1d77cb490b | C++ | lordnynex/CLEANUP | /FORKS/C/L.A.S.E.R.-TAG-GRL/tree/libs/ofAddons/computerVision/ofCvColorImage.h | UTF-8 | 1,122 | 2.6875 | 3 | [
"WTFPL",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | #ifndef _CV_COLOR_IMAGE_H
#define _CV_COLOR_IMAGE_H
//----------------
#include "ofMain.h"
#include "ofCvConstants.h"
//------------------------------------
class ofCvColorImage {
public:
ofCvColorImage();
void allocate(int _w, int _h);
void clear();
void setFromPixels(unsigned char * ... | true |
3ec62cc59a356ba205917b5a75a171ed22a985e4 | C++ | ANetCode/Netcode | /ext/netcode/network/message.cpp | UTF-8 | 1,353 | 2.828125 | 3 | [] | no_license | #include "message.h"
message::message(lua_State* L) {
this->L = L;
m_udata = nullptr;
reset();
}
bool message::parse(buffer& buffer) {
if (m_ready == true)
return true;
if(m_message_start == false) {
m_message_start = true;
const uint8_t* raw_data = buffer.r_data();
... | true |
bc1cf6d3b93f06401cf1cb7a67f5e855a893194c | C++ | Jazzcharles/ACM-ICPC-Code | /shuoj/1664/main.cpp | UTF-8 | 248 | 2.53125 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int n,i,j,a[100];
char ch;
while(scanf("%d",&n)!=EOF)
{
ch=getchar();
for(i=0;n!=0;i++)
{
a[i]=n%3;
n=n/3;
}
for(j=i-1;j>=0;j--)
putchar(a[j]+'0');
printf("\n");
}
return 0;
}
| true |
ecd17869a82cb29b841b942d1d823e64c5932b74 | C++ | ksychla/DiscreteKnapsackProblem | /DiscreteKnapsackProblem/main.cpp | UTF-8 | 2,039 | 2.875 | 3 | [] | no_license | //
// main.cpp
// DiscreteKnapsackProblem
//
// Created by Krzysztof Sychla on 17.05.2018.
// Copyright © 2018 Krzysztof Sychla. All rights reserved.
//
#include <iostream>
#include "BackPack.hpp"
#include <fstream>
#include "Timer.hpp"
int main(int argc, const char * argv[]) {
int C;
int n;
std:... | true |
e566ab24a15e9d9b910213ffcd99a884147137c2 | C++ | kusan-thana/PLT | /src/common/engine.cpp | UTF-8 | 2,980 | 2.625 | 3 | [] | no_license | #include "engine.hpp"
#include <iostream>
using namespace engine;
Engine::Engine(state::LevelState& levelState) : levelState(levelState), actions(levelState), engineMode(PLAY) {
commandSet = new engine::CommandSet();
commandSet2 = new engine::CommandSet();
}
Engine::~Engine() {
free(commandSet);
free(command... | true |
bafd593d296ecac582bce9f7975d2101f1d50eff | C++ | avaz1301/schoolProjects | /Advanced OOP in C++/InvertedIndex/Invertedindex.cpp | UTF-8 | 2,239 | 3.28125 | 3 | [] | no_license | //Angelo Zamudio CS381 Summer 16'
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
using namespace std;
class InvertedIndex {
private:
map<string, pair<int, vector<int>>> wordIndex;
public:
InvertedIndex() { };
~InvertedIndex(){};
bool alreadyIndexed(string... | true |
fc00aa7e5cfba0e04ab3a1c8f69ab24de7bb8116 | C++ | Yiwen-Gao/final-project | /src/network/resps.cpp | UTF-8 | 1,800 | 2.734375 | 3 | [] | no_license | #include "conn.h"
using namespace std;
const string CONTENT_OP = "Content-Length:";
string BaseResp::get_header() {
return "HTTP/1.0 200 OK";
}
string BaseResp::get_body() {
return "";
}
// recv own cert resp
CertResp::CertResp(string cert) {
this->cert = cert;
}
string CertResp::get_body() {
stri... | true |
96b515fb2cfeae3a81652cbd0c37e3f7123dac62 | C++ | rouille/Toolkit | /simuevents.h | UTF-8 | 3,783 | 2.875 | 3 | [] | no_license | #ifndef _SIMUEVENTS_H
#define _SIMUEVENTS_H
#include <vector>
#include "events.h"
#include "healpixmap.h"
#include "TRandom2.h"
using namespace std;
/*! \file simuevents.h
This file contains the codes we developped for simulating events. The procedure is described in GAP2005-083.
We simulate the events accor... | true |
619da65c7a0afdf6131df09dbc9b805312840ce8 | C++ | HyunHub/Learning-Algorithm | /practice60/practice65.cpp | UHC | 705 | 2.84375 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
// ̷ Ž(DFS)
int map[8][8];
int ch[8][8];
// ð
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
int n, i, j, cnt;
void DFS(int x, int y) {
int i, xx, yy; // ǥ
if(x==7&& y==7){
cnt++;
}
else {
for(i=0; i<4; i++) {
... | true |
98245df0758a0867ca2cef7ff9b3d36ae9c74b50 | C++ | Chigric/Mag_2_course_1_Lab | /lab3/lab3.cpp | UTF-8 | 2,743 | 2.796875 | 3 | [] | no_license | #include <cassert>
#include <map>
#include <functional>
#include <numeric>
#include "lab3.h"
#include "Output.hpp"
namespace SundayWork {
// Solving coefficients for solution Volterra integral equation
Vector coefsForVolterraIntegralEquation(ECubatureRules cubatureRule, std::size_t amountPoints)
{
Vector coefs(0... | true |
609e574f66cd855cf7cfb3e62bfa13935a8ec8ca | C++ | xavierfebrer/sample1_fire_shaders | /sample1_fire_shaders/sample1_fire_shaders/core/include/Animation.h | UTF-8 | 734 | 2.78125 | 3 | [] | no_license | #pragma once
#include "Util.h"
#include "AnimationStep.h"
class Animation {
private:
double deltaTimeLeft;
int initialLoopsLeft;
int loopsLeft;
int currentStepIndex;
std::vector<std::unique_ptr<AnimationStep>> steps;
public:
Animation(std::vector<std::unique_ptr<AnimationStep>> steps, int loopTimes = -1);
... | true |
60c0369f93e8c6a1a50eee30d6d8c395ad29c883 | C++ | cumtmiao/Algrithm | /leecode/Tree/Flatten_Binary_Tree_to_Linked_List.cpp | UTF-8 | 1,695 | 3.75 | 4 | [] | no_license | /*
Given a binary tree, flatten it to a linked list in-place.
For example, given the following tree:
1
/ \
2 5
/ \ \
3 4 6
The flattened tree should look like:
1
\
2
\
3
\
4
\
5
\
6
*/
#include<bits/stdc++.h>
using namespace std;
struct TreeNo... | true |
f6ceb2cc671997bf69ed4c463b4861a938e58c52 | C++ | danakreimer/ProblemSolver | /FileCacheManager.h | UTF-8 | 3,278 | 3.3125 | 3 | [] | no_license | //
// Created by duni on 12/01/2020.
//
#ifndef PROBLEMSOLVER_FILECHACHEMANAGER_H
#define PROBLEMSOLVER_FILECHACHEMANAGER_H
#include <fstream>
#include <mutex>
#include "CacheManager.h"
using namespace std;
template<class Problem>
class FileCacheManager : public CacheManager<Problem, string> {
private:
std::mut... | true |
83931e7b08074ffce774613f673ae392dcf411e4 | C++ | theomission/layerlab | /src/fourier.cpp | UTF-8 | 17,027 | 2.6875 | 3 | [
"BSD-2-Clause"
] | permissive | /*
fourier.cpp -- Functions for sampling and evaluating Fourier series
Copyright (c) 2015 Wenzel Jakob <wenzel@inf.ethz.ch>
All rights reserved. Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.
*/
#include <layer/fourier.h>
#include <layer/simd.h>
NAM... | true |
74472dd3e694bdf0b795a243abfa917c9eedc0ba | C++ | WZH-moyu/wuzhihu | /10-20/10-20/test.cpp | UTF-8 | 2,147 | 3.078125 | 3 | [] | no_license | #include<iostream>
#include<stdlib.h>
using namespace std;
//int Add(int a, int b)
//{
// return a + b;
//}
//double Add(double a, int b)
//{
// return a + b;
//}
//int main()
//{
// Add(1, 2);
// Add(1.0, 2);
// Add(2.0, 3.0);
// system("pause");
// return 0;
//}
//class Base
//{
//public:
// virtual void Funtest1(int... | true |
2d4a768816047b64ae4ab615222fbe424e1df4a9 | C++ | karunvarma/Pakfood-Internationals---OOP-Case-Study | /TransportT4.h | UTF-8 | 1,509 | 3.296875 | 3 | [] | no_license | /** Transport class
*
* #include "TransportT4.h" <BR>
* -llib
*
*/
#ifndef TRANSPORT_H
#define TRANSPORT_H
// SYSTEM INCLUDES
#include<iostream>
using std::string;
// Transport class definition
class Transport {
public:
// LIFECYCLE
/** Default + Overloaded constructor.
*/
Transport(float = ... | true |
5a687f1d6abfda6cc2599fb5f262af13927ef7b1 | C++ | OKriw/Seminar3 | /Task.h | UTF-8 | 980 | 2.734375 | 3 | [] | no_license | //
// Created by Olga on 16/09/2020.
//
#ifndef TTIMER_TASK_H
#define TTIMER_TASK_H
#include "Timer.h"
enum states {
stopped, //initial state
running,
deleted //when we want to delete from the storage
};
class Task {
private:
class Timer *timer;
bool isValid(states new_state);
/*states for... | true |
93eea6ebcf922c09869d7dc5feef5864d905a70e | C++ | fedepiz/osdev | /src/heap.cpp | UTF-8 | 4,136 | 3.109375 | 3 | [] | no_license | #include <heap.h>
#include <system.h>
void Heap::insert_block(unsigned char* ptr,unsigned long total_size) {
unsigned long payload_size = total_size - sizeof(heap_block_tag) - sizeof(heap_block_footer);
heap_block_tag head = { payload_size, 0xacab, false };
heap_block_footer footer = { (heap_block_tag*)ptr };
memc... | true |
11f5ed65a7241aa623e24b10ad3c9ec020e720f9 | C++ | chrisdyck/COMP1045 | /Lab007L3/Lab007L3.ino | UTF-8 | 743 | 3.234375 | 3 | [] | no_license | /*
Name: Lab007L3.ino
Created: 6/6/2018 5:12:06 PM
Author: chris
*/
int RGBGreenPin = 10; //The green RGB LED is connected pin 10 of the Arduino.
int rotationPin = A0;
int data = 0;
void setup() {
Serial.begin(9600); //This will enable the Arduino to send data to the Serial monitor.
}
// the loop function runs ove... | true |
5802703df4b33d775cc981d43a2d4c98f6d1f6ec | C++ | Diusrex/UVA-Solutions | /11900 Boiled Eggs.cpp | UTF-8 | 664 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
using namespace std;
// [egg][weightAfter] -> best number to be added
// Includes this egg
int main()
{
int T;
cin >> T;
for (int t = 1; t <= T; ++t)
{
int N, P, Q;
cin >> N >> P >> Q;
int sum = 0, numUsed = 0;
int i, weight;
... | true |
671733e4d6975b7bc401429f9d51a1b6f80a3eaa | C++ | phenixcxz/CppLearning | /practice/day2/递归阶乘.cpp | UTF-8 | 448 | 2.875 | 3 | [] | no_license | /*************************************************************************
> File Name: 递归阶乘.cpp
> Author: cxz
> Mail: phenixcxz@163.com
> Created Time: 三 6/17 19:33:29 2020
************************************************************************/
#include<iostream>
using namespace std;
int f(int x){
if(x == ... | true |
0e1f126916e3174ec371a18720f48a6154bfd5b9 | C++ | Mia-Cross/modules_cpp | /cpp06/ex02/main.cpp | UTF-8 | 1,668 | 2.90625 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | true |
b9dfcb7cc4242af1662e4a57e8a69f76dc004b4a | C++ | lzbxh/CPP_GOF | /设计模式/设计模式/装饰模式.cpp | UTF-8 | 1,321 | 3.5 | 4 | [] | no_license | //
// 装饰模式.cpp
// 设计模式
//
// Created by 刘智滨 on 16/7/6.
// Copyright © 2016年 刘智滨. All rights reserved.
//
#include <iostream>
//动态的给一个对象添加一些额外的职责。就增加功能来说,此模式比生成子类更为灵活。
using namespace std;
class Car
{
public:
virtual void show() = 0;
};
class RunCar : public Car
{
public:
virtual void show()
{
... | true |
4dc55412a479551ba26ad4bfb552d231b68c3e7d | C++ | vmswift/CS372-Data-Structures | /Overload Throttle/Overload Throttle/throttle.h | UTF-8 | 2,258 | 3.5 | 4 | [] | no_license | //Throttle Overload Class Header
//throttle.h
//CS372 Fall 2014
//By John Knowles jknowle2@my.athens.edu
//Date 9/8/2014
//
//This is a partial clone of the file in the textbook
//I combined the cpp and header file into the header
#include <cassert>
#include <iostream>
class throttle
{
public:
throttl... | true |
05d340b8692ecfb86e4934014a3ac324fe543be5 | C++ | Guillaume227/app_utils | /src/string_utils.cpp | UTF-8 | 10,569 | 2.8125 | 3 | [] | no_license | #include <cstring>
#include <regex>
#include <sstream>
#include <vector>
#include <app_utils/string_utils.hpp>
#include <app_utils/cond_check.hpp>
#include <app_utils/container_utils.hpp>
namespace app_utils {
namespace strutils {
namespace {
std::string const openSymbols = "<({[";
std::string const closeSymbols =... | true |
38bdb739d34b8c75cdcdf497461bd068ec51d406 | C++ | Leprasa/Stroustrup_homeworks | /5/5.9.7.cpp | UTF-8 | 797 | 4.09375 | 4 | [] | no_license | //7.Определите таблицу, содержащую название месяцев и кол-во дней в каждом из них.
//Выведите содержимое таблицы.Воспользуйтесб массивом структур,каждая из которых
//хранит назв. месяца и кол-во дней в нем.
//
#include <iostream>
struct month {
const char *name;
int days;
};
int main()
{
month year[5];
year[0]... | true |
53fdaeaad3e05f554a10a28b78977f5a3a748916 | C++ | MelulekiDube/md_allocator | /include/freelist.h | UTF-8 | 3,310 | 3.234375 | 3 | [] | no_license | #pragma once
#include "memory_blk.h"
#include <stdlib.h>
#include <algorithm> // std::max
#define WORD_SIZE 4
template <class A, size_t s> class FreeList {
A parent_;
struct Node {
Node *next;
} root_;
public:
FreeList(A allocator) : parent_(allocator) { root_ = nullptr; }
static constexpr unsigne... | true |
6fc800b4780f5da68beee122ef0dceae284cc466 | C++ | kaseLunt/CalendarApp | /lunt_reminder.cpp | UTF-8 | 599 | 2.96875 | 3 | [] | no_license | #include "lunt_reminder.h"
// Reminder's method implementations
/************************************************************************/
Reminder::Reminder()
{
}
void Reminder::setText()
{
//prompt for reminder text and save
std::cout << "Enter reminder text: ";
//call getline once to clear the buffer of the... | true |
dff217e83db38f87bd4ab6edae5b543ecf66c1af | C++ | SpintroniK/libeXaDrums | /DrumKit/Triggers/Curves/CurveType.h | UTF-8 | 1,511 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* Curves.h
*
* Created on: 2 Jun 2015
* Author: jeremy
*/
#ifndef LIBEXADRUMS_SOURCE_DRUMKIT_CURVES_CURVE_H_
#define LIBEXADRUMS_SOURCE_DRUMKIT_CURVES_CURVE_H_
#include "../../../Util/Enums.h"
#include <sstream>
#include <string>
#include <type_traits>
namespace DrumKit
{
enum class CurveType
{
L... | true |
d3b98e52073b4286c1e23ba25a9960b5c85dad7f | C++ | Mosaic0412/CPlusPlus | /day02/day02_encapsulationPrivate/day02_encapsulationPrivate/main.cpp | UTF-8 | 1,148 | 3.453125 | 3 | [] | no_license | //
// main.cpp
// day02_encapsulationPrivate
//
// Created by 陈庆华 on 2020/3/15.
// Copyright © 2020 陈庆华. All rights reserved.
//
/*
建议将成员变量设置为private
*/
#include <iostream>
#include <string>
using namespace std;
class Person{
private:
string pName; //可读可写
int pAge = 23; //只读
string pLover; //只写
publ... | true |
55ea62f5c6a655e727758be25b308f0f74550ede | C++ | HemanDas/cpp_project | /Lab_works/Lab_object/Operatoroverloading/complex_op.cpp | UTF-8 | 679 | 3.640625 | 4 | [] | no_license | #include<iostream>
using namespace std;
class complex{
float real=0,imag=0;
public:
void getdata(){
float r,i;
cout<<"enter the real and imaginary part"<<endl;
cin>>r>>i;
real=r;
imag=i;
}
complex operator +(complex a)
... | true |
3cfd74231cc3cfb83cc9711e253ab7e8949dcc1c | C++ | ImanolGo/VideoPixels | /Arduino/SD_VideoPlayer/SD_VideoPlayer.ino | UTF-8 | 4,723 | 2.625 | 3 | [] | no_license | /*
SD Video Player
Description:
* Led video player reading content from SD Card
Hardware:
* Teensy 3.5
* WS2811 5V LED strips
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila, pin 7 on Teensy with audio board
** MISO - pin 12 on Arduino Uno... | true |
b83c08fac337f7658a42853b26d065a278667b89 | C++ | BitBlitObviMormon/Minecraft-Server | /src/data/datatypes.cpp | UTF-8 | 21,369 | 3.3125 | 3 | [] | no_license | #include "debug.h"
#include "data/datatypes.h"
#include "client/client.h"
#include <stdexcept>
#include <iostream>
/******************************************
* CountNumVarLength *
* Reads a variable and counts its length *
******************************************/
Byte CountNumVarLength(con... | true |
7a405c7e5f30e33b8e92d489dd6c014a3ea60907 | C++ | Ixox/NeoPixel-Projects | /NeoLampe/src/LedSpot.h | UTF-8 | 1,198 | 2.828125 | 3 | [] | no_license | /*
Copyright © 2018, Xavier Hosxe
Free license, do what you want with these files
*/
#ifndef LEDSPOT_H
#define LEDSPOT_H
#include <Adafruit_NeoPixel.h>
enum LedAnimation
{
ANIM_0 = 0,
ANIM_1,
ANIM_2,
ANIM_3,
ANIM_4,
ANIM_FINISHED
};
class LedSpot
{
public:
LedSpot(uint16_t numberOf... | true |
933f6e18af6237f2293e937e411a96c2d4def9ea | C++ | tks3210/Atcoder | /abc109/abc109_d.cpp | UTF-8 | 1,790 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
//pair<int int> 二つの異なる型の値を保持する。
//メンバ変数としてfirst, secondを持つ。XX.firstみたいな感じでアクセスする。
//https://cpprefjp.github.io/reference/utility/pair.html
#define pir pair<int, int>
//vector<T> 動的配列。
//不定個数の要素を格納できる。push_back()で要素を追加する。
vector<pair<pir,pir>> ans;
int main(){
... | true |
fdb9b8b3f571b7bed87d8bc067a3b368177b737a | C++ | dongyanchaoTJ/LNMHacks-3.0-Submission | /manvendra19_f0ec/Code1_OneTXintdatatoServer/code01_tx/code01_tx.ino | UTF-8 | 2,961 | 2.84375 | 3 | [] | no_license | #include<SPI.h> // Library used to connect arduino with other devices
#include<nRF24L01.h> // Library made by TMRH Group for nRF24L01
#include<RF24.h> // Library made by TMRH Group for nRF24L01
#include "printf.h" // To displa... | true |
512f6d7a2a7affb8a585809ede46331a8e8db2a0 | C++ | xxORVARxx/SDL-Book | /src/data/Parser.cpp | UTF-8 | 11,806 | 3.109375 | 3 | [] | no_license |
#include "Parser.h"
namespace data
{
void Throw_invalid_argument( std::string the_corrupted_input );
void Throw_file_corrupted( std::string _str = "" );
bool Is_template( std::string& _function );
void Comment( std::ifstream& _file, std::string& _comment );
std::string Check_for_comments( std::ifstream& _... | true |
f5c9fc92be5777b8c315491fecb4bd615bcec3f6 | C++ | mugur9/cpptruths | /cpp0x/curry_class_template.cpp | UTF-8 | 1,197 | 3.1875 | 3 | [] | no_license | #include <type_traits>
#include <functional>
#include <map>
#include <iostream>
template <template <template <class> class> class T>
struct TTT {};
template <template <class...> class C, class... T, class D = C<T...>>
std::true_type valid(std::nullptr_t);
template <template <class...> class C, class... T>
std::false... | true |
fe0f80353a7efd55e07809ca0e1197f2a35b2fc3 | C++ | qqsskk/Connection | /demo/echo/epoll_server/epoll_server.cpp | UTF-8 | 1,922 | 2.515625 | 3 | [] | no_license | #include <EPollServer.h>
#include "../Protocal.h"
#include <vector>
#include <iostream>
#include <stdio.h>
using namespace std;
#define LISTEN_PORT 8000
#define LISTEN_QUEUE 5
#define MAX_MSG_SIZE 1024
#define MAX_FDS 1024
#define MAX_EVENTS 10
int main()
{
ConcurrentServer *pServer = new EPollServer(MA... | true |
20f93421ade81099f10daff37605910956cf696a | C++ | moevm/oop | /6383/KaramyshevAO/lab1.2/Arc.cpp | UTF-8 | 1,194 | 3.109375 | 3 | [] | no_license | #include "Arc.h"
Arc::Arc(Point p1, Point p2, double input_radius, Point &cntr, Color &clr) : P1(p1), P2(p2), Circle(input_radius, cntr, clr) {}
void Arc::Calibr(double calibr) {
Circle::Calibr(calibr);
P1.x = (P1.x - cntr.x)*calibr + cntr.x;
P1.y = (P1.y - cntr.y)*calibr + cntr.y;
P2.x = (P2.x - cntr.x)*calibr +... | true |
a209a669b585fdfcf2d8dd1b86ab0df62e043b28 | C++ | sh4062/Leetcode | /278.cpp | UTF-8 | 601 | 3.1875 | 3 | [] | no_license | // The API isBadVersion is defined for you.
// bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
long l = 1;
long r = n;
int mid = 0;
while(l!=r){
mid=(l+r)/2;
//cout<<mid;
if(isBadVersion(mid)&&!isBadVersion(mi... | true |
30ae98500300dc04af86f7ed1c81294a0e808eff | C++ | niuxu18/logTracker-old | /second/download/squid/gumtree/squid_repos_function_5683_last_repos.cpp | UTF-8 | 478 | 2.546875 | 3 | [] | no_license | std::vector<Auth::User::Pointer>
CredentialsCache::sortedUsersList() const
{
std::vector<Auth::User::Pointer> rv(size(), nullptr);
std::transform(store_.begin(), store_.end(), rv.begin(),
[](StoreType::value_type v) { return v.second; }
);
std::sort(rv.begin(), rv.end(),
[](const A... | true |
2ee7a3e9727e64b117375139373728d725c63703 | C++ | Krixium/KindaFastMatrixLibrary | /KindaFastMatrixLibrary/Matrix.h | UTF-8 | 2,194 | 2.984375 | 3 | [] | no_license | #pragma once
#include <assert.h>
#include <cmath>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
namespace kfml
{
class Matrix
{
public:
// Row
const size_t M;
// Column
const size_t N;
private:
// Was the determinant already calculated?
bool mbDetCalcu... | true |
6c31c2746f38c6b0e22ffd7eba1b77a91d209442 | C++ | figopratama/pemrograman-dasar | /Praktikum1.c+.cpp | UTF-8 | 433 | 2.921875 | 3 | [] | no_license | /*Program Menghitung Billing Warnet*/
#include <iostream>
#include <conio.h>
using namespace std;
int main ()
{
int A,B,C,X,Y,Z,T;
cout<<"HITUNG BIAYA WARNET KAMU DISINI\n";
cout<<endl;
cout<<"Masukkan Total Durasi Kamu Bermain Dibawah Ini\n";
cout<<"Jam = ";cin>>A;
cout<<"Menit = ";cin>>B;
cout... | true |
787a2887a3272542244ab72bda82327ef7e3f34a | C++ | allenARM/Cpp-Piscine | /Day02/ex02/Fixed.class.hpp | UTF-8 | 1,311 | 2.8125 | 3 | [] | no_license | #ifndef FIXED_CLASS_HPP
# define FIXED_CLASS_HPP
#include <iostream>
#include <string>
#include <cmath>
class Fixed
{
public:
Fixed(void);
Fixed(Fixed const & src);
Fixed(int const val);
Fixed(float const valf);
~Fixed(void);
Fixed& operator=(Fixed const & rhs);
bool operator>(Fixed const & rhs) const... | true |
c325313b846ef8de058f57e1f2b47f7b7b9290dd | C++ | Dynmi/HW_CODE20 | /4_2/main.cpp | UTF-8 | 2,589 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
#define MAXN 560010
using namespace std;
set<int, less<int>> adj[MAXN]; // adj[i]是一个有序集合,包含了节点i的所有流出节点
int START;
vector<int> path; // 存储路径的栈
int deg[MAXN]; // 节点的出度
int max_all,cur_all;
int cnt,n; // 总共几条回路
vector<int>::iterator w_iter;
... | true |
4727fdee2e9a2ef865a6a85976551d11b48bf349 | C++ | hay2202/CPP-Ex5 | /sources/BinaryTree.hpp | UTF-8 | 8,500 | 3.734375 | 4 | [] | no_license | #pragma once
#include <iostream>
#include <queue>
#include <stack>
using namespace std;
namespace ariel{
template<typename T>
class BinaryTree{
private:
typedef struct Node {
T data;
Node* left = nullptr;
Node* right = nullptr;
Node(const T& val ) :... | true |
b2ce8509dc58925c337d02b57a87964a44d992dd | C++ | coronalabs/corona | /platform/windows/Corona.Native.Library.Win32/Interop/Input/InputDeviceDriverType.cpp | UTF-8 | 2,905 | 2.75 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown"
] | permissive | //////////////////////////////////////////////////////////////////////////////
//
// This file is part of the Corona game engine.
// For overview and more information on licensing please refer to README.md
// Home page: https://github.com/coronalabs/corona
// Contact: support@coronalabs.com
//
////////////////////////... | true |
988a3b2bb7c72e0a9fff47967e5850b4a70a4fe3 | C++ | helenyueyu/GFG-Exercise-Practice | /swapChanges.cpp | UTF-8 | 407 | 3.078125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int minOperations(string s, string t, int n)
{
int ct0 = 0, ct1 = 0;
for (int i = 0; i < n; i++) {
if (s[i] == t[i])
continue;
if (s[i] == '0')
ct0++;
else
ct1++;
}
return max(ct0, ct1);
}
int main()
{
string s = "010",... | true |
3981e085cf1f7d5e354da6442793ad6c8bac8f9d | C++ | DFaouaz/RVR_UCM_2019-20 | /proyecto/Server.cc | UTF-8 | 6,008 | 2.984375 | 3 | [] | no_license | #include "Server.h"
#include "MessageServer.h"
#include "MessageClient.h"
#include <chrono>
Server::Server(const char *host, const char *port) : socket(host, port), terminated(false)
{
players = std::vector<Player *>(4, nullptr);
}
Server::~Server()
{
}
// Public methods
void Server::init()
{
// Socket bind... | true |
df63f89e5dd00b8d1477a19ed2cc8c0359619414 | C++ | Jorgitou98/Acepta-el-Reto | /Soluciones/AceptaElReto258CogeElSobreYCorre.cpp | UTF-8 | 1,600 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <deque>
using namespace std;
struct tElem{
int elem, pos;
};
bool resuelveCaso() {
int n, k;
cin >> n >> k;
if (n == 0 && k == 0)
return false;
deque <tElem> colaK, candidatosMax;
tElem max = { 0, -1 };
int valor;
for (int i = 0; i < k; ++i){ //Cojo el maximo
cin >> valor;
i... | true |
2881d29e7290e910fd4c08919c71d92c73f6bb89 | C++ | bonly/exercise | /2010/201005/20100528_io_pool.cpp | UTF-8 | 4,038 | 3.03125 | 3 | [] | no_license | /**
* @file 20100528_io_pool.cpp
* @brief
*
* @author bonly
* @date 2012-7-11 bonly created
*/
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <iostream>
class thread_pool_checker: private boost::noncopyable
{
public:
thread_pool_checker(boost::asio::io_servi... | true |
6d2e8634fdb2046fa2b5994dba8e57be89747959 | C++ | Gabelonio/UD-Computer-Science | /8. Double Queue/main.cpp | WINDOWS-1250 | 539 | 2.90625 | 3 | [] | no_license | /*
Proyecto Manejo de colas dobles.
Nombres:
Gabriel Esteban Castillo Ramrez - 20171020021
Esteban Quintero Amaya -20171020022
*/
#include <iostream>
#include "Doblecola.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
... | true |
685bcc04c6e4103e1d31c16a7fc85b6ddea4ef71 | C++ | hackerlank/renyang-learn | /socket/c++/tcp/five/simple_server_main.cpp | UTF-8 | 2,319 | 3.0625 | 3 | [] | no_license | #include "ServerSocket.h"
#include "SocketException.h"
#include <iostream>
#include <string>
#include "imagedata.h"
using namespace std;
void SDFile(ServerSocket *server,char *filename);
void SDStruct(ServerSocket *server,char *pixel);
int main(int argc,char **argv) {
cout << "running...." << endl;
ServerSocket *se... | true |
db74c5a7c88021f21894ebcd8a48568e343d73ba | C++ | alesandraisla/curso-linguagem-c | /tipos_variaveis.cpp | ISO-8859-1 | 1,123 | 3.40625 | 3 | [] | no_license | #include <stdio.h>
int main (){
//Armazena caracterer
/*
char variavelChar = 'a';
printf("%c\n", variavelChar);
scanf("%c", &variavelChar);
printf("%c\n", variavelChar);
*/
/*
bool variavelBool = true; // pode ser true 1 ou false que 0 usado em programa de sim ou nao
printf("%i\n", variavelBool);
... | true |
857bcd1cde08f3d2751db018d3181bcc44130c87 | C++ | lastvirgo266/AlgorithmProblem | /Baekjoon/14502_write.cpp | UTF-8 | 2,471 | 2.8125 | 3 | [] | no_license | #include<stdio.h>
#include<queue>
using namespace std;
int decayed[8][8] = {0,};
int board[8][8] = {0,};
int weight[4][2] = { {0,1}, {0,-1}, {1,0}, {-1,0}};
int N,M;
typedef struct _point{
int y, x;
}Point;
int BFS(){
queue<Point> que;
for(int i=0; i<N; i++)
for(int j=0; j<M; j++){
... | true |
4ded4bab26057d33113bc2fa34ec0cead699c4b1 | C++ | tziccardi/pHController | /main.cpp | UTF-8 | 3,268 | 2.921875 | 3 | [] | no_license | //
// main.cpp
// phController
//
// Created by Thomas Ziccardi on 5/3/14.
// Copyright (c) 2014 Thomas Ziccardi. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
#include <stdlib.h>
#include <unistd.h>
#include <wiringPi.h>
using namespace std;
const char wday_... | true |
2b9a9a69eebdd7d2767df77f5808c88d5fb6268c | C++ | seohojinn/algorithm | /소수2/소수2/main.cpp | UTF-8 | 981 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <deque>
using namespace std;
int arr[10001];
int solve(int data){
deque<int> value;
int size = 0;
while(data != 0){
value.push_front(data % 10);
data /= 10;
}
size = int(value.size());
for(int i=0;i<size;i++){
data = 0;
... | true |
f775bf9a9c937e7efc4a7471a5d2da2da7184907 | C++ | nawaf331/fractal | /fractal.cpp | UTF-8 | 19,949 | 2.671875 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <GL/glut.h>
//#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
//#define OS_WIN
//#endif
int width=600, height=600; // window size
int windowID;
int color=0,flag=... | true |
593bcf79fd1b156ef73f4e8318661e20da551b77 | C++ | albertomila/continous-formation | /MoreIdioms/MoreIdioms/samples/MI05_AttorneyClient.h | UTF-8 | 1,255 | 3.265625 | 3 | [] | no_license | #pragma once
#include "stdafx.h"
#include <cstdio>
class CClient
{
private:
void A(int data) {}
void B(float data) {}
void C(double data) {}
friend class Attorney;
};
class Attorney
{
private:
static void CallA(CClient& client, int data)
{
client.A(data);
}
static void CallB(CClient& ... | true |
40182dc99cb2bf35bb013396b8a66013c76c90cc | C++ | Takiwa-i/Atcoder | /ABC/118/B.cpp | UTF-8 | 420 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
int main(void)
{
int n, m;
std::cin >> n >> m;
std::vector<int> M(m, 0);
for (int i = 0; i < n; i++)
{
int k;
std::cin >> k;
for (int i = 0; i < k; i++)
{
int a;
std::cin >> a;
--a;
M[a]++;
}
}
int ans = 0;
for (in... | true |
697ed0c6ab814dfd5d7d53c057f6037cfe5aa958 | C++ | mz299/HuffmanCoding | /henc3608.cpp | UTF-8 | 4,612 | 2.6875 | 3 | [] | no_license | // Min Zeng cs610 3608 prp
#include <iostream>
#include <fstream>
#include <vector>
#include "Huffman3608.h"
#include "MinHeap3608.h"
using namespace std;
bool readOriginFile3608(const char* filePath, vector<unsigned char> &filedata) {
ifstream fin(filePath, ios::binary);
if (fin.fail()) {
return... | true |
16ba399e7cb5fdf5e1c04274bb7f33a08e65abdd | C++ | sky4walk/Raycaster | /Vector3D.cpp | UTF-8 | 2,453 | 3.28125 | 3 | [] | no_license | #include <math.h>
#include "Vector3D.h"
Vector3D::Vector3D(void)
{
for(int i=0;i<3;i++)
{
m_vector[i] = 0.0;
}
}
Vector3D::Vector3D(const Vector3D &vec)
{
for(int i=0;i<3;i++)
{
m_vector[i] = vec.m_vector[i];
}
}
Vector3D::Vector3D(double x,double y,double z)
{
m_vector[0] = x;
m_vect... | true |
fa487844caa2c31b54cc8c8327b347acf40f32c7 | C++ | SydneySchiller/Comsc-200 | /GeometryHomework7/GeometryHomework.cpp | UTF-8 | 4,583 | 3.109375 | 3 | [] | no_license | // Lab 12, The "Geometry Homework 7" Program
// Programmer: Sydney Schiller
// Editor(s) used: Notepad
// Compiler(s) used: MinGW TDM GCC
#include "GeometryHomework.h"
#include <iostream>
using std::endl;
using std::ios;
using std::ostream;
#include <iomanip>
using std::setprecision;
#include <cstdlib>
#include <cm... | true |
858e96e5575c5c020375235aa9d85758dc3e8bcb | C++ | Prithviraj8/DS-Codes | /TBT_Practise.cpp | UTF-8 | 2,661 | 3.5625 | 4 | [] | no_license | #include <iostream>
using namespace std;
class node
{
public:
int data,lbit,rbit;
node *left,*right;
};
class TBT {
public:
node *root;
public:
TBT(){
root = NULL;
}
public:
void create(node*);
void inorder(node*);
void preorder(node*);
}... | true |
829afff730af17e38365baeb60a15615971ffc1b | C++ | linux-cc/minihttpd | /mysql/mysql.h | UTF-8 | 2,451 | 2.640625 | 3 | [] | no_license | #ifndef __MYSQL_MYSQL_IMPL_H__
#define __MYSQL_MYSQL_IMPL_H__
#include "config.h"
#include <mysql.h>
#include <vector>
#include <string>
BEGIN_NS(mysql)
using std::string;
using std::vector;
class Mysql {
public:
struct Row {
Row(MYSQL_ROW row, int num);
const string &operator[](int index) const... | true |
d01c23ebfb09b9c6ba996196cbc448945e81b6ed | C++ | Lujie1996/Leetcode | /39. Combination Sum/39. Combination Sum/main.cpp | UTF-8 | 1,493 | 3.34375 | 3 | [] | no_license | //
// main.cpp
// 39. Combination Sum
//
// Created by Jie Lu on 05/03/2018.
// Copyright © 2018 Jie Lu. All rights reserved.
//
// 回溯的思路,递归实现
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void getCombination(vector<int>& candidates, vector<vector<int>>& res, vector<int>& com, i... | true |
422b61253643514b58e903af6ec8a7248274dd31 | C++ | nave7693/leetcode | /165-compare-version-numbers.cpp | UTF-8 | 1,217 | 3.65625 | 4 | [
"MIT"
] | permissive | // https://leetcode.com/problems/compare-version-numbers/
class Solution {
public:
int getNumber(string s, int *index) {
int result = 0;
while (*index < s.size() && s[*index] != '.') {
result = result * 10 + s[*index] - '0';
(*index)++;
}
if (s[*ind... | true |
22a950e5b227bb5961ae2ad77a2116ddfc04a64d | C++ | mrdishant/Python | /AddTwoNumbers.cpp | UTF-8 | 178 | 2.984375 | 3 | [] | no_license |
#include<iostream>
using namespace std;
int a,b;
int main(){
cout<<"Enter A : ";
cin>>a;
cout<<"Enter B : ";
cin>>b;
cout<<"Sum is ";
cout<<(a+b);
return 0;
}
| true |
17b19366c233dbff6d67444c4b26aef328e81d8d | C++ | SETHJI01/DSA | /String/caseSort.cpp | UTF-8 | 771 | 2.578125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int n=s.length();
int hash_sm[26]={0},hash_cap[26]={0};
for(int i=0;i<n;i++){
if(s[i]>='A'&&s[i]<='Z')
hash_cap[s[i]-'A']++;
else
hash_sm[s[i]-'a']++;
}
int sm=0,cap=0;
stri... | true |
bf074f679592a538fc47590b566c275e53c5c356 | C++ | NubGhost/Snake-Game-CPP | /SnakeFiles/Point.h | UTF-8 | 1,422 | 3.09375 | 3 | [] | no_license | #ifndef _POINT_H_
#define _POINT_H_
#include <iostream>
#include "Gotoxy.h"
#include "Direction.h"
#include "Color.h"
#define LINES 20
#define ROWS 80
using namespace std;
class Point
{
int x;
int y;
int dir_x = 1;
int dir_y = 0;
void moveImpl() {
x = (x + dir_x + ROWS) % ROWS;
y = (y + dir_y + LINES) % LI... | true |
742c031c275df207b93b4629b20a6e71eb1c43a3 | C++ | weixu000/pixel-factory | /include/PixelFactory/Application.h | UTF-8 | 308 | 2.515625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <list>
class Window;
class Application {
public:
Application();
~Application();
static Application &Instance() { return *application_; }
int Run();
private:
static inline Application *application_ = nullptr;
friend class Window;
std::list<Window *> windows_;
};
| true |
39581ec026f2cc5adc8de8712d5643f0bf7232c6 | C++ | baileyweible/Project_5 | /spyro.cpp | UTF-8 | 1,170 | 2.9375 | 3 | [] | no_license | #include "spyro.hpp"
Spyro::Spyro(JsonEntityBuilder &builder, JsonItemBuilder & inventory, uint32_t uid) :
Entity(builder, inventory, uid)
{
std::cout << Name() << " the spyro has entered the battle" << std::endl;
}
void Spyro::Flameshoot(Entity *target)
{
Attack(target, 4.5, "Flameshoot");
}
void Sp... | true |
eee715b527f590e3cb7bf5c9d797965478c93a03 | C++ | YourNerdyJoe/transconsciousness | /transconsciousness/rect.cpp | UTF-8 | 423 | 3.015625 | 3 | [] | no_license | #include "rect.h"
Rect::Rect() : pos(0, 0), w(16), h(16)
{
calculateVertices();
}
Rect::Rect(float x, float y, float w, float h) : pos(x, y), w(w), h(h)
{
calculateVertices();
}
Rect::~Rect()
{
}
void Rect::calculateVertices()
{
float hw = w/2,
hh = h/2;
v[0].setElements(pos.x-hw, pos.y-hh);
v[1].setElement... | true |
554fe9e6f9aa5deccdf91cee09e70e4434842f81 | C++ | ssauermann/AutoPas | /src/autopas/selectors/ContainerSelector.h | UTF-8 | 7,480 | 2.71875 | 3 | [
"BSD-2-Clause"
] | permissive | /**
* @file ContainerSelector.h
* @author F. Gratl
* @date 11.06.18
*/
#pragma once
#include <array>
#include <vector>
#include "autopas/containers/ParticleContainer.h"
#include "autopas/containers/directSum/DirectSum.h"
#include "autopas/containers/linkedCells/LinkedCells.h"
#include "autopas/containers/verletC... | true |
773fbfa0a0b9cd66cfef5278f072e757b9ea5bfe | C++ | mrdepth/libdgmpp | /c-wrapper/area.cpp | UTF-8 | 448 | 2.515625 | 3 | [
"MIT"
] | permissive | //
// area.cpp
// dgmpp
//
// Created by Artem Shimanski on 14.12.2017.
//
#include "area.h"
#include "internal.h"
dgmpp_type dgmpp_area_create (dgmpp_type_id type_id) {
try {
return new_handle(std::make_shared<Area>(static_cast<TypeID>(type_id)));
}
catch (...) {
return nullptr;
}
}
dgmpp_type dgmpp_area... | true |
e63dcf9f50c416c81563b1ea9e2e6f6c9154d3dd | C++ | antoni-heredia/ED-COMPARTIDO | /Practica3/include/Pila_max_Cola.h | UTF-8 | 2,546 | 3.625 | 4 | [
"MIT"
] | permissive | /**
* @file Pila_max_Cola.h
* @brief Fichero cabecera del TDA Pila Máximo Implementado con Cola
*
*/
#ifndef __PILA_COLA_H__
#define __PILA_COLA_H__
#include <iostream>
#include <cassert>
#include <string>
#include "cola.h"
/**
* @brief T.D.A. Pila_max_Cola
*
* El T.D.A. Pila_max_Cola permite crear un contenedo... | true |
6c86f57d65686199e9aef37faa0d6d41eaa86755 | C++ | SineObama/Calculator | /Calculator/CalculationStack.h | GB18030 | 2,269 | 3.4375 | 3 | [] | no_license | #pragma once
#include <stack>
#include <stdexcept>
#include "BasicCalculationStack.h"
#include "BasicCalculationTree.h"
#include "BasicCalculation.h"
#include "CalculationException.h"
namespace sine {
namespace calculator {
/**
* ܴС()㡣
* ջΪʵֵġ
*/
template<class T>
class CalculationStack : public BasicCalculation<... | true |
9115d7621f020d870141acdb98860024be3b3edc | C++ | BackupTheBerlios/windstille-svn | /trunk/collisiontest/colltest.cxx | UTF-8 | 1,468 | 2.640625 | 3 | [] | no_license | #include "colltest.hxx"
#include "collision.hxx"
#include <assert.h>
SweepResult simple_sweep_1d(float a, float aw, float av,
float b, float bw, float bv)
{
SweepResult res;
// Normalize the calculation so that only A moves and B stands still
float v = av - bv;
if (v > 0)
{
res.t0 = (b - (a +... | true |
0d30fb4261f766b6d751e462ab6f495075412175 | C++ | hskramer/CPlus | /ProgramPP/Chapter06/Problem06/Problem06/grammar.cpp | UTF-8 | 2,573 | 3.484375 | 3 | [] | no_license | #include "../../std_lib_facilities.h"
/* program implements a parses simple english sentence given the following definitions:
* Sentence:
Article Noun Verb
Noun Verb
Sentence Conjunction Sentence
* Noun:
birds, fish, C++
* Verb:
rules, fly, swim
* Conjunction:
and, or, but
* Article:
The, t... | true |