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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
203931fde26b38f75e404849632a4a0533876139 | C++ | piratebreizh/DockAuto | /noeud.h | UTF-8 | 792 | 2.90625 | 3 | [] | no_license | #ifndef NODE_H
#define NODE_H
#include <math.h>
class Noeud
{
int xPos;
int yPos;
int distanceParcourue; // distance totale déjà parcourue jusqu'à ce noeud
// priorite= distanceParcourue + Distance Restante Estimee
int priorite; // smaller: higher priorite
public:
Noeud(int, int, int,... | true |
8e5463223a61fbcedd9d556b2db2e77539cbc278 | C++ | venkatesh551/CodeChef | /2015/Jan/Lunchtime/Piece_of_cake.cpp | UTF-8 | 455 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main(void)
{
int t;
cin >> t;
while (t-- > 0)
{
string s;
cin >> s;
int cnt[26] = {0};
for (auto c: s)
{
++cnt[c-'a'];
}
int sum = 0, max_cnt = 0;
for (int i = 0; i < 26; ++i)
{
sum += cnt[i];
max_cnt = max(max_cnt, cnt[i]);... | true |
b6cc628220b22a75ddf3fdd19ad723f8a169e008 | C++ | 1iuyzh/exercise | /data_structures_and_algorithm_analysis/5/HashTable_quatratic/HashTable.cpp | UTF-8 | 434 | 3.125 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
#include"HashTable.h"
using namespace std;
int main() {
HashTable<string> hashTable(101);
vector<string> vecs{"struggle", "indignant", "sophisticated", "staggering", "gaze"};
for (auto &s : vecs)
hashTable.insert(s);
cout << hashTable.contai... | true |
d068f38f1c130d2235fb79986a62bd33613be4e7 | C++ | Ujjwal120/MyC- | /__GEOXD__rns5.cpp | UTF-8 | 2,218 | 2.625 | 3 | [] | no_license |
// 1.87 second sec
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int X1, X2, Y1, Y2, a, b, c;
ll d;
const ll inf = 1e18;
const int mod = 1e9 + 7;
ll gcd(ll a, ll b, ll &x, ll &y) {
if (!b) {
x = 1, y = 0; return a;
}
ll rlt = gcd(b, a % b, y, x);
y -= a / b * x;
... | true |
afc8aa02b7872182779de5f10fd12d0645172c7f | C++ | duanxianze/lab7 | /Graph.h | GB18030 | 8,925 | 3.40625 | 3 | [] | no_license | #ifndef GRAPH_H
#define GRAPH_H
#include "SeqQueue.h"
#include <fstream>
const int maxWeight = 100000;
// ͼijඨ#Ȩͼ
// TΪͣEΪȨֵͣһӦΪijһ͡
template <class T, class E>
class Graph{
public:
Graph(int sz){
maxVertices = sz;
numVertices = 0;
numEdges = 0;
}
virtual ~Graph(){};
bool GraphEmpty() const{ //ͼշ
return (... | true |
7fba3b8cbd082a4bfb00a76e51e0a3c970030b7f | C++ | lcp102/ButtonManager | /src/mdw/button/buttonstatesm.cpp | UTF-8 | 3,338 | 2.875 | 3 | [] | no_license | /*
* buttonstatesm.cpp
*
* Created on: 29 mars 2019
* Author: Yan Michellod
*/
#include <buttonstatesm.h>
#include "event/evbuttonpressed.h"
#include "event/evbuttonreleased.h"
#include "event/events.h"
#include "buttonEventsHandler.h"
/**
* @brief Constructor of ButtonStateSM
*/
ButtonStateSM::ButtonSt... | true |
fbcd8b0f57380a7da2babb895db32d7f9fd14195 | C++ | JsKim4/BOJ-BaekJoon-Online-judge- | /cpp/1000/1600/P1600.cpp | UTF-8 | 1,523 | 2.609375 | 3 | [] | no_license | #include<iostream>
#include<tuple>
#include<queue>
#pragma warning (disable:4996)
#define MAX 210000000
using namespace std;
// 1600 말이 되고픈 원숭이
int k, h, w;
int zoo[31][200][200];
int way[][3] = { {0,1,0},{0,-1,0}, {1,0,0},{-1,0,0},
{-1,-2,1},{-2,-1,1},{1,-2,1},{2,-1,1},
{1,2,1},{2,1,1},{-1,2,1},{-2,1,1} };
bool avail(... | true |
0d9b2180037176103d74ad16b055f9d0bc10839c | C++ | zhanghouxin07/communication-protocol-yinnuo | /path_generate/ref/main_ref.cpp | UTF-8 | 739 | 2.78125 | 3 | [] | no_license | #include "Agent.h"
#include <fstream>
#include <iostream>
using namespace std;
void InitializeAgent(AgentController*& _agents);
int main(int _argc, char** _argv){
srand(static_cast<unsigned int>(time(NULL)));
char next = 'Y';
AgentController* agent = NULL;
InitializeAgent(agent);
//main render loop
whi... | true |
c60aece6d6fe2f6284f0ab1f609f87102f5ad90b | C++ | chrisbex/tic-tac-toe-sfml | /brick.h | UTF-8 | 1,336 | 2.9375 | 3 | [] | no_license | class Brick
{
public:
Brick();
Brick(sf::Vector2f x);
void SetCoordinates(sf::Vector2f x);
void draw(sf::RenderWindow &wind);
sf::Vector2f GetCoordinates();
void update();
void SetState(int x) { state = x; };
int GetState() { return state; };... | true |
0978ed57792d6ece5e2844fdc48593c207af879f | C++ | ahbarif/Online-Judge-Solutions | /LightOJ/1182 - Parity.cpp | UTF-8 | 500 | 3 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
int main()
{
long long int num, mod, count, i, test;
cin >> test;
for (i = 1; i <= test; i++)
{
count = 0;
cin >> num;
while (num > 0)
{
mod = num % 2;
num = num / 2;
if (mod % 2 == 1)
{
count++;... | true |
92dc5aada5ac7f2126b00fa4020876f350d17b37 | C++ | Abigail-Verhelle/CS120 | /onlyLetters.cpp | UTF-8 | 411 | 3.5 | 4 | [] | no_license | #include <iostream>
using namespace std;
string justletters(string r)
{
int i = 0;
while (r[i] != 0)
{
i++;
}
for (int x =0; x < i; x++)
{
string l = alpha(r[x]);
}
return string l;
}
int main()
{
string r = "";
cout < "Enter string: ";
cin >> r;
... | true |
64255fe48023701aabc398317ab69dd8c2cb5835 | C++ | ntustison/Utilities | /src/GetJointSamples.cxx | UTF-8 | 2,391 | 2.78125 | 3 | [] | no_license | #include "itkArray.h"
#include "itkImageDuplicator.h"
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkImageFileWriter.h"
#include <string>
#include <vector>
#include <fstream>
template <unsigned int ImageDimension>
int... | true |
84ee7048ba3656b1cdd1e8a8065ce50802bdd8c0 | C++ | Yur4ikMarchenko/GameOfHeroes | /Source.cpp | UTF-8 | 9,582 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <ctime>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string comeback;
string path = "history.txt";
fstream fs;
//меню
menu:
cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
cout << "~~~~~~~~~~~~ Game of Her... | true |
83ace6d3de09ade2c92cdd30452b2ae1429f0d8a | C++ | Bappy38/Light-OJ-solved-Problem | /Beginner/LOJ-1107.cpp | UTF-8 | 453 | 2.703125 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int T,i,m,j,x,y,x1,y1,x2,y2;
scanf("%d",&T);
for(i=1;i<=T;i++)
{
scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
scanf("%d",&m);
printf("Case %d:\n",i);
for(j=1;j<=m;j++)
{
scanf("%d %d",&x,&y);
if((x>=x1 && x<=x2) && (... | true |
793fa95fc179b44a4384b7ed39b38adcd5b4c210 | C++ | Apostoln/tree | /BinaryTreeNode.h | UTF-8 | 5,059 | 3.375 | 3 | [] | no_license | #ifndef TREE_BINARYTREENODE_H
#define TREE_BINARYTREENODE_H
#include <iostream>
#include <memory>
#include <cassert>
#include <queue>
#include <experimental/memory>
#include "Order.h"
template <class T>
class Node : public INode<T> {
protected:
using typename INode<T>::UniqNode;
using typename INode<T>::Obse... | true |
efc584a898db4e5114090fee5eebe54011f6516a | C++ | Raffaello/sdl2-vga-terminal | /sdl2-vga-terminal/src/VgaTerminal.hpp | UTF-8 | 7,112 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Window.hpp"
#include <memory>
#include <string>
#include <bitset>
#include <atomic>
#include <mutex>
#include <utility>
class VgaTerminal : public Window
{
public:
typedef struct
{
uint8_t mode; // video mode (only mode 3 available at the moment)
uint8_t tw; ... | true |
1bd225c54ebae54be393d08d55462a0b0f6fb67c | C++ | Jamil132/DSA-COMPLETE-SERIES | /Practise Code 1/Multiply Inheritance.cpp | UTF-8 | 938 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Base1
{
public:
void setdata(int r){
base1 = r;
}
protected:
int base1;
private:
};
class Base2
{
public:
void setdata1(int r){
base2 = r;
}
protected:
int base2;
private:
};
class Base... | true |
dfd0515072312963829bf24e2df63532a80a7695 | C++ | danmur14/DataStructures560 | /Murga_Lab6/test.cpp | UTF-8 | 3,785 | 3.28125 | 3 | [] | no_license | /*
* @file: test.cpp
* @author: Daniel Murga
* @date: 2017.3.5
* @brief: Timing between BST and MinHeap
*/
#include <iostream>
#include <fstream>
#include "Timer.cpp"
#include "MinHeap.h"
#include "BinarySearchTree.h"
int main()
{
double duration;
Timer T;
std::cout << " | BST | Heap" << st... | true |
f1a8eb57edb6b764bd09d8c1f9277ad4b29fea8c | C++ | itsboazlevy/Portfolio | /advCPP/catalog/include/Publisher.h | UTF-8 | 665 | 2.9375 | 3 | [] | no_license | #ifndef PUBLISHER_H
#define PUBLISHER_H
#include <string>
class Publisher
{
public:
Publisher(const std::string& _publisher);
const std::string& GetPublisher() const;
private:
const std::string m_publisher;
};
////////////////////////////////////////////////
bool operator == (const Publisher& _a, const Publisher... | true |
0e5bb8a49c3b35b9da5eca51529c7844b68e3b18 | C++ | quanghona/Caro2 | /Caro.cpp | UTF-8 | 2,122 | 3.171875 | 3 | [
"MIT"
] | permissive | /*
* Caro - A simple game writing in C++ console programming.
* This game operate state by state. Every state has specific functions
* 1. Menu: At this state, there are 3 option: Start new game, information
* and Quit.
* 1.1 Start new game: players start a new game.
* 1.2 information : print the introducti... | true |
1fec0c5728cd5dd35ec1fefb269402d90005846a | C++ | mstemen0010/CC | /,mstring.h | UTF-8 | 2,930 | 2.859375 | 3 | [] | no_license | #ifndef _MSTRING_H
#define _MSTRING_H
#include <iostream.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#ifndef TRUE
#define TRUE 1
#define FALSE !TRUE
#endif
#define ERROR_INDEX_OUT_OF_BOUNDS "index out of range"
#define OPERATE_FIRST 0
#define OPERATE_ALL 1
class mstring {
public:
mstring();... | true |
65735170bb3615391779b1c05485c96446607286 | C++ | linoyisr/RoboticaFinal | /RoboticaProject/behaviors/GoForward.cpp | UTF-8 | 1,994 | 2.59375 | 3 | [] | no_license | /*
* GoForward.cpp
*/
#include "GoForward.h"
bool GoForward::startCond() {
/*return (_robot.checkRange(_robot.getLaserSpec() / 2 - LASER_SPEC,
_robot.getLaserSpec() / 2 + LASER_SPEC));*/
bool result = (_robot->isRangeClear(_robot->getLaserSpec() / 2 - 111, _robot->getLaserSpec() / 2 + 111));
cout << endl << "... | true |
ce3c1089e202d92e64065518ee479f530b4e2539 | C++ | adekwal/lab4 | /main.cpp | WINDOWS-1250 | 1,815 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <math.h>
#include "rk4.h"
//zagadnienie pocztkowe: {1} y'(t)=f(t,y);
//warunek pocztkowy: {2} y(t0)=y0;
double t0 = 0, tk = 2;//t nalezy do takiego przedzialu
double y_0 = 1;
double lambda = 10;
double f(double t, double y);//f(t,y);
double y_an(double t);
int main()... | true |
e9e55b68bdf6ff5d4f779804e7838265b9ce73c5 | C++ | sid6602/curated-resources | /STL Code/Deque.cpp | UTF-8 | 417 | 3.171875 | 3 | [] | no_license | #include<iostream>
#include<deque>
using namespace std;
int main()
{
deque<int> d;
cout<<"size"<<d.size()<<endl;
d.push_back(70);
d.push_front(50);
cout<<"size"<<d.size()<<endl;
cout<<"index element is->"<<d.at(1)<<endl;
cout<<"is deque empty?->"<<d.empty()<<endl;
d.pop_f... | true |
61709036ce63fbae3af89b9fb8c07ae189bc32e4 | C++ | dmeneses/ask-me | /src/structs/trienode.cpp | UTF-8 | 693 | 3.171875 | 3 | [] | no_license | #include "trienode.h"
TrieNode::TrieNode() : content_(' '), marker_(false)
{
}
char TrieNode::content()
{
return content_;
}
void TrieNode::setContent(char c)
{
content_ = c;
}
bool TrieNode::wordMarker()
{
return marker_;
}
void TrieNode::setWordMarker()
{
marker_ = true;
}
TrieNode* TrieNode::fi... | true |
8464cd13e926e11a692e24b535191d3e8dfe193d | C++ | neoJINXD/Concordia-Projects | /COMP 371/Assignment 2/VS2017/src/Texture.cpp | UTF-8 | 1,124 | 2.75 | 3 | [] | no_license | #define STB_IMAGE_IMPLEMENTATION
#include "Texture.h"
#include <iostream>
Texture::Texture(std::string file, unsigned int _type)
{
//type = _type;
unsigned char* data = stbi_load(file.c_str(), &width, &height, &colorChannels, 0);
if (!data)
{
std::cout << "Failed to load texture @ " + file << std::endl;
exi... | true |
69f69758e341bb267c4fa5651c4d49345e1f0bdd | C++ | BGCX261/zk-tool-svn-to-git | /trunk/zk_tool/ZkAdaptor.h | UTF-8 | 12,462 | 2.59375 | 3 | [] | no_license | #ifndef __ZK_ADAPTOR_H__
#define __ZK_ADAPTOR_H__
/**
*@file ZkAdaptor.h
*@brief Zookeeper的c++接口,采用Zookeeper的多线程模式
*@author cwinux@gmail.com
*@version 1.0
*@date 2011-11-10
*@warning 无
*@bug
*/
#include <string>
#include <vector>
#include <list>
#include <map>
#include <inttypes.h>
using namespace std;
exte... | true |
248c21c7568ca439b9c80d7895923ec8ecd059cd | C++ | BitRapture/Fite | /TopdownBeatemup/EventManager.h | UTF-8 | 1,035 | 2.78125 | 3 | [] | no_license | #ifndef _EVENTMANAGER_H_
#define _EVENTMANAGER_H_
#include <SDL.h>
class EventManager
{
// Private variables
private:
// Change in x and y movement
int mDeltaX{ 0 }, mDeltaY{ 0 };
// Mouse x and y position
int mMouseX{ 0 }, mMouseY{ 0 };
// Mouse left and right buttons
bool mMouseL{ false }, mMouseR{ false };
... | true |
fa0f6500cb1d693492c1c428a8244d29efd9ede0 | C++ | DiegoBanegas/programacion2 | /cicloanidado3/main.cpp | UTF-8 | 1,593 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
/*
ingresar el nombre del alumno,luego debemos de pedir
las tres notas parciales usando un ciclo,presentar el promedio,la nota mayor
de los tres parciales.
Preguntar si desea continuar,al final presentar el nombre del a... | true |
09665e8e33b867f79fd664013abfa41eccb6496d | C++ | uvbs/gameengine | /Development/Src/LibCommon/ExpressionNode.h | UTF-8 | 2,482 | 2.703125 | 3 | [] | no_license | #ifndef __ZION_EXPRESSION_NODE__
#define __ZION_EXPRESSION_NODE__
namespace Zion
{
namespace Expression
{
class BaseNode;
class Node;
class BaseNode
{
public:
BaseNode(_U32 level);
virtual ~BaseNode();
bool SetParent(Node* pParent, _U32 Index);
virtual _U32 GetChildrenCount();
virtual Bas... | true |
e492aed3295345c861d4498e42628c24f251b266 | C++ | jvastola/Crow-Projects | /Login/test/test.cpp | UTF-8 | 3,700 | 2.765625 | 3 | [] | no_license | #include <igloo/igloo.h>
#include <Authenticator.h>
#include <Database.h>
#include <User.h>
#include <stdio.h>
using namespace igloo;
Context(UserTest){
User user = User("jsoap", "abc123", "Joe", "Soap", "joe@yahoo.com", "123456");
Spec(CanGetUsername){
Assert::That(user.getUsername(), Equals("jsoap"));
}
Spec... | true |
2a8cf46a16da9483ee09831fe2d5ece0c884ec74 | C++ | wangzhe17/leetcodeTest | /N_687.cpp | UTF-8 | 593 | 3.296875 | 3 | [] | no_license | class Solution {
public:
int longestUnivaluePath(TreeNode* root)
{
if(!root) return 0;
int res = 0;
helper(root, root, res);
return res;
}
int helper(TreeNode *node, TreeNode *parent, int &res)
{
if(!node) return 0;
int left = helper(node->left, node, res);... | true |
11d4676d1ef7628d39432f5d71691087749d0703 | C++ | platicratic/advent-of-code-2020 | /day 1/main.cpp | UTF-8 | 617 | 3.078125 | 3 | [] | no_license | // Part Two
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("input.in");
ofstream fout("output.out");
void solve() {
vector<int> V;
int number;
while (fin >> number) {
V.push_back(number);
}
for (int i = 0; i < V.size(); i ++) {
for (int j = i + 1... | true |
6a54810183600dcc5c07e95863679f381cbc4e34 | C++ | bluepine0808/cppplus | /sales.cpp | UTF-8 | 676 | 3.640625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int weeklySales, sales1, sales2, sales3;
cout << "Enter the WeeklySales:" << endl;
if (!(cin >> weeklySales)) {
cout << "Please enter the Integer!" << endl;
return 0;
}
cout << "The WeeklySales is : " << weeklySales << endl;
... | true |
cb63768b602631776a063cb4daef2402ad3ed94b | C++ | kanglanglang/danei | /CSD1404(待补充)/c++(CSD1404,GAJ)/day07/11use_ploy.cpp | UTF-8 | 1,125 | 3.484375 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Animal{
public:
void show(){
cout << "show()" << endl;
}
virtual void run(){
cout << "动物run()" << endl;
}
};
class Dog:public Animal{
public:
/* 函数重写 */
void run(){
cout << "狗用四条腿跑" << endl;
}
/* dog 的个性 */
void dogfu... | true |
4aeeec284eab188cef16355e4be03eea9b41d141 | C++ | snewell/codeeval | /challenge-0005.cpp | UTF-8 | 999 | 3.015625 | 3 | [
"MIT"
] | permissive | #include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
int main(int argc, char ** argv)
{
(void) argc;
std::ifstream input{argv[1]};
std::vector<int> vals;
int val;
input >> val;
while(input)
{
vals.push_back(val);
auto const last = vals.rend();
... | true |
7180f26163ca53b2653dd5cf1faf83204fd4d7ed | C++ | suryakiran/CodeSamples | /NG/get-ng-image-title.cpp | UTF-8 | 1,719 | 2.9375 | 3 | [] | no_license | #include<boost/filesystem/path.hpp>
#include <boost/program_options.hpp>
#include <boost/spirit.hpp>
#include <boost/algorithm/string.hpp>
#include <fstream>
#include <string>
#include <iostream>
using namespace boost::filesystem ;
using namespace boost::algorithm ;
using namespace boost::spirit ;
using namespace st... | true |
4e2bfa41972c05fc2999f5782e268c30422793aa | C++ | trammell/test | /C++/TICPP-2e-v1/C03/reinterpret_cast.cpp | UTF-8 | 735 | 3.203125 | 3 | [
"Artistic-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | //: C03:reinterpret_cast.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
#include <iostream>
using namespace std;
const int sz = 100;
struct X { int a[sz]; };
void print(X* x) {
for(int i = 0; i < sz; i++)
... | true |
ab6431e26264a59cfd22c29a22a0dd1860c18045 | C++ | liuhe3647/serialize | /src/json/encoder.cpp | UTF-8 | 4,402 | 2.65625 | 3 | [] | no_license | #include "json/encoder.h"
#include <assert.h>
namespace serialize {
JSONEncoder::JSONEncoder(std::string& str) : _writer(str) {
}
JSONEncoder::~JSONEncoder() {
}
void JSONEncoder::encodeValue(const char* sz, bool value, bool* pHas) {
_writer.Key(sz);
_writer.Bool(value);
}
... | true |
4a2aba11a1b7374b4d7fdb09dfa903287259a4cc | C++ | Legend94rz/OJCodes | /ACM/[USACO]Twofive_记忆化搜索.cpp | UTF-8 | 1,498 | 2.75 | 3 | [] | no_license | /*
ID: rz109291
PROG: twofive
LANG: C++
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <memory.h>
using namespace std;
char cr;
int N;
int f[6][6][6][6][6];
string W;
char ans[26];
bool ok(int p, char c)
{
return (ans[p] == 0 || ans[p] == c);
}
int dfs(int a, int b, int c, ... | true |
e4305ff1552c89ce51c937171a8ba74833ea1e48 | C++ | erestor/ctoolhu | /ctoolhu/thread/async.hpp | UTF-8 | 1,049 | 2.8125 | 3 | [
"MIT"
] | permissive | //----------------------------------------------------------------------------
// Author: Martin Klemsa
//----------------------------------------------------------------------------
#ifndef _ctoolhu_thread_async_included_
#define _ctoolhu_thread_async_included_
#include "pool.hpp"
namespace Ctoolhu::Thread {
//Sc... | true |
89f9aea60d1fd756e19c371b954f634928d89f4d | C++ | jxliu1216/CPP-Primer-Plus | /chapter-5/forloop.cpp | UTF-8 | 579 | 3.234375 | 3 | [] | no_license | /*************************************************************************
> File Name: forloop.cpp
> Descriptions: introducing the forloop
> Compiler: GCC/ G++ (Version 7.3.0)
> Author: Jinxue Liu
> Mail: LiuJinxuepro@163.com
> Created Time: Sat 15 Sep 2018 10:13:08 PM CST
*****************... | true |
2007d99821f1a10e1e3ea65aecfbb74a86a38924 | C++ | ristri/Competitive-Programming | /LeetCode/424.cpp | UTF-8 | 489 | 2.859375 | 3 | [] | no_license | class Solution {
public:
int characterReplacement(string s, int k) {
int n = s.length();
vector<int>count(26);
int i = 0, maxCount = 0, maxLength = 0;
for(int j = 0; j < n; j++) {
maxCount = max(maxCount, ++count[s[j] - 'A']);
while(j - i + 1 - maxCount > k) {... | true |
97ffe5712f4ecba47aa700c7bffcf5467d0b7070 | C++ | CursosIE/IE-0217-III-16-G0 | /Tarea1LuisDiegoFernandezB22492/Pokemon.cpp | UTF-8 | 543 | 2.953125 | 3 | [] | no_license | #include "Pokemon.h"
Pokemon::Pokemon() {
}
Pokemon::~Pokemon() {
}
string Pokemon::call() {
return cry;
}
//imprime informacion basica general de cualquier pokemon
void Pokemon::printInfo() {
cout << "Nombre: " << name << endl;
cout << "Especie: " << species << endl;
cout << "Estado: " << status ... | true |
842be17fddfbfbe42c7d070ee504f7a003da858d | C++ | jastadj/john | /src/color.cpp | UTF-8 | 620 | 2.640625 | 3 | [] | no_license | #include "color.hpp"
using namespace tinyxml2;
COLOR loadColorFromXMLNode(XMLNode *tnode)
{
COLOR tcol;
XMLNode *anode = NULL;
anode = tnode->FirstChild();
while(anode != NULL)
{
if(!strcmp(anode->Value(), "bg")) anode->ToElement()->QueryIntText(&tcol.m_Background);
else if(!st... | true |
372e36237b09aa4313355707c3f886aa1557cd16 | C++ | tomasrggm/AVT_Template2 | /AVT_Template1/meshFromAssimp.cpp | ISO-8859-13 | 11,238 | 2.59375 | 3 | [] | no_license | /* --------------------------------------------------
Functions to handle with struct MyMesh based meshes from Assimp meshes:
- import 3D files to Assimp meshes
- creation of Mymesh array with VAO/VBO Geometry and Material
* it supports 3D files with till 2 diffuse textures, 1 specular map and 1 normal map
*
Joo ... | true |
3e283e5e157d788072c2d4ad1137641146589369 | C++ | Abhishek150598/Algorithms_for_cp | /sqrtdec.cpp | UTF-8 | 797 | 2.90625 | 3 | [] | no_license | //Square root decomposition
#include<bits/stdc++.h>
#define max 1000000
#define maxsqrt 1000
using namespace std;
int arr[max];
int block[maxsqrt];
int block_size;
void update(int index, int value)
{
int block_no=index/block_size;
block[block_no]=block[block_no]-arr[index]+value;
arr[index]=value;
}... | true |
d9bc2a8ea0945f6a769abd7a6d47060cee8d20be | C++ | StarkShang/Projects | /Check/v0.0.3/Release/cells/2016/5140729048/L51/L01/func.hpp | UTF-8 | 1,076 | 3.5 | 4 | [] | no_license | /*******************************************
* STUDENT结构体
* int类型成员 : 学号id
* char[1024]数组类型成员 : 姓名name
* double[3]数组类型成员 : 三门课成绩course
*******************************************/
struct STUDENT
{
int id;
char name[1024];
double course[3];//根据要求定义变量
};
/***************************************
* 计算各门课平均成绩及最高... | true |
ce10f94816fb86f0e7ff0f8f646177f567603659 | C++ | calmdan/MyLeetcode | /Median of Two Sorted Arrays.cpp | UTF-8 | 7,047 | 3.453125 | 3 | [] | no_license | //============================================================================
// There are two sorted arrays A and B of size m and n respectively. Find the
// median of the two sorted arrays. The overall run time complexity should be
// O(log (m+n)).
//==================================================================... | true |
c37afdff79ccec395737bf34d0be973468a7ffae | C++ | emd22/arch-engine | /Game/ModelLoaders/ObjLoader.cpp | UTF-8 | 4,329 | 3.203125 | 3 | [] | no_license | #include "ObjLoader.h"
#include "../Math/vector2.h"
#include "../Math/vector3.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
#include <algorithm>
#include <functional>
#include <cctype>
#include <locale>
void Split(const std::string &s, char delim, std::vector<std::string> &elems)
{
s... | true |
0c2958cdfcb0a456d87813c9834139cce2bfe1d8 | C++ | joe2hpimn/dg16.oss | /orca/gpos/libgpos/include/gpos/common/CSyncHashtableIter.h | UTF-8 | 2,939 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | //---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2011 EMC Corp.
//
// @filename:
// CSyncHashtableIter.h
//
// @doc:
// Iterator for allocation-less static hashtable; this class encapsulates
// the state of iteration process (the current bucket we i... | true |
8fa81b5eed651bab490b3074d71a5e867e5caf8d | C++ | Ivanhan2018/zsbbserver | /src/computinghurt/skills.cpp | GB18030 | 10,984 | 2.78125 | 3 | [] | no_license | // @brief ϵͳΪܣܣܣ
// @author
#include "skills.h"
namespace
{
static bool isInRange(computinghurt::IRandomGenerator* randomGenerator, unsigned int probability)
{
MY_ASSERT(randomGenerator != 0, "randomGenerator == 0");
if (randomGenerator == 0 )
return false;
int random = randomGenerator->generator(1, 10... | true |
992a32e6a5ddec9c55ede4411e7da15e973108f6 | C++ | dagil02/TaxiRevengeDLC | /GTT/EnemyPool.h | UTF-8 | 836 | 2.640625 | 3 | [] | no_license | #pragma once
#include "GameObject.h"
#pragma once
#include "GameObject.h"
#include "Enemy.h"
#include <vector>
class EnemyPool :public GameObject
{
public:
EnemyPool(EnemyPool&) = delete;
EnemyPool& operator=(const EnemyPool&) = delete;
static EnemyPool* GetInstance() {
if (instance_ == nullptr) {
instance_ ... | true |
51476a5ceed3f9b74aef54f12a97202e9b64aaa6 | C++ | SJ-Innovation/TeensyVive | /src/SensorNode.cpp | UTF-8 | 4,200 | 2.71875 | 3 | [] | no_license | //
// Created by Sam Lane on 10/02/2018.
//
#include "SensorNode.h"
#include "config.h"
void SensorNode::SetLEDState(int LEDState) {
static int CurrentLEDState = LED_OFF;
if (LEDState != CurrentLEDState) {
switch (LEDState) {
case LED_OFF:
pinMode(_PinData.LED1Pin, INPUT);... | true |
04933431eea7e81cb2625fb32b59c8c92b2b5673 | C++ | dtbinh/M1S2 | /AlgoGeo/TP_Note/ARN.cc | UTF-8 | 12,167 | 3.28125 | 3 | [] | no_license | #include<iostream>
#include <stdlib.h>
#include <math.h>
#include "ARN.h"
using namespace std;
//Constructeurs**********************************//
ARN::ARN(bool (*EgaleCleUSER)(int cle1,int cle2), bool (*InferieurCleUSER)(int cle1,int cle2)){
//creer un arn vide et on fixe les operateurs de comparaison
nul=new ... | true |
419aea09a09e8d6ee1f16d3c1b48e7896433758b | C++ | mgcg216/Comp236 | /Project2/Savings.cpp | UTF-8 | 1,089 | 2.984375 | 3 | [] | no_license | // Michael Guerrero
// March 25, 2014
// CS 236 C++ Project 2
//4-29-14
//Inheritance/ Banking program
// Description: Savings Function .cpp that creates the functions that to restrict the input.
#include "Savings.h" //needed if files are separate
#include <string>
#include "string"
#include <iostream>
#inclu... | true |
f599dd2d0bfe724f754458c13be9294a5c9dd8f5 | C++ | Vieran/DataStructure | /Dendriform/Tree/Lib/Tree.h | UTF-8 | 854 | 3.5625 | 4 | [] | no_license | //树的抽象类
#ifndef TREE_H
#define tree_h
#include <iostream>
using namespace std;
template <class elemType>
class Tree
{
public:
virtual void clear() = 0;//删除树中所有的节点
virtual bool isEmpty() const = 0;//判断是否为空树
virtual elemType root(elemType flag) const = 0;//找出树的根节点;如果树空则返回特殊值
virtual elemType parent(elem... | true |
8b44599839ae738d9ca5cd67e1191490efffb852 | C++ | DaniAngelov/Cpp_Programming | /Object_Oriented_Programming/Homeworks/First_Homework/Second Task/DNSCache.h | UTF-8 | 576 | 2.703125 | 3 | [] | no_license | #pragma once
#include "DNSRecord.h"
#include <iostream>
using namespace std;
class DNSCache
{
private:
DNSRecord* records = nullptr;
int size = 0;
void resize();
void increaseSize();
void decreaseSize(int n);
public:
DNSCache(); //constructors
DNSCache(const DNSCache&);
~DNSCache();
bo... | true |
ecf492737f8ddc5cd768520c95f5771743e1f011 | C++ | Leonardo-Lourenco/Programacao-c | /Aula-39/Aula-39.cpp | UTF-8 | 454 | 3 | 3 | [] | no_license | #include <iostream>
#include <string.h>
// Ponteiros e Vetor ou Arrays
using namespace std;
int main(){
int num[] = {1,2,3,4,5};
int *direcao_numero;
//direcao_numero = &num[0];
direcao_numero = num;
for(int i =0; i< 5; i++){
//cout<<"Elementos do Vetor: [ "<<i<< " ] "<<*... | true |
2671a0c70411950d1d0a27eee4880c9529a6ceb4 | C++ | ghost26/big_integer | /big_integer/main.cpp | UTF-8 | 412 | 2.828125 | 3 | [] | no_license | //
// main.cpp
// big_integer
//
// Created by Руслан Абдулхаликов on 06.06.15.
// Copyright (c) 2015 Руслан Абдулхаликов. All rights reserved.
//
#include <iostream>
#include "big_integer.h"
using namespace std;
int main()
{
big_integer a("200000000000000000000000000000000000000000000000000000000000000000000... | true |
a84c9fbd803cfd74290bedcb0844f9a92f3b86c2 | C++ | its-sachin/COP290 | /Inevitable/Sound.cpp | UTF-8 | 3,366 | 2.890625 | 3 | [] | no_license | //Using SDL and standard IO
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include "constants.hpp"
class Sound {
private:
Mix_Music *bgm = NULL;
Mix_Chunk *coin = NULL;
Mix_Chunk *die = NULL;
Mix_Chunk *respawn = NULL;
Mix_Chunk *eat = NULL;
Mix_Chunk *mind = ... | true |
0585b81ce8cc54258b4eb20c9f59529112ffff0b | C++ | MuhammadHananAsghar/Binary-Maximun-Heap-in-Cpp | /heapmax.cpp | UTF-8 | 2,031 | 3.78125 | 4 | [] | no_license | // CREATED BY MUHAMMAD HANAN ASGHAR
// PYTHONIST
#include <iostream>
using namespace std;
class BinaryMaximumHeap{
private:
int *heap;
int heapSize;
int arraySize;
int getParent(int index){
return (index - 1) / 2;
}
int getRight(int index){
return (2 * index) + 2;
}
int getLeft(int index){
... | true |
4a991c15fce82a4234a09b9327a5f60cbb37061f | C++ | WFCSC112AlqahtaniFall2019/project0-Alexa-Brown | /main.cpp | UTF-8 | 1,153 | 3.5625 | 4 | [] | no_license |
// Alexa Brown, CSC 112, Project 0
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World! " << endl;
int i=-10;
int j=-10;
int firstEquationx;
int firstEquationy;
int equalto1;
int equalto2;
int secondEquationx;
int secondEquationy;
cout << "Enter the firs... | true |
2142e731644863417c6cab908125377d68a3f7dc | C++ | smunj/InterviewBit | /Backtracking/palindromePartitioning.cpp | UTF-8 | 964 | 3.0625 | 3 | [] | no_license | bool pal(string s, int a, int b){
while(a < b){
if(s[a] != s[b]){
return false;
}
a++;
b--;
}
return true;
}
void fn(vector<vector<string> >& ans, vector<string> v, int i, int n, string A){
if(i == n){
ans.push_back(v);
return;
}
... | true |
5e1ffb2e1580746fcce6df258de002663f625149 | C++ | Rgeers/INOOP | /Lesson 5/Homework/Boeken.cpp | UTF-8 | 855 | 3.078125 | 3 | [] | no_license | #include "Boek.h"
#include <iostream>
#include "Boeken.h"
Boeken::Boeken() {
}
Boeken::~Boeken() {
boekenPlank.clear();
}
Boeken::Boeken(std::string gekregenNaam) {
naam = gekregenNaam;
}
Boeken::Boeken(const Boeken& andereBoeken) {
boekenPlank = andereBoeken.boekenPlank;
}
Boeken& Boeken::operator=(const Boek... | true |
e8aea9fe14f41000a39073cc95ad3799f448cb50 | C++ | tcShadowWalker/XKey | /test/CryptStreamOld.h | UTF-8 | 2,325 | 2.5625 | 3 | [] | no_license | #pragma once
#include <streambuf>
#include <vector>
struct bio_st;
struct evp_cipher_st;
namespace XKey {
namespace v12 {
enum ModeInfo {
NO_OPTIONS = 0,
/// Encode content in base64
BASE64_ENCODED = 1,
/// Encrypt file. If this is omitted, the file is stored in plaintext
USE_ENCRYPTION = 2,
/// If this is no... | true |
8ab8e94953e915c7386333eaac83130f48036ba3 | C++ | sophiegri/programmiersprachen-aufgabenblatt-2 | /source/rectangle.hpp | UTF-8 | 701 | 2.9375 | 3 | [
"MIT"
] | permissive | #ifndef RECTANGLE_HPP
#define RECTANGLE_HPP
#include "color.hpp"
#include "vec2.hpp"
#include "window.hpp"
class Rectangle
{
private:
Vec2 max_height; //top right, x2, y2
Vec2 min_height; //bottom left, x1, y1
Color color;
public:
Rectangle ();
Rectangle (Vec2 const& _max_height, Ve... | true |
a8c8b114610532b5e925d7b49666dff647a2e157 | C++ | fengqing-maker/manager | /Sid_Project_Manger/Sid_Project_Manger/Src/MainFrame/UI/CGridCtrl/AbstractGridViewManager.h | GB18030 | 19,458 | 2.671875 | 3 | [] | no_license | /*******************************************************/
/**
*@file AbstractGridViewManager.h
*@brief ͼģ
*@note ͼʵӦ̳ͨذ
* ûԼҪıͼ
*@author ߷
*@date [4/10/2014]
********************************************************/
#pragma once
#include "./NewCellTypes/GridCellCombo.h"
#include "./NewCellTypes/GridCellCheck.h"
#inc... | true |
73b3259660a21e53cbbf66fefdd151bf9333fe0e | C++ | benwhittington/3DTransformations | /src/main.cpp | UTF-8 | 3,909 | 2.53125 | 3 | [] | no_license | #define OLC_PGE_APPLICATION
#include <olcPixelGameEngine.h>
#include <vector>
#include <iostream>
#include "domain.hpp"
#include "mapRange.hpp"
#include "point.hpp"
#include "shape.hpp"
#include "transform.hpp"
static constexpr double pi = 3.141592;
class Transform : public olc::PixelGameEngine {
Shape<3> m_Shape0;... | true |
fdb8a40878be92abc15c2612f051d555edc6e0ff | C++ | harsh735/practice | /ATM HS08TEST.cpp | UTF-8 | 304 | 2.953125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
// your code goes here
int x;
float y;
cin>>x>>y;
if(x%5 == 0 && y >=(x+.5))
{
y = y - (x + .5);
cout<<y;
}
else if(x > y)
{
cout<<y;
}
else
{
cout<<y;
}
return 0;
}
| true |
1089c5e7c55a04e29482041b2cbebc9c9d0133fd | C++ | BlueAndi/esp-rgb-led-matrix | /lib/AudioService/src/SpectrumAnalyzer.h | UTF-8 | 5,766 | 2.609375 | 3 | [
"GPL-3.0-only",
"LGPL-2.1-only",
"MIT",
"BSD-3-Clause",
"LGPL-3.0-only",
"Apache-2.0"
] | permissive | /* MIT License
*
* Copyright (c) 2019 - 2023 Andreas Merkle <web@blue-andi.de>
*
* 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 ... | true |
dc5152b393c046d96c3899778190f0d041a4ee4f | C++ | Hapiny/msu-compiler-course | /fdom/main.cpp | UTF-8 | 3,542 | 2.8125 | 3 | [] | no_license | #ifdef __cplusplus
#define export exports
extern "C" {
#include "qbe/all.h"
}
#undef export
#else
#include "qbe/all.h"
#endif
#include <iostream>
#include <unordered_map>
/*
Keith Cooper, Timothy Harvey, and Ken Kennedy.
A simple, fast dominance algorithm.
Rice University, CS Technical Report 06-33870, 0... | true |
6d81ee1d445ab805b2cb2e233ac157b3b1728669 | C++ | ezraezra101/coursework | /WPI_3_IMGD_3000_Game_Engine/dragonfly_only_ezra/src/EventMouse.cpp | UTF-8 | 891 | 2.8125 | 3 | [] | no_license | #include "EventMouse.h"
df::EventMouse::EventMouse() {
setType(df::MOUSE_EVENT);
btn = df::UNDEFINED_MOUSE_BUTTON;
action = UNDEFINED_MOUSE_ACTION;
mouse_xy = Position();
}
df::EventMouse::EventMouse(EventMouseButton init_btn, EventMouseAction init_action, Position pos) {
setType(df::MOUSE_EVENT);
btn = init_bt... | true |
7cad0aae9c3c4fe90583032579f53e2c7c3e623b | C++ | ryanulep/cs100_lab03 | /container.h | UTF-8 | 1,420 | 3.328125 | 3 | [] | no_license | #ifndef CONTAINER_H
#define CONTAINER_H
#include <stdexcept>
#include <stdlib.h>
#include <list>
#include <vector>
#include "Base.h"
#include "sort.h"
class Sort;
class Container {
protected:
Sort* sort_function;
public:
Container() : sort_function(NULL) { };
Container(Sort* function) : sort_function(fun... | true |
bd77fe0c5fc4d63228fac0caf55f75a82beac932 | C++ | bfelger/BloomFilter | /include/bjf/Hash/Murmur3.hpp | UTF-8 | 4,663 | 2.8125 | 3 | [] | no_license | ///////////////////////////////////////////////////////////////////////////////
// Murmur3.hpp
///////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef BJF__MURMUR3_HPP
#define BJF__MURMUR3_HPP
#include "hash.hpp"
namespace bjf::Hash {
constexpr hash_t rotl(const hash... | true |
1d9430a751892b03b4faa4017a566ff954fc01cd | C++ | WardF/hycast | /test/inet/Socket_test.cpp | UTF-8 | 7,099 | 2.625 | 3 | [
"UCAR"
] | permissive | /**
* This file tests class `Socket`.
*
* Copyright 2019 University Corporation for Atmospheric Research. All rights
* reserved. See file "COPYING" in the top-level source-directory for usage
* restrictions.
*
* File: Socket_test.cpp
* Created On: May 17, 2019
* Author: Steven R. Emmerson
*/
#includ... | true |
7cb4a9f9da5f63c729f0705a99d19f63943322e8 | C++ | SimKyuSung/Algorithm | /BeakJoon C++ Algorithm/1267핸드폰 요금.cpp | UHC | 382 | 3.046875 | 3 | [] | no_license | /// 1267ڵ
#include <iostream>
using namespace std;
int main()
{
int n; cin >> n;
unsigned long long y = 0, m = 0;
while (n--) {
unsigned long long input; cin >> input;
y += ((input + 30) / 30) * 10;
m += ((input + 60) / 60) * 15;
}
if (y > m) cout << "M " << m << endl;
else if (m > y) cout << "Y " << y... | true |
41b87cf3f95770b7ddaa9428eec1c9ee4873368e | C++ | bonetblai/cp2fsc-and-replanner | /benchmarks/replanner/wumpus/kill/generator.cc | UTF-8 | 10,170 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <deque>
#include <set>
#include <cassert>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
using namespace std;
struct Map {
int height;
int width;
int *map;
Map(istream &is) : height(0), width(0), map(0) {... | true |
757a2a1140c537c84ba13638759351e3fbefe8a1 | C++ | Khrishp/CS235 | /Week02/stack.h | UTF-8 | 6,789 | 3.5625 | 4 | [] | no_license | /***********************************************************************
* Header:
* stack
* Summary:
* This class contains the notion of an stack: a bucket to hold
* data for the user. This is just a starting-point for more advanced
* constainers such as the stack, set, stack, queue, deque, and map
... | true |
7fe2ac531b570891a0a649cd3e40b2e0ff7f77b1 | C++ | zylzjucn/Leetcode | /100~199/115. Distinct Subsequences.cpp | UTF-8 | 628 | 2.640625 | 3 | [] | no_license | class Solution {
public:
int numDistinct(string s, string t) {
vector<vector<int>> m(s.length() + 1, vector<int> (t.length() + 1));
for (int i = 0; i < m.size(); i++) {
for (int j = 0; j < m[0].size(); j++) {
if (i == 0)
m[i][j] = 0;
if... | true |
29c86c1d5fe5ec2dafd33ba1d04a6ae25a577962 | C++ | bappy451/Competative-Code | /CodeForces/Brain's Photos.cpp | UTF-8 | 510 | 3.015625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
while(cin>>n>>m)
{
bool flag = true;
char temp;
for(int i=0;i<n; i++)
for(int k=0;k<m; k++)
{
cin>>temp;
if((temp == 'W' || temp == 'B' || tem... | true |
3dcc97fd017cadf47a1bd2912cb193d182387961 | C++ | johnnyczhong/xiangqi | /xiangqi/Board.h | UTF-8 | 4,016 | 2.875 | 3 | [
"MIT"
] | permissive | //board.h
//header file
#include <map>
#include "Board_Defaults.h"
#ifndef BOARD_H
#define BOARD_H
class Board
{
private:
bool b_north_turn = true; //north starts first
int turn = 1; //north: 1, south: -1
std::map<int, bool> m_in_check =
{
{1, false}, {-1, false}
};
std::map<int, int>... | true |
edfb8437a8a3084d324a6fb425ca51f3ab6ddc24 | C++ | AnkitAnks/Paper---1 | /Q1.cpp | UTF-8 | 710 | 3.5 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout<<"Enter the array size"<<"\n";
cin>>n;
int arr[n];
cout<<"Enter the array Elements"<<"\n";
for(int i=0;i<n;i++)
cin>>arr[i];
if (n < 2)
cout<<" Invalid Input ";
int f,s;
f=INT_MAX;
s=INT_MAX;... | true |
2a5d8d43805a8db86e24306e2d7bdd08fbb5c7f0 | C++ | doanamo/Game-Engine-12-2013 | /Source/Common/ShelfPacker.hpp | UTF-8 | 683 | 2.953125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Precompiled.hpp"
//
// Shelf Packer
// Packs rectangles together to save as muhc space as possible.
// It's not the most optimal algorithm, but it's very straight forward.
//
class ShelfPacker
{
public:
ShelfPacker();
~ShelfPacker();
void Create(glm::ivec2 size, glm::ivec2 spaci... | true |
ffbd8d2e21d8aef94fee9ba2e419f17e1697d765 | C++ | Niraka/ThirdYearProject | /Include/UserInterface/UIProgressBarColored.h | UTF-8 | 2,954 | 3.28125 | 3 | [] | no_license | /**
A progress bar that supports colouring and sound effects on completion.
@author Nathan */
#ifndef UI_PROGRESS_BAR_COLORED_H
#define UI_PROGRESS_BAR_COLORED_H
#include "UIProgressBar.h"
#include "UIComponentListener.h"
#include "UIResourceManager.h"
class UIProgressBarColored :
public UIProgressBar,
public UIC... | true |
f120de0d71ba662bbef7a7f12598722a618a3ec5 | C++ | arturo182/QtCraft | /item/toolitem.cpp | UTF-8 | 1,755 | 2.671875 | 3 | [] | no_license | #include "toolitem.h"
#include <item/tooltype.h>
#include <gfx/screen.h>
#include <gfx/color.h>
#include <gfx/font.h>
#include <QStringList>
QStringList ToolItem::LEVEL_NAMES = QStringList() << "Wood"
<< "Rock"
<< "Iron"
<< "Gold"
<< "Gem";
QLis... | true |
177926f02a3d967d390a1d7634beb3b46b641e0c | C++ | vpsetter/HW-2sem | /HW 7 (19)/7.3.cpp | UTF-8 | 1,187 | 3.578125 | 4 | [] | no_license | #include <algorithm>
#include <future>
#include <iostream>
#include <numeric>
#include <thread>
#include <vector>
template < typename Iterator, typename F >
void parallel_for_each(Iterator first, Iterator last, F function, const std::size_t max_size)
{
const std::size_t length = std::distance(first, last);
if (leng... | true |
07b770cc7bbbb3099a755f6c6c2f28a37040422c | C++ | kangyeop/algorithm | /level2/62048.cpp | UTF-8 | 400 | 3.015625 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
using namespace std;
int GCD(int a, int b) {
if (a % b) {
return GCD(b, a % b);
}
return b;
}
long long solution(int w, int h) {
long long answer = 1;
int gcd = GCD(max(w, h), min(w, h));
long long x = w;
long long y = h;
lon... | true |
94795ccb5b02596ffc4ba4c86da6236291dd3507 | C++ | Nufflee/fm-dekoder | /fm/wave.hpp | UTF-8 | 2,724 | 3.390625 | 3 | [] | no_license | #pragma once
#include <stdint.h>
#include <iostream>
#include <fstream>
#include <cstring>
enum class WaveFormat : uint16_t
{
PCM = 0x0001
};
template <class T>
static void write_bytes(std::ofstream &stream, T value)
{
stream.write(reinterpret_cast<const char *>(&value), sizeof(T));
}
static v... | true |
b8d54755a441c11d26ae1e6708f157f8aaa5ce0b | C++ | Rysc0/Operating-systems-lab | /Lab02/Lamport.cpp | UTF-8 | 1,875 | 3.109375 | 3 | [] | no_license | #include <sys/shm.h>
#include <iostream>
#include <cstdlib>
#include <unistd.h>
#include <sys/wait.h>
using namespace std;
int *array, id, *broj, procesa;
int max(){
int max = broj[0];
for(int i = 0; i < procesa; i++){
if(max < broj[i]){
max = broj[i];
}
}
return max;
}
void kriticni_odsjecak(i... | true |
3e298a64c8c2449b66a6ea0f7122a376264a426d | C++ | arthurherbout/crypto_code_detection | /data/code-jam/files/3014486_AVictor_5649687893770240_0_extracted_D_small.cpp | UTF-8 | 1,215 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <limits>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <queue>
#include <cstring>
using namespace std;
int N, M;
set< string > letters[10];
int b... | true |
c3005c20bc1bd2a697f170cf6965fb50e1588894 | C++ | gregorymwillis/TicTacToeFileReader-c- | /T3Reader.cpp | UTF-8 | 2,386 | 3.515625 | 4 | [] | no_license | /*************************************************************************************
** Name: Greg Willis
** Date: 11/19/2017
** Description: (T3Reader.cpp)
************************************************************************************/
#include "T3Reader.hpp"
#include "Board.hpp"
#include <string>
#include <fs... | true |
6920e2caeef8378fe618c10720297105946b56e6 | C++ | samuraiexx/competitiveProgramming | /cf/702/f.cpp | UTF-8 | 2,614 | 2.65625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define st first
#define nd second
const int INF = 0x3f3f3f3f;
mt19937_64 llrand(random_device{}());
struct node {
pair<int, int> val;
int cnt, lz;
int amt;
ll pri;
node *l, *r;
node(int x) : val(x), amt(0), cnt(1), rev(0), pri(llrand()), l(0), r(... | true |
f754070db0c053157ca527b14720a68b45b1ef92 | C++ | dchwebb/Oscar | /Oscar446/src/config.cpp | UTF-8 | 3,115 | 2.78125 | 3 | [] | no_license | #include "config.h"
#include "ui.h"
#include "osc.h"
#include "fft.h"
#include "tuner.h"
Config cfg;
// called whenever a config setting is changed to schedule a save after waiting to see if any more changes are being made
void Config::ScheduleSave()
{
scheduleSave = true;
saveBooked = SysTickVal;
}
// Write cali... | true |
ce3a3db98038d8ed4825c9960b4470c3a07778d6 | C++ | scottsidoli/CPP-Applications-for-Financial-Engineering-Pre-MFE | /Section 1.4/Exercise143/Exercise143/Exercise143.cpp | UTF-8 | 4,047 | 3.9375 | 4 | [
"MIT"
] | permissive | // Exercise 1.4.3 - Word Counter (Switch-Case Loop)
//
// by Scott Sidoli
//
// 3-29-19
//
// The goal of this exercise is to create a program that accepts the user input of a string
// and returns the count of characters, words, and lines using a switch-case loop.
// Preprocessor Directives
#include <stdio.... | true |
a8c4e4082b452b893a8807b807547cb886f5d2d0 | C++ | Chimnii/Algospot | /Problems/Programmers/Lv2.172927.cpp | UTF-8 | 2,082 | 3.546875 | 4 | [] | no_license | #include <string>
#include <vector>
using namespace std;
int min(int a1, int a2) { return a1 < a2 ? a1 : a2; }
struct metal
{
int d, i, s;
metal() : d(0), i(0), s(0) {}
metal(int _d, int _i, int _s) : d(_d), i(_i), s(_s) {}
void emplace(const vector<int>& picks)
{
d += (picks.size() > 0 ? ... | true |
90bfb18532e0f4af395ab3d8fb1c4e6bdf6fc667 | C++ | kimlar/Packfile | /PackEngine.cpp | UTF-8 | 15,662 | 2.78125 | 3 | [] | no_license | #include "PackEngine.h"
#include "UtilDataType.h"
PackEngine::PackEngine(std::string packFileName)
{
this->packFileName = packFileName;
gotError = false;
}
PackEngine::~PackEngine()
{
ClosePackFile();
}
void PackEngine::Open()
{
Close();
gotError = false;
packFile = new PackFile(packFileNam... | true |
68211ba2f0566fbdc5bae7055522b77671c24774 | C++ | Hangtu/Arduino | /Ultrasonico/Ultrasonico.ino | UTF-8 | 1,547 | 2.828125 | 3 | [] | no_license |
//SR04
int PIN_TRIG=7;
int PIN_ECO=6;
long duracion=0;
long distancia=0;
void setup() {
// Inicializacion de la comunicacion serial
Serial.begin (9600);
// Inicializacion de pines digitales
pinMode(PIN_TRIG, OUTPUT);
pinMode(PIN_ECO, INPUT);
}
void loop() {
mandar2();
recibir();
... | true |
71dc49e9615bfd3ddfd4c953280bf9963a9044dd | C++ | Julian-guillermo-zapata-rugeles/udea-laboratorio-1 | /lab1_15/main.cpp | UTF-8 | 630 | 4.03125 | 4 | [] | no_license | /*
Ejercicio 15. Escriba un programa que pida constantemente números hasta que se ingrese el nú-
mero cero e imprima en pantalla la suma de todos los números ingresados.
Ej: si se ingresan 1, 2, 3, 0 se debe imprimir:
El resultado de la sumatoria es: 6
*/
#include <iostream>
using namespace std;
int main()
{
int ... | true |
f984c27333d13847abddcc0b3a4cc1f8f2783dd1 | C++ | svens/pal | /pal/net/ip/basic_resolver.test.cpp | UTF-8 | 6,878 | 2.5625 | 3 | [
"MIT"
] | permissive | #include <pal/net/ip/basic_resolver>
#include <pal/net/test>
#include <catch2/catch_template_test_macros.hpp>
namespace {
using namespace pal_test;
TEMPLATE_TEST_CASE("net/ip/basic_resolver", "",
udp_v4,
tcp_v4,
udp_v6,
tcp_v6)
{
using protocol_t = std::remove_cvref_t<decltype(TestType::protocol_v)>;
using ... | true |