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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dc60c2ce8d50d7e5aadd24b3fdebe72bf3be499d | C++ | avmovie/learning-notes | /notepad/searchdialog.cpp | UTF-8 | 2,481 | 2.703125 | 3 | [] | no_license | #include "searchdialog.h"
SearchDialog::SearchDialog(Config *config, QWidget *parent) :
QWidget(parent), config(config)
{
setupUi(this);
setWindowIcon(QIcon(tr(":images/notepad.png")));
setWindowTitle(tr("Search & Replace"));
findCombo->setMaxCount(config->maxHistory);
findCombo->addItems(confi... | true |
44946c2c168e1ad2a0e371043b6abf62aeaf2f8c | C++ | balramsingh54/CompCod | /c++/pattern/india.cpp | UTF-8 | 221 | 2.625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
string str="INDIA";
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < i; j++)
{
cout<<str[j];
}
cout<<endl;
}
return 0;
} | true |
575bf28ce02faff3bf766b27ce3af333a32ed0b7 | C++ | Rennelovessleeping/LeetCode_Adventure | /BackTracing/291-WordPatternII.cpp | UTF-8 | 1,637 | 3.125 | 3 | [] | no_license | /**************************************************************************
* File Name : 291-WordPatternII.cpp
*
* Purpose :
*
* Creation Date : 26-04-2017
*
* Last Modified : Wed Apr 26 23:14:38 2017
*
* Created By : Renne Bai
**************************************************************************/
class... | true |
b4b9ea4ba7daafaca7f0232af9fd78ab7fcb3c2d | C++ | rohannarde/configurationpuzzles | /JamPuzzle.cpp | UTF-8 | 7,668 | 2.84375 | 3 | [] | no_license | // File: $Id: JamPuzzle.cpp,v 1.2 2011/05/06 00:08:23 rsn5770 Exp $
// Author: Anand Rathod
// Description: Contains the main method to initiate the Traffic
//Jam puzzle and take input values from user.
// Revisions:
// $Log: JamPuzzle.cpp,v $
// Revision 1.2 2011/05/06 00:08:2... | true |
122953020e570904a8d6173ecfb83de2ef82f031 | C++ | nimukelkar/Binary-Tree-Operations | /main.cpp | UTF-8 | 7,049 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include<stack>
using namespace std;
int cl=0;
int ci=0;
class node{
private:
int data;
node* left;
node* right;
public:
friend class tree;
//void create();
};
class tree{
public:
node* root;
tree()
{
root=NULL;
}
void create();
void i... | true |
57fdefad374dbc111edcb257a463c77a490a846f | C++ | yyzYLMF/hihocoder | /1138_islands_travel.cc | UTF-8 | 2,016 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <climits>
using namespace std;
struct Node {
int x;
int y;
};
//TLE Bellman-Ford
int main() {
int N;
int *dp;
Node* store;
int i,j,k,temp;
bool flag;
cin>>N;
if(N<=1) {
cout<<"0"<<endl;
return 0;
}
dp = new i... | true |
d59760f1100781b4e57d264a4b9014124f42ae35 | C++ | IAmBullsaw/acpp | /exams/code20170112/assignment7.cpp | UTF-8 | 1,647 | 3.28125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
#include <iomanip>
#include <iterator>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
class Student {
public:
Student() = default;
Student(string const& name, string const& surname,
string const& pnr, int const& points,
char const& grade... | true |
35e8c9eadf74111da1996657fd4931a9b241438a | C++ | WaitGodot/lua | /ClassToLua.cpp | UTF-8 | 544 | 2.953125 | 3 | [] | no_license | #include "ClassToLua.h"
#include <iostream>
#include "LuaStack.h"
ClassToLua::ClassToLua()
{
m_member = 0;
m_scriptHandler = -1;
}
ClassToLua::~ClassToLua()
{
}
void ClassToLua::print(){
if( m_scriptHandler != -1){
LuaStack::getInstance()->execute(m_scriptHandler);
}else{
std::cout<< "Class: member->" << m_... | true |
370024e69ab68cd4e7f7d4167c1ad6ad70cbc775 | C++ | Spetsnaz-Dev/CPP | /LeetCode/test_.cpp | UTF-8 | 1,135 | 3.03125 | 3 | [] | no_license | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
sort(nums.begin(),nums.end());
set <vector<int> > myset;
int i,left,right;
int n = nums.size();
for(i=0;i<n-2;++i)
{
left = i+1;
right = n-1;
... | true |
b34b16b0787b48211e5b672557483c27044f1496 | C++ | chegestar/airscratch | /AirScratch/riaafilter.cpp | UTF-8 | 2,962 | 2.640625 | 3 | [] | no_license | #include "riaafilter.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
RIAAFilter::RIAAFilter()
{
}
// The Recording side of RIAA Equalization
static float recA[3] = { 1.0000000000, -0.7218922000, -0.1860520545 };
static float recB[3] = { 1.0000000000, -1.7007240000, 0.7029381524 };
static float playA[3] ... | true |
8fcce9e8067ad0a83897afcac5682b25bdc02275 | C++ | Bryan9815/AI-Assignment-2 | /DM2242 AI Framework/Base/Source/Waiter.cpp | UTF-8 | 3,922 | 2.78125 | 3 | [] | no_license | #include "Waiter.h"
#include "Customer.h"
#include "Chef.h"
#define DELAY_TIME 2.f
#define GIVE_ORDER_MSG "New Order!"
#define RECEIVE_FOOD_MSG "Food's ready!"
#define PASS_BILL_MSG "Here's the bill!"
Waiter::Waiter()
{
Name = "Waiter";
EntityManager::GetInstance()->AddEntity(this);
}
Waiter::~Waiter()
{
}
voi... | true |
6b5d614adf18cadb6abb6492ec9401d6f358a8e2 | C++ | AllanNozomu/CompetitiveProgramming | /Leetcode/res/Rotate Image/2.cpp | UTF-8 | 726 | 2.9375 | 3 | [
"MIT"
] | permissive | \*
Author: allannozomu
Runtime: 8 ms
Memory: 9 MB*\
class Solution {
public:
void reverse_lines(vector<vector<int>>& matrix){
for (vector<int> &line : matrix){
reverse(line.begin(), line.end());
}
}
void swap_positions(vector<vector<int>>& matrix){
int N = matrix.si... | true |
3cc1648f657eb24accea8299b1ead1020c5b482f | C++ | sekcheong/Amulet | /src/utils/registry.cc | UTF-8 | 5,627 | 2.921875 | 3 | [] | no_license | // registry.cc
// written by Alan Ferrency
// August 1995
// registry of names for debugging Amulet wrappers and method wrappers.
// only compile this in if we're debugging.
#ifdef DEBUG
#include <am_inc.h>
#include REGISTRY__H // for registry stuff.
#include TYPES__H // for wrappers
#include UNIV_MAP__H // for hash... | true |
54edd25bd710855a183bbc81fe60c78ce5b06908 | C++ | thiagovas/Macaco-Louco | /testinator.cpp | UTF-8 | 2,708 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <fstream>
#include <functional>
#include <iomanip>
#include <sstream>
using namespace std;
string... | true |
141206d7ea731d88223dcd043900176c150547cf | C++ | verloka/CPPFromZero | /src/011.TextFileIO/011.TextFileIO.cpp | UTF-8 | 1,183 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | #include "stdafx.h"
using namespace std;
int main()
{
system("color 70");
setlocale(0, "");
SetConsoleTitle("011.Text File I/O");
//write
string filePath;
string fileContent;
string fileName;
cout << "Enter path for new text file: ";
cin >> filePath;
cout << "Waht are you want to write to file? File conten... | true |
e2e26faf21151652064da301739947ad27bc51c2 | C++ | mingdyuo/TCP-socket-chatting-server | /ChattingServer_v1.1/ChattingClient/LobbyDisplay.h | UHC | 2,587 | 2.9375 | 3 | [] | no_license | #pragma once
#ifndef LOBBY_DISPLAY_H
#define LOBBY_DISPLAY_H
#include "Display.h"
#include <map>
#include <string>
class LobbyDisplay : public Display
{
public:
LobbyDisplay() = delete;
LobbyDisplay(uint32_t id) :
myId_(id), cursorIndex_(4), lowerLimit_(4)
{}
void UpdatePlayer(uint32_t id, std::string name)
... | true |
e8d24700112f29fdf47fee22d2c24ec341c13245 | C++ | PenteractStudios/Tesseract | /Project/Libs/MathGeoLib/Math/TransformOps.cpp | ISO-8859-1 | 8,629 | 2.84375 | 3 | [
"MIT"
] | permissive | /* Copyright Jukka Jylnki
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... | true |
009d4f244a27bcabb01152c4d31d79c04b6b1124 | C++ | DeercoderCourse/Course-Project | /C++/code/chap9_8/chap9_8/chap9_8.cpp | GB18030 | 4,664 | 3.421875 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int MAX = 23;
class SET{
int *elem; //żԪصĶ̬ڴ
int count,total; //ĿǰԪظԪظ
public:
SET(int total);
SET(const SET&);
int find(int val) const;
int full() const;
int empty() const;
virtual SET operator +(const SET&);
virtual SET operator -(const SET &)const; //... | true |
9ad53ed90e1efc006471cc25a461acd998503ca0 | C++ | guille31794/AAED | /Práctica 1/Ej 8/cuadrado.cpp | UTF-8 | 462 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include "cronometro.h"
using namespace std;
inline double cuadrado (double cuadrado) {return cuadrado * cuadrado;}
int main(int argc, char const *argv[]) {
int contador = 0; cronometro cronometro;
double numeroAElevar;
cout << "Introduzca el numero: ";
cin >> numeroAElevar;
cronometro.a... | true |
12443ffd11a7e908005b0fdde1e628e05b1ce674 | C++ | Eradan94/Mastercraft-CB | /glimac/src/Chunk.cpp | UTF-8 | 11,775 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <utility>
#include "glimac/common.hpp"
#include "glimac/Chunk.hpp"
#include <glimac/glm.hpp>
namespace glimac {
void Chunk::build(unsigned char** worldHeightArray, Color** worldTerrainArray, const int& x, const int& y, const int& z) {
int terrain;
int ... | true |
1f9b2e3132121666957aa6cc691112f270287b90 | C++ | norshtein/train | /poj3440/main.cpp | UTF-8 | 1,905 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
const char* prefix[] = {"","Probability of covering 1 tile = ","Probability of covering 2 tiles = ","Probability of covering 3 tiles = ","Probability of covering 4 tiles = "};... | true |
e6ef6d3390c0ba606c3c4f5822790400834f0be6 | C++ | smhaaker/atari-arduino | /AtariController/AtariController/AtariController.ino | UTF-8 | 1,281 | 2.96875 | 3 | [] | no_license | #include "Keyboard.h" //include the library used for keyboard commands
void setup() {
Serial.begin(9600);
delay(5000);
pinMode(3, INPUT_PULLUP); //define all pins uses as inputs
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, OUTPUT);
Keyboard.begi... | true |
b9e78317e338eb2913e18aa3c4d767d151adeee0 | C++ | rhayatin/C-- | /Turn an image by 90 degree.cpp | UTF-8 | 393 | 2.734375 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int r,c;
char arr1[4][8]={"***^***","***|***","***|***","***|***"};
char arr[100][100];
while(1)
{
r=4;c=7;
for(int i=0;i<r;i++)
for(int j=0;j<c;j++)
arr[j][r-i-1]=arr1[i][j];
for(int i=0;i<c;i++)
{
for(int j=0;j<r... | true |
13c67a1fbe7b233bec72c127466ecae421c78c1a | C++ | reFreshD2/AoN | /main.cpp | UTF-8 | 11,227 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <string.h>
using namespace std;
struct Element {
char *str;
Element *Prev, *Next;
};
class StringDL {
Element *H, *T;
unsigned int LengthElem;
void Add(const char *elem) {
Element *temp = new Element;
temp->Next = nullptr;
temp->str = new char... | true |
0b2cb2ba36b19cbc5b18cad3db33d5db1b9dbbf5 | C++ | rafa95359/programacionCOmpetitiva | /HackerRank/palindrome-index.cpp | UTF-8 | 1,088 | 2.953125 | 3 | [] | no_license | #include <bits/stdc++.h>
typedef long long Long;
using namespace std;
pair <bool,int> palindromo(string c){
pair <bool,int>resp;
for(Long i=0;i<c.size()/2 ;i++){
if(c[i] != c[c.size()-i-1]) {
resp.first=false;
resp.second=i;
return resp;
}
}
resp.fir... | true |
6ba06f8b7155d8a910923f83100e9449bc02aad4 | C++ | mkmpvtltd1/Webinaria | /src/common/Folders.h | UTF-8 | 1,260 | 2.65625 | 3 | [
"MIT"
] | permissive | #pragma once
class Folders
{
private:
Folders();
static bool BuildPathFromBase(TCHAR *path, const TCHAR *base, const TCHAR *subPath);
public:
static const TCHAR* My(); // Returns path to module which is currently executing.
static const TCHAR* Home(); ... | true |
5d9ffbc071b3e586aed89dfd09bf6e980b467cbb | C++ | Peter-Roger/linear_algebra | /tests.cpp | UTF-8 | 11,036 | 3.125 | 3 | [] | no_license | #include <string>
#include <iostream>
#include <sstream>
#include <random>
#include <stdexcept>
#include "linear_algebra.hpp"
using namespace linear_algebra;
class TestMatrix {
public:
void run() {
std::cout << "Running tests:" << std::endl;
// matrix
test_dft_ctor();
test_std_ct... | true |
78072367c11f2f580534f941fe0f64c6bc5c1952 | C++ | ValentinUsedREKTItsSuperEffective/REKTgine | /src/Screen.cpp | UTF-8 | 225 | 2.59375 | 3 | [] | no_license | #include "Screen.hpp"
unsigned int Screen::width = 0;
unsigned int Screen::height = 0;
Screen::Screen(unsigned int width, unsigned int height){
Screen::width = width;
Screen::height = height;
}
Screen::~Screen(){}
| true |
bd7615728fb70a5c0a91a885ed61766d87b48f62 | C++ | jlewis2112/CPTS-440 | /HW9 Final/Agent.cc | UTF-8 | 37,297 | 2.734375 | 3 | [] | no_license | // Agent.cc
//
// This code works only for the testworld that comes with the simulator.
//Joseph
//Lewis
//HW 9
//I tried moving my global variables to the .h file. I had some errors doing that.
#include <iostream>
#include <list>
#include "Agent.h"
using namespace std;
int stench[11][11]; //array of stench location... | true |
c94ff49a3d821c45f7fde921e74f6b365bcd8e0b | C++ | anonymous007-coder/Jumping-Into-CPP-Exercises | /ch16-recursion/Recursive Linked List/main.cpp | UTF-8 | 2,331 | 4.03125 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
struct node
{
string keyVal;
node* next;
};
void traverse(node* restOfList)
{
if (restOfList != NULL)
{
cout << restOfList->keyVal << endl;
traverse(restOfList->next);
}
}
node* addElement(node* restOf... | true |
276fb14fed9c71769968ac9c6f7442b227a7f473 | C++ | abhijithneilabraham/TESLA_Robotic-arm | /Sweep.ino | UTF-8 | 976 | 2.78125 | 3 | [] | no_license | #include <Servo.h>
Servo servo1, servo2, servo3, servo4, servo5 servo6;
int pos = 0;
const int pingPin = 7;
const int echoPin = 6;
void setup()
{
Serial.begin(9600);
pinMode(pingPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void ultrasonic()
{
long duration, distance;
digitalWrite(pi... | true |
d95d5efce8ddb6e0fde9d776282fdaee6e4b7b1e | C++ | OSLL/vpulse | /calculator.h | UTF-8 | 4,352 | 3.21875 | 3 | [] | no_license | #ifndef CALCULATOR_H
#define CALCULATOR_H
#endif // CALCULATOR_H
#include <utility>
#include <conf.h>
#include <videoreader.h>
#include <processor.h>
#include <mat.h>
using harmonic_stat = pair<double,double>; //a data type for holding information about an harmonic oscillation, first is amplitude, second is period... | true |
ffb39f16b379686db84f51d7702fdc4321671612 | C++ | gbrlas/AVSP | /CodeJamCrawler/dataset/09_24594_76.cpp | UTF-8 | 1,690 | 3.375 | 3 | [] | no_license | // string constructor
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
bool MatchPattern (std::string word, std::string pattern)
{
int wptr = 0;
bool flag = false;
for (unsigned int pptr = 0; pptr < pattern.length(); pptr ++)
{
if (pattern.at(pptr) ... | true |
958b259ccf50bd256c8e0c72c875aab4f3376340 | C++ | sunsidi/Leetcode | /27.cpp | UTF-8 | 481 | 3.96875 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int removeElement(vector<int> &nums, int value) {
int pos = 0;
for(int num:nums) {
if(num !=value){
nums[pos] = num;
pos++;
}
}
return pos;
}
int main() {
vector<int> nums = {1,2,3,4,5,6,1,2,3,4,5,6,7,1,2,3,4,5};
int value = 4;
int pos = remov... | true |
894cdb2be85d300d4c9932beb00a6121c31e79f7 | C++ | CPKai/leetcode | /leetcode_17.cpp | UTF-8 | 1,600 | 3.734375 | 4 | [] | no_license | #include <vector>
#include <string>
using namespace std;
class Solution17 {
public:
vector<string> letterCombinations(string digits) {
vector<vector<char>> d(10);
d[0] = {' '};
d[1] = {};
d[2] = {'a','b','c'};
d[3] = {'d','e','f'};
d[4] = {'g','h','i'};
... | true |
6cf92f2b00aa549fef55d0ebdb936bfab4818cc6 | C++ | riplaboratory/Kanaloa | /SurfaceVehicles/WAMV/Arduino/KillMega/a20190915_wamvKillArduino/io.ino | UTF-8 | 3,747 | 2.796875 | 3 | [] | no_license | void readRemoteKill() {
/*
Checks the receiver channel 4 and sets remoteKillStatus based on it.
*/
// Create local, non-volatile copy of pulse widths (QuickMedian does not like volatile arrays)
int ch4PulseFilt[nMedian] = {};
memcpy(ch4PulseFilt, ch4PulseArray, nMedian * 2);
// Take median of pulse w... | true |
fd1dc5aac2a55c86a0cdc72b54f90c03e96f16a1 | C++ | samuelbrown3199/AI-Assignment | /Code/AssignmentAI/AStar.cpp | UTF-8 | 4,735 | 3.703125 | 4 | [] | no_license | #include "AStar.h"
AStar::AStar(Maze* _maze)
{
currentMaze = _maze; //keeps a pointer of the current maze
nodeAmount = currentMaze->tileData.size(); //works out the amount of nodes in the maze
SetupNodeList(); //sets up the node data
Algorithm(); //starts the algorithm
}
AStar::~AStar()
{
}
void AStar::SetupN... | true |
38e400c99459c2fe7b01e948943e482ffabbc783 | C++ | shanPic/CodeOfAcm | /2017训练比赛/9.16西安网络赛/e.cpp | UTF-8 | 830 | 2.53125 | 3 | [] | no_license | /*
* @FileName: D:\代码与算法\2017训练比赛\9.16西安网络赛\e.cpp
* @Author: Pic
* @Created Time: 2017/9/16 13:37:07
*/
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
const ll mod=999999999;
ll sum(ll x)
{
ll res=0;
while(x){
res+=(x%10);
x=x/10;
}
return res;
}
ll cal(ll i)
{
ll res=0;
res... | true |
ee2f3a794644cec1803e7810d2d1b6e6edb8a258 | C++ | xshaheen/cpp-data-structure | /BinaryTree/TreeType.h | UTF-8 | 9,210 | 3.75 | 4 | [] | no_license | // Created by Mahmoud Shaheen on 5/8/2019.
// Implementation of binary tree.
// TODO: test code well
#ifndef TREETYPE_H
#define TREETYPE_H
#include <iostream>
#include "QueueType.h"
template <class ItemType>
struct TreeNode{
ItemType info;
TreeNode<ItemType> *left;
TreeNode<ItemType> *right;
};
enum Order... | true |
6f29df15ead7f5bb279b3d9e72971dd3c1c2fc5c | C++ | joonas-yoon/PS | /BOJ/16431.cpp | UTF-8 | 1,194 | 2.5625 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;
typedef int lld;
typedef pair<int, int> ii;
int jy, jx;
char visit[1001][1001];
static int ddy[] = {-1,0,0,1,-1,... | true |
8ff897b92b911ddb0ab48806df2448c386e226b4 | C++ | heykenwu/Geographic-Information-System | /NameIndex.cpp | UTF-8 | 3,620 | 2.796875 | 3 | [] | no_license | #include "NameIndex.h"
unsigned int NameIndex::elfhash(string key){
unsigned int h = 0;
unsigned int s;
for (int i =0; i < key.length(); i++) {
h = (h << 4) + key[i];
s = h & 0xf0000000L;
if(s) {
h ^= s >> 24;
}
h &= ~s;
}
return h;
}
void Name... | true |
292082a700ae894964021076040508a5434dfb16 | C++ | eecs280staff/unit_test_framework | /unit_test_framework.hpp | UTF-8 | 22,044 | 2.6875 | 3 | [
"MIT"
] | permissive | #ifndef UNIT_TEST_FRAMEWORK_HPP
#define UNIT_TEST_FRAMEWORK_HPP
#include <map>
#include <utility>
#include <string>
#include <iostream>
#include <sstream>
#include <cmath>
#include <memory>
#include <vector>
#include <typeinfo>
#include <type_traits>
#include <cstdlib>
#include <iterator>
#include <algorithm>
#include... | true |
365e2570c91e74dfd2b5bd52e32f68aec4672b5b | C++ | AlexaEgorova/KiTG | /fordBellman.cpp | UTF-8 | 1,700 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
long long inf = 1e7; //изначально расстояние до всех вершин будет равно бесконечности = 10000000
int n, m;
cin >> n >> m;
vector<int> H(n, -1), L(m), I(m), J(m), C(m);
for (int i = 0; i < m; i += 1){
cin >> I[i] >> J[i]... | true |
c8726ddbc0611ba50041a2407fac69cde0f84b6f | C++ | sikorski-as/script-interpreter | /structures/ast/VariableDefinition.h | UTF-8 | 822 | 3.03125 | 3 | [] | no_license | #ifndef TKOM_INTERPRETER_VARIABLEDEFINITION_H
#define TKOM_INTERPRETER_VARIABLEDEFINITION_H
#include <string>
#include "Statement.h"
#include "Assignable.h"
class VariableDefinition : public Statement{
public:
VariableDefinition(std::string typeName, std::string name, Assignable::ptr value)
: name(nam... | true |
bf73b8cb60bea4bf2fadbbd3a9f24fc98a7018ac | C++ | wangjianfei/Tony_high_C | /own_study_1020/class_exec.cpp | UTF-8 | 1,743 | 4.15625 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Time
{
public:
void set_time(); //公共成员函数
void show_time(); //公共成员函数
private:
int hour;
int minute;
int sec;
};
void Time::set_time()
{
cout<<"please input hour"<<endl;
cin>>hour;
cout<<"please input minute"<<endl;
c... | true |
facdf92985604c154db801ffb40ee971e68224ed | C++ | JakeBrawer/misc | /classes/yale/oop/HW3/conway_main.cpp | UTF-8 | 2,299 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <string>
#include "conway.h"
using cs427_527::Conway;
int main(int argc, char **argv)
{
char *s = argv[0] + strlen(argv[0]) - 1;
while (s > argv[0] && *(s - 1) != '/')
{
s--;
}
std::string exeNa... | true |
4edda2151d6fc8e396a3cfb20fe55cf8afea9340 | C++ | MuazAlhaidar/Fall-2020---AI-Class-Search-Algorithms-HW1---Console---Individual-Project | /PrioritySearch.hpp | UTF-8 | 1,580 | 2.859375 | 3 | [] | no_license | #ifndef _PRIORITY_
#define _PRIORITY_
#include "NodeAndMap.hpp"
#include <iostream>
using namespace NodeAndMap_namespace;
namespace PrioritySearch_namespace {
template <class T>
void PrioritySearch() {
std::priority_queue<node, std::vector<node>, T> frontierSet;
setMapAndSets();
frontierSet.push(nodeG... | true |
1442d185ac2bbf28d29324428220b04b1eff12bf | C++ | Saharokrafinad/OOP_Panasenko | /OOP_Panasenko/Main.cpp | UTF-8 | 751 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include "Program.h"
using namespace std;
int main(int argc, char* argv[])
{
setlocale(LC_ALL, "Russian");
if (argc != 3)
{
cout << "Не найдены файлы in_file out_file" << endl;
system("pause");
exit(1);
}
ifstream inFileStream(argv[1]);
ofstream outFileStream(argv[2]);
Container c;
... | true |
9432aa1122f6427e2dce3243330d8f6e2e194be2 | C++ | Sondro/Acid | /Sources/Graphics/Commands/CommandPool.hpp | UTF-8 | 596 | 2.78125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <thread>
#include <vulkan/vulkan.h>
#include "Export.hpp"
namespace acid {
/**
* @brief Class that represents a command pool.
*/
class ACID_EXPORT CommandPool {
public:
explicit CommandPool(const std::thread::id &threadId = std::this_thread::get_id());
~CommandPool();
operator const VkCo... | true |
08fb0bbed5865548356a4645afab0ff69ddd4623 | C++ | D3E0/RTA | /Solved/Multi-University Training Contest/E-Sort StringB.cpp | UTF-8 | 1,586 | 2.6875 | 3 | [] | no_license | //============================================================================
//Name:牛客多校第三场 E Sort String 字符串Hash
//https://www.nowcoder.com/acm/contest/141/E
//============================================================================
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
t... | true |
ab8870293d7b2bd2e5375e4f23cfba81c4b245d3 | C++ | iagsav/AS | /T4/AvdeevaAN/task2.cpp | UTF-8 | 878 | 3.421875 | 3 | [] | no_license | #include<stdio.h>
#include<vector>
#include<time.h>
#include<stdlib.h>
using namespace std;
vector<int> countingSort(vector<int>& a, int max)
{
vector<int> counts;
counts.resize(max);
for(auto& it : a)
{
counts[it]++;
}
for(int index = 1; index < max; index++)
{
counts[in... | true |
3a487a64c8e4b01e2543176566b84dbfb3ae8315 | C++ | cleggacus/opengl-tetris | /src/game/Cell.h | UTF-8 | 987 | 3.0625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <array>
#include "../include/VertexBuffer.h"
using namespace std;
struct Vertex{
float positionX;
float positionY;
float texCoordX;
float texCoordY;
float color;
};
enum BlockType {
none, I, J, L, O, S, T, Z
};
class Cell{
private:
unsi... | true |
76eca800426f4768d5314fe8b17e298b928db352 | C++ | CdTCzech/AdventOfCode2015 | /Days/Day13.cpp | UTF-8 | 2,887 | 2.953125 | 3 | [] | no_license | #include "Day13.h"
#include "../FileReader.h"
#include <algorithm>
#include <iterator>
#include <map>
#include <sstream>
#include <string>
namespace day13
{
int64_t part1()
{
std::map<std::string, Person> persons;
int64_t result = 0;
for (const auto& line : getLineByLine<std::vector<std::string>>("Days\\day... | true |
91749b9dee9c8529d52d9890a3e01e267d38349d | C++ | HidehikoKondo/TheLastHairCocos2dx | /the_last_hair2dx/Classes/game/GameRuleManager.cpp | UTF-8 | 2,298 | 2.640625 | 3 | [] | no_license | //
// GameRuleManager.cpp
// ther_last_hair2dx
//
// Created by 大原幸夫 on 2014/08/07.
//
//
#include "GameRuleManager.h"
USING_NS_CC;
GameRuleManager::GameRuleManager()
{
}
GameRuleManager::~GameRuleManager()
{
}
/**
* シングルトンインスタンス
*/
GameRuleManager * GameRuleManager::getInstance()
{
static GameRu... | true |
ee4f5d04b8dfe4ce2f44e2da73d3b476679f0c94 | C++ | enarantu/ProjectEuler | /self_contained_solutions/problem36.cpp | UTF-8 | 812 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Num{
int number;
string dec;
string bin;
public:
Num(int x);
bool isDoublePalindome();
};
int main(){
long long sum = 0;
for(long long i = 1 ; i < 1000000 ; i++){
Num n(i);
if(n.isDoublePalindome()){
sum += i;
}
}
cout << sum << endl... | true |
7d4baf4c991f1df176a1733416a01f7956bb073e | C++ | RiverApril/AAAA | /Document.hpp | UTF-8 | 1,901 | 2.609375 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
#define VERSION_NORMAL 1
#define VERSION_COLOR 2
#define C_DARK_BLACK 0x0 // white when background is black
#define C_DARK_RED 0x1
#define C_DARK_GREEN 0x2
#define C_DARK_YELLOW 0x3
#define C_DARK_BLUE 0x4
#define C_DARK_MAGENTA 0x5
#define C_DARK_CYAN 0x6
#define C_D... | true |
571c46bb3291cfb132cbcb5343385f11fa06bcde | C++ | SunNEET/LeetCode | /HighFrequency/65. Valid Number.cpp | UTF-8 | 2,304 | 3.625 | 4 | [] | no_license | class Solution {
public:
bool isNumber(string s) {
// 一個數字的構成 = 符號 + 浮點數 + e + 符號 + 整數
// 用 DFA 來處理這個問題會比較容易,可以把每個字元的輸入看成狀態的input,讓他發生轉移
// 先整裡一下怎麼設定不同狀態,再來設定彼此之間怎麼移轉,做題前把狀態機先畫出來
// s0: 起始狀態 (什麼都沒有)
// s1: 前半部有了"+-"符號 ("+" or "-" or " +"...)
// s2: 前半部有了數字("12" or ... | true |
002049c8e66a98d74ce65499db58b875ab791987 | C++ | xRiveria/Amethyst | /Amethyst/Source/Runtime/ECS/World.h | UTF-8 | 1,537 | 2.515625 | 3 | [] | no_license | #pragma once
#include "../../Core/ISubsystem.h"
#include <vector>
#include <string>
namespace Amethyst
{
class Context;
class Entity;
class World : public ISubsystem
{
public:
World(Context* engineContext);
~World();
// === Subsystem ===
bool OnInitialize() override;
void OnUpdate(float deltaTime) ove... | true |
e12071ac63b98b2ac3936487e446d03f1c094312 | C++ | Jasonzhu0314/cpp-review | /map/map_sort.cc | UTF-8 | 865 | 3.1875 | 3 | [] | no_license | /*************************************************************************
> File Name: map_sort.cc
> Author:Jasonzhu
> Mail: jasonzhu_0314@163.com
> Created Time: Tue 13 Jul 2021 07:59:17 AM CST
************************************************************************/
#include <iostream>
#include <map>
using na... | true |
640afd31ad04e7fe46c2128cc2e3954821aaa8a3 | C++ | piyushsaha/graph-algorithms | /sssp_undirected_unweighted_bfs.cpp | UTF-8 | 1,857 | 3.203125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int V;
vector<int> *adj;
//char *labels;
bool *visited;
int *parent;
void insertEdge(int u, int v) {
adj[u].push_back(v);
adj[v].push_back(u);
}
bool DFSRec(int s, int parent) {
visited[s] = true;
for(int a=0; a<adj[s].size(); a++) {
int adjacent = adj[s][a];
/... | true |
a5ae46bf718085c258af78782a4c215d40e1e2e4 | C++ | simhoonnam/algorithm | /Recursion Function,DFS,BFS/2.cpp | UTF-8 | 477 | 3.078125 | 3 | [] | no_license | #include<stdio.h>
int result[11000000], tmp = 0, middle = 0;
void binaryTree(int n) {
if (n == 1) {
result[tmp++] = n;
}
else{
binaryTree(n - 1);
result[tmp++] = n;
if (n != middle)
binaryTree(n - 1);
}
}
int main() {
int n, i;
scanf("%d",&n);
middle = n;
binaryTree(n);
... | true |
af3b49e58e78ae424fdb4c880f630b5513f3fcd4 | C++ | jrbitt/quimera | /Quimera/Atributo.h | UTF-8 | 350 | 3.375 | 3 | [] | no_license | #pragma once
template<class V>
class Atributo
{
private:
string nome;
V valor;
public:
Atributo() {
nome = "";
}
Atributo(string n, V v) {
nome = n;
valor = v;
}
~Atributo(){}
void setNome(string n) {
nome = n;
}
void setValor(V v) {
valor = v;
}
string getNome() {
return nome;
}
V getVal... | true |
c5a1616c3a939f518f3039c72e441e987c23d8a3 | C++ | Jaimee007/practicas_info | /magos/casashogwarts.h | UTF-8 | 508 | 2.5625 | 3 | [] | no_license | #ifndef CASASHOGWARTS_H
#define CASASHOGWARTS_H
#include <iostream>
#include "magos.h"
using namespace std;
class CasasHogwarts
{
private:
string _nombre;
int _num_miembros;
Magos *miembros;
public:
CasasHogwarts(string nombre, int miembros);
~CasasHogwarts();
int Size();
void ReSize(int n... | true |
f707ad6b371b70256174b96e9f1a66198d05e4ed | C++ | mansasha21/OOP | /cache(pattern strategy)/MemoryCache.hpp | UTF-8 | 462 | 2.671875 | 3 | [
"Unlicense"
] | permissive | #pragma once
#include "BaseCache.hpp"
#include <unordered_map>
class MemoryCache final: public BaseCache
{
std::unordered_map<std::string, std::string> data_;
public:
MemoryCache() = default;
~MemoryCache() override = default;
bool has(const std::string& key) override;
std::string read(const std::stri... | true |
5978db917ad1b370c08989b706db5b34a2d08448 | C++ | MregXN/Leetcode | /BinarySearch/349.cpp | UTF-8 | 1,081 | 3.828125 | 4 | [] | no_license | // 给定两个数组,编写一个函数来计算它们的交集。
//
// 示例 1:
// 输入:nums1 = [1,2,2,1], nums2 = [2,2]
// 输出:[2]
// 示例 2:
// 输入:nums1 = [4,9,5], nums2 = [9,4,9,8,4]
// 输出:[9,4]
//
// 说明:
// 输出结果中的每个元素一定是唯一的。
// 我们可以不考虑输出结果的顺序。
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
... | true |
7a97641e136b8008a735ffb05b25638e13ae3cb7 | C++ | feedliu/LeetCode | /exist.cpp | UTF-8 | 3,381 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <cstring>
using std::vector;
using std::string;
struct position{
int x;
int y;
vector<int> path; // 1 : left
// 2 : top
// 3 : right
// 4 : bottom
};
bool contains(vector<vector<cha... | true |
1168b1ff08fab876a7a6c059ee01252109ff9991 | C++ | franciscomatos/Supermarket-Distribution-Network-ASA-P1 | /main.cpp | UTF-8 | 4,694 | 2.796875 | 3 | [] | no_license | #include <vector>
#include <stdio.h>
#include <algorithm>
/*will be used for output*/
int subnetworks = 0;
int nConnections = 0;
std::vector<int> scc;
std::vector<std::vector<int> > connections;
bool sortFunction(const std::vector<int>& a, const std::vector<int>&b) {
if(a[0] == b[0])
return a[1] < b[1];
else... | true |
b180afd509b87a9d709c551fa8691c8f8433d2cf | C++ | baactree/Algorithm | /Geometry/rotating_calipers.cpp | UTF-8 | 366 | 2.828125 | 3 | [] | no_license | double dist(point a, point b){
return hypot(a.x-b.x, a.y-b.y);
}
double calipus(const vector<point>& p){
int n = p.size();
double ret=-1;
int j=1;
for(int i=0;i<n;i++){
int ni=(i+1)%n;
while(true){
int nj=(j+1)%m;
if(ccw(hull[ni]-hull[i], hull[nj]-hull[j])<0)
j=nj;
else
break;
}
ret=max(re... | true |
2bedfead9c476bf41c18472bc56f4bc7c301549f | C++ | DerKontrolleur/reaktionswand | /libraries/SensorNew/SensorNew.cpp | UTF-8 | 2,011 | 2.90625 | 3 | [] | no_license | #include "SensorNew.h"
Sensor::Sensor(int latchpin, int datapin, int clockpin) {
_latchpin = latchpin;
_datapin = datapin;
_clockpin = clockpin;
pinMode(_latchpin, OUTPUT);
pinMode(_clockpin, OUTPUT);
pinMode(_datapin, INPUT);
digitalWrite(_latchpin, LOW);
delayMicroseconds(5);
digitalWrite(_latchpin, HIGH... | true |
35419cd17023e1c283cf05b3fc81d25b7044b3fd | C++ | XeCycle/cxxtest | /uncaught-destruct-static.cc | UTF-8 | 300 | 3.015625 | 3 | [] | no_license | #include <iostream>
struct print_on_destruct {
~print_on_destruct()
{
std::cout << "destructed\n";
}
};
void fn()
{
static print_on_destruct a;
(void)a;
}
int main()
{
try {
print_on_destruct stack_var;
fn();
throw 1;
} catch(...) {
return 1;
}
return 0;
}
| true |
8b149323ee5631b71a6e0507b344bbb6ba5f4d31 | C++ | tonyli00000/Competition-Code | /UVA Online Judge/10763/10763/10763.cpp | UTF-8 | 656 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
using namespace std;
int min(int x, int y) {
if (x < y)return x;
else return y;
}
int max(int x, int y) {
if (x > y)... | true |
10c506df0eb076e8a8820c4c885b1829b7cb2193 | C++ | rafael-radkowski/setforge | /src/Model3D.h | UTF-8 | 2,085 | 3 | 3 | [
"MIT"
] | permissive | #pragma once
/*
class Model3D
This class implements a simple model renderer with the sole purpose to show the object in a window.
It links the shader code with the geometry with a default light source and calls the draw function.
Features:
- Loads an obj file and renders it.
- Links a shader program to the obj geome... | true |
dafef7fb9d6e8e855b35a8e5c0db21b42c49f672 | C++ | dd-harp/MASH | /macro/src/flux_movement/flux_movement.h | UTF-8 | 2,724 | 2.703125 | 3 | [] | no_license | #ifndef SRC_MARKOV_FLOW_H
#define SRC_MARKOV_FLOW_H
#include <exception>
#include <map>
#include <sstream>
#include <vector>
#include <variant>
#include "armadillo"
#include "boost/random/binomial_distribution.hpp"
#include "boost/random/mersenne_twister.hpp"
#include "boost/random/uniform_real_distribution.hpp"
na... | true |
7351366761eda6eedd91f888d621337d538465db | C++ | pv-912/Programming | /C++ Files/Previous/DP/binomial.cpp | UTF-8 | 343 | 2.796875 | 3 | [] | no_license | #include<iostream>
using namespace std;
void solve(){
int n,k;
cin>>n>>k;
int arr[n+1][k+1];
for(int i=0; i<=n; i++){
for(int j= 0; j<=min(i,k); j++){
if(j==0 || j==i)
arr[i][j] = 1;
else
arr[i][j] = arr[i-1][j] + arr[i-1][j-1];
}
}
cout<<arr[n][k]<<endl;
}
int main(){
int t;
cin>>t;
whil... | true |
c0059ee7150efa4cf623ae8efccabb64a8a363ac | C++ | Stef4nio/Markov-Normal-Algorithm | /SubstitutionManager.cpp | UTF-8 | 1,629 | 2.984375 | 3 | [] | no_license | //
// Created by stef4 on 2/2/2020.
//
#include "SubstitutionManager.h"
#include "Substitution.h"
#include <iostream>
void SubstitutionManager::PushSubstitutionToList(Substitution substitution)
{
if(!isInitialized)
{
_lastElement->Data = substitution;
isInitialized = true;
return;
... | true |
d633c5a5d8c3b06e09aa87f1a245e92ef291bf3c | C++ | FeilongHou/Autonomous-Robot | /ROBOTCODE-2.ino | UTF-8 | 32,336 | 2.671875 | 3 | [] | no_license |
bool RedDrop = false;
bool BlueDrop = false;
bool GreenDrop = false;
bool YellowDrop = false;
bool inHallway = true ;
bool inRoom = false;
bool room1Complete = false;
bool room2Complete = false;
bool room3Complete = false;
bool room4Complete = false;
bool room1Enter = false;
bool room2Enter = false;
bool room3Ent... | true |
7d0d8ab00a3d0c891cbc3c396c83d247e0a3982c | C++ | carlshen/clean-cpp | /CompositePattern/src/commandprocessor.h | UTF-8 | 567 | 2.921875 | 3 | [] | no_license | #ifndef COMMANDPROCESSOR_H_
#define COMMANDPROCESSOR_H_
#include "command.h"
#include <iostream>
#include <memory>
#include <stack>
class CommandProcessor
{
public:
void execute(const CommandPtr& command) {
command->execute();
commandHistory.push(command);
}
void undoLastCommand() {
if (commandHistory.empty... | true |
37f569d97f4f34470c20f30f558e9e32120739b5 | C++ | YIP10/TTS-GrafkomH-672018219 | /main.cpp | UTF-8 | 9,540 | 2.875 | 3 | [] | no_license | #include <stdlib.h>
#include <GL/glut.h>
#include <math.h>
void segi () {
glBegin (GL_POLYGON) ;
glVertex2f (-10,50) ; //garis bawahan,depan garis kiri
glVertex2f (25,120) ; //garis bawahan
glVertex2f (60,50) ; //garis pucukan,depan garis kanan
glVertex2f (25,-20) ;//garis pucukan
glEnd ();
}
... | true |
81f41c37ffd965c086b920328e5caf344e7e552d | C++ | pmdoll/tomcat | /src/cpp/pro_gen/Pos.h | UTF-8 | 2,321 | 3.90625 | 4 | [
"MIT"
] | permissive | /**
* @brief This file defines the members and methods
* implemented as part of the Pos class
*/
#pragma once
#include <string>
/**
* @brief This class represents a 3D coordinate
*/
class Pos {
private:
int x;
int y;
int z;
public:
/**
* @brief Get the X coordinate of this object
*... | true |
51e8ddd3d2b481bfdd0f777da7232aa6eca0d018 | C++ | prateeks97/Cpp_Data_Structures_and_Algorithms | /C++ Practice/Data Structures and Algorithms/Queue/queue_array.cpp | UTF-8 | 1,241 | 3.78125 | 4 | [] | no_license | #include <iostream>
#include <cmath>
#include <cstring>
#define MAX_SIZE 101
using namespace std;
class Queue{
int A[MAX_SIZE];
int front;
int rear;
public:
Queue(){
front = -1;
rear = -1;
}
bool IsEmpty(){
return (front == -1 && rear == -1);
}
void Enqueue(int ... | true |
ad10da52fbe5d9cc6842b17369527a54a02ca808 | C++ | tlikhomanenko/flashlight | /flashlight/pkg/speech/augmentation/SoundEffect.h | UTF-8 | 2,468 | 2.828125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <memory>
#include <mutex>
#include <random>
#include <sstream>
#include <string>
#include <vector>
na... | true |
f89cf48622496b35fe3a7f0ee2d6e4fa7b6aee58 | C++ | ms303956362/myexercise | /Cpp/LeetCode/wc312_2.cpp | UTF-8 | 607 | 2.75 | 3 | [] | no_license | #include "usual.h"
class Solution {
public:
int longestSubarray(vector<int>& nums) {
int n = nums.size(), max_num = *max_element(nums.begin(), nums.end());
int i = 0, ans = 1;
while (i < n) {
if (nums[i] != max_num) {
++i;
} else {
int... | true |
c739c8243227bc5bd9ef5c84bf6fd40de0ab88f6 | C++ | mayali123/data-structure | /实验课代码/stack.cpp | GB18030 | 2,681 | 3.328125 | 3 | [] | no_license | #include<stdio.h>
#include<malloc.h>
#define ElemType char
#define MAXSIZE 100
#define Status int
#define Error 0
#define True 1
#define FALSE 0
#define OK 1
typedef struct stack{
ElemType data[MAXSIZE];
int top;
}ST;
ST* InitStack()
{
ST* stack =(ST*)malloc(sizeof(ST)) ;
stack->top =-1;
return... | true |
13205ea25bfaf538e1dfe510307812c1190efb03 | C++ | hhhjjjja/Cpp | /Assignment/161014_Circle배열 분리/161014_Circle배열 분리/main.cpp | UHC | 1,543 | 3.84375 | 4 | [] | no_license | #include <iostream>
#include "Circle.h" //Circle.h include
using namespace std;
int main() {
cout << "ϰ ϴ ?"; //ϰ ϴ ?
int n, radius; //n= , radius=
cin >> n; //n Է
if(n <= 0) return 0; //Է¹ n 0 ۰ų 0ȯ
Circle *pArray = new Circle [n]; //n Circle迭
for(int i=0;i<n;++i) { ... | true |
74f13359a3aff30fc7a2d2506b728f58b14f5a0e | C++ | llundell/CS311 | /treesort.h | UTF-8 | 4,364 | 3.65625 | 4 | [] | no_license | // treesort.h
// Laura Lundell & Khan Howe
// Started: 11/13/18
// Updated: 11/20/18
// Header for function template treesort.h
// Exercise A: Treesort
/* Sources used:
* Dr. Chappell's slides treesort.h skeleton
* Charles helped eliminate checking for nullptr in insert() and traverse()
* and instead checking if ... | true |
01b3e9d9487b812e6765405ad63f3a0f1e0f4d48 | C++ | Suanec/BachelorOfIS | /专业课程序解疑/指针通过角标符操作/指针通过角标符操作/指针通过角标符操作.cpp | GB18030 | 1,259 | 2.84375 | 3 | [] | no_license | #include<iostream>
# include <stdio.h>
using namespace std;
struct S
{
int i;
int *p;
};
void main()
{
S s;
int *p = &s.i;
p[0] = 1;
p[1] = 5;
cout<<"p[0] = "<<p[0]<<";"<<"s.i = "<<s.i<<endl;
cout<<"&p[0] = "<<&p[0]<<";&s.i = "<<&s.i<<endl;
cout <<"p[1] = " <<p[1]<<"; s.p = "<<s.p<<" "<<endl;
cout<<"&p[1] = ... | true |
6d1e24e4e8a833ce1dfad1f3703137cd7f5d70d2 | C++ | frank1iu/PlayCompiler | /compiler.hpp | UTF-8 | 2,140 | 2.546875 | 3 | [] | no_license | #pragma once
#include "parser.hpp"
#include "runtime.hpp"
#include <string>
#include <array>
using namespace std;
static int last_label = 0;
class Compiler {
public:
Compiler();
// reference counts of each register
// -1 means reserved
// r5, r6, r7 start as reserved, so there are actually
//... | true |
cc3f37dbc2e81f933eecfe0afc6e0b7f267eb1b6 | C++ | Zhgsimon/Piscine_ece | /arete.cpp | UTF-8 | 554 | 2.78125 | 3 | [] | no_license | #include "arete.h"
Arete::Arete(int id, int sommet_depart, int sommet_arrive): m_id{id},m_sommet_depart{sommet_depart},m_sommet_arrive{sommet_arrive}
{
}
void Arete::ajouterPoids(float poids){
m_poids.push_back(poids);
}
float Arete::getPoids()const{
return m_poids[0];
}
float Arete::getPoids2()const{
r... | true |
511f64768c23ebe25789057c9d9a5ff0998b3ed0 | C++ | tyuety/201811050983 | /programming/2.2.cpp | GB18030 | 1,112 | 3.515625 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
struct num
{
int number;
struct num *next;
};
int getnumber(int m,int n);
int getnumber1(int m,int n);
int main()
{
int m,n;
scanf("%d%d",&m,&n);
printf("Ϊ:%d\n\n\n",getnumber(m,n));
return 0;
}
int getnumber(int m,int n)
{
struct num ... | true |
1daead4d0847dfb32b1bc0d1267c20be98218574 | C++ | ianjamesx/University | /COSC 220/Lab4/vectorAux.cpp | UTF-8 | 1,486 | 3.28125 | 3 | [] | no_license | /*
vectorAux.cpp
Implementations of template functions
Cosc-220 Lab 7
Thomas Anastasio
Created: February 25, 2003
Current: March 13, 2003
*/
////////// THIS CODE IS PROVIDED TO STUDENTS /////////////
#include "vectorAux.h"
#include <vector>
#include <algorithm>
#include <iostr... | true |
0974e102abf137324ae9a8ef472a35b8e5d18a71 | C++ | Jenocn/MessageCenter | /cpp/ClassType.h | UTF-8 | 792 | 2.671875 | 3 | [] | no_license | /*
By Jenocn
https://jenocn.github.io/
*/
#ifndef __CLASS_TYPE_H_H__
#define __CLASS_TYPE_H_H__
template<typename T>
class ClassTypeCounter final
{
public:
static int _count;
public:
ClassTypeCounter()
{
_index = _count;
++_count;
}
public:
int _index{ 0 };
};
template<typename T>
int ClassTypeCounter<T>... | true |
30ab0f7e19e18ec9adb4ca82c0f8d7ce2b54edb5 | C++ | AtwoodHuang/redbase | /src/rm_pagehdr.h | UTF-8 | 1,673 | 2.875 | 3 | [] | no_license | #ifndef REDBASE_RM_PAGEHDR_H
#define REDBASE_RM_PAGEHDR_H
#include <iostream>
#include "bitmap.h"
#include <cstring>
struct RMPageHdr {
int free; // 和common_thing里定义一样
char * freeSlotMap; // 记录freeslot 的bitmap
int numSlots; //slot总数
int numFreeSlots; //空闲slot数
RMPageHdr(int numSlots... | true |
1ac7edbb6db0c27130801ad6fb8402ba815ca817 | C++ | Ronnie-Git/Starting-point | /5.everyday/2019-04/12/1.最大乘积.cpp | UTF-8 | 1,095 | 3.140625 | 3 | [] | no_license | /*************************************************************************
> File Name: 1.最大乘积.cpp
> Author: x
> Mail: x.com
> Created Time: 2019年04月12日 星期五 21时54分31秒
************************************************************************/
#include <iostream>
using namespace std;
const int INF = 0x3f3f3f3f;
ty... | true |
9db1169fa6823873a5a997efd5225e8e592bba2e | C++ | dmauk/ASCII-Game-Test | /ASCII GAME/Player.h | UTF-8 | 349 | 3.046875 | 3 | [] | no_license | #pragma once
class Player {
public:
//Constructors
Player();
void init(int health, int attack, int defense, int level, int experience);
//Functions
void setLocation(int x, int y);
void getLocation(int &x, int& y);
private:
//Stats
int _health;
int _attack;
int _defense;
int _level;
int _experience;
//... | true |
e6da0176f7dc60c14a159cb81a5dd10926067bac | C++ | bingluen/CSE-CODE | /PD2-A6/PD2-A6/Vector.cpp | UTF-8 | 6,343 | 3.765625 | 4 | [] | no_license | // Member-function definitions for class Vector.
#include "Vector.h" // include definition of class Vector
// constructor
template< typename T >
Vector< T >::Vector( unsigned int n, const T val )
{
size = n;
capacity = n;
ptr = new T[ n ];
if( n > 0 )
for ( unsigned int i = 0; i < n; i++ )
... | true |
17aee290d2d9a75c364b180eb2cb1eafea28e5cc | C++ | scipianus/Algorithm-contests | /USACO/USACO - February 2012 - Silver/Overplanting/Overplanting.cpp | UTF-8 | 1,557 | 2.734375 | 3 | [] | no_license | /*
PROB: planting
LANG: C++
*/
#include<fstream>
#include<vector>
#define MOD 666013
#define MAX 100000000
using namespace std;
int n;
long long sol;
struct Interval{int st,dr;};
struct Element{int lin; vector <Interval> v;};
vector <Element> Hash[666013];
inline bool Sortare(Interval A,Interval B)
{
if(A.st==B.st)
... | true |
d76fe963f72aa89e482a063a788a6fda2c444e8e | C++ | Tudor67/Competitive-Programming | /LeetCode/Problems/Algorithms/#2360_LongestCycleInAGraph_sol1_dfs_O(N)_time_O(N)_extra_space_174ms_103MB.cpp | UTF-8 | 986 | 3.09375 | 3 | [
"MIT"
] | permissive | class Solution {
private:
void dfs(int node, int level, vector<int>& levelOf, vector<bool>& isInStack, vector<int>& edges, int& res){
levelOf[node] = level;
isInStack[node] = true;
int nextNode = edges[node];
if(nextNode != -1){
if(levelOf[nextNode] == -1... | true |
31e178dfc78bb40f05acc0511efb9e3edf0577eb | C++ | planetarymike/mars_lya_solar_occultation | /interp_1d.h | UTF-8 | 9,769 | 3.078125 | 3 | [] | no_license | //interp_1d.h -- base class for interpolation routines
#include <cmath>
#include "nr3.h"
#ifndef __Interp_H_
#define __Interp_H_
using std::pow;
struct Base_interp
// Abstract base class used by all interpolation routines in this
// chapter. Only interp is called by the user.
{
int n, mmm, jsav, cor, dj;
double ... | true |
3f11ab8e9e159ad9046358cf7698fd105fb7c97a | C++ | nikiryota0731/robocon2019 | /LCD_big_kai/LCD_big_kai.ino | UTF-8 | 5,594 | 2.515625 | 3 | [] | no_license | #include<LiquidCrystal.h>
#include<Wire.h>
#include"swController.h"
#include"slaveReceiver.h"
LiquidCrystal lcd(7,12,6,11,8,10,9);
bool monitor_flag[4] = {0, 0, 0, 0};
int taswBL_pin = A3, taswB_pin = A2;
int taswR_pin = A0, taswY_pin = A1;
int Red_led_pin = 2, Blue_led_pin = 3;
int tosw_pin = 4;
byte send_data;
bool ... | true |
b39312dd7848bab2115dbfc3b09c073416368bec | C++ | mephi-student/laba3_new | /main.cpp | UTF-8 | 11,469 | 3.21875 | 3 | [] | no_license | #define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "binarytree.hpp"
#include "binarytree.cpp"
#include "functions.cpp"
#include "functions.hpp"
#include <random>
double randDouble(double n1, double n2) {
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> dist(n1, n2... | true |