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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a47a121841e885ec7044419b24fa64080951e4c4 | C++ | andrew4356/oop | /lw2/Encode/ConsoleApplication1/Encode_test.cpp | UTF-8 | 1,388 | 2.65625 | 3 | [] | no_license |
#include "stdafx.h"
#include "../Encode/unitForEncode.h"
BOOST_AUTO_TEST_SUITE(HtmlEncode_function)
BOOST_AUTO_TEST_CASE(replacement_the_symbol_apostrophe)
{
const string expectedResult = "'";
string symbol = "\'";
string encode = HtmlEncode(symbol);
BOOST_CHECK(encode == expectedResult);
}
BOOST_A... | true |
5172d8c21645d96d763f3682d429bc5f1f3f1d16 | C++ | Yurickh/UnBanco | /src/UserUnit.cpp | UTF-8 | 12,067 | 2.78125 | 3 | [] | no_license | #include "UserUnit.h"
#include <iostream>
extern list<TableClass> PersUnit::returnList;
//===============CtrlUserLogin=====================
ManType CtrlUserLogin::autent(UsrMatric* usrMatric, UsrPassword* usrPassword) throw (invalid_argument, PersError)
{
PersGetManager getManager;
getManager.execute(usrMatric);... | true |
ca98a5b44f6ca89d68c83891614b9f15cecd0680 | C++ | jhrotko/dynamic_k2tree | /include/dktree/DKtreeNodeIterator.hpp | UTF-8 | 2,137 | 3.09375 | 3 | [] | no_license | #ifndef __D_K_ITERATOR_VERTICE__
#define __D_K_ITERATOR_VERTICE__
#include <iterator>
#include <memory>
#include "../graph/Graph.hpp"
using namespace std;
namespace dynamic_ktree {
template<class dktree>
class DKtreeNodeIterator : public GraphIterator<DKtreeNodeIterator<dktree>> {
public:
using ... | true |
2cae84e239d87397c8987cad4944b0d3202235cb | C++ | ameerj/nxgpucatch | /src/tests/shader/lop3.cpp | UTF-8 | 2,448 | 2.828125 | 3 | [] | no_license | #include <catch2/catch_test_macros.hpp>
#include "eval_util.h"
namespace {
struct Tuple {
uint32_t a, b, c;
};
} // Anonymous namespace
uint32_t Run(Tuple value, std::string code) {
return EvalUtil::Run(".dksh compute\n"
"main:\n"
"MOV R0, c[0x0][0x140];\n"
... | true |
1ba99af28b7bd30367b6af07d5042d538b6ca5dd | C++ | dendibakh/Algorithm-Tasks | /Coursera class/ComplexDataStructures/Graphs/ShortestPath/ShortestPath/TopologicalSort.h | UTF-8 | 558 | 2.640625 | 3 | [] | no_license | #pragma once
#include <queue>
#include <stack>
#include <vector>
#include "EWDiGraph.h"
namespace TpgSort
{
class TopologicalSort
{
void dfs(const EWDiGraph& graph, int v);
public:
typedef std::queue<int> ReversePostOrderContainer;
typedef std::stack<int> PostOrderContainer;
TopologicalSort(const EWDiGraph&... | true |
484a281e600c12c0c692a80101c778dca985e0be | C++ | TIS2018-FMFI/visionlab-meraky | /Odčítavanie/Roi.cpp | UTF-8 | 4,068 | 2.75 | 3 | [] | no_license |
#include "Roi.h"
using namespace std;
Roi::Roi()
{
}
Roi::Roi(string roi_name, double& pos_x, double& pos_y, double& width, double& height, int PDM, string units, string typ)
{
name = roi_name;
x = pos_x;
y = pos_y;
this->width = width;
this->height = height;
this->PDM = PDM;
this->units... | true |
5c4ca461fb6d2ed5b2948ce0136ddd9e274983ac | C++ | Ph0en1xGSeek/ACM | /TOJ/Vector.cpp | UTF-8 | 495 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int arr1[11], arr2[11];
int ca, d, ans;
scanf("%d", &ca);
while(ca--)
{
ans = 0;
scanf("%d", &d);
for(int i = 0; i < d; i++)
scanf("%d", &arr1[i]);
for(int i = 0; i ... | true |
31f48a48a19ce07424c6ec3f84e576f1d7016a1a | C++ | avast/retdec | /src/fileinfo/file_information/file_information_types/dotnet_info.h | UTF-8 | 4,587 | 2.59375 | 3 | [
"MIT",
"Zlib",
"JSON",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"BSD-3-Clause",
"GPL-2.0-only",
"NCSA",
"WTFPL",
"BSL-1.0",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | /**
* @file src/fileinfo/file_information/file_information_types/dotnet_info.h
* @brief Information about .NET.
* @copyright (c) 2017 Avast Software, licensed under the MIT license
*/
#ifndef FILEINFO_FILE_INFORMATION_FILE_INFORMATION_TYPES_DOTNET_INFO_H
#define FILEINFO_FILE_INFORMATION_FILE_INFORMATION_TYPES_DOT... | true |
80920ded499482678ab49e0888949dc9175546f0 | C++ | xingfeT/c-practice | /day-001-100/day-016/problem-2/main.cpp | UTF-8 | 1,599 | 4.09375 | 4 | [] | no_license | /*
* Write a C program that displays the following prompts:
* "Enter the length of the swimming pool:"
* "Enter the width of the swimming pool:"
* "Enter the average depth of the swimming pool:"
*
* After each prompt is displayed, your program should use a scanf()
* function call to accept data from the keyboar... | true |
9d1d8decf1291e05f63bc14e8454351ddc855c4e | C++ | julkifli/microbot_v12.2 | /microbot_v12.2_MOTORTEST/microbot_v12.2_Motor_Test.ino | UTF-8 | 1,226 | 2.640625 | 3 | [] | no_license | /*
MiCROBOT V12.2
Julkifli Awang Besar
C0d3 for Motor Test
Suite with MiCROBOT PCB.
*/
// Motor L
int dir1A = 4;
int dir2A = 9;
int pwmA = 5;
// Motor R
int dir1B = 7;
int dir2B = 8;
int pwmB = 6;
int sw = 12;
void setup()
{
pinMode(dir1A, OUTPUT);
pinMode(dir2A, OUTPUT);
pinMode(pwmA, OUTPUT);
pinM... | true |
a436966cd2373f7874d02f79ea349fa96ab4c5e8 | C++ | rikigigi/sokoban-solver | /boxbomb.cpp | UTF-8 | 3,084 | 2.671875 | 3 | [] | no_license | #include "boxbomb.h"
#include <stack>
std::vector<BoxBombMove> BoxBombFrame::get_possible_moves(){
if (possible_moves_calculated)
return possible_moves;
possible_moves.clear();
std::stack<std::pair<ssize_t,ssize_t> > to_check;
to_check.push(pos);
aux.assign(lx*ly,false);
aux[idx(pos)]=t... | true |
abb4ecd7b8823f404055ca24133bf387b45957a5 | C++ | STEllAR-GROUP/hpxla | /tests/std_complex_cblas_compatibility.cpp | UTF-8 | 1,080 | 2.9375 | 3 | [
"BSL-1.0"
] | permissive | ////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012 Bryce Adelstein-Lelbach
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//////////////////////////////////... | true |
f5d8a9289e68e4d9d4eb79d2d5b50a057976d488 | C++ | swgeek/MacOpenGL | /02_redWindow/02_redWindow.cpp | UTF-8 | 712 | 2.828125 | 3 | [] | no_license |
// complile using: g++ 02_redWindow.cpp -o 02_redWindow -framework OpenGL -framework GLUT
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
void render(void)
{
// clear color buffer to the value set by glClearColor
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
int main(int ar... | true |
5ac1ba79b8670d985469a54b11b83cf80a3d9e05 | C++ | Adil-sc/Zoo-Tycoon | /Zoo.cpp | UTF-8 | 24,340 | 3.421875 | 3 | [] | no_license | /*********************************************************************
** Program Name: Project 2
** Author: Adil Chaudhry
** Date: 1/26/2019
** Description: Zoo.cpp holds the class functions for the Zoo class
*********************************************************************/
#include "Zoo.h"
/******************... | true |
6346c38896bd753d9b73333b4b2ff4012f0a8bd2 | C++ | its-sachin/InterviewBit | /Linkedlist/revList.cpp | UTF-8 | 592 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
//typedef long long int;
#define inf 1e18
#define mod 1000000007
#define pb push_back
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode* reverseList(ListNode* A) {
ListNode* c = A;
if(c==nullptr)
re... | true |
92683c66fc6cdef9acc0f4c7d91b8c86bb044ebf | C++ | turfnima/cppPractice | /hitEffect.cpp | WINDOWS-1252 | 3,435 | 3.46875 | 3 | [] | no_license | #include<iostream>
#include<random>
#include<string>
//Xiaozhi Li
// 2017/11/5
//code for fun...
//my cousin was playing a game Onmyouji
// he asks if anyone can calculate the hit effect of a char.
//so the char casts a snow storm, apply on hit effects three times,
//each time,there is freeze, slow, and additional fre... | true |
e797fea75cade9b4ed2f9ee3fc187b0236496436 | C++ | RaoMiao/freestyle | /RakNet/Include/InternalPacketPool.h | UTF-8 | 2,488 | 2.65625 | 3 | [] | no_license | /* -*- mode: c++; c-file-style: raknet; tab-always-indent: nil; -*- */
/**
* @file
* @brief Internal Packet Pool Class Declaration.
*
* This file is part of RakNet Copyright 2003, 2004
* Rakkarsoft LLC and Kevin Jenkins.
*
* Usage of Raknet is subject to the appropriate licence agreement.
* "Shareware" Licens... | true |
3e3116d8ea0563f2ed6ab0c0f9481c382e35ccbd | C++ | xhdhr10000/alg | /2/heap.h | UTF-8 | 930 | 3.5625 | 4 | [] | no_license | class Heap {
protected:
int *h;
int s;
int p;
public:
Heap(int size) {
this->h = (int*)malloc(sizeof(int)*(size+1));
this->s = size;
this->p = 0;
}
~Heap() {
free(this->h);
}
void push(int item) {
if (this->p + 1 > this->s) {
this->s *= 2;
this->h = (int*)realloc(this->h, sizeof(int)*this->s)... | true |
fac1dabc60fc1f640b0d0b970d64098ea24e720f | C++ | HxTenshi/GraduationProject | /engine/TenshiEngine/Source/Library/easing.h | SHIFT_JIS | 5,387 | 3.46875 | 3 | [] | no_license | #pragma once
//http://easings.net/ja
//C[WO
namespace Easing
{
inline double InQuad(double t, double totaltime, double max, double min)
{
max -= min;
t /= totaltime;
return max*t*t + min;
}
inline double OutQuad(double t, double totaltime, double max, double min)
{
max -= min;
t /= totaltime;
return... | true |
6a3e018847aaa992712e2afb58cb88209b36b21c | C++ | springtiger/GraphicsRoi | /GraphicsRoiLib/graphicsRoiPolygon.cpp | UTF-8 | 11,102 | 2.609375 | 3 | [] | no_license | #include "graphicsRoiPolygon.h"
#include <QEvent>
#include <QGraphicsSceneMouseEvent>
#include <QDebug>
#include <QGraphicsScene>
GraphicsRoiPolygon::GraphicsRoiPolygon(QGraphicsObject *parent)
: GraphicsItemPolygon(parent)
, IRoi(this)
{
init();
}
GraphicsRoiPolygon::GraphicsRoiPolygon(const QPolygonF &... | true |
1f3a66258b41b674449cb573021a0567a43f0c96 | C++ | ChanceXuan/Connect4 | /Strategy.cpp | GB18030 | 5,378 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include "Point.h"
#include "Strategy.h"
#include "UCT.h"
#include <conio.h>
#include <atlstr.h>
Node* root;
bool rootCreated = false;
using namespace std;
const double timeLimit = 2.5; //ʱΪ3s
/*
Ժӿ,úԿƽ̨,ÿδ뵱ǰ״̬,Ҫӵ,ӵһϷӵ,ȻԿƽֱ̨Ϊij
input:
Ϊ˷ֹԶԿƽ̨άɸģдIJΪconst
... | true |
a0f9d15b5c96b590ccc934aa8f17c018fe61d022 | C++ | jamboree/niji | /include/niji/support/box.hpp | UTF-8 | 8,594 | 2.671875 | 3 | [
"BSL-1.0"
] | permissive | /*//////////////////////////////////////////////////////////////////////////////
Copyright (c) 2015 Jamboree
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
///////////////////////////////////////////////////... | true |
da3f797f96f34b413a10d10f99cdf905f9dc10b0 | C++ | MYTE21/Competitive-Programming-Problems | /Codeforces_A, B/Codeforces - 448 (A. Rewards).cpp | UTF-8 | 583 | 3.015625 | 3 | [] | no_license | /*input
1 0 0
1 0 0
1
*/
#include<iostream>
#include<cstdio>
#include<cmath>
#include<math.h>
using namespace std ;
int main()
{
int cup ;
int totalCup = 0 ;
int medal ;
int totalMedal = 0 ;
int shelfNumber ;
int neededShelf = 0 ;
for(int i=0;i<3;i++)
{
cin>>cup ;
totalCup += cup ;
... | true |
391e78d5a6667729cef92639882c9bd8108c0c2a | C++ | thomasmainguy/Echec_Game_Mainguy_Thomas | /SDL_Template/Game.h | UTF-8 | 1,073 | 2.96875 | 3 | [] | no_license | #pragma once
#include <SDL.h>
#include <SDL_image.h>
#include <string>
// forward declaration
class Board;
class Game
{
public:
Game();
~Game();
///<summary>Cree la SDL(window)</summary>
void InitSDL();
///<summary>Creer un new board </summary>
void InitGame();
///<summary>Appelle du event de board</summary>
... | true |
883730a085a66b27afb61f7b03c82d75720dab8c | C++ | green-fox-academy/zolnay | /week_5/exercise/tasks/main.cpp | UTF-8 | 2,302 | 3.765625 | 4 | [] | no_license | #include <iostream>
#include <map>
#include <string>
int main() {
std::map<std::string, int> shoppingList = {
{"Eggs", 200},
{"Milk", 200},
{"Fish", 400},
{"Apples", 150},
{"Bread", 50},
{"Chicken", 550}
};
std::cout << "Th... | true |
1e9a2c35ac0d5b4705c01702f3bce726dceb0dd5 | C++ | mchchiang/senescence | /analysis/src/BeadsInSphere.cpp | UTF-8 | 4,500 | 2.890625 | 3 | [] | no_license | /* BeadsInSphere.cpp
*
* A program that reads the position file and counts
* the average number of heterochromatin baeds within
* a cutoff radius from a heterochromatin bead
*/
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <fstream>
... | true |
124d98ad24ef63cac492d4fa9adfc377bf55b834 | C++ | cpenny42/juce-spotify | /models/spotify_CursorPager.h | UTF-8 | 1,772 | 2.78125 | 3 | [] | no_license | namespace spotify {
template <class T> class CursorPager
{
public:
CursorPager<T>();
CursorPager<T> (const juce::var& pagerJson);
CursorPager<T> (const CursorPager<T>& other);
const juce::String& GetHref() const;
const juce::Array<T>& GetItems() const;
int GetLimit() const;
const juce:... | true |
deb9f656ec92dc994d536c7a6316832807b25aa1 | C++ | SakiAkizuki/ChessGame | /bishop.cc | UTF-8 | 2,255 | 2.953125 | 3 | [] | no_license | #include "bishop.h"
#include "board.h"
#include <vector>
#include <algorithm>
using namespace std;
Bishop::Bishop(int row, int col, char type, Board *board) : Piece(row, col, type, board) {}
bool Bishop::legalMove(int drow, int dcol) {
int row = getRow();
int col = getCol();
Piece *dest = board->getBoard()[drow... | true |
e317cf168db76e64f682e9a12a0b5418783d85fb | C++ | phoopies/DesdeoInterface | /desdeo_interface/ArduinoFiles/Components/Component/Component.cpp | UTF-8 | 814 | 3.078125 | 3 | [] | no_license | /*
Component.cpp - Library for a base component
*/
#include "Arduino.h"
#include "Component.h"
Component::Component(uint8_t id, char type) {
_hasChanged = false;
_type = type;
_id = id;
}
/*
* Function: hasChanged
* --------------------
* Has the component value changed. _hasChanged is mainly up... | true |
c2d2011f1f09260626910e60bc224d39dfbe698f | C++ | decelj/trichoplax | /src/transform_stack.h | UTF-8 | 625 | 2.640625 | 3 | [] | no_license | #ifndef __TRANSFORM_STACK_H__
#define __TRANSFORM_STACK_H__
#include <glm/glm.hpp>
#include <stack>
class TransformStack {
public:
TransformStack();
void push();
void pop();
void transform(const glm::mat4& m);
glm::vec3 transformPoint(const glm::vec3& p) const;
glm::vec3 transformNormal(c... | true |
3e9fbd8b8cc61b1eb98751a7e32a8747f9e8b6cf | C++ | hjmjohnson/XEParallelProg | /HelloWorld/HelloWorld.cpp | UTF-8 | 389 | 2.609375 | 3 | [] | no_license | #include <stdlib.h>
#include <iostream>
#include <omp.h>
int main()
{
// Add first
//#pragma omp parallel default(none) shared(std::cout)
{
// Add second
//#pragma omp critical
{
#if defined(_OPENMP)
int id = omp_get_thread_num();
#else
int id = 0;
#endif
std::cout << "HelloWorld(" << id << ")"
... | true |
b63c4184a57ec3b305ba25d58d54e35eb6792751 | C++ | strange-hawk/data_structure_algorithms | /tree/count_nodes_in_complete_bintree.cpp | UTF-8 | 959 | 3.359375 | 3 | [] | no_license | // complete binary tree - a tree in which all the levels are completely filled except the last level
// the filling of the last level are done from left to right
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
struct Node{
int key;
Node* left;
Node* right;
No... | true |
3cfc4d1947c4bfd38fcfc7f2286f7da4209374e0 | C++ | igorternyuk/TeQtMineSweeper | /rightclickedbutton.cpp | UTF-8 | 477 | 2.75 | 3 | [] | no_license | #include "rightclickedbutton.h"
RightClickedButton::RightClickedButton(int rowNumber, int columnNumber, QWidget* parent) :
QPushButton(parent), rowNumber_(rowNumber), columnNumber_(columnNumber)
{}
void RightClickedButton::mousePressEvent(QMouseEvent* event)
{
if(event->button() == Qt::LeftButton)
emi... | true |
53cfdb4e88d3addf6ade3a31c5079e288fff37f6 | C++ | libSDL2pp/libSDL2pp | /tests/test_pointrect.cc | UTF-8 | 13,447 | 3.125 | 3 | [
"Zlib",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <SDL_main.h>
#include <SDL2pp/Point.hh>
#include <SDL2pp/Rect.hh>
#include "testing.h"
using namespace SDL2pp;
BEGIN_TEST(int, char*[])
{
// Point basic ops
Point p(1,2);
EXPECT_TRUE(p.GetX() == 1 && p.GetY() == 2);
EXPECT_TRUE(p == Point(1,2));
EXPECT_TRUE(p != Point(1,1));
EXPECT_TRUE(p != ... | true |
bf7cae275dbbdf605a0cb8af5812e93508f45e4b | C++ | SydneyDimitra/ASEexamples | /ImageRandom/src/main.cpp | UTF-8 | 784 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include "Image.h"
#include <random>
int main()
{
constexpr size_t width=200;
constexpr size_t height=200;
std::cout<<"testing image\n";
Image test(width,height);
std::random_device rd;
std::default_random_engine re(rd());
std::uniform_int_distribu... | true |
74766d375ea4aa96ca9db7685be4c595dec43df4 | C++ | Vakondzoli/Arduino-MeArm | /Testing - code samples for sensors and display/keypad_working/keypad_working.ino | UTF-8 | 1,516 | 2.921875 | 3 | [] | no_license | /* @file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
*/
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on... | true |
41d58dcc72d1720a90749d7b78bbec4253b94832 | C++ | inaniwa3/test | /explicit/c.cpp | UTF-8 | 572 | 3.4375 | 3 | [] | no_license | #include <cstdio>
class Hoge
{
public:
Hoge(int a) {}
};
class Fuga
{
public:
explicit Fuga(int a) {}
};
void FuncHoge (Hoge hoge) {}
void FuncFuga (Fuga fuga) {}
int main()
{
//// https://ja.cppreference.com/w/cpp/language/copy_initialization
// T object = other; (1)
Hoge hogeA = 1;
/... | true |
b40fdbf78cbb50d8ff2b99a7e589d76626fe826b | C++ | doantue/CS594_Project | /IRC/HandleMessages.cpp | UTF-8 | 8,362 | 2.671875 | 3 | [] | no_license | #include <winsock2.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <istream>
#include <vector>
#include <queue>
#include <thread>
#include <sstream>
#include <iomanip>
#include "SendRecvMsg.h"
#include "Common.h"
#include "SharedTask.h"
#include "MessageStorage.h"
#include "Hand... | true |
931660ebf5499d45e2eeaaf70494aaff51742ab4 | C++ | chorizou/Chess-game | /Queen.cpp | UTF-8 | 679 | 3.125 | 3 | [] | no_license | // Anna Hu
// ahu13, czou9, rmurato2
// Section 02
#include "Queen.h"
/* Defines the legal moves for Queen
* @param start: the starting coordinates
* @param end: the ending coordinates
* @return whether move is legal
*/
bool Queen::legal_move_shape(std::pair<char, char> start, std::pair<char, char> end) const{
... | true |
0e35220a13030dd39da7039dcb1fa4564d4b2f19 | C++ | eric-jacobson/AddressBook | /Contact.cpp | UTF-8 | 3,676 | 3.203125 | 3 | [] | no_license | // Contact.cpp Contact class implementation
#include "Contact.h"
// Constructors
Contact::Contact()
{
phoneNumber = "Unknown";
emailAddress = "Unknown";
birthday = "Unknown";
pictureFile = "Unknown";
}
Contact::Contact(Field phoneIn, Field emailIn, Field birthdayIn, Field pictureIn)
{
phoneNumber = phoneIn;
e... | true |
3508df4bde2fa71d1a99e4cb49d04c6b919e5cb3 | C++ | tangzhanran/LeetCodes | /BestTimetoBuyandSellStockwithCooldown.cpp | UTF-8 | 1,445 | 3.875 | 4 | [] | no_license | // 309. Best Time to Buy and Sell Stock with Cooldown
//
// Say you have an array for which the ith element is the price of a given stock on day i.
//
// Design an algorithm to find the maximum profit.
// You may complete as many transactions as you like
// (ie, buy one and sell one share of the stock multiple times) w... | true |
3b8a897fba0fcd89362ccb2bd7c1657e7afa97f1 | C++ | Nechrito/s0009d-lab-env | /projects/Resource/code/MaterialResource.cpp | UTF-8 | 2,064 | 2.875 | 3 | [
"MIT"
] | permissive | // Copyright © 2020 Philip Lindh
// All rights reserved
#include "MaterialResource.h"
#include <fstream>
#include "CString.h"
bool MaterialResource::Load(const std::string& path, const std::string& name)
{
std::ifstream file(path);
if (!file.is_open())
{
std::cout << "Failed to open " << path << ... | true |
a46539a3011e34fda4a3dc45ff0f0ca99ce3ca8f | C++ | andreasfertig/cppinsights | /tests/Issue81.cpp | UTF-8 | 182 | 3.015625 | 3 | [
"MIT"
] | permissive | auto f(int i)
{ // also `decltype(auto) f(int i)` and `int(*f(int i))[3]`
static int arr[5][3];
return &arr[i];
}
auto *ff(int i)
{
static int arr[5][3];
return &arr[i];
}
| true |
d01f192ff6ff8cade5b1c2bafdd1e97af0862caa | C++ | Sadat97/SuperMarket | /src/Item.cpp | UTF-8 | 905 | 3.25 | 3 | [] | no_license | #include "../include/Item.h"
Item::Item()
{
}
Item::Item(string N,string T,int I,int A,int P)
{
Name=N;
Type=T;
ID=I;
Avamount=A;
Price=P;
}
void Item :: display_items(int s)
{
cout<<"- "<<setw(12)<<this->get_Name()<<" | "<<setw(10)<<this->get_Type()<<" | "<<setw(8)<... | true |
0206dcc39cb5a31479c04a45a0d2f01149b724cc | C++ | BatFace/Hangman | /CompleteBots/Connect4.CPP/Api.cpp | UTF-8 | 5,826 | 2.703125 | 3 | [] | no_license | #include "Api.h"
#include "rest/Response.hpp"
#include "rest/UrlRequest.hpp"
#include "json.hpp"
using json = nlohmann::json;
namespace Api
{
const std::string site("yorkdojoconnect4.azurewebsites.net");
bool Init()
{
#ifdef WIN32
auto wVersionRequested = MAKEWORD(2, 2);
WSAData wsaData;
int ret = WSAS... | true |
5a9d8344efd3bd41d8989e41369af0ce78d75442 | C++ | tinased95/Principles-of-computers-and-programming | /binary search.cpp | UTF-8 | 694 | 3.125 | 3 | [] | no_license | #include<stdio.h>
#define SIZE 5
int main(){
int a[100],i,n,m,c=0,f,e,mid;
printf("Enter the size of an array: ");
scanf("%d",&n);
printf("Enter the elements in ascending order: ");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("Enter the number to be search: "... | true |
61db81774d7e95ee506aec3ff0a0108a43a44072 | C++ | kuangr5950/ga_fcnpr | /lib/mockturtle/include/mockturtle/utils/progress_bar.hpp | UTF-8 | 3,845 | 2.765625 | 3 | [
"MIT"
] | permissive | /* mockturtle: C++ logic network library
* Copyright (C) 2018 EPFL
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the right... | true |
aec37c2cf1b16c95c460df1b2e35f7dc31874f72 | C++ | kristofleroux/uh-ogp1-project | /Stone Age/Stone Age - Qt Application/model/Cards/RangedResourceBuildingCard.cpp | UTF-8 | 1,034 | 2.828125 | 3 | [] | no_license | #include "RangedResourceBuildingCard.h"
#include "../Game.h"
#include "../PlayerBoardItems/Resource.h"
// Constructor
RangedResourceBuildingCard::RangedResourceBuildingCard(int returnPoints, QString imagePath, Game* game, int min, int max) :
BuildingCard{returnPoints, imagePath, game}, m_minimumResources{min}, m_m... | true |
59e0031aab375674b6f8f5789ec2dc3576ecbe69 | C++ | everett1224/mytest | /Curiously_Recurring_Template_Pattern.cc | UTF-8 | 2,551 | 3.609375 | 4 | [] | no_license | ////
//this is Curiously_Recurring_Template_Pattern test
// Q1: static_cast syntax : static_cast<type>(expression)
// Q2: keyword "this" in different scope means different type
// n3376 9.3.2/1
// In the body of a non-static (9.3) member function, the keyword this is a prvalue expression whose value is the address of t... | true |
ce4a2eaa6fc17753246127c2bbf5356810a5ed06 | C++ | codingsf/tcpproxy_libevent | /lev-master/include/levhttp.h | UTF-8 | 4,484 | 2.5625 | 3 | [
"MIT",
"BSL-1.0"
] | permissive | // Copyright (c) 2014 Yasser Asmi
// Released under the MIT License (http://opensource.org/licenses/MIT)
#ifndef _LEVHTTP_H
#define _LEVHTTP_H
#include <iostream>
namespace lev
{
class EvHttpRequest;
class EvHttpServer;
class EvHttpRequest
{
public:
EvHttpRequest(struct evhttp_request* req)
{
mReq =... | true |
767ed27b62a55be7da5e982a48d38032a21f17b8 | C++ | Joann3a/noi | /Noi-OpenJudge/1.编程基础/1.05编程基础之循环控制/CH010506-2.cpp | UTF-8 | 276 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #include <cstdio>
#include <iostream>
using namespace std;
int main()
{
int n, x, maxv=0, minv=10000;
cin >>n; //n=6
for (int i=1; i<=n; i++)
{
cin >> x;
if (x > maxv) maxv = x;
if (x < minv) minv = x;
}
cout << maxv - minv <<endl;
return 0;
}
| true |
7e44e1d96c8ef394ae37328c3934a1d04c2eb026 | C++ | ITAbits/documentacao | /treinamento-c/2016/aula-05/turma-01/Exemplo_002.cpp | UTF-8 | 492 | 3.515625 | 4 | [] | no_license | ///Resolver Flavius Josephus por recursividade com funcoes
#include <stdio.h>
int flaviusJosephus(int n, int k)
{
if (n == 1)
return 1;
return ((flaviusJosephus(n-1,k) + k-1) % n + 1);
}
int main()
{
int n, k, sobrevivente;
printf("PROBLEMA DO FLAVIUS JOSEPHUS\n\n");
printf("Digite o nume... | true |
6a9ea433a1506a1ef39d4a188756624cb108eff6 | C++ | cchadwickk/Labs | /CD/LexicalAnalyser/comment/comment.h | UTF-8 | 1,735 | 3.046875 | 3 | [] | no_license | #include<fstream>
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
class charFileManager{
protected:
ifstream ifile;
ofstream ofile;
char infile[20],oufile[20];
int line;
char ch;
public:
charFileManager(){
line=1;
}
void openfiles(... | true |
caa90b7fbba620c6526036dc14c66dee1024b469 | C++ | gameofmachine/C-for-Financial-Engineering | /homework_level_5/3.6/3.6.1/3.6.1/test.cpp | UTF-8 | 286 | 2.5625 | 3 | [] | no_license | #include"array.h"
#include<iostream>
using namespace XIANGZOU;
void main()
{
Containers::Array a(10);
//cout << a[10] << endl; //runtime error occurs
try
{
cout << a[10] << endl;
}
catch (int err)
{
if (err == -1) cout << "index out of bound" << endl;
}
}
| true |
42841094cdee3c40b8c6b850deddfa77f043a686 | C++ | pepesoriagarcia99/C--_2017-2018 | /repaso/3/main.cpp | UTF-8 | 1,132 | 3.671875 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
float valor_producto;
char tipo_iva;
float iva;
float valor_con_iva;
cout<<"Introduce valor del producto: ";
cin>>valor_producto;
cout<<"tipo de iva (<a>iva general, <b>iva reducido, <c>iva superreducido): ";
cin>>tipo_iva;
if... | true |
ccb5dd449e61543799d326fe0bf9a4e38e240985 | C++ | FennelFetish/InfinityCube | /animations/Rainbow.h | UTF-8 | 1,290 | 2.6875 | 3 | [] | no_license | #pragma once
#include "../Animation.h"
class AnimRainbow : public Animation
{
private:
float t;
public:
AnimRainbow() : t(0) {}
virtual void update(AnimationContext& ctx, long tpf, bool beat) override
{
t += tpf / 1000000.0f;
... | true |
bcb6bbd8c97abeb21478058f755a62cac80023f4 | C++ | sanskriti12/arrays | /array33.cpp | UTF-8 | 281 | 3.34375 | 3 | [] | no_license | //product of two elements in an array..
# include<stdio.h>
# include<stdlib.h>
int main()
{
int n,i,j;
int x=6;
int a[]={1,2,3,4,5,6};
n=sizeof(a)/sizeof(a[0]);
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(a[i]*a[j]==x)
printf("elements are %d and %d",a[i],a[j]);
}
| true |
bc8b8820c7886f78f1df245e2df20018bef1e1c2 | C++ | erhemdiputra/codeforces | /problemset/i-wanna-be-the-guy/main.cpp | UTF-8 | 621 | 2.890625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool checkLvl(int arr[], int n) {
for(int i = 1; i <= n; i++) {
if(arr[i] == 0) {
return false;
}
}
return true;
}
int main() {
int n, p, q, lvl, arr[105];
bool isPass;
memset(arr, 0, sizeof(arr));
cin>>n;
cin>... | true |
97a92fe35c7ddfc6300feb0f811a1fc35470c19f | C++ | ucsd-cse-125-spring-2019/cse125-sp19-group2 | /Shared/Timer.hpp | UTF-8 | 1,776 | 3.578125 | 4 | [] | no_license | #pragma once
#include <functional>
#include <chrono>
/** Utility class for use on the server or client. These are "fake" timers in
* that they are synchronous and the update() function needs to be called on
* them frequently. This is enough for our needs in this case, because we
* have very fast loops on both t... | true |
f1fd7830b78cb31289b4aa197d6dbaa0f697c3d0 | C++ | Amaterasu90/Runner | /Source/Runner/Private/OrbitalActor.cpp | UTF-8 | 2,232 | 2.5625 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#include "Runner.h"
#include "OrbitalActor.h"
// Sets default values
AOrbitalActor::AOrbitalActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCan... | true |
a05a74deb7de691102b3d729b5ff87bf4674365f | C++ | Datta2901/Algorithmic-Implementations | /Advanced DS/Policy Based DS/Problem - 1.cpp | UTF-8 | 5,838 | 2.8125 | 3 | [
"MIT"
] | permissive | // Source(s): https://atcoder.jp/contests/abc190/editorial/639
// NOTE: I tried to the problem using Method 1 (based on similar concept of Merge Sort), but it gave
// TLE on some of the cases, but when I calculated inversions using Method 2 (PBDS), it passed all cases.
// Don't know why it happened as bot... | true |
e3726eaf5b33bbbf1ee976cb28d98b2000306b49 | C++ | bixcoito/ExerciseList | /Q4.cpp | ISO-8859-1 | 949 | 3.6875 | 4 | [] | no_license | #include <iostream>
using namespace std;
float calcular_area(float base, float altura);
int main()
{
/*
Programa AREA DO TRIANGULO
Calcula a rea de um Tringulo.
A rea do Tringulo dada por: (base * altura) / 2.
Dicas: Voc precisa enviar alguma informao para a funo?
Dicas: Quais informaes precisam ser pass... | true |
3f0e933b64b11b67e443db3f1ce7b725aac1faa0 | C++ | ericksonalves/questions | /erickson/tree-top-view/tree-top-view.cpp | UTF-8 | 612 | 3.46875 | 3 | [] | no_license | #include <deque>
void go_left(node* root, std::deque<int>& deque)
{
if (root != nullptr) {
deque.push_front(root->data);
go_left(root->left, deque);
}
}
void go_right(node* root, std::deque<int>& deque)
{
if (root != nullptr) {
deque.push_back(root->data);
go_right(root->ri... | true |
6103101047ad243695df68b44c8bab984fc325ad | C++ | seflopod/InstructorMemory | /InstructorMemory/titlebutton.cpp | UTF-8 | 1,604 | 2.765625 | 3 | [] | no_license | #ifndef _TITLEBUTTON_H_
#include "titlebutton.h"
#endif
#include "game.h"
TitleButton::TitleButton()
{
_canDraw = false;
_drawPriority = 0;
//_texId = -1;
_text = "";
_position = Vector3();
_height = 0.0f;
_width = 0.0f;
}
void TitleButton::init(string text, Vector3 position, float height, float width)
{
_te... | true |
b3416dc23083dbd6b2ef04edec266a82d5305219 | C++ | inatel-codetroopers/notebook | /code/matematica/gcd.cpp | UTF-8 | 246 | 3.34375 | 3 | [] | no_license | // Calcula o maior divisor comum entre A e B
ll A, B;
cin >> A >> B;
cout << __gcd(A, B);
// Calcula o menor multiplo comum entre A e B
ll lcm(ll A, ll B) {
if (A and B)
return abs(A) / __gcd(A, B) * abs(B);
else
return abs(A | B);
} | true |
78431159637c7f730091f24eb6de7a912fe5c644 | C++ | bulacu-magda/Alemia | /data/raw/train/student_3/1188/1185/Wallnut.cpp | UTF-8 | 558 | 2.640625 | 3 | [] | no_license | #include "Wallnut.h"
using namespace GameMechanics;
Wallnut::Wallnut(int rowUp, int colLeft) : Plant(rowUp, colLeft)
{
this->ID = EntityID::WALLNUT;
auto index = getIndex(PLANTS_ID, this->ID);
this->HP = PLANTS_HP[index];
this->cost = PLANTS_COST[index];
this->width = UserInterface::WALLNUT_WIDTH;
}
Wallnut:... | true |
ee4fe18e7938c4dfda96f4f9d6618c2578568404 | C++ | SyedTabishAzam/portfolio | /Others/Games/Making of games - Allegro/Ass 5/Striker/Explosion.cpp | UTF-8 | 2,054 | 3.328125 | 3 | [] | no_license | #include "Explosion.h"
Explosion::Explosion(BITMAP* image, int frame_width, int frame_height, Point position) : Plane(image, frame_width, frame_height, position)
{ //Constructor the calls the constructor of Plane (just like bullet)
type=-1; //Type of explosion is Exclusive, that is a negative number
sp=0... | true |
a1f7f81ca4ec6a2dab5d4af8ce8df3bdf59ecc33 | C++ | peterekepeter/vulkan | /vulkan/VulkanShader.cpp | UTF-8 | 1,182 | 2.84375 | 3 | [] | no_license | #include "pch.h"
#include "VulkanShaderModule.h"
VulkanShaderModule::VulkanShaderModule(VkDevice device, const char* data, size_t size) : device(device) {
Init(data, size);
}
VulkanShaderModule::VulkanShaderModule(VkDevice device, const std::vector<char>& binary) : device(device) {
Init(binary.data(), binary.size()... | true |
b6d01c41394a56a4f7686061afbc2f5190a778c6 | C++ | nopanderer/ps | /star/2446.cpp | UTF-8 | 438 | 3.015625 | 3 | [] | no_license | /**
* Star 9
* 2446
*/
#include <cstdio>
int main(){
int n;
int i,j;
scanf("%d",&n);
for(i=0;i<n-1;i++){
for(j=0;j<i;j++){
printf(" ");
}
for(j=0;j<2*n-1-2*i;j++)
printf("*");
printf("\n");
}
for(i=0;i<n-1;i++){
printf(" ");
}
printf("*\n");
for(i=1;i<n;i++){
fo... | true |
54adb9310c8380b1ef5a483d31d88c02bc0e89c1 | C++ | Ra1nWarden/Online-Judges | /UVa/948.cpp | UTF-8 | 701 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstdio>
int fib[41];
using namespace std;
int main() {
fib[0] = 1;
fib[1] = 2;
for(int i = 2; i < 41; i++)
fib[i] = fib[i-1] + fib[i-2];
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int x;
cin >> x;
int xc = x;
string result(41, '0')... | true |
6a1b672b09cf169348170179a2180c13b68a501e | C++ | kunyuan/FeynCalc | /src/utility/vector.h | UTF-8 | 4,144 | 3.140625 | 3 | [] | no_license |
#ifndef __FeynCalc__vector__
#define __FeynCalc__vector__
#include <initializer_list>
#include <iosfwd>
#include <math.h>
#include <sstream>
#include <vector>
using namespace std;
template <typename T, int D> class Vec {
private:
T _Array[D];
public:
Vec() {}
Vec(std::initializer_list<T> list) {
int i = ... | true |
02a5199587f208721337750309a331dc9b40b760 | C++ | hernanrocha/opengl | /src/Obj.h | UTF-8 | 5,066 | 2.875 | 3 | [] | no_license | #ifndef _OBJ_H
#define _OBJ_H
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <fstream>
#include <vector>
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include <gl\glaux.h... | true |
a99abbc9f9789655bf518bc954234c2610b76a0c | C++ | strncat/competitive-programming | /hacker-rank/graph-theory/kruskal-mst-really-special-subtree.cpp | UTF-8 | 2,741 | 3.34375 | 3 | [] | no_license | //
// Hacker Rank
// Kruskal (MST): Really Special Subtree
//
// Created by Fatima B on 12/30/15.
// Copyright © 2015 Fatima B. All rights reserved.
//
#include <iostream>
#include <vector>
#include <queue>
#include <assert.h>
#include <algorithm>
class Edge {
public:
int x;
int y;
int weight;
Ed... | true |
0623bfb900208fdc7e2c72a207317901c7427981 | C++ | HongfeiXu/LeetCode | /project/src/IntersectionOfTwoArraysII.h | UTF-8 | 2,375 | 3.9375 | 4 | [] | no_license | #pragma once
/*
350. Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection.
Example:
Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].
Note:
Each element in the result should appear as many times as it shows in both arrays.
The result can be in any order.
Follow up... | true |
346eba512915865b8c748088d7a20acc5e6ac286 | C++ | vasta88/CYOE---Zombies | /main.cpp | UTF-8 | 9,135 | 3.171875 | 3 | [] | no_license | #include <iostream>
using namespace std;
char whilstAB(char); //validates input for ab menus
char whilstABC(char); //validates input for abc menus
#include <iostream>
using namespace std;
int main() {
char choice;
cout<<"This program lets you choose the actions you take in a story."<<endl;
cout<<"Read the story, th... | true |
0a8be8f2b294c1cab8898dd53236d2da65ab26d6 | C++ | mustafamengutay/Basic-Projects-with-Cpp | /SimpleEmployeeProject/src/EmployeeSystem.cpp | UTF-8 | 3,038 | 3.9375 | 4 | [] | no_license | #include <iostream>
#include <stdlib.h>
using namespace std;
const int MAX = 10000;
string names[MAX];
int ages[MAX];
double salaries[MAX];
char genders[MAX];
int added = 0; // number of emloyees
int menu() {
// This function provides to see a process which we will use.
int choice = -1;
... | true |
fe945550843911c052c6638b85bd952ab270d6c3 | C++ | pankajkumar9797/hangMan | /hangMan.cpp | UTF-8 | 2,603 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <random>
#include <algorithm>
using namespace std;
class hangMan{
private:
string word;
string update_word;
int chances_left;
bool game_over;
string select_word();
void updat... | true |
8030ff39030c540b766db59e5a473a63b7a601d8 | C++ | Delaunay/Kiwi | /src/TaskRunner/main.cpp | UTF-8 | 3,326 | 3.453125 | 3 | [] | no_license | /*#include <vector>
#include <cassert>
template <typename E>
class MatrixExpression {
public:
typedef typename E::Scalar Scalar;
Scalar operator()(size_t x, size_t y) const { return static_cast<E const&>(*this)(x, y); }
size_t cols() const { return static_cast<E const&>(*this).cols(); }
size_t rows() const { re... | true |
442a23df06c44a777771393d278b44d8bfbf53ad | C++ | corn-eliu/runsepprun | /RunServerRun/ConnectionSender.cpp | UTF-8 | 1,196 | 2.515625 | 3 | [] | no_license | #include "ConnectionSender.h"
#include "Globals.h"
#include "Server.h"
#include "LogicEngine.h"
/*!
* the thread is contructed
*/
ConnectionSender::ConnectionSender(Server *s)
{
running = false;
server = s;
udpSocket = new QUdpSocket();
udpSocket->moveToThread(this);
}
//! Closes the socket and dest... | true |
c51bd22e16d08b88f2ed4c4d02e61790c3e6710b | C++ | aratalin/write_more_code | /174_dungeon_game_H_dp.cpp | UTF-8 | 801 | 2.515625 | 3 | [] | no_license | class Solution {
public:
int calculateMinimumHP(vector<vector<int>>& dungeon) {
if (dungeon.size() == 0) return 0;
int n = dungeon.size(), m = dungeon[0].size();
vector<vector<int>>dp(n, vector<int>(m, INT_MAX));
if(dungeon[n-1][m-1] >= 0) dp[n-1][m-1] = 0;... | true |
1038154ff0ca81a0d3061de56921bd27869bf8e6 | C++ | RodicaMihaelaVasilescu/AdventOfCode2018 | /#11/day11.cpp | UTF-8 | 2,071 | 3.0625 | 3 | [] | no_license | #include <bits/stdc++.h>
#define N 301
using namespace std;
tuple<int, int, int, int> Solve(vector<vector<int>> matrix, int k)
{
int topLeftCornerX, topLeftCornerY, squareLength, sumMax = INT_MIN;
vector<vector<int>> partialSum(N,vector<int>(N)) ;
for (int j = 0; j < N; j++)
{
int s... | true |
e31208081ad6bfdddfd653bc08002f6458fba095 | C++ | harem123/Git | /Sensado celdas/AtomSensado/AtomSensado.ino | UTF-8 | 2,369 | 2.671875 | 3 | [] | no_license |
const int En_WrRd_RS485 = 2;
const int Led_1 = 13;
const int Led_2 = 6;
const int Led_3 = 5;
// ++ pines de sensado my pins y pin de salida
int myPins[] = {7, 8,9};
int sN=00;
boolean flag;
// ++++++++++++++++++++++++++++++
// variables de buffering
char VarChar = ' ';
String BufferIn = "";
boolean S... | true |
e93e9066ac5f476496baca2bc5b1a17726078e5c | C++ | endurodave/StateMachine | /SelfTest.cpp | UTF-8 | 1,869 | 2.828125 | 3 | [
"MIT"
] | permissive | #include "SelfTest.h"
#include <iostream>
using namespace std;
SelfTest::SelfTest(INT maxStates) :
StateMachine(maxStates)
{
}
void SelfTest::Cancel()
{
#if 1
// External event functions in a state machine base class may use a partial transition
// map if preceded by PARENT_TRANSITION. The partial transition ma... | true |
13e67e2a890c9c74b858f4cf566121199aa0724a | C++ | chaoaero/leetcode_answers | /valid_parentheses.cc | UTF-8 | 1,174 | 3.3125 | 3 | [] | no_license | /*==================================================================
* Copyright (C) 2015 All rights reserved.
*
* filename: valid_parentheses.cc
* author: Meng Weichao
* created: 2015/11/10
* description:
*
================================================================*/
#inclu... | true |
673dda9395ade5e61ba9cdcb1498d351c14a5a0d | C++ | evelyn-plee/leetcode | /547_FriendCircles/solution3.cpp | UTF-8 | 1,534 | 3.453125 | 3 | [] | no_license | /**
Union-find
time complexity:O(n^3). Traverse the complete matrix once. Union and find operations take O(n) time in worst case.
space complexity: O(n). Parent array of size n is used.
**/
#include <vector>
#include <unordered_set>
using namespace std;
class UnionFindSet {
public:
UnionFindSet(int n) {
... | true |
ab2d194e36832ef931ba465f4b60b770b1857a47 | C++ | RedXtreme99/utd_projects | /Unix_C++/Project2/Program2Turnin/program2.cpp | UTF-8 | 1,623 | 3.328125 | 3 | [] | no_license | /*
Filename program2.cpp
Date 2/7/2019
Author Basil Elhindi
Email bae170000
Course CS 3377.502 Spring 2019
Version 1.0
Copyright 2019, All Rights Reserved
Description
File containing main that calls the command line parser and reads the input file and writes it to an output ... | true |
57ce53ca9e217fcbd3b1d5b13d2740ed0c4cabf0 | C++ | lutfulrafi/190041210-CSE-4302 | /Lab4/190041210_Task3.cpp | UTF-8 | 1,036 | 3.890625 | 4 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
class Employee
{
private:
string EmpName;
int ID;
int age;
float salary;
public:
void FeedInfo(string name,int i,int a,float sal)
{
EmpName=name;
ID=i;
age=a;
salary=sal;
}
string getStatus()
{
... | true |
b9b7b2ad8472536b64d0aedcc87a694afb8debc3 | C++ | MaksShizo/19 | /Stack_c.h | UTF-8 | 195 | 2.640625 | 3 | [] | no_license | #pragma once
class Stack_c
{
private:
struct Stack
{
char data[20];
Stack* next;
};
Stack* stack;
int n;
Stack* make_stack();
public:
void add_to_stack();
void print_stack();
};
| true |
6270903724cbe46a38bd7042cfc1ce6a198d64cf | C++ | AMJAeioLuz/Personal | /Sensores_y_Modulos/Mandar_lectura_temperatura_por_SERIAL/Mandar_lectura_temperatura_por_SERIAL.ino | UTF-8 | 1,746 | 3.03125 | 3 | [] | no_license | #include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
inline size_t LiquidCrystal_I2C::write(uint8_t value) {
send(value, Rs);
return 1;
}
const int sensor = A0; //entrada del sensor LM35-1
const int sens... | true |
0b2203cce9d7116a48e2d28f2119797aedee204d | C++ | qliu67/compiler | /compiler/LivenessAnalysis.cpp | UTF-8 | 6,952 | 2.609375 | 3 | [] | no_license | #include "llvm/Pass.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/InstIterator.h"
#include "231DFA.h"
#include <set>
#include <algorithm>
using namespace llvm;
using namespace std;
namespace llvm{
class LiveInfo : public Info{
public:
~LiveInfo() {}
/*
* Print out t... | true |
c32005a12312b612f784088554cf397f75c6517b | C++ | MadMuck/fk | /Games/20189004_潮汕麻将/GameCode/Server/majiang/PatternFinder/PatternResultCards.cpp | UTF-8 | 782 | 2.796875 | 3 | [] | no_license | #include "PatternResultCards.h"
PatternResultCardsImpl::PatternResultCardsImpl(int type, const CardList &cards):m_Type(type), m_Cards(cards)
{
for(int i = 0; i < m_Cards.size(); ++i)
{
m_IsJoker.push_back(0);
}
}
PatternResultCardsImpl::PatternResultCardsImpl(int type, const CardList &cards, const CardList &isJo... | true |
48413125774e62239f86a71a95d8a4c603b88763 | C++ | samsank06/my-learnings | /oops-c++/constructors1.cpp | UTF-8 | 543 | 3.4375 | 3 | [] | no_license | #include<iostream>
using namespace std;
class constr{
private:
int a,b;
public:
constr()
{
a=30;
b=40;
}
void display()
{
cout<<"a= "<<a<<endl<<"b="<<b<<endl;
}
~cons... | true |
4d38a93b1445e5d3cca376a398ccee0265f4c8ae | C++ | mguillemot/kamaku.foliage | /foliage/leaf_graphic/graphic_types.hpp | UTF-8 | 2,345 | 3.109375 | 3 | [] | no_license | #ifndef __FOLIAGE_GRAPHIC_TYPES
#define __FOLIAGE_GRAPHIC_TYPES
#include <iostream>
#include "../basic_types.hpp"
#include "../settings.hpp"
#include "../fastmath.hpp"
namespace Foliage
{
typedef Uint16 Color;
enum ScreenMode { YOKO, TATE };
struct Size
{
Sint16 w, h;
Size() : w(0), h(0)
{
}
Si... | true |
d3425f347ba187bd6a6db062b4b71cc7fd581bf3 | C++ | Flovln/42-abstractVm | /includes/Instruction.hpp | UTF-8 | 2,235 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <sstream>
#include <regex>
#include <vector>
#include <list>
#include <string>
#include <string.h>
#include <algorithm>
#include <iterator>
#include "Infos.hpp"
#ifndef INSTRUCTION_HPP
# define INSTRUCTION_HPP
struct Token {
enum Type {
Instruction,
Operan... | true |
f2af1a3f881344d1f53e894539c6ccb8e7713bdd | C++ | BenSeawalker/EntityFramework | /EntityFramework2/EntityManager.cpp | UTF-8 | 3,880 | 3.0625 | 3 | [] | no_license | #include "EntityManager.h"
#include "System.h"
#include "Components.h"
#include <time.h>
#include <thread>
using std::thread;
typedef EntityManager::EID EID;
//void UpdateSystems(EntityManager * _this);
EntityManager::EntityManager()
: m_running(true)
{
thread system_loop(&EntityManager::UpdateSystems, *this, t... | true |
727dc107b39f6b4e83dd50a444c5a22293b68f82 | C++ | 0xJacky/dataStruct-oj | /DS二叉树/DS二叉树--二叉树的中后序遍历及操作/main.cpp | UTF-8 | 3,563 | 3.25 | 3 | [] | no_license | //
// main.cpp
// DS二叉树--二叉树的中后序遍历及操作
//
// Created by Jacky on 2021/5/9.
//
#include <iostream>
using namespace std;
class BiTreeNode {
public:
int data;
BiTreeNode *LeftChild;
BiTreeNode *RightChild;
BiTreeNode *parent;
BiTreeNode() : LeftChild(NULL), RightChild(NULL), parent(NULL) {}
~BiT... | true |
10a70ed598fae5532110e6b29c5889359c9c4021 | C++ | LukasKnd/SlimeShooter | /src/GameEngine.h | UTF-8 | 909 | 2.59375 | 3 | [] | no_license | #ifndef GAMEENGINE_H_INCLUDED
#define GAMEENGINE_H_INCLUDED
#include <vector>
#include <SFML/Graphics.hpp>
#include "./GameState.h"
#include "./Constants.h"
namespace sg {
class GameEngine {
private:
std::vector<GameState*> states;
bool isRunning;
public:
G... | true |
df4f8bc4a68f2aeab09142229b61b68859b82d29 | C++ | xorazmiy1996/wargaming-test-task | /cpp/test/test-cyclic-queue.cpp | UTF-8 | 2,601 | 3.375 | 3 | [
"MIT"
] | permissive | #include <gtest/gtest.h>
#include "simple_class.h"
#include "../src/second/cyclic_queue.h"
TEST(test_cyclic_queue, test_cyclic_queue_with_pod)
{
test_tasks::impl_on_array::statically::cyclic_queue<int, 5> queue1;
// queue is empty, so throw exception
EXPECT_ANY_THROW(queue1.pop());
queue1.push(100);
... | true |
2918c0a6ecab73e97778c6b224836a2786a2478b | C++ | potpath/algo-class | /exercise/ex02/e1_fibo/solution/main.cpp | UTF-8 | 543 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
// read input from keyboard and store in n
int n;
scanf("%d",&n);
int curr; // current fibonacci number
int next; // the next fibonacci number
// compute n-th fibo... | true |
8cd3c559dc65eb698d6dcd2a4584970d20c59766 | C++ | cogito666/Autonomous-Air-Boat-Controller | /BoatController2/PWMWidthCounterI2C.h | UTF-8 | 875 | 2.578125 | 3 | [] | no_license | // PWMWidthCounterI2C.h
#ifndef _PWMWIDTHCOUNTERI2C_h
#define _PWMWIDTHCOUNTERI2C_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#include "PWMWidthCounterIface.h"
#include <Wire.h>
class PWMWidthCounterI2C : public PWMWidthCounterIface{
protected:
union PulseWidth{... | true |