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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
378ce5945201e0ebb9362b06dfd28fafa161b914 | C++ | seanmoir/COSC342 | /04/Shapes/Rectangle.cpp | UTF-8 | 978 | 3.359375 | 3 | [] | no_license | #include "Rectangle.h"
#include <algorithm>
#include <iostream>
Rectangle::Rectangle(int minX, int minY, int maxX, int maxY, const Pixel& colour) :
Shape(colour), minX_(minX), minY_(minY), maxX_(maxX), maxY_(maxY) {
}
Rectangle::Rectangle(const Rectangle& rect) :
Shape(rect), minX_(rect.minX_), maxX_(rect.maxX_)... | true |
5e3018215a1f7c0b34a0cc09fe189074f3423c79 | C++ | ZeroBone/ZBoss | /src/components/container.cpp | UTF-8 | 3,749 | 2.6875 | 3 | [
"MIT"
] | permissive | #include <zboss/components/container.hpp>
#include <zboss/entity/entity.hpp>
namespace zboss {
using namespace std;
Vector2D ContainerComponent::getPosition() const {
return rawPosition;
}
void ContainerComponent::setPosition(const Vector2D& pos) {
setPosition(pos.x, pos.y);
}
... | true |
338fe6596dae7b5bc0bc27e7a29933178430b66e | C++ | bayusamudra5502/PustakaCPP | /Pemrograman Kompetitif/beras2.cpp | UTF-8 | 1,077 | 2.875 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
struct Beras{
double C1;
int C; // Harga
int W; // berat
};
double f(int X, int N, vector<Beras> data){
if(X <= 0){
return 0;
}else{
if(data.size() == 0){
return 0;
}else{
double maxe = 0;... | true |
dbcde73d4d0cb2ae2e60944a17c59e99a413f3a5 | C++ | Zuvo007/InternSearchWorkspace | /sourcecodes/9997.RecursionCodingBat/2.RevStringWord.cpp | UTF-8 | 1,306 | 3.5625 | 4 | [] | no_license | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
string GetReverse(string s,int start,int end)
{
//base case the function will continue
//up to end=s.size()-1;
//cout<<s;
if(end==s.size())
{
//this is for the last word of the string
... | true |
84db71696a32dd62a140c4b9fa1ed9b6ed571413 | C++ | HuNNTTeR/Programiranje-I | /Zadatak I/01.cpp | UTF-8 | 482 | 3.75 | 4 | [] | no_license | #include<iostream>
using namespace std;
int isFact(int);
int sum(int);
int main()
{
int N;
cout << "Unesi neki cijeli broj N" << endl;
cin >> N;
cout << "Suma faktorijela svih neparnih brojeva od 1 do " << N << " je " << sum(N);
cin.get();
return 0;
}
int isFact(int x)
{
int f = 1;
for (int i = 2; i <= ... | true |
ce4ca1c36a77c86c9d863848f9b8469c4c55124f | C++ | IT6DevGroup/Epic-Defense | /Epic_defense/Epic_defense/log.cpp | UTF-8 | 1,864 | 3.015625 | 3 | [] | no_license | #include "log.h"
LOG &LOG::GetInstance ()
{
static LOG theSingleInstance;
return theSingleInstance;
}
LOG::LOG ()
{
log_file = fopen ("error.log", "w");
}
LOG::~LOG ()
{
fclose(log_file);
}
void LOG::WriteStringToLog (char *fmt, ...)
{
va_list ap;
char format[STRING_LENGTH];
int cou... | true |
ec4cdfe375779610f49fb033bb1db921c42649ed | C++ | juangil/programmingContests | /codeforces/codeforces320/B.cpp | UTF-8 | 1,426 | 2.765625 | 3 | [] | no_license | # include <bits/stdc++.h>
using namespace std;
bool mycmp(pair< int, pair<int,int> > a, pair< int, pair<int,int> > b){
return a.first < b.first;
}
int main(){
int n;
while(cin >> n){
vector< pair<int, pair<int,int> > > highest;
for(int i = 2; i <= 2*n; ++i){
int m = i - 1;
... | true |
441a10280294dc28e59bbd6aebe5fa9ede3668b9 | C++ | Yairbib/Pipe-Puzzle-game | /src/Controller.cpp | UTF-8 | 3,493 | 2.671875 | 3 | [] | no_license | #include "Controller.h"
#include <SFML/Graphics.hpp>
#include <fstream>
void Controller::run()
{
Textures textures;
std::ifstream file("Board.txt");
auto window = sf::RenderWindow(sf::VideoMode::getDesktopMode(), "The Pipe Puzzle Game", sf::Style::Default);
setMenu(window, textures);
for (float i =... | true |
68247e36f1ce1e53afc0c7cb894b5abe8a11696f | C++ | oulrich1/PastAssignments | /csci566-p4/include/geometry/geometry.h | UTF-8 | 3,768 | 2.734375 | 3 | [] | no_license | /* Geometry.h
*
* Base class for geometric objects.
*/
#include "utils.h"
using namespace std;
typedef Angel::vec4 color4;
typedef Angel::vec4 point4;
#ifndef GEOMETRY_H
#define GEOMETRY_H
// this is the length of one symetric side of the unit cube..
// #define UNIT_CUBE_D 0.5
#define UNIT_CUBE_D 1.0... | true |
63055577980d6cbed6fcedd3eeeee8b0de725228 | C++ | PabloBlanco10/Algoritmos-EDA | /Algoritmos/Iterativos/circo.cpp | UTF-8 | 955 | 2.953125 | 3 | [] | no_license | //
// circo.cpp
//
//
// Created by Pablo Blanco Peris on 31/1/17.
//
//
#include <stdio.h>
#include <iostream>
using namespace std;
int circo(int v[], int n){
int childs = 1;
int max = v[0];
bool encontrado = true;
for(int i = 1; i < n; i++){
if(encontrado){
if(v[i] <= m... | true |
0ea9b6484711f1bfa7413206ec581d3aa659daca | C++ | manjaripokala/ParallelAlgorithms_Su20 | /TermProject/generateGraph.cpp | UTF-8 | 4,357 | 3.03125 | 3 | [
"MIT"
] | permissive | //
// Created by Pedzinski, Dale on 8/9/20.
//
#include "jsmn.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <limits.h> //For PATH_MAX
//// Structure to represent a vertex and its distance
//struct distNode {
// int64_t node;
// int64_t dist;
... | true |
f833842dc0044796000b1638d56b2e67a1ea6fc4 | C++ | Exxxasens/Programming | /Practice/09/C++/Project/Project.cpp | UTF-8 | 630 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
char a;
int h1, h2, m1, m2;
cin >> h1 >> a >> m1;
cin >> h2 >> a >> m2;
if ((h1 == 0 && h2 == 23 && m2 - 45 + m1 <= 15) || (h1 == 23 && h2 == 0 && m1 - 45 + m2 <= 15)) {
cout << "Встр... | true |
0a3ac567337cd5cd194b25efa20a8eb715971804 | C++ | deardeng/learning | /vstest/C++/51cpp/51cpp/04.cpp | UTF-8 | 1,597 | 3.53125 | 4 | [] | no_license | #include <iostream>
using namespace std;
#include <string>
class MyException{
public:
MyException(const char* message)
:message_(message){
cout << "MyException..." << endl;
}
MyException(const MyException& other):message_(other.message_){
cout << "Copy MyException..." << endl;
}
~MyException(){
... | true |
fe5eba8c79b7fc237fd2285b3bbc73040f9ad1b8 | C++ | ivilab/kjb | /lib/semantics/Token_map.cpp | UTF-8 | 1,263 | 2.90625 | 3 | [] | no_license | /*!
* @file Token_map.cpp
*
* @author Colin Dawson
* $Id: Token_map.cpp 16870 2014-05-22 19:34:15Z cdawson $
*/
#include "semantics/Token_map.h"
#include <map>
namespace semantics
{
Token_map::Val_type Token_map::get_code(const Token_map::Key_type& key)
{
Map::left_iterator it = map_.left.find(key);
... | true |
002bf69404dcb2ccd56f2fcafb4b763d2194b8e8 | C++ | lineCode/FTXUI | /src/ftxui/dom/color.cpp | UTF-8 | 1,597 | 2.5625 | 3 | [
"MIT"
] | permissive | // Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/dom/elements.hpp"
#include "ftxui/dom/node_decorator.hpp"
namespace ftxui {
class BgColor : public NodeDecorator {
public:
BgColor(Elements ch... | true |
06a47b81c4328e013c7158f6058d638e97db30ae | C++ | Musthofa-017/tugas-besar-alpro | /Tugas Besar/main.h | UTF-8 | 4,193 | 3.03125 | 3 | [] | no_license | #ifndef MAIN_INCLUDE
#define MAIN_INCLUDE
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
class Bos {
private:
string username = "", password = "";
public:
Bos(){
}
bool login(string user, string pass){
ifstream file("data.dt");
while (!... | true |
b7493a6af0299b003611e9f9f95449c1467cf96e | C++ | Oipo/Machine | /other/Machine-kitchen-old/src/menustate.cpp | UTF-8 | 1,911 | 3.03125 | 3 | [] | no_license | #include "menustate.hpp"
#include "menuentry.hpp"
#include "gamestate.hpp"
MenuState::MenuState(Game *game)
: State(game), selection_(0)
{
AddEntry(MenuEntryID::Play, "Play");
AddEntry(MenuEntryID::Settings, "Settings");
AddEntry(MenuEntryID::About, "About");
AddEntry(MenuEntryID::Quit, "Quit");
entries_[0].set_... | true |
202c7feebb29ab7c9f0b67dc52a160bbfe05158e | C++ | SharpNip/3DShip | /3DShip/3DShip/BoxCollider.cpp | UTF-8 | 2,788 | 3.171875 | 3 | [] | no_license | #include "BoxCollider.h"
//Default Constructor, everything's set to zero.
BoxCollider::BoxCollider()
:Collider3D(nullptr, Type::BOX, 0, 0, 0)
, mWidth(0)
, mHeight(0)
, mDepth(0)
{
}
//Default deconstructor
BoxCollider::~BoxCollider()
{
}
// Basically copied from Pier-Luc's 2D colliders, and simply adding in a ... | true |
1c5e3624ad9037ce4c18f8e9a6eb5baff40defd6 | C++ | blockspacer/swordbow-magic | /include/clientrunningstate.hpp | UTF-8 | 1,617 | 2.578125 | 3 | [
"MIT"
] | permissive | #ifndef CLIENTRUNNINGSTATE_HPP
#define CLIENTRUNNINGSTATE_HPP
#include "iclientstate.hpp"
#include "messagetypes.hpp"
#include "ipaddress.hpp"
class Client;
class ClientRunningState : public IClientState {
private:
Client* client;
std::vector<int> presses; //contains what keystrokes have been made (cleared on ever... | true |
1d79926f4bb8a4c9334b8d47ee11fef9452b2b9a | C++ | Pstalwalkar7/GFG | /Graph/12.cpp | UTF-8 | 1,635 | 2.6875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class Solution
{
public:
//Function to return the minimum cost to react at bottom
//right cell from top left cell.
int minimumCostPath(vector<vector<int>>& grid)
{
int n = grid.size();
int m = grid[0].size();
vector<pair<int,int>> ... | true |
6ace8673ac5508aa8b25944faf07b1be03e011cd | C++ | lukewegryn/MIPS_Assembler | /main.cpp | UTF-8 | 4,966 | 3.015625 | 3 | [] | no_license | /* Luke Wegryn
* Project1
* CompOrg 2500
* 2/17/2015
*/
#include <fstream>
#include <iostream>
#include <iomanip>
#include <memory>
#include <stdexcept>
#include <string>
#include <sstream>
#include <vector>
#include <QStringList>
#include <QString>
#include <QFile>
#include <QTextStream>
#include <QByteArray>
#inc... | true |
c807a7d96d33fe9d665d7714837e9b7eef0512e0 | C++ | newton449/virtual-server | /VirtualServerWindows/MainProgram/HttpServletsImpl.cpp | UTF-8 | 6,932 | 2.84375 | 3 | [] | no_license | #include <fstream>
#include "HttpServletsImpl.h"
#include "FileSystem.h"
#include "Logger.h"
#include "StringUtils.h"
////////////////////////////////////////////////////////////////////////
// Function implementations of DefaultHttpServlet
// Do the HTTP method.
void DefaultHttpServlet::doMethod(String methodName, I... | true |
6f637ee289791f67c3247f3bd9734be7d64fb7dc | C++ | thdgmltjd123/Algorithm_04 | /baekjoon/20200101/20200101/1427 소트인사이드.cpp | UHC | 425 | 3.078125 | 3 | [] | no_license | // 10989 ذߴ ̿Ͽ Ǯ!
// ̹Ƿ count 迭 !
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int count[10] = { 0, };
string s;
cin >> s;
for (int i = 0; i < s.length(); i++)
{
count[s[i] - '0']++;
}
for (int i = 9; i >= 0; i--)
{
for (int j = 0; j < count[i]; j++)
{
cout << i;
}
... | true |
f6d992b994ea8609e9b8a3f241ffb7c3e9787477 | C++ | claytonsuplinski/RacingGame | /RacingGame/alien.cpp | UTF-8 | 11,640 | 2.75 | 3 | [] | no_license | /*
Name: Clayton Suplinski
ID: 906 580 2630
CS 559 Project 3
Creates an alien object out of cylinders, discs, and spheres.
*/
#include <iostream>
#include "alien.h"
using namespace std;
using namespace glm;
//Create a alien object
Alien::Alien() : Object(){}
Alien::~Alien(){
this->TakeDown();
}
//Initialize the ... | true |
1dc1f10bb84a43db89c84198ddf34bd44b9a784d | C++ | elwin0214/leetcode | /src/palindrome/ShortestPalindrome.cpp | UTF-8 | 632 | 2.96875 | 3 | [] | no_license | /*
https://leetcode.com/problems/shortest-palindrome/
Shortest Palindrome My Submissions Question
Total Accepted: 11498 Total Submissions: 66112 Difficulty: Hard
Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by... | true |
8dc071380403497bf94ec676ee71f00efee3ff29 | C++ | tanvir14012/Sphere-Online-Judge-My_Solutions | /spoj ARITH2 try.cpp | UTF-8 | 1,806 | 3.046875 | 3 | [] | no_license | #include <stdio.h>
int main()
{
char operator;
long long n, a, res;
scanf( "%lld", &n );
while ( n-- )
{
operator = 0;
scanf( "%lld", &res );
while ( 1 )
{
scanf( "%s", &operator );
if ( operator == '=' )
{
break;
... | true |
55b0e3f67edb83ed8961ea220c8c1dd2e33d9c5c | C++ | Manash-git/C-Programming-Study | /str length manually.cpp | UTF-8 | 204 | 2.765625 | 3 | [] | no_license | //#include<stdio.h>
#include<bits/stdc++.h>
int main(){
char s[100];
int i;
printf("Enter a string:\t");
gets(s);
for(i=0;s[i]!='\0';++i);
printf("\n Length of the strings: %d",i);
return 0;
}
| true |
35acb6a81e9db7324fa47aa804ce0db7e5285fca | C++ | IFortunater/LCRecord | /C++/70.cpp | UTF-8 | 1,260 | 3.65625 | 4 | [] | no_license | #include<iostream>
using namespace std;
// 时间超限 不可取
// class Solution
// {
// private:
// int count = 0;
// public:
// int climbStairs(int n)
// {
// calculate(n);
// return count;
// }
// void calculate(int n){
// if (n == 0){
// count++;
// retur... | true |
63ad648d83d42e7e7acc5935cffd41aff47e29c7 | C++ | romaldowoho/UCSC-Cpp-class | /HW2 - basic/ninetynine/ninetynine.cpp | UTF-8 | 2,205 | 3.515625 | 4 | [] | no_license | #include "ninetynine.h"
#include "../util/util.h"
void ninetynine::run() {
string ones[] = {"nine", "eight", "seven", "six", "five", "four", "three", "two", "one", ""};
string zero[] = {"Nine", "Eight", "Seven", "Six", "Five", "Four", "Three", "Two", "One", "Zero"};
string tens[] = {"Ninety", "Eighty", "Seventy", ... | true |
00b30b5369a458f19287bd1df9dcd67273756c3b | C++ | LinkSon-PC/EDD_1S2020_PY1_201800634 | /EDD_1S2020_201800634/EDD_1S2020_201800634/Matriz.h | UTF-8 | 5,201 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <fstream>
#include "Ficha.h"
using namespace std;
class Matriz
{
int y;
int x;
Ficha* _Ficha;
int _Punto;
Matriz* _Arriba;
Matriz* _Abajo;
Matriz* _Izquierda;
Matriz* _Derch... | true |
6fe0e1253d40b41e12f60bf03c1b03266a935f31 | C++ | hieu-ln/IT82-03 | /CodeC3/LeQuocVin_C3_Bai1.cpp | UTF-8 | 7,157 | 2.859375 | 3 | [] | no_license | //#include <iostream>
//#include <iomanip>
//#include <ctime>
//#include <stdio.h>
//using namespace std;
//#define MAX 5000
//int a[MAX], n;
//void output(int a[], int n)
//{
// for (int i = 0; i < n; i++)
// cout << setw(4) << a[i];
// cout << endl;
//}
//void input(int a[], int &n)
//{
// for (int i = 0; i < n; i++... | true |
6c6db65fd97da91be998be389c150752f9950039 | C++ | Fraszczak/_SpaceShooter | /Laser.cpp | UTF-8 | 281 | 2.53125 | 3 | [] | no_license | #include "pch.h"
#include "Laser.h"
Laser::Laser(Animation &animation, float x, float y) : Entity::Entity(animation, x, y)
{
this->name = "Laser";
};
void Laser::update(sf::Time &t)
{
int laser_speed = 1;
this->y -= laser_speed;
if (this->y < 0) { this->life = false; }
}
| true |
f3cefccd6f14a85e654120ad7d5b57e44963cd3a | C++ | baoqingti/SmartPointer | /SmartPointer/main.cpp | GB18030 | 4,517 | 3.3125 | 3 | [] | no_license | #include "SmartPointer_v1.h"
#include "SmartPointer_v2.h"
#include "SmartPointer_v3.h"
#include "SmartPointer_v4.h"
//Դ
//v1,v2Ӧõ
class SomeClass
{
public:
SomeClass() {cout << "SomeClass default constructor" << endl;}
~SomeClass() {cout << "SomeClass destructor" << endl;}
};
//v3Ӧõ
class SomeClass3: public R... | true |
76a6c510e8e82ad175d7d322c497d577f33494b6 | C++ | VRavaglia/LingProg-2019-1-Trabalho | /Entidade.cpp | UTF-8 | 667 | 2.5625 | 3 | [] | no_license | #include "Entidade.h"
bool contemComponente(Componente componente, unsigned componentes){
if(componentes % componente == 0){
return true;
}
return false;
}
Entidade::Entidade(): velocidade (vec2<float>(0,0)){
}
void Entidade::emForaDaTela() {
}
void Entidade::emColisao() {
}
void Entidade::a... | true |
9b898f7890e3134ccd631d9b2e78fbff96397f43 | C++ | gerson1974/tripmaster | /screen.cpp | UTF-8 | 3,012 | 3.078125 | 3 | [
"MIT"
] | permissive | #include "screen.h"
Screen::Screen() :
lcd(LiquidCrystal_I2C(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE)), printedTrip1Distance(0), printedTrip2Distance(0), printedTankDistance(0) {
}
void Screen::setupScreen() {
lcd.begin(20, 4);
lcd.setCursor(0,0);
lcd.print("Crappy Tripmaster");
}
void Screen::registerTr... | true |
fc32b1ca2c884148270ecd558b50e75c99ad57a1 | C++ | HumMan/BaluScript | /Source/SemanticInterface/Internal/SStatements.cpp | UTF-8 | 5,109 | 2.609375 | 3 | [] | no_license | #include "SStatements.h"
#include "SLocalVar.h"
#include "SMethod.h"
#include "SExpression.h"
#include "SBytecode.h"
#include "SReturn.h"
#include "SWhile.h"
#include "SIf.h"
#include "SFor.h"
#include "SClass.h"
class TSStatementBuilder :public SyntaxApi::IStatementVisitor
{
TSStatement* return_new_operation;
TSC... | true |
540457daa6bf96d5b61f384e89ebc56cf94ac648 | C++ | PTMKUCCHi/GAME | /shooting/j1412口羽雅晴funnybullet.cpp | UTF-8 | 7,716 | 2.8125 | 3 | [] | no_license | /*///////////////////////////////////////////////////////////
今回は時間で制御して三つの弾幕の動きを作成した.
一つ目は,360度の方向に円形に一斉に発射する弾幕,
二つ目はソニックブームのように自機めがけて発射する弾幕
そして三つめが敵機から9方向に一直線上に連射される弾幕だ.
敵機の動きは円運動をさせたので,いろんなところから弾が飛びかっていて
実践的になったと感じた.
作ってみて実際のシューティングゲームのようにいろんな弾幕を作り出せたのでよかった.
///////////////////////////////////////... | true |
c4fa115f9e3cfcecf15ea58de6e5a7f9d67907ec | C++ | at0x0ft/Lec.2018.ProgrammingC.CompetitiveProgrammingPart | /8/8.cpp | UTF-8 | 1,367 | 3.125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void cReadLn(int &n)
{
scanf("%d", &n);
}
void cReadLn(std::vector<int> &v)
{
int n = v.size();
for (int i = 0; i < n; i++)
scanf("%d", &v[i]);
}
bool binSearch(const vector<int> &s, const int val)
{
int high = 0, low = s.size() - 1;
if (low ... | true |
080689f2b086a321ea053f5032d2780ab189f4e1 | C++ | SabaaKiwan/vaSheet03 | /ActionRecognition/Utils.cc | UTF-8 | 1,370 | 2.859375 | 3 | [] | no_license | /*
* Utils.cpp
*
* Created on: May 10, 2017
* Author: ahsan
*/
#include "Utils.hh"
void Utils::readVideo(const std::string& filename, std::vector<cv::Mat>& result) {
// open video file
cv::VideoCapture capture(filename);
if(!capture.isOpened())
Core::Error::msg() << "Unable to open Video: " << filename... | true |
07562707eec5265f8d53f1614718d094ba120754 | C++ | UzzielSW/Curso-de-Cplus | /Modulos de C++/Bloque 2.4 - Funciones/Ejercicio 3 - elevacion de un numero.cpp | UTF-8 | 759 | 3.75 | 4 | [] | no_license | /*Ejercicio 3: Escriba una funci�n nombrada funpot() que eleve un n�mero entero que
se le transmita a una potencia en n�mero entero positivo y despliegue el resultado.
El n�mero entero positivo deber� ser el segundo valor transmitido a la funci�n.*/
#include<iostream>
using namespace std;
void pedirDatos();
void funp... | true |
2523b3529db774aef359fd7a22279bf57e745d68 | C++ | gkourtis/napl22 | /naplCharTraits.cpp | UTF-8 | 1,781 | 2.984375 | 3 | [] | no_license |
class char_traits_Char : public std::char_traits<Char> {
public:
// typedef Char char_type;
typedef uWord size_type;
typedef int32_t int_type;
typedef Char* pointer; typedef const Char* const_pointer;
typedef Char& reference; typedef const Char& const_reference;
//static size_type length(){return size();}
//stat... | true |
1c98b7f984f406c8e5e75e519683adb2e3193408 | C++ | kubonits/atcoder | /abc/100/130/abc139/abc139-f.cpp | UTF-8 | 688 | 2.5625 | 3 | [] | no_license | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<deque>
#include<cmath>
using namespace std;
int main(){
int n;
double x[100],y[100],dis,ans=0.0,xx,yy,a,b;
const double PI=3.14159265358979323846;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%l... | true |
96fb7c891a3365af3ee149659ec9409871be6d48 | C++ | GunnerLab/Develop-MCCE | /yingying_delphi/Delphicpp_v8.4.2_Linux/src/dplt/ddm/view/Global.h | UTF-8 | 767 | 2.6875 | 3 | [
"MIT"
] | permissive | #ifndef DDM__VIEW__GLOBAL_H__INCLUDED
#define DDM__VIEW__GLOBAL_H__INCLUDED
#include "../../ddm/view/ViewTraits.h"
namespace ddm {
/**
* \concept{DDMViewConcept}
*/
template <class ViewType>
constexpr
typename std::enable_if<
ddm::view_traits<ViewType>::is_view::value &&
ddm::view_traits<ViewType>::is_local::... | true |
070073e867d62abb33cf8b3ab32db364c988cd1e | C++ | Huasheng-hou/AOAPC-I | /AOAPC-I/Chapter 2. Mathematics/Counting/uva11529.cpp | UTF-8 | 1,830 | 2.59375 | 3 | [] | no_license | //
// uva11529.cpp
// AOAPC-I
//
// Created by apple on 2019/8/16.
// Copyright © 2019 huasheng. All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
// Strange tax, 点在三角形内, Accepted! 0.710s
using namespace std;
const int maxn = 1210;
int n, ka... | true |
cebf27d98836c3d53c164c6eeb62425518cc3b3f | C++ | suyash0103/Competitive-Coding | /Practice Comp code/maxSumContSubarray.cpp | UTF-8 | 620 | 2.65625 | 3 | [] | no_license | int Solution::maxSubArray(const vector<int> &A) {
int max = 0;
int maxFinal = 0;
int flag = 0;
for(int i = 0; i < A.size(); i++)
{
if(A[i] > 0)
{
flag = 1;
break;
}
}
if(flag == 0)
{
int min = A[0];
for(int i = 1; i < A.size... | true |
9e430d6950713758f7b411e2321cfec5fcdbd5ce | C++ | complabs/mpi-labs | /lab2/pi-nb.cpp | UTF-8 | 3,381 | 3.296875 | 3 | [] | no_license | /**
Calculate pi
# Lab 2 Exercise 3: Find pi using non-blocking communications
Use a non-blocking send to try to overlap communication and computation.
Take the code from Exercise 1 as your starting point.
*/
#include <iostream>
#include <iomanip>
#include <random>
#include <mpi.h>
sta... | true |
902a4ca133edb504b0ae9e67a3edef379a89e7b5 | C++ | NefarioDr/sample-code | /cpp/snippets/join_vector.cpp | UTF-8 | 541 | 3.109375 | 3 | [] | no_license | #include <algorithm>
#include <experimental/iterator>
#include <iostream>
#include <vector>
#include <sstream>
/**
* the std::experimental is defined from c++14, so you must specific your compiler with '-std=c++14',
* or it will throw an error: no member named 'experimental' in namespace 'std'.
*/
int main() {
... | true |
6e9eae74b00fca5bea437b636288d48459c45234 | C++ | savvynavi/Intro-to-cpp | /dynamic arrays/dynamic array question 2/dynamic array question 2/main.cpp | UTF-8 | 781 | 3.875 | 4 | [] | no_license | #include<iostream>
using namespace std;
//create dynamic 2d array, print it, delete it
int main(){
int width = 5;
int height = 5;
//creating the array, inner ones need to be made in a loop
int **arr1 = new int *[height];
for(int i = 0; i < height; i++){
*(arr1 + i) = new int[width];
}
//filling the array wi... | true |
202a1f54b025b46daeb71b5bc571acd4b4396c6f | C++ | LJBCPH/comp_fin_exam_1 | /exam_1/Vasicek.cpp | UTF-8 | 1,864 | 2.71875 | 3 | [] | no_license | #include "Vasicek.h"
#include "RungeKutta.h"
#include <cmath>
#include <vector>
#include <iostream>
Vasicek::Vasicek(const double r_input, const double kappa_input, const double theta_input, const double sigma_input, const double step_length_input)
:r(r_input), kappa(kappa_input), theta(theta_input), sigma(sigma_inpu... | true |
cb24c65bda7cbca3744aee0f314962d9bd2bc9d2 | C++ | OpenSuede/Suede | /server/src/http_response.cpp | UTF-8 | 3,420 | 2.6875 | 3 | [
"MIT"
] | permissive | #include <openssl/sha.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/buffer.h>
#include <http_response.hpp>
#include <http_request.hpp>
#include <stdlib.h>
#include <cstring>
#include <string>
using std::string;
/**
* Getter for statusCode
* @return response status code as a string
*/
const ... | true |
3bf7f26ba01a0fe70d02dd15cdf3f678e3c7de31 | C++ | DELTA-FORCE-CTF/Zeus_cpp | /src/util/Util.h | UTF-8 | 1,377 | 2.8125 | 3 | [] | no_license | //
// Created by aurailus on 28/04/19.
//
#ifndef ZEUS_UTIL_H
#define ZEUS_UTIL_H
#include <string>
#include <sstream>
#include <vec3.hpp>
namespace Util {
static std::string floatToString(float val) {
std::ostringstream out;
out.precision(2);
out << std::fixed << val;
return out... | true |
cf069001ccf97cbc734f62c0369e23748f0c81f7 | C++ | stsewd/schedules_manager | /materias.cpp | UTF-8 | 3,869 | 2.78125 | 3 | [
"MIT"
] | permissive | #include <string>
#include <fstream>
#include <iostream>
#include <vector>
#include <regex>
#include <sstream>
#include "materias.h"
#include "docentes.h"
#include "estudiantes.h"
void Materias::set_docentes_file(std::string path)
{
docentes.set_docentes_file(path);
}
void Materias::set_materias_file(std::string... | true |
0037fd455a5b4b477410a756d5447375352764d8 | C++ | itiievskyi/42-CPP-Pool | /day04/ex02/TacticalMarine.cpp | UTF-8 | 1,768 | 2.6875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* TacticalMarine.cpp :+: :+: :+: ... | true |
9a7fa9f24a24be01c1981fb580f7f9acff43362f | C++ | sicojuy/leetcode | /contest/914.cpp | UTF-8 | 684 | 2.75 | 3 | [] | no_license | #include <vector>
using namespace std;
class Solution {
public:
int gcd(int a, int b) {
int t;
while (b != 0) {
t = b;
b = a % b;
a = t;
}
return a;
}
bool hasGroupsSizeX(vector<int>& deck) {
int m[10000] = {0};
int x = 0;... | true |
097393f2d47729df212f8d3fef45869bab3eca35 | C++ | aman955/Competitive-Coding | /Before Novemeber 2017/Codechef/Easy/ADTRI2.cpp | UTF-8 | 750 | 2.703125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool isprime[5000010];
bool ishypotenus[5000010];
vector<int> prime;
int lim=5000000;
void process()
{
memset(isprime,true,sizeof(isprime));
isprime[0]=false;isprime[1]=false; isprime[2]=true;
int i,j;
for(i=2;i*i<=lim;i++)
{
if(isprime[i])
{
... | true |
265ef5ec5b0dffbaed499fd227152830c05d397c | C++ | jiffylubeyou/CS-236-Labs | /Lab 1 Datalog Scanner CS 236/Relation.h | UTF-8 | 2,505 | 3.09375 | 3 | [] | no_license | #ifndef RELATION_H
#define RELATION_H
#include <set>
#include<sstream>
#include"Tuple.h"
#include"Scheme.h"
#include"Predicate.h"
using namespace std;
class Relation
{
public:
Relation(string name, Predicate scheme) { this->name = name; this->scheme = scheme; };
~Relation();
void addTuple(Tuple tuple)
{
tupl... | true |
d4b426834b8410169f808a3f0fa5407e59dd5474 | C++ | JosefHF/DD1388 | /lab2/matris.h | UTF-8 | 3,215 | 3.375 | 3 | [] | no_license | #include <vector>
#include <initializer_list>
template <class T>
class Matris {
public:
// constructors
Matris();
Matris(T x);
Matris(T rows, T columns);
Matris(const Matris<T>& m);
Matris(std::initializer_list<T> list);
~Matris();
//Operators
T& operator()(cons... | true |
b78d1e3091f3530b4512a57293e2814216a3d089 | C++ | cplab/klustakwik | /linalg.h | UTF-8 | 1,288 | 2.8125 | 3 | [] | no_license | /*
* linalg.h
*
* Linear algebra
*
* Created on: 13 Nov 2011
* Author: dan
*/
#ifndef LINALG_H_
#define LINALG_H_
#include "numerics.h"
// Matrix which has the form of a block matrix and a nonzero diagonal
// Unmasked gives the indices corresponding to the block matrix
// Masked gives the indices corres... | true |
4dce0fbf4864ecf16b1e46a953c3dc3d5e215ebc | C++ | braeden-muller/hospitalBeds | /client.h | UTF-8 | 1,089 | 2.78125 | 3 | [] | no_license | #ifndef HOSPITALBEDS_CLIENT_H
#define HOSPITALBEDS_CLIENT_H
#include <algorithm>
#include <string>
#include <chrono>
#include <cpprest/http_client.h>
#include <cpprest/json.h>
#include <cwchar>
#include "db_connection.h"
#pragma comment(lib, "cpprest_2_10")
using namespace web::http::client;
/*!
* Th... | true |
92c48bcd836937d6b6c998208f9ae232866c8af2 | C++ | mattremmel/mrlib | /mrlib/container/String.hpp | UTF-8 | 24,547 | 3.234375 | 3 | [] | no_license | //
// String.hpp
// Archimedes
//
// Created by Matthew Remmel on 7/29/15.
// Copyright (c) 2015 Matthew Remmel. All rights reserved.
//
/*
* The purpose of this class was to add a full featured string
* class to C++.
*/
#ifndef MRLIB_STRING_HPP
#define MRLIB_STRING_HPP
#include <string>
#include <fstream>
#incl... | true |
8af9f8974a6162b3467e20dfe7e8b5a8ae536d16 | C++ | YuzukiTsuru/SingSyn | /lib/libSinsy/util/PhonemeTable.h | UTF-8 | 1,897 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef SINSY_PHONEME_TABLE_H_
#define SINSY_PHONEME_TABLE_H_
#include <map>
#include <vector>
#include <string>
namespace sinsy {
class PhonemeTable {
public:
typedef std::vector<std::string> PhonemeList;
class Result {
public:
//! constructor
Result();
... | true |
f057d8a17a932bbf86d9c56d532469f4cea8579a | C++ | dfr8938/coursera_repo | /cpp_white/const/main.cpp | UTF-8 | 434 | 3.234375 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
const int x = 5;
// x = 6;
// x += 4;
cout << x << endl;
const string s = "Hello, ";
cout << s.size() << endl;
// s += "World!";
cout << s.size() << endl;
const vector<string> strings = {"hello"... | true |
483f4b03a6b372630053bbfba9b1d2a2c939ca57 | C++ | km-9/cleanGITproject | /templateMatcher.h | UTF-8 | 1,251 | 2.640625 | 3 | [] | no_license | #include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace std;
using namespace cv;
namespace templateMatch
{
class templateMatcher
{
public:
//if the matching method uses a mask or not
bool use_mask;
//img: the frame c... | true |
a3e445a2a63915073a01ba21352ca8896639a4f1 | C++ | FuckingError/Interesting-Algorithm | /4.4编辑距离/main.cpp | GB18030 | 1,329 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <cstring>
/*
20181018 21:05:20
ַ
һֲ ɾȥ 滻
dp[i][j] = min{dp[i-1][j]+1,dp[i][j-1]+1,dp[i-1][j-1]+diff} diff=0 d[i-1]==d[j-1] 1
IJ һҪע ǷеȺŰ
*/
using namespace std;
const int N = 100;
char str1[N],str2[N];
int d[N][N]; //༭ ڵǰÿһԪصֵ ʱַӦʱIJ
int min(int a,int b){
return a<b?a:b; //ؽСֵ
}
in... | true |
13507791a22a48d083dda8b4ec7977d7f9f1410d | C++ | TheHappyHearse/Art_Car_Fire | /Art_Car_Fire.ino | UTF-8 | 4,369 | 3.421875 | 3 | [] | no_license | /*
Art Car Flame Effect
2015
~-~-~-~-~-~-~-~-QUESTIONS: ~-~-~_~-~-~-~-~-~-~-~-~-
Shold I be using ints where I put bytes instead?
Can I use arrays instead of so much repetition in
the "determineSequence" function?
*/
//The following go to the pins that control firing the effect
const byte LeftFireSw=2; //Gr... | true |
ad62911e08192cda880d85a0b7b85295f5534a8d | C++ | dmitriano/Awl | /Tests/TypeIndexTest.cpp | UTF-8 | 2,155 | 2.734375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Product: AWL (A Working Library)
// Author: Dmitriano
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "... | true |
793eab2c02aa38d97438c368e0636e51ea6e5e7d | C++ | KorlaMarch/competitive-programming | /main.cpp | UTF-8 | 7,207 | 2.71875 | 3 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <windows.h>
#include <queue>
using namespace std;
char buffer[80][24];
//0 = null
//1 = menu
//2 = play
//3 = high score
//4 = about
//5 = Game over
int score;
int scene = 0;
int currentMenu = 0;
int inGame = 0;
//0 = north
//1 = south
//2 = east
//3 = west
int directio... | true |
5dcc8c540969ca478980a3f80dcb0fc488200d0f | C++ | Oleg20502/infa_2sem | /Lab2/Task6.cpp | UTF-8 | 332 | 2.53125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int nmax, nummax = 1, a;
cin >> a;
nmax = a;
while (a != 0){
cin >> a;
if (a == nmax){
nummax++;
}
else if (a > nmax){
nmax = a;
nummax = 1;
}
}
cout << nummax;
... | true |
8b4c66fb670300bda6555f5ee48db55909d6ee50 | C++ | Zylann/SnowfeetFramework | /include/fm/scene/core/ComponentList.hpp | UTF-8 | 2,106 | 3.15625 | 3 | [] | no_license | #ifndef HEADER_ZN_COMPONENTLIST_HPP_INCLUDED
#define HEADER_ZN_COMPONENTLIST_HPP_INCLUDED
#include <iostream>
#include <cassert>
#include <unordered_set>
#include <fm/types.hpp>
namespace zn
{
// Generic container gathering a specific type of component.
template <class Cmp_T>
class ComponentList
{
public:
// Adds... | true |
7ea7fd741b75a5142730f0d4141fffa0983ec151 | C++ | IamLena/s21_cpp | /cpp05/ex01/Form.cpp | UTF-8 | 1,617 | 3.40625 | 3 | [] | no_license | #include "Form.hpp"
Form::Form() : name(""), ifsigned(false), signgrade(150), executegrade(150) {}
Form::Form(std::string const &name, int signgrade, int executegrade) : name(name), ifsigned(false), signgrade(signgrade), executegrade(executegrade) {
if (signgrade < 1 || executegrade < 1)
throw Form::GradeTooHighExc... | true |
9b03d024fecf9c32c4b1a1be3362329d49f7e347 | C++ | sibsau-STF/Assembler-labs | /Main/main3.cpp | UTF-8 | 1,893 | 2.9375 | 3 | [] | no_license | #include <locale.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <time.h>
#include "../Headers/CashTest.h"
hash::sequenceAllocator* methods;
void Init() {
methods = new hash::sequenceAllocator[3];
methods[0] = hash::orderedSequence;
methods[1] = hash::reversedSequence;
methods[2] = hash::r... | true |
a50f8e9b9d7b89b4d38afa43046860bb5b70875d | C++ | gcl8a/template | /list.h | UTF-8 | 23,148 | 3.109375 | 3 | [] | no_license | /*
* 16.07.21: added Pop() function to make FIFO queue
* 12.05.16: added TListIterator::DeleteCurrent
* 12.04.09: added GetFirst and GetLast()
* 12.03.05: Add Jump() and JumpToFirst() methods
* 12.03.04: added Find(string) method to list
* 11/05/31: Add TSList, a sorted list
* 11/05/31: general maintenance and u... | true |
e016c655d4e3dd0935b30414114ffbd52b766b8c | C++ | ConnorOfLocke/3D_Math_Library | /NewThing/colour.cpp | UTF-8 | 7,605 | 3.046875 | 3 | [] | no_license | #include "colour.h"
colour::colour()
: r(1.0f), g(1.0f), b(1.0f), a(1.0f)
{
}
colour::colour(float a_r, float a_g, float a_b, float a_a)
{
//intresting way of setting of clamping between 1 and 0
if (a_r > 0.0f)
r = (a_r > 1.0f) ? 1.0f: a_r;
else
r = 0.0f;
if (a_g > 0.0f)
g = (a_g > 1.0f) ? 1.0f: a_g;
... | true |
20a98c50aec6b07e8fddd1cd20d44b3da4e62b67 | C++ | nikakogho/codeforces | /Problems/899A.cpp | UTF-8 | 295 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, ones = 0;
cin >> n;
for(int i = 0; i < n; i++)
{
short x;
cin >> x;
ones += x == 1;
}
int twos = n - ones;
int min = twos > ones ? ones : twos;
int teams = min;
ones -= min;
teams += ones / 3;
cout << teams;
}
| true |
eef5f950e1ce0ebacddea8353752ad2fa9ab9ad4 | C++ | mirgk/seat_assignment | /src/commondata.h | UTF-8 | 1,177 | 3.3125 | 3 | [] | no_license | #ifndef COMMON_DATA_H
#define COMMON_DATA_H
#include <string>
namespace seat_assignment {
namespace data {
/*!
* \brief Represents a passenger.
* Uses compiler generated copy constructor and assignment operator.
*/
struct Passenger
{
... | true |
96ca27e49b6af916de173c77a4e5a22478c8d0d1 | C++ | xgc820313/npapi-mdns | /project/_old/usocket.h | UTF-8 | 1,338 | 3.0625 | 3 | [] | no_license | /**
* @file usocket.h
*
* Created on: 2009-11-05
* Author: jldupont
*/
#ifndef USOCKET_H_
#define USOCKET_H_
#include <string>
using namespace std;
/**
* uSocket Exception Class
*/
class uSocketException {
public:
/**
* Create with an `errno`
*/
uSocketException( int _err ) {
err = ... | true |
7c7027671ff3c1182bb107d098cf972d421f197a | C++ | turi-code/GraphLab-Create-SDK | /graphlab/cppipc/common/authentication_base.hpp | UTF-8 | 2,983 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Copyright (C) 2016 Turi
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD license. See the LICENSE file for details.
*/
#ifndef CPPIPC_COMMON_AUTHENTICATION_BASE_HPP
#define CPPIPC_COMMON_AUTHENTICATION_BASE_HPP
#include <string>
#include <graphlab/cppipc... | true |
8ad2e58f7da76cf70fb80633f23db7f5693ba2be | C++ | ankan-ekansh/Competitive-Programming | /DEC18B/comas.cpp | UTF-8 | 1,728 | 2.640625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);
// #endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
vector<int> v;
while(t--){
int n;... | true |
8e9d63bd36249ced280dc23a669679e4bdccfb21 | C++ | oscardh97/figure2d | /triangle.h | UTF-8 | 311 | 2.703125 | 3 | [] | no_license | #pragma once
#include "figure2d.h"
#include "pointer.h"
#include <string>
using std::string;
class Triangle : public Figure2D{
Pointer p1, p2, p3;
double a, b, c;
public:
Triangle(Pointer, Pointer, Pointer);
virtual ~Triangle();
double area()const;
double perimeter()const;
string toString()const;
};
| true |
0dbca3e4be769ffc58ffef87930fbd17d1591263 | C++ | ChaofanChen/ogs5_bhe | /MSH/TM/dtm_plane.cpp | UTF-8 | 2,205 | 2.75 | 3 | [] | no_license | /*
dtm_plane.cpp
>Plane class
last update : 2003.11.24
*/
#include "stdafx.h" /* MFC */
#include "dtm_plane.h"
namespace dtm
{
// Plane
///03.11.24
Plane::Plane(Point* p0,Point* p1,Point* p2)
{
double x0,y0,z0;
double x1,y1,z1;
double x2,y2,z2;
x0 = p0->getX();
y0 = p0-... | true |
11092d6a61aafce1af1fb7d60d2bbc23ecb5e9c4 | C++ | YorickBrain/BWT | /Sa.cpp | GB18030 | 3,477 | 2.78125 | 3 | [] | no_license | int leq(int a1, int a2, int b1, int b2) //ıȽ
{
return (a1 < b1 || a1 == b1 && a2 < b2);
}
int leq(int a1, int a2, int a3, int b1, int b2, int b3) //ıȽ
{
return (a1 < b1 || a1 == b1 && leq(a2, a3, b2, b3));
}
//stably sort a[0 .. n -1] to b[0 .. n-1] , with keys in 0 ... K from r
static void radix... | true |
521783258972519661feb363635a1c6e42becc6f | C++ | xuesongzh/cpp-concurrency | /multithread/30async参数详解.cpp | GB18030 | 2,641 | 3.875 | 4 | [] | no_license | #include <future>
#include <iostream>
#include <string>
#include <thread>
using namespace std;
int mythread() {
cout << "߳id=" << std::this_thread::get_id() << endl;
return 1;
}
int main(void) {
cout << "main thread id =" << std::this_thread::get_id() << endl;
//һ첽
std::future<int> result = std::... | true |
8efb7b911646ce21f92e9644e133bae8ecc68c72 | C++ | tectronics/synit | /src/cnf2aig/aigHash.cpp | UTF-8 | 3,336 | 2.609375 | 3 | [] | no_license | #include <cassert>
#include <climits>
#include <algorithm>
#include "aigHash.h"
using namespace QuteRSAT;
size_t
AigHashFunc::operator() ( const AigNode &a ) const
{
return 2000000011 * unsigned( a[0]._data ) + 2000000033 * unsigned( a[1]._data );
}
/*
size_t
hash_value( const AigNode & node )
{
... | true |
1a0a47b53c92206351404e9056e6216996589650 | C++ | LandReagan/GameOfLife | /tests/Cell_tests.cpp | UTF-8 | 390 | 3.125 | 3 | [] | no_license | #include <catch.hpp>
#include <Cell.hpp>
TEST_CASE("Cell class tests") {
SECTION("Constructors") {
SECTION("Default constructor") {
gol::Cell cell;
REQUIRE(cell.is_alive() == false);
}
}
SECTION("Cell methods 'make_alive()' and 'kill()'") {
gol::Cell cell;
cell.make_alive();
REQUIRE(cell.is_alive... | true |
41802ba6502ba67f3ea4ffa40097b384e684d9a9 | C++ | Ceruleanacg/Crack-Interview | /Legacy/53. Maximum Subarray [LeetCode]/main.cpp | UTF-8 | 982 | 3.109375 | 3 | [
"MIT"
] | permissive | //
// main.cpp
// 53. Maximum Subarray [LeetCode]
//
// Created by Shuyu on 2018/4/9.
// Copyright © 2018年 Shuyu. All rights reserved.
//
#include <iostream>
#include <vector>
class Solution {
public:
int maxSubArray(std::vector<int>& nums) {
std::vector<int> dp(nums.size(), 0);
... | true |
d4b0ccf45584d07c398346d044f78f2b79dab0e2 | C++ | ijwilson/GenTL | /flowSeq.h | UTF-8 | 3,446 | 3.109375 | 3 | [] | no_license |
#ifndef FLOWSEQ_H__
#define FLOWSEQ_H__
#include <string>
#include <algorithm>
#include <vector>
#include <utility> // for pair
using std::ostream;
using std::string;
using std::vector;
/** A class to represent a flow-wise version of a sequence */
class flowSeq {
public:
/** constructors for flowseq ... | true |
b864d9f462149f55518a95340b9be557d65d64ba | C++ | cpcsdk/z80tonops | /src/test.cpp | UTF-8 | 1,022 | 2.75 | 3 | [] | no_license | /**
* @author Romain Giot <giot.romain@gmail.com>
* @licence GPL
* @date 01/2017
*/
#include <cassert>
#include "z802nops.h"
#include <string>
#include <iostream>
void T(const std::string & opcode, z80tonops::Timing nops) {
const z80tonops::Timing duration = z80tonops::duration(opcode);
std::cerr << "Opc... | true |
d0ff3e0bec783f5347155a31298deaf83a09dd5f | C++ | wjddlsy/Algorithm | /Baekjoon/baek_4354_문자열제곱/baek_4354_문자열제곱/main.cpp | UTF-8 | 1,807 | 2.765625 | 3 | [] | no_license | //
// main.cpp
// baek_4354_문자열제곱
//
// Created by 윤정인 on 30/09/2018.
// Copyright © 2018 윤정인. All rights reserved.
//
#include <iostream>
using namespace std;
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
using namespace std;
vector<int> getPi(string p)
{
int m = (int)p... | true |
3b44e281202506eb6386e6e747df5181e138e98a | C++ | mgoyret/INFO_UTN | /INFO_II/tpc/tpc_12/tpc_12/intarr.cpp | UTF-8 | 727 | 3.25 | 3 | [] | no_license | #include "intarr.h"
IntArr::IntArr(int sz)
{
size = sz;
used = 0;
p = new int(size);
}
IntArr::IntArr(int sz,int qtty,int *vec)
{
int i;
if(sz < qtty)
size = qtty;
else
size = sz;
p = new int [size];
for(i=0; i<qtty;i++)
{
p[i] = vec[i];
... | true |
ed4cca60f22e23c0bb203caccfbe8ad5ca4ae2ce | C++ | agloks/Cpp-Study | /Kata-digitalRoot.cpp | UTF-8 | 806 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
/*
1 - diminui os preços do carro a cada turno por percentLossByMonth
2 - fazer isso enquano savingperMonth + startPriceOld < startPriceNew
3 - retorna um vector com o total de turno + a sobra do processo 2
*/
int digital_root(int n)
{
std::str... | true |
e7b4c83157814eb04ef638a25936bde1adbd16e9 | C++ | rsgcaces/AVRFoundations | /MOTORS/DCMotorBasic/DCMotorBasic.ino | UTF-8 | 1,317 | 3.140625 | 3 | [] | no_license | // PROJECT :DC Motor: User control
// PURPOSE :Demonstrates interactive control over motor speed and direction
// AUTHOR :C. D'Arcy
// DATE :2018 07 03
// uC :328
// STATUS :Working
// REFERENCE:http://mail.rsgc.on.ca/~cdarcy/Datasheets/sn754410.pdf
uint8_t directionPin = 8; //slide swi... | true |
bfc77a941bf967d179e567c0298ed644a3a77f2d | C++ | LeoBrilliant/LeetCodeLib | /P101~150/ConvertSortedArrayToBinarySearchTree.cpp | UTF-8 | 1,889 | 3.28125 | 3 | [] | no_license | /*
* ConvertSortedArrayToBinarySearchTree.cpp
*
* Created on: 2016年12月2日
* Author: user
*/
#include "ConvertSortedArrayToBinarySearchTree.h"
ConvertSortedArrayToBinarySearchTree::ConvertSortedArrayToBinarySearchTree() {
// TODO Auto-generated constructor stub
}
ConvertSortedArrayToBinarySe... | true |
70fa8d6fc3eb26e0e3ca014a3c6fc1c3cf11f03d | C++ | Millsy242/GameEngineSFML | /BaseProject/GameEngine/Game/Entity.cpp | UTF-8 | 1,503 | 2.75 | 3 | [] | no_license | //
// Entity.cpp
// BaseProject
//
// Created by Daniel Harvey on 13/09/2019.
// Copyright © 2019 Daniel Harvey. All rights reserved.
//
#include "Entity.hpp"
void Entity::LoadTexture(std::string filepath)
{
Collision::CreateTextureAndBitmask(EntityTexture, filepath);
EntitySprite.setTexture(EntityTexture... | true |
8b3a09916bbfc9937bf9b1fb6294e67f312ae3ae | C++ | minemile/afina | /src/storage/SimpleLRU.cpp | UTF-8 | 3,423 | 2.75 | 3 | [] | no_license | #include "SimpleLRU.h"
namespace Afina {
namespace Backend {
// See MapBasedGlobalLockImpl.h
bool SimpleLRU::Put(const std::string &key, const std::string &value) {
auto it = _lru_index.find(key);
if (it == _lru_index.end()) {
std::size_t size = key.size() + value.size();
CheckLRUCache(size);
... | true |
788a2bd5294a08b5876cd4c70ed88cfa3791cd3b | C++ | ruandaniel/PG | /11. 披萨.cpp | UTF-8 | 1,473 | 3.375 | 3 | [] | no_license | //dp[i][j] means max pizza the first person can get when slices[i:j] remained, assume everyone is smart
//dp[i][j] = max(slices[i] + sum[i+1:j] - dp[i+1][j], slices[j] + sum[i:j-1] - dp[i][j-1])
// = max(sum[i:j] - dp[i+1][j], sum[i:j] - dp[i][j-1])
//dfs with memory
class Solution{
public:
int pizza(vector<i... | true |
9c07b38561d293a5af16234d020955bf9150d163 | C++ | thisjdzhang/Leet_Code | /[67] [Add Binary] [Easy] [Math String] [Facebook] [2 43 66].cpp | UTF-8 | 804 | 3.203125 | 3 | [
"MIT"
] | permissive | /*
Question# + Difficulty + Topic + Company + Similar_Question
[67] [Add Binary] [Easy] [Math String]
[Facebook]
[2 43 66].cpp
*/
class Solution {
public:
string addBinary(string a, string b) {
string str = "";
bool carry = 0;
for(int i =a.size()-1,j = b.size()-1;i>=0||j>=0;i--,j--)
... | true |
9db018e6cd13562a02db95f2705866982b7301b9 | C++ | shubharthaksangharsha/institutional_training | /day5_assingment/q1.cpp | UTF-8 | 879 | 3.484375 | 3 | [] | no_license | #include<iostream>
using namespace std;
class WaveType{
double wavelength;
public:
void input(){
cout<<"The program determines the type of electromagnetic wave\n";
cout<<"Please enter the wavelength in meters of an electromagnetic wave: ";
cin>>wavelength;
}
void display(){
if(wavelength <=1e... | true |
6543f7d1b1f2b256fc4dc475a24e1eee740672cb | C++ | kojima0615/Algorithm_library | /code/BellmanFord.cpp | UTF-8 | 2,282 | 3.15625 | 3 | [] | no_license |
//ベルマンフォード
class BellmanFord
{
public:
typedef struct Edge
{
ll from;
ll to;
ll cost;
Edge(ll f, ll t, ll c) : from(f), to(t), cost(c) {}
} Edge;
ll edge_num, vertex_num, start, goal;
vector<Edge> edges;
vector<ll> dist;
vector<ll> afby_nc;
BellmanFord(l... | true |
6508c2016196aeecd1e8021dfd81ca21b2c8eb05 | C++ | janos32783/UtilityCode | /TestDrivers/SmartPointerTestDriver.h | UTF-8 | 2,549 | 3.140625 | 3 | [] | no_license | //
// Created by molberding on 9/12/2017.
//
#ifndef UTILITYCODE_SMARTPOINTERTESTDRIVER_H
#define UTILITYCODE_SMARTPOINTERTESTDRIVER_H
#include "../DataTypes/SmartPointer.h"
#include "TestDriver.h"
using namespace smart_pointer;
class TestObject {
private:
int val;
public:
TestObject() : val(0) {}
TestO... | true |
c5f152a6a6053c386b6a19db6050c654d3d0a031 | C++ | jamessimonmorris/Lakeshore | /G53GRACW/TextureManager.cpp | UTF-8 | 2,917 | 2.796875 | 3 | [] | no_license | #include "TextureManager.h"
TextureManager::~TextureManager() {
int n = textures.size();
if (n > 0)
glDeleteTextures(n, &textures[0]);
}
GLuint TextureManager::loadImage(const char* filename) {
BITMAPFILEHEADER fileHeader;
BITMAPINFOHEADER infoHeader;
GLuint texObject;
unsigned char *pixelBuffer;
FILE *bitm... | true |