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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f57f6575328c80c8c9c409a3581cc9282d6ff4c3 | C++ | edumargra/CGI | /MartinGraells_SolaRoca_Raytracer2/Code/shapes/sphere.h | UTF-8 | 515 | 2.71875 | 3 | [
"MIT"
] | permissive | #ifndef SPHERE_H_
#define SPHERE_H_
#include "../object.h"
class Sphere: public Object
{
public:
Sphere(Point const &pos, double radius);
Sphere(Point const &pos, double radius,double angle,Vector const &axis);
virtual Hit intersect(Ray const &ray);
virtual std::vector<float> UVco... | true |
aa05fcf411d7fb0d659a00a04e11e6f5d36fa20b | C++ | oliversssf2/opengl | /source/utilities/Shader.h | UTF-8 | 994 | 2.59375 | 3 | [] | no_license | //
// Created by fongsu on 4/3/19.
//
#ifndef OPENGL_SHADER_H
#define OPENGL_SHADER_H
#include<glad/glad.h>;
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
class Shader {
unsigned int ID;
Shader(const char* vertexPath, const char* fragmentPath);
void use();
void setBool(const std... | true |
40a505ee57d84cd4137b7f8e2a187f4fa0de7978 | C++ | mmaricic/FilesystemManagement | /projekat2/except.h | UTF-8 | 1,274 | 2.984375 | 3 | [] | no_license | #ifndef _EXCEPT_H
#define _EXCEPT_H
#include <iostream>
using namespace std;
class EInvalidPath {
friend ostream& operator<<(ostream& os, const EInvalidPath& e){
return os << "Invalid path!" << endl;
}
};
class EAliasEmpty {
friend ostream& operator<<(ostream& os, const EAliasEmpty& e){
return os << "Alias i... | true |
cade4e000cf5b11aa8d9e82c22603141a329fd8a | C++ | neilharia7/AlgorithmicToolbox | /Week_4_Programming_Assignment_3/inversions.cpp | UTF-8 | 1,124 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define long long long
long inversions = 0;
void Merge(int left[], int right[], int a[], int left_part, int right_part){
int i=0,j=0,k=0;
while((i < left_part) && (j < right_part)){
if(left[i] <= right[j]){
a[k++] = left[i++];
}
... | true |
cb77b25f50d6e5313482288d5ae59e4e571272b6 | C++ | aayushsinha44/codezilla | /Sorting/Merge Sort/C++/Arrays/MergeSortArrayTest.cpp | UTF-8 | 2,026 | 3.734375 | 4 | [
"MIT"
] | permissive | /*********************************************************************************
* Instructions:
* To compile: g++ MergeSort_ArrayTest.cpp -o MergeSort_ArrayTest -std=c++11
* To run: ./MergeSort_ArrayTest [#elements]
* Where #elements is number of elements in an array, default is 100.
* Author: Mounika Ponu... | true |
ff9a174c9a864303db98a5c3a542ff56bacfafd9 | C++ | Duanyll/Standard-TLE-Library | /src/other/merge_sort.cpp | UTF-8 | 767 | 3.109375 | 3 | [
"WTFPL"
] | permissive | template <typename T>
void merge_sort(T* a, int l, int r, int& ans, T* tmp) {
if (l == r) return;
int mid = (l + r) >> 1;
merge_sort(a, l, mid);
merge_sort(a, mid + 1, r);
int i = l, j = mid + 1;
int k = l;
while (i <= mid && j <= r) {
if (a[i] <= a[j]) {
tmp[k++] = a[i++... | true |
a1fe9d56f2aeaec142b86396fa88b388254f8b62 | C++ | migregal/bmstu-iu7-cg | /lab_04/logic/circle_algs/parametric.cpp | UTF-8 | 665 | 2.78125 | 3 | [
"MIT"
] | permissive | //
// Created by gregory on 24.03.2021.
//
#include <cmath>
#include <utils.h>
#include <parametric.h>
void paramcircle(std::vector<point_t> &dots, const point_t &c, double r,
const color_t &color) {
auto step = 1 / r;
for (auto t = 0.; t <= M_PI_4;) {
tmirrored(dots, {c.x + r * cos(t), c.... | true |
241cfa3ef03da89a8b9d015dbb278d314b2256ca | C++ | S-1-T/pascal-c-compiler | /src/main.cpp | UTF-8 | 1,414 | 2.578125 | 3 | [
"MIT"
] | permissive | #include "yacc/p2c.tab.h"
#include "yacc/semantic_analyser.h"
#include "codes/codes_generator.h"
#include <string>
#include <iostream>
#define COMPILE_TO_BIN true
using namespace std;
extern Program *root;
int main(int argc, char *argv[])
{
string fileName;
string noExtendedNameFileName;
// 处理文件名
... | true |
0f1d32de7ad94527d7e8e25f30d613a8b8380992 | C++ | DuyetVu2001/Study-CPlusPlus-Language | /BaiTapTrenLop/BT 17-4-2020/B1.cpp | UTF-8 | 481 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int nhap(){
int n;
do{
cout << "Nhap vao so nguyen duong n: ";
cin >> n;
}while(n < 1);
return n;
}
int tinhS(int n){
if(n == 1){
return 1;
}
return (pow(-1, n+1)*n) + tinhS(n-1);
}
long long tinhP(int n){
if(n == 1){
return 1;
}
return n*n ... | true |
776df01e885251182d826a40641fddcbaf8220e3 | C++ | fjnoyp/Graphics | /eyerays-blue/source/Art.cpp | UTF-8 | 3,337 | 3.234375 | 3 | [] | no_license | #include "Art.h"
Art::Art(float timeIncr, int depth, uint32 num) : timeIncrement(timeIncr) {
G3D::Random randomGenerator1(num);
G3D::Random randomGenerator2(num+1234);
G3D::Random randomGenerator3(num+9713);
expression1 = shared_ptr<Expr>(build(depth,randomGenerator1));
expression2 = shared_... | true |
97e81c2357448acc02abf9d568134b9184d54542 | C++ | lap089/Practice | /A. Joysticks/Source.cpp | UTF-8 | 354 | 2.921875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main() {
int charge, uncharge, m=0;
cin >> charge;
cin >> uncharge;
if (charge > uncharge) swap(charge, uncharge);
while (charge > 0 && uncharge > 0) {
if (charge + uncharge == 2) break;
if (uncharge <= 2) { swap(charge, uncharge); }
uncharge -= 2;
charge++;
... | true |
b262ff272fe0877806cb25ac218c4d6c52a91372 | C++ | lawy623/Algorithm_Interview_Prep | /Algo/Leetcode/406QueueReconstructionByHeight.cpp | UTF-8 | 1,163 | 3.328125 | 3 | [] | no_license | // greedy
class Solution {
public:
static bool comp(vector<int>& a, vector<int>& b){
if(a[0] > b[0]) return true;
if(a[0] == b[0]) return a[1] < b[1];
return false;
}
vector<vector<int>> reconstructQueue(vector<vector<int>>& people) {
sort(people.begin(), people.end(), comp);... | true |
d849b21c75e76c5a75be17151e07594b9056f571 | C++ | EarnestGibbs/BullCowGame | /BullCowGame/BullsAndCows/BullsAndCows/FBullCowGame.cpp | UTF-8 | 3,767 | 3.1875 | 3 | [] | no_license | #include "FBullCowGame.h"
#include <map>
#include <time.h>
#define TMap std::map
using int32 = int;
void FBullCowGame::Reset()
{
constexpr int32 MAX_TRIES = {};
HIDDEN_WORD = MyRandomHiddenWord;
MyHiddenWord = HIDDEN_WORD;
MyMaxTries = MAX_TRIES;
MyCurrentTry = 1;
bGameIsWon = false;
return;
}
... | true |
520e64afc13e46759571db0a0c2e8a3324133157 | C++ | Diusrex/UVA-Solutions | /122 Trees on the level.cpp | UTF-8 | 2,280 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | #include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
struct Node
{
long long num;
string position;
bool operator<(const Node &other) const
{
// Print out inital first
if (position.size() != other.po... | true |
c36f5443a015e052bafad0f5a8032289a2f5b023 | C++ | tedopranowo/WewEngine | /WewEngine/Source/Tools/ResourceCache.h | UTF-8 | 1,715 | 3.25 | 3 | [] | no_license | #pragma once
#include <unordered_map>
#include <memory>
#include <FilePath.h>
//-------------------------------------------------------------------------------------------------
// Class ResourceCache
//-------------------------------------------------------------------------------------------------
template<typena... | true |
2328a153fe78c08ebea849d3c6353f56c3b217d0 | C++ | y-wan/OJ | /timus/1982最小生成树.cpp | MacCentralEurope | 1,436 | 2.984375 | 3 | [
"MIT"
] | permissive | //СKruskal+bfs
#include <iostream>
#include <queue>
using namespace std;
priority_queue<pair<int, pair<int, int> > > pq;
int path[101][101], powered_count = 0; // bfs_visited_count
bool powered[101], connect[101][101]; // bfs_visited[101]
void bfs_power_up(const int center, const int n) {
for (int i = 1; i <= n; i++... | true |
6a105eab8b32f291292399927c9c26712cd4ea29 | C++ | sansajn/test | /namecollision.cpp | UTF-8 | 251 | 3 | 3 | [] | no_license | #include <iostream>
struct foo {
void introduce() {std::cout << "i'm foo\n";}
};
class goo
{
public:
foo foo() const {return f;}
private:
::foo f;
};
int main(int argc, char * argv[])
{
goo g;
foo f = g.foo();
f.introduce();
return 0;
}
| true |
9dac9571823b43d5a4f750954bde8331081b03e5 | C++ | ssavi-ict/UVa-Online-Judge | /Learning Bitwise Sieve.cpp | UTF-8 | 808 | 2.703125 | 3 | [] | no_license | #include<bits/stdc++.h>
#define MAX 10000005
using namespace std;
int status[(MAX/32)+2];
bool check(int n, int pos) { return (bool)(n & (1<<pos)); }
int SET(int n, int pos){ return n=n|(1<<pos);}
void sieve()
{
int sqrtN=int (sqrt(MAX));
for(int i=3; i<=sqrtN; i=i+2)
{
if(check(s... | true |
fe596b3fe0ae556cebe5ffd1d3a1ac9bbf0157bc | C++ | CommunicoPublic/iris | /tags/iris-0.1.23/include/core/MainLoopEventWatcher.hpp | UTF-8 | 2,066 | 2.515625 | 3 | [] | no_license | /*-
* Copyright (c) Iris Dev. team. All rights reserved.
* See http://www.communico.pro/license for details.
*
*/
#ifndef _MAIN_LOOP_EVENT_WATCHER_HPP__
#define _MAIN_LOOP_EVENT_WATCHER_HPP__ 1
/**
@file MainLoopEventWatcher.hpp
@brief Main loop event watcher
Accepts network connections and put them to th... | true |
f367a6b0a766a2865ff1024c7ae106030f0daa43 | C++ | svenmcgov/cit_245 | /iotest.cpp | UTF-8 | 218 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
int main(){
ifstream fin;
fin.open("test.txt");
char next;
fin.get(next);
while(!fin.eof()){
cout << next;
fin.get(next);
}
cout << endl;
}
| true |
1239575f52ee29d3e74eeb859c4ac30801dd10e2 | C++ | jeromeNoir/QuICCPython | /src/Exceptions/Exception.cpp | UTF-8 | 401 | 2.515625 | 3 | [] | no_license | /**
* @file Exception.cpp
* @brief Definitions of the Exception methods.
* @author Philippe Marti \<philippe.marti@colorado.edu\>
*/
// System includes
//
// External includes
//
// Class include
//
#include "Exceptions/Exception.hpp"
// Project includes
//
namespace QuICC {
Exception::Exception(const std... | true |
e8e20de7fa30609f19a1477cd1cfd9d38d27a549 | C++ | MeJustBear/SHACAL-algorithm | /lab2_v1/HeaderForBmp.h | UTF-8 | 2,554 | 2.578125 | 3 | [] | no_license | #pragma once
#include<iostream>
#include<fstream>
#define bmp 19778
#pragma pack(push,1)
/*@brief
first header in bmp type
*/
typedef struct {
unsigned short bfType; //2
unsigned int bfSize; //4(6)
unsigned short bfReserved1;//2(8)
unsigned short bfReserved2; //2(10)
unsigned int bfOffBits; //4(14)
... | true |
90df58261dc3a309a94ea84c1d6981afff60aad2 | C++ | hemantgangolia/two_roads | /ingredient.h | UTF-8 | 246 | 2.5625 | 3 | [] | no_license | #ifndef INGREDIENT_HPP // This is used to avoid including a header more than once.
#define INGREDIENT_HPP
#include <string>
class Ingredient
{
public:
std::string name;
int expiry;
Ingredient ();
Ingredient(std::string, int);
};
#endif | true |
d233cb8b3f2dbb23f78d664c29d8028192afaa61 | C++ | TerenYeung/Road-To-BE | /Computer-Science/C++/Ch5/ex5_9.cpp | UTF-8 | 669 | 3.34375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using std::vector;
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main()
{
unsigned int ac = 0, ec = 0, ic = 0, oc = 0, uc = 0, otherc = 0;
char ch;
while(cin >> ch){
if (ch == 'a' || ch == 'A') ++ac;
else if (ch == 'e' ||... | true |
135b305e9e29cd0df3e230bf1e4fa37a6f466bf7 | C++ | rAum/vilga | /vilga/include/vilga/detail/data.hpp | UTF-8 | 1,252 | 3.125 | 3 | [
"MIT"
] | permissive | #pragma once
#ifndef VILGA_DETAIL_DATA_HPP
#define VILGA_DETAIL_DATA_HPP
#include <memory>
#include <string>
#include <vilga/detail/macros.hpp>
namespace vilga_detail {
class memory_block_t {
public:
std::size_t size_ = 0;
std::unique_ptr<std::uint8_t[]> bytes_;
static void free_mem(void* data, void*) noexcep... | true |
164dc9966a5cfe15a195eca706ae2546c503cfb1 | C++ | wangbiy/- | /test_2020_9_5_1/test_2020_9_5_1/test.cpp | GB18030 | 1,835 | 3.28125 | 3 | [] | no_license | #include <iostream>
using namespace std;
//Убż
#if 0
//1.³
#include <set>
#include <string>
int main()
{
string str;
set<string> s;
while (cin >> str)
{
s.insert(str);//ȥ
}
cout << s.size() << endl;
return 0;
}
#endif
#if 0
//2.ƻ
#include <vector>
#include <math.h>
int avg(vector<int> arr)
{
int average = 0;/... | true |
41f243837175bf2ccf3797caa46776ae483d5b47 | C++ | Kitware/VTK | /Filters/Points/vtkMaskPointsFilter.h | UTF-8 | 3,869 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-CLAUSE
/**
* @class vtkMaskPointsFilter
* @brief extract points within an image/volume mask
*
* vtkMaskPointsFilter extracts points that are inside an image mask. The
* image mask is a second in... | true |
959a285a6ff5d767d9a3d83bb0da7bb319eb374a | C++ | shribadiger/interviewpreparation | /HackerRank/SaleByMatch.cpp | UTF-8 | 339 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
int main() {
int n = 10;
int list[]={10,10,10,30,10,20,20,10,40,50};
int *result = new int[101];
memset(result,0,sizeof(int)*101);
for(int i=0;i<10;i++){
result[list[i]]++;
}
for(int i=0;i<51;i++) {
if(result[i] != 0)
std::cout<<"\t"<<result[i]... | true |
f16e0baa7d7a3a3907437a053318c19244a14fa1 | C++ | wazzamauro/ASD | /priorityqueue/PriorityQueue.h | UTF-8 | 4,720 | 3.078125 | 3 | [] | no_license | //
// Created by Mauro Nicolì on 2019-04-08.
//
#ifndef STRUTTURE_DATI_PRIORITYQUEUE_H
#define STRUTTURE_DATI_PRIORITYQUEUE_H
template<class T>
class CodaP {
public:
typedef T _item;
CodaP();
CodaP(int);
CodaP(const CodaP<T> &);
~CodaP();
void insert(_item);
_item min();
void d... | true |
73f73d200829aa6a0ec7ff0deea7a195626bb2df | C++ | mseeg/pj2 | /Bomber.cpp | UTF-8 | 796 | 3.109375 | 3 | [] | no_license | #include "MilitaryUnit.h"
Bomber::Bomber(string name, int attackDamage) : MilitaryUnit(name, attackDamage)
{
type = "splash";
}
int SquadRemaining(vector<MilitaryUnit*>& Squad)
{
int alive =0;
for(int i =0; i<Squad.size();++i)
if(Squad[i]->isAlive())
++alive;
return alive;
}
void Bomber::fightAll(vector<... | true |
b02e312f75969e9fa8c8c49c1d4f61b1d854126c | C++ | albertored11/PCOM-Problems | /OJ/11367/11367.cpp | UTF-8 | 1,906 | 2.65625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using vvii = vector<vii>;
using iii = pair<int, ii>;
using viii = vector<iii>;
const int INF = 10e8;
const int MAX_CAP = 102;
const int MAX_CITIES = 1002;
int numCit... | true |
241cd78de421134396c8830b024fb56555789ec8 | C++ | akgarhwal/Sports-Programming | /Hacker-Rank/Project Euler-HackerRank/Project Euler #7: 10001st prime.cpp | UTF-8 | 776 | 3.109375 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
bool isPrime(int n)
{
if (n == 2)
return true;
if (n == 3)
return true;
if (n % 2 == 0 )
return false;
if (n % 3 == 0 )
return false;
int i = 5;
int w = 2;
while (i * i <= n)
{
if( n % i == 0)
re... | true |
66677877be6317cd5313d371fd52c8394def2600 | C++ | katherine0504/Uva | /231.cpp | UTF-8 | 993 | 2.734375 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#define MAX 32800
int LIS[MAX] = {1}, num[MAX] = {0};
int cnt, ans, in;
void init();
void findLIS();
int main() {
int i;
int casecnt = 1;
while (scanf("%d", &in) != EOF) {
if (in == -1) {
break;
}
init();
num[0] = in;
cnt = 1;
while (scanf("%d... | true |
ca00aef4fa9a5518e3eaed552238ec4a272d2d4b | C++ | the-nexus/ProjectAutomata | /source/ProjectAutomata/ProjectAutomata/Automata/Simulations/ForestFireSimulation.h | UTF-8 | 626 | 2.953125 | 3 | [
"MIT"
] | permissive | #ifndef FOREST_FIRE_SIMULATION_H
#define FOREST_FIRE_SIMULATION_H
#include "Simulation.h"
// STATES:
// 0 : dead
// 1 : alive
class ForestFireSimulation : public Simulation
{
public:
static const Color treeColor;
static const Color fireColor;
static const Color emptyColor;
ForestFireSimulation();
~ForestFireSi... | true |
11d31478534b15f5066054ad1e075ff4acd17789 | C++ | JackMcCallum/Portfolio | /Demos/Games/Tanks/Source/CollisionManager.h | UTF-8 | 1,647 | 2.59375 | 3 | [] | no_license | /************************************************************************/
/* @class CollisionManager
* @author Jack McCallum
*
* @description
* Collision manager is responsible for checking for collisions, handling them
* then sending the event to object.
*
/****************************************************... | true |
21dc7c8cc9235c44bae2d4bb59f355f767899401 | C++ | JDR-neu/bezier_curve | /tests/TestPolynomial1D.cpp | UTF-8 | 1,185 | 3.0625 | 3 | [
"MIT"
] | permissive | /**
* @file TestPolynomial1D.cpp
*
* @brief test polynomial
*
* @author btran
*
* @date 2019-08-11
*
* Copyright (c) organization
*
*/
#include "gtest/gtest.h"
#include <bezier/PowerBasisPolynomial1D.hpp>
#include <ctime>
class TestPolynomial : public ::testing::Test
{
protected:
void SetUp()... | true |
928b518d9fe1d58b6f870d14c0028845dab6cccb | C++ | umdreamer/leetcodeproblems | /addTwoNumbers.cpp | UTF-8 | 2,949 | 3.734375 | 4 | [] | no_license | /**
* leetcode: rotate list
* medium
*/
#include <cstdio>
/**
* Definition for singly-linked list.
*/
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode* createList(int* values, int size) {
ListNode* head = NULL;
ListNode* tail = NULL;
for (int i... | true |
27ba0175e06484cecf98d93f2d2027c47d409b5a | C++ | devidattadehury/cs141 | /lab7q2.cpp | UTF-8 | 649 | 4 | 4 | [] | no_license | #include<iostream>
using namespace std;
//recursion to display all natural no.s from lowest to highest
//i is lowest and a is highest.
int numbers(int i,int a)
{
if (a >= i)
{
//displaying no.s starting from lowest
cout <<i <<endl;
numbers(i + 1,a);
}
else
{cout <<endl;
}
}
//main function
int main... | true |
ccbf331c6e077edb117ef22878c4fe4d57f111be | C++ | Aeopp/DevilMayCry- | /Engine/Header/TEXTURE.H | UHC | 987 | 2.546875 | 3 | [] | no_license | #ifndef __TEXTURE_H__
#define __TEXTURE_H__
#include "Resource.h"
#include <any>
BEGIN(ENGINE)
class ENGINE_DLL Texture final : public Resource
{
private:
LPDIRECT3DTEXTURE9 m_pTexture;
D3DXIMAGE_INFO m_tInfo;
TEXTUREDESC m_tDesc;
private:
explicit Texture(LPDIRECT3DDEVICE9 const _pDevice);
explicit Texture(co... | true |
baa12aea4d6b57ffe6446e7a9a5105f51f89363a | C++ | anmolmishra02/Dfs-and-bfs | /level order traversal.cpp | UTF-8 | 1,137 | 3.296875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class treenode
{
public:
int val;
treenode*left;
treenode*right;
treenode(int v)
{
val=v;
this->left=NULL;
this->right=NULL;
}
};
vector<vector<int>> levelorder(treenode*root)
{
vector<vector<int>> ans;
if(root==NULL)
{
return ans;
... | true |
152061ce2fc7fcc697c65f43dfc46a7da3170536 | C++ | rstraight/T | /T/T/SymTable.h | UTF-8 | 558 | 2.546875 | 3 | [] | no_license | #ifndef SYMTABLE_H
#define SYMTABLE_H
#include <iostream>
#include <list>
#include <deque>
#include <vector>
#include <stdio.h>
#include <string.h>
using namespace std;
class SymTable
{
public:
SymTable();
~SymTable();
int addSymbol(string name, string value);
int setSymbol(string ... | true |
1727dc5d507d7642749406f88c6a7375a6848c06 | C++ | CrustyAuklet/xmega-ecpp | /include/device/peripherals/GPIO.hpp | UTF-8 | 2,136 | 2.703125 | 3 | [] | no_license | /**
* None-GPIO (id I6085)
* General Purpose IO
*
*
*/
#pragma once
#include "device/register.hpp"
#include <cstdint>
namespace device {
/**
* GPIO
* General Purpose IO Registers
* Size: 16 bytes
*/
template <addressType BASE_ADDRESS>
struct GPIO_t {
/// General Purpose IO Register 0 - 1 bytes
stru... | true |
dc3bda37a75e779b57c4943bbc89253c229d3814 | C++ | dan1109/CasualGame | /CasualGame/PlayerInputManager.cpp | UTF-8 | 5,966 | 2.53125 | 3 | [] | no_license | #include "PlayerInputManager.h"
#include "Game.h"
#include "Player.h"
#include "Config.h"
#include <cmath>
PlayerInputManager::PlayerInputManager() {}
void PlayerInputManager::handleInput(const sf::Event& event, const sf::Vector2f& mousePosition, Game& game)
{
if (event.type == sf::Event::MouseButtonPressed)
{
... | true |
0eac259ed43bd91f421d3c7e87303eb7f101c422 | C++ | eglrp/myds-old | /Forest/Forest.h | GB18030 | 6,350 | 3.703125 | 4 | [] | no_license | #include "MultiTree.h"
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
/**
* Forest: ɺֵܱʾʾĶɵɭ
* note: Ҫʶĵײָṹ˱ΪԪ
*/
class Forest
{
public:
// 1. constructor
Forest(); // ĬϹ캯յɭ
Forest(const vect... | true |
2af43de221d646bbffc1186be43308d76074cd65 | C++ | hackerlank/buzz-server | /src/game_server/server/extension/soul/soul_actor_manager.cc | UTF-8 | 1,705 | 2.5625 | 3 | [] | no_license | //
// Summary: buzz source code.
//
// Author: Tony.
// Email: tonyjobmails@gmail.com.
// Last modify: 2013-06-14 15:42:15.
// File name: soul_actor_manager.cc
//
// Description:
// Define class SoulActorManager.
//
#include "game_server/server/extension/soul/soul_actor_manager.h"
#include "game_server/server/extensi... | true |
2c10aa7172f381cfb4d07cc835c94f19ebd747d8 | C++ | DenisDesimon/LeetCode | /1352_Product_of_the_Last_K_Numbers.cpp | UTF-8 | 1,198 | 3.953125 | 4 | [] | no_license | //#1352 Product of the Last K Numbers - https://leetcode.com/problems/product-of-the-last-k-numbers/
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
class ProductOfNumbers {
vector<int> Prefix;
public:
ProductOfNumbers() {
Prefix.push_back(1);
}
void ... | true |
88333f50156cc744335d6a3bb4aadcbf5f5c3fc7 | C++ | bsuljic1/Programming-techniques | /TP2018/T12/Z6/main.cpp | UTF-8 | 7,956 | 3.171875 | 3 | [] | no_license | /*
TP 16/17 (Tutorijal 12, Zadatak 6)
Autotestove napisao Kerim Hodzic. Sve primjedbe/zalbe, sugestije
i pitanja slati na mail: khodzic2@etf.unsa.ba.
Vrsit ce se provjera na prepisivanje tutorijala (na kraju semestra)
*/
#include <iostream>
#include <iomanip>
#include <cstring>
#include <stdexcept>
#include <ne... | true |
42e3d6f9faabb72109f1e39c2b920846c577de2f | C++ | alexandrofernando/java | /acm/P2104__Kth_Number.cpp | UTF-8 | 695 | 2.921875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
struct Number {
int value;
unsigned index;
};
int compare(const void *a,const void *b)
{
return ((const Number *)a)->value-((const Number *)b)->value;
}
Number numbers[100001];
int main()
{
int i;
int n,m;
unsigned I,J,K;
int count;
scanf("%d%d",&n,&m);
for (i=0;i<... | true |
86605195604e108e5db281a48c143cb3cebe9aeb | C++ | fngoc/CppModules | /Module04/ex03/Character.hpp | UTF-8 | 552 | 2.84375 | 3 | [] | no_license | #ifndef EX03_CHARACTER_HPP
#define EX03_CHARACTER_HPP
#include "ICharacter.hpp"
class Character : public ICharacter {
public:
Character(string name);
Character(Character& сharacter);
virtual ~Character();
Character& operator=(const Character& сharacter);
virtual const string& getName() const;
... | true |
1c66f25b71d0257056df2a0caf73c1980ba8d7e0 | C++ | caballa/covenant | /tools/covenant.cpp | UTF-8 | 6,112 | 2.515625 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <cstdlib>
#include <boost/program_options.hpp>
#include <Common.h>
#include <parser/ParseUtils.h>
#include <parser/ParseProblem.h>
#include <CFG.h>
#include <Solver.h>
#include <regsolver/Product.h>
using namespace std;
using namespace covenant;
namespace po = boost::program_options;
int... | true |
9aa211d8c25889b55a2f264c647dd94bc591a010 | C++ | Kitware/vtk-examples | /src/Cxx/Images/ImageLuminance.cxx | UTF-8 | 2,478 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #include <vtkImageActor.h>
#include <vtkImageCanvasSource2D.h>
#include <vtkImageLuminance.h>
#include <vtkImageMapper3D.h>
#include <vtkInteractorStyleImage.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmart... | true |
d791afbec38f5e3d07dec3a1a36a8e7965003e97 | C++ | ajanaliz/BasicGL | /SelfAssessment1_2/SlefAssssment1_2/main.cpp | UTF-8 | 597 | 2.65625 | 3 | [] | no_license | #include <GL\glut.h>
#include <iostream>
#include <cmath>
#define N 100
#define PI 3.14
static float R = 1.0;
void init()
{
glClearColor(1.0, 1.0, 1.0, 1.0);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
float t = 0, x = 0.0, y = 0.0;
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINE_LOOP);
for (int i = 0; i < N;i++... | true |
3135a1b546a075c2b7ae465666d3f7abcb7e8216 | C++ | rajneeshkumar146/pepcoding-Batches | /2019/batch_01/grp1_graph/l001.cpp | UTF-8 | 3,593 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Edge
{
public:
int v = 0;
int w = 0;
Edge(int v, int w)
{
this->v = v;
this->w = w;
}
};
const int n = 9;
vector<vector<Edge *>> graph(n, vector<Edge *>());
void addEdge(vector<vector<Edge *>> &g, int u, int v, int... | true |
69a452ee90de29fc71b16bdc5e0e3f1ad3006048 | C++ | 20060201/Abbreviation | /main.cpp | UTF-8 | 2,507 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cctype>
using namespace std;
int main(){
string s, s1;
string str;
int n;
cout << "Key Word: ";
getline(cin, str);
//
string SS[99];
vector <string> vSS;
//
n=0;
s1="";... | true |
d7c6f12bc6cf57bbf607630db5f7f462f2b306b7 | C++ | 0yhy/Algorithm | /6. 背包问题/ZeroOnePack.cpp | UTF-8 | 785 | 2.84375 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int MAXN = 105;
const int MAXC = 1005;
const int INF = 0x3f3f3f3f;
int N, V;
int c[MAXN], v[MAXN];
int f[MAXN][MAXC];
void initiaize() // 不用恰好装满
{
for (int i = 0; i <= N; ++i)
for (int j = 0; j <= V; ++j)
f[i][j] = 0;
}
void initializeFull() // ... | true |
ad08eec5cc054ad1d7f20875e7aaa5838657d07c | C++ | bangbv/Master | /Thesis/documents/fimi01/source/Trie.cpp | UTF-8 | 20,107 | 2.84375 | 3 | [] | no_license | /***************************************************************************
Trie.cpp - description
-------------------
begin : cs dec 26 2002
copyright : (C) 2002 by Ferenc Bodon
email : bodon@mit.bme.hu
****... | true |
021712da6982a68b9174c5a4f1b5c3f3d0c1f6dd | C++ | JinhwanSul/SW_Expert_Academy_practice | /1242/Jinhwan/1242.cpp | UTF-8 | 7,517 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
// Using String Match, Rabin-Karp Algorithm
int decrypt(int *one_number)
{
int i, value = 0;
for (i = 0; i < 7; i++) {
// printf("%d ", one_number[i]);
value = value + one_number[i] * (1<<(6-i));
}
// print... | true |
71a26854b6279768391134259a62f1ffb56bbeea | C++ | frandibar/pacman3d | /lib/sockets/Socket.cpp | UTF-8 | 2,573 | 2.828125 | 3 | [] | no_license | #include "Socket.h"
#include "debug.h"
#include <iostream>
#include <cerrno>
#include <string>
#include <fcntl.h>
using std::string;
Socket::Socket() : _sock(-1)
{
memset(&_addr, 0, sizeof(_addr));
}
Socket::~Socket()
{
if (isValid())
::close(_sock);
}
bool Socket::create()
{
_sock = socket(AF_... | true |
470dc73f9e07c38649226a3dddd82d0bd55697db | C++ | MasakiMuto/DxShooot | /DxShoot/PlayEngine.h | UTF-8 | 843 | 2.578125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <memory>
#include <list>
#include "ImageLoader.h"
#include "PlayerCharacter.h"
#include "Shot.h"
#include "CharacterManager.h"
#include "Enemy.h"
#include "Rectangle.h"
namespace dxshoot
{
class PlayEngine
{
public:
static PlayEngine& getInstance();
PlayEngine();
~PlayEngine();
void update(... | true |
1459bf72f63106c7ea9f2ee627ccd58ee08d113b | C++ | fromasmtodisasm/xform-megatexture | /src/geom/xDrawVert.h | UTF-8 | 2,134 | 2.875 | 3 | [
"MIT"
] | permissive | #ifndef __DRAWVERT_H__
#define __DRAWVERT_H__
/*
===============================================================================
Draw Vertex.
===============================================================================
*/
class xDrawVert
{
public:
xVec3 xyz;
xVec3 normal;
byte color[4];
xVec2 st;
x... | true |
04fc8c55f32b8f398f7badd3a5e0a1550e5e806d | C++ | anhtuan10/Memories | /main.cpp | UTF-8 | 201 | 2.96875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int myAge = 21;
cout << "Hello bro! \n"<< "\tNice to meet you! \n";
cout << "\t\tI'm "<< myAge << " years old. \n";
return 0;
} | true |
9d77071d5915f23feaff47ef70e3c947166b43a1 | C++ | Kitware/vtk-examples | /src/Cxx/Rendering/Cone4.cxx | UTF-8 | 4,037 | 3 | 3 | [
"Apache-2.0"
] | permissive | //
// This example demonstrates the creation of multiple actors and the
// manipulation of their properties and transformations. It is a
// derivative of Cone.tcl, see that example for more information.
//
// First include the required header files for the VTK classes we are using.
#include <vtkActor.h>
#include <vtkC... | true |
9d87f7684fd7ed9bfefc7d671bf601504f98debd | C++ | face4/AtCoder | /ABC/039/C.cpp | UTF-8 | 907 | 3.28125 | 3 | [] | no_license | #include<iostream>
using namespace std;
// strの接頭辞がpreかどうかを判別する.
bool startsWith(string str, string pre){
int s = str.length(), p = pre.length();
if(s < p) return false;
int j;
for(j = 0; j < p; j++){
if(str[j] != pre[j]) break;
}
return j == p;
}
int main(){
string piano = "... | true |
cbbf1ea0fa50e9b6a4eeb90a168820a44bb8f3a1 | C++ | Slava/competitiveProgramming | /more-source/arithmetics/051_faktoriali!!!.cpp | UTF-8 | 359 | 2.53125 | 3 | [] | no_license | // Kim Vyacheslav KarKTL
#include <cstdio>
using namespace std;
int main ()
{
freopen ("input.txt", "r", stdin);
freopen ("output.txt", "w", stdout);
int n, a = 1, i, k = 0;
char s[25];
scanf ("%d %s", &n, &s);
while (s[k]) k++;
i = n % k;
if (!i) i = k;
for (; i <= n; i += k)
... | true |
13f40dd4ca646f06ccb97a91dc3f6b490f0399a7 | C++ | Air-Terranean/Demonstrations | /doublelinkedlist.cpp | UTF-8 | 2,646 | 3.765625 | 4 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <string>
#include "doublelinkedlist.h"
using namespace std;
list::list()
{
head = NULL;
tail = NULL;
temp = NULL;
curr = NULL;
}
void list :: addnodehead (int ahnum, char ahword)
{
cout << "Enter a number: " << endl;
cin >> ahnum;
cout << endl;
cout << "Enter ... | true |
cf19ab7ed1b9e82517296067f770e3677fa09525 | C++ | le-quoctrung/Course-Registration-System | /main/Course-Registration-System/Score.cpp | UTF-8 | 866 | 2.65625 | 3 | [] | no_license | #include"school.h"
#include"file.h"
void readScore(string path, char username[], char password[], int type, ScoreList& List) {
fstream file(path);
string tr;
Score* cur = nullptr;
if (file.is_open()) {
getline(file, tr, ',');
getline(file, List.CourseCode, ',');
getline(file, tr);
getline(file, tr);
while... | true |
0e8956e360098567611a5f3661a7291e379abd7b | C++ | 1111Viter/05091970 | /main12.cpp | UTF-8 | 1,290 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <conio.h>
#include <string.h>
#include <stdio.h>
using namespace std;
struct Struct
{
char name[64];
int yr;
int cb;
int cpb;
}s;
void Menu(int);
void inp(Struct s);
void out(Struct s);
void srch(Struct s);
FILE *f;
int main(){
char c;
m: cout<<"w - write;\n"
"r - read;\n"... | true |
522b5fb00ca6c508c6292f3c6aa5bc68b71047ba | C++ | ngvozdiev/ncode-common | /src/free_list.h | UTF-8 | 6,700 | 3.078125 | 3 | [
"MIT"
] | permissive | #ifndef NCODE_FREE_LIST_H
#define NCODE_FREE_LIST_H
#include <stddef.h>
#include <vector>
#include <functional>
#include <memory>
#include <mutex>
#include <set>
#include "common.h"
#include "logging.h"
namespace nc {
template <typename T>
class FreeList;
template <typename T>
FreeList<T>& GetFreeList();
// A free... | true |
65e7001e0d840b3c3127ee7df89e533e7edc34a3 | C++ | BohuTANG/cascadb | /include/cascadb/comparator.h | UTF-8 | 1,026 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright (c) 2013 The CascaDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef CASCADB_COMPARATOR_H_
#define CASCADB_COMPARATOR_H_
#include <assert.h>
#include "slice.h"
na... | true |
d0bbeee9492981af2dec1e904967ace79caf042b | C++ | MikeAndTheWorld/Rocket-Wars | /Project/src/Rendering/Texture.cpp | UTF-8 | 3,217 | 3.15625 | 3 | [] | no_license | #include "Rendering\Texture.h"
////Create a Texture and set some default values.
//Texture::Texture(GLuint TexWidth, GLuint TexHeight, unsigned char* data) : SizeX(0), SizeY(0), Internal_Format(GL_RGBA), Image_Format(GL_BGRA), Wrap_S(GL_REPEAT), Wrap_T(GL_REPEAT), Filter_Min(GL_LINEAR), Filter_Max(GL_NEAREST) {
// glG... | true |
ccc28fce0564a25f34c07c864253305a931d913f | C++ | eyalbi/college-cpp-projects | /build_dictionary/Menu.cpp | UTF-8 | 1,620 | 3.546875 | 4 | [] | no_license | #include "Menu.h"
void Menu::MainMenu()
{
Definition temp;
String Stemp;
int i = ZERO, end;
cout << "Hello i am dictionary follow the instruction and hace fun" << endl;
do {
cout << "1. Create a dictionary\n\n2.Enter a new word to the dictionary\n\n3.Add a new definition to an existing word\n\n4.find a... | true |
c757c8c313860bc16c60dd8c192791dba00144a5 | C++ | tmgerard/Lateral-Earth-Pressure | /src/LateralEarthPressure.cpp | UTF-8 | 4,107 | 3.1875 | 3 | [] | no_license | #include <math.h>
#include "LateralEarthPressure.h"
/*
* Abstract class for lateral earth pressure of soil behind retaining walls.
* Classes for calculating earth pressures based on Rankine's or Coulomb's
* theory of lateral earth pressure shall inherit this class. Note that these
* classes do not take ... | true |
37521057803be58a7ffdea86b377e8c511772461 | C++ | mackeper/AlgorithmsAndDataStructures | /kattis/arrivingontime/time_table_graph.hpp | UTF-8 | 2,897 | 3.265625 | 3 | [] | no_license | #include <vector>
#include <queue>
#include <limits>
namespace popup {
class Edge {
public:
size_t from_;
size_t to_;
int64_t weight_;
size_t starting_time_;
size_t period_;
Edge(size_t from, size_t to, size_t starting_time, size_t period, int64_t weight) {
from_ = from;
to_ = t... | true |
12ad3c31418cc517bf7a4a95c0654da3a831c220 | C++ | ioio-creative/FFMount | /FFMount_KineticController/src/Timeline.h | UTF-8 | 2,043 | 2.75 | 3 | [] | no_license | //A class for timeline that contain keyframes and calculate their tween values based on X position
//call getValueAtPos to get the tween value of keyframes
#ifndef __ParkYohoTimeline__
#define __ParkYohoTimeline__
#include <stdio.h>
#include "ofMain.h"
#include "ofxGui.h"
#include "Keyframe.h"
#include "ofEvents.h"
... | true |
50d6744af0f0fb59b166352ed0b33b91352b977e | C++ | SeekerNik/code | /HRank/SequenceEquation.cpp | UTF-8 | 535 | 3.046875 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
vector<int> permutationEquation(vector<int> p)
{
map<int, int> result;
vector<int> ret;
for (int i = 0; i < p.size(); i++)
{
result[p[i]] = i + 1;
}
for (int j = 0; j < p.size(); j++)
{
int ind1 = result[p[j]];
... | true |
75372fce60874154528ad91e909214aa6b07292e | C++ | miroslavavramov/Memory-Game | /26.10.2014_-_Jordan/MemoryCard/src/main.cpp | UTF-8 | 384 | 2.6875 | 3 | [] | no_license | #include "Game.h"
const int SCREEN_WIDTH = 1024;
const int SCREEN_HEIGHT = 768;
// our Game object
Game* g_game = 0;
int main(int argc, char* argv[]) {
g_game = new Game();
g_game->Init("Memory_;)", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_FULLSCREEN_DESKTOP);
//main loop
while (g_game->Running()) {
g_game... | true |
56ae7d59a95062e0cfddb857f404b6f757c813a0 | C++ | GabeOchieng/ggnn.tensorflow | /program_data/PKU_raw/40/2830.c | UTF-8 | 696 | 3.03125 | 3 | [] | no_license | double S(double a,double b,double c,double d,double m);
double max(double a,double b,double c,double d);
int main(int argc, char* argv[])
{
double a,b,c,d,m,ans;
scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&m);
if(max(a,b,c,d)<(a+b+c+d)/2)
{
m=m*3.1415926/180/2;
ans=S(a,b,c,d,m);
printf("%.4lf",ans);
}
... | true |
9e0f84e556ea5a3365536f32b5968be8ea4c8cf2 | C++ | rcaelers/esp32-beacon-scanner | /components/loopp/include/loopp/utils/bitmask.hpp | UTF-8 | 5,497 | 2.734375 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2014 Dmitry Arkhipov
// Copyright (C) 2017 Rob Caelers <rob.caelers@gmail.com>
//
// 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 li... | true |
77cf85d1db35530ad46210ea761e26fa77b820af | C++ | Ex-Soft/test | /ASP.NET/test/AnyTestIII/Test/Others/Lander/Lander.cpp | UTF-8 | 3,470 | 2.515625 | 3 | [] | no_license | #using <system.dll>
#using <mscorlib.dll>
#using <system.web.dll>
using namespace System;
using namespace System::Web::UI;
using namespace System::Web::UI::WebControls;
public __gc class LanderPage:public Page
{
protected:
static const double
gravity=1.625,
landermass=17198;
... | true |
c29059b21e9cf890440f424d93da2927f9d0df30 | C++ | rollfatcat/ProblemSet | /APCS試題/20190615/e294.cc | UTF-8 | 2,300 | 3.75 | 4 | [] | no_license | /* 題目給訂一個數字(字串)需要找到距離目前數字差值最小的『合法』數字,輸出差值
* 類似競賽題,需要自行觀察規律(規律不好找)
*/
#include<bits/stdc++.h>
using namespace std;
/* 輸出第一個出現『偶數』的位數,若無則輸出-1
* 初始判斷輸入的數字是否即符合條件(若是則直接輸出0)
*/
inline int Test(char Nss[]){
for(int i=0;Nss[i]!=0;i++)
if( (Nss[i]&1)==0 )
return i;
return -1;
}
/* 將輸入的字串轉換成對應... | true |
ee3eeb30e4c036a0f146682d79af6b3d1df373de | C++ | brettdh/instruments | /src/debug.cc | UTF-8 | 2,607 | 2.640625 | 3 | [
"BSD-2-Clause"
] | permissive | #include "instruments.h"
#include "debug.h"
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include "timeops.h"
#include <pthread.h>
#include <sstream>
#include <string>
#include <iomanip>
#include <stdexcept>
using std::ostringstream; using std::string;
using std::se... | true |
dac44110bd78c587d4ca6eb163286c84f80544ac | C++ | MrAntex/Formes | /Point.cpp | UTF-8 | 806 | 2.9375 | 3 | [] | no_license | #include "Point.h"
#pragma once
//#include <iostream>
Point::Point(Vector2f _ancre) : ancre(_ancre), couleur(sf::Color::Black)
{}
Point::Point(const Point& orig) : ancre(orig.ancre){}
Point::~Point() {}
/*
bool Point::isOver(Vector2f _ancre) const
{
float dx = (ancre.x >= _ancre.x ? ancre.x - ... | true |
1de1e75c171a8d4d287dfe69276ffa658d76d158 | C++ | pengyaoc/Interview-Question | /Anagrams.cpp | UTF-8 | 885 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <unordered_map>
#include <string>
using namespace std;
vector<string> anagrams(vector<string> &strs) {
// map sorted string to its index
// If already in the output, set index to -1
unordered_map<string, int> stringMap;
string temp;
vector<string> r... | true |
f2a1ce6fc721a3372f50fdb8cb07d50ea565da4f | C++ | KanadeSiina/PracticeCode | /201905_practice/ppp.cpp | UTF-8 | 869 | 2.65625 | 3 | [] | no_license | struct Node{
Node *l,*r;
int id;
Node(int _id):id(_id),l(NULL),r(NULL){}
};
Node* rt[maxn];
int tot;//编号
int ins[maxn];
#define Lson L,mid,o->l
#define Rson mid+1,R,o->r
void build(int L,int R,Node* &o)
{
o=new Node(tot++);
if(L==R)
{
addedge(o->id,L);
return;
}
int mid=L+R>>1;
build(Lson);
build(Rson);
... | true |
5e19e9ed387b50a3243ed19705e3d9ad5a145e3d | C++ | AndyJVain/lab-projects | /COEN70 Formal Specification and Advanced Data Structures/project8/pqueue.cpp | UTF-8 | 3,412 | 3.671875 | 4 | [] | no_license | // FILE: pqueue.cpp
// IMPLEMENTS: The functions of the pqueue class.
// INVARIANT for the node class:
// The data of a node is stored in data_field,
// the link to the next node is stored in link_field,
// and the priority is stored in priority_field.
#include "pqueue.h"
#include <cassert> // Provi... | true |
2934f6cf43c307de13d58cedd51e70c9437e91d1 | C++ | codersalman/Technocrats-HacktoberFest | /Data Structures and Coding Algorithm/03. Stack/Stack_sort_using_another_stack.cpp | UTF-8 | 1,324 | 3.96875 | 4 | [
"MIT"
] | permissive | /*
Sort a stack using a temporary stack
*/
/*
Algo:--
Create a temporary stack say temp.
While input stack is NOT empty do this:
Pop an element from input stack call it temp
while temporary stack is NOT empty and top of temporary stack is greater than temp,
pop from temporary... | true |
9ca0d4d3e42b01561bc877a2458adfff44280afc | C++ | nyanp/STF | /STF/stf/util/Macros.h | UTF-8 | 2,687 | 3 | 3 | [] | no_license | /**
* @file Macros.h
* @brief STF全体で使用する簡単なマクロ関数を記述する.
*
* @author Taiga Nomi
* @date 2011.02.16
*/
#ifndef Macros_h
#define Macros_h
// コピーコンストラクタと=演算子関数を無効にするマクロ
// これはクラスの private: 宣言の中で使うべきだ。
// from: google C++ coding styles
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); ... | true |
068625ebf6bd22ba3ebd762f440c78549c1bb082 | C++ | RezzaRect/SandBox | /rendering/Shader.h | UTF-8 | 766 | 2.53125 | 3 | [] | no_license | #ifndef SHADER_H
#define SHADER_H
#include <string>
#define GLEW_STATIC
#include <GL/glew.h>
#include "../core/Camera.h"
#include "../core/Transform.h"
// Reference: https://github.com/BennyQBD/ModernOpenGLTutorial
class Shader
{
public:
Shader(const std::string& fileName);
void Bind();
... | true |
d4eaf8745f268930e9b0d1804c675e0d21efc4e9 | C++ | Dragon-qing/vs | /visual studio的代码/练习/4/源.cpp | GB18030 | 814 | 3.3125 | 3 | [] | no_license | #include<iostream>
using namespace std;
class Household_electricity
{
private:
double consumption, coefficient;
public:
Household_electricity(int x,int y):consumption(x), coefficient(y){}
double cal() { return consumption * 0.785 * coefficient; }
void display();
};
class car
{
double Fuel;
public:
car(int x):Fuel... | true |
896bf5e5545b11fb2a039a5b2cb757a9ae3eaac8 | C++ | massimilianonardi/m | /os/sunaptos_bak/bak/sunaptos_28_class_sequence_element/src/test/sequence.h | UTF-8 | 3,591 | 2.96875 | 3 | [
"MIT"
] | permissive | #ifndef _SEQUENCE_H
#define _SEQUENCE_H
#include <vector>
#include <sstream>
using namespace std;
#include "debug.h"
//typedef char element;
typedef bool element;
//enum class sequence_type
//{
// unspecified_pointer_t = -1,
// unspecified_t = 0,
// sequence_t = 1,
// service_t = 2,
// boolean_t = 100,
// inte... | true |
5dac223e565ceb1b0e314e3461d768c83f958ca8 | C++ | diwadd/sport | /cf_districts_connection.cpp | UTF-8 | 1,889 | 2.859375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
void left_just(string &s, int n, char c = ' ') {
while(s.length() < n) {
s = c + s;
}
}
template<typename T> void print_vector(vector<T> &vec) {
int n = vec.size... | true |
162458429beb8c258a316be122fbce2f3587475f | C++ | kyungee/algorithm | /acmicpc/acm_15650.cpp | UTF-8 | 640 | 2.734375 | 3 | [] | no_license |
// https://www.acmicpc.net/problem/15650
#include <vector>
#include <stdio.h>
#include <iostream>
using namespace std;
#define MAX 10
int n, m;
bool visit[MAX];
vector<int> v;
void DFS(int idx, int cnt) {
if(cnt == m) {
for(int i=0; i<v.size(); i++) {
printf("%d ", v[i]);
}
... | true |
caed0bcebadd24a7f4dff52620f519e3e1725094 | C++ | iCodeIN/stdext | /lib/fs.cpp | UTF-8 | 4,553 | 2.765625 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2019 - Gabriel Cuvillier, Continuation Labs (www.continuation-labs.com)
// Licensed under the MIT License.
// Main header
// #include <stdext/fs>
// std
#include <cstring> // std::strcpy
#include <string> // std::string
#if defined( STDEXT_USE_CPP_FILESYSTEM_BACKEND )
#if __has_include( <filesyst... | true |
a402749023e599e5e8682affebf00fef556c6aa9 | C++ | slantto/slantto.github.io | /IS-ICE/Code/IS_ICE_CONTROL_BUTT/getDataFromPi.ino | UTF-8 | 1,501 | 2.640625 | 3 | [] | no_license | void getDataFromPi() {
// receive data from PC and save it into inputBuffer
if(Serial.available() > 0) {
char x = Serial.read();
// the order of these IF clauses is significant
if (x == endMarker) {
readInProgress = false;
newDataFromPC = true;
inputBuffer[bytesRecvd] = 0;
... | true |
27251204da4d568903ca72d643b8d6b4847004dd | C++ | TaelorMcMillan/FishBowlProject | /FishTankBase/src/solar/Sphere.cpp | UTF-8 | 906 | 2.53125 | 3 | [] | no_license | #include "Sphere.hpp"
Sphere::Sphere() {
radius = 1.0;
mode = MODE_WIRE;
textureID = 0;
splices = 50;
stacks = 50;
quad = gluNewQuadric();
sx = 1 ;
sy = 1 ;
sz = 1 ;
}
Sphere::~Sphere() {
gluDeleteQuadric(quad);
}
void Sphere::draw() {
quad = gluNewQuadric();
gluQuadricTexture(t... | true |
2cb2a10c5084a2a595583a561163befcec1dcf26 | C++ | KKozlowski/PAGI2016 | /PAGI 3/Timer.h | UTF-8 | 602 | 2.875 | 3 | [] | no_license | #pragma once
#include <chrono>
#include <iostream>
#include "main.h"
using namespace std::chrono;
class Timer
{
private:
milliseconds pastMoment;
unsigned long long deltaMs;
float deltaTime;
public:
Timer()
{
pastMoment = duration_cast< milliseconds >(
system_clock::now().time_since_epoch()
);
}
voi... | true |
116b8b739e73dd1d8e23f46d33651a0adfd852a3 | C++ | BGCX261/z-one-svn-to-git | /trunk/other/charles/sprite.h | UTF-8 | 418 | 2.53125 | 3 | [] | no_license | /**
*@file rs232.c
*@date 30/05/2012
*@author Charles Oliveira
*@author Rodrigo Siqueira
*@brief Arquivo com as implementações de rs232.
**/
/**
*@class Sprite
*@date 11/17/2012
*@author Charles Oliveira
*@brief Classe responsável por funcionalidades dos sprites
*/
class Sprite
{
public:
short width; /*... | true |
8ac1ebc5fbb35541097fbbbfda3d55938a546dca | C++ | jiutianbrother/binder_like | /utils/CondVariable.cpp | UTF-8 | 2,883 | 2.765625 | 3 | [] | no_license | /*
* File: CondVariable.cpp
* Desc: 条件变量实现文件
* Author: fanxiaoyu
*
*/
#include <errno.h>
#include <Logger.h>
#include <CondVariable.h>
extern Logger log;
/***********************************************************/
/* public */
/***********************************************************/
CondVaria... | true |
e92e075ffd49130aff93aebd1cde66259fe3193e | C++ | pgrAm/JSD-OS | /apps/listmode.cpp | UTF-8 | 593 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | #include <sys/syscalls.h>
#include <terminal/terminal.h>
#include <stdio.h>
#include <stdlib.h>
terminal s_term{"terminal_1"};
int main(int argc, char** argv)
{
set_stdout(
[](const char* buf, size_t size, void* impl)
{
s_term.print(buf, size);
return size;
});
display_mode mode;
int i = 0;
while(get... | true |
7053dde50672d4df98466865e5d7ecf7dbdd980a | C++ | Time-Coder/Data_Structure | /Tree/BinTree/BST/RedBlack/redblack.cpp | UTF-8 | 2,964 | 2.828125 | 3 | [] | no_license | #ifdef REDBLACK_H
template<class KeyType>
typename BinTree<KeyType>::Node*
RedBlack<KeyType>::red_child(typename BinTree<KeyType>::Node* node)
{
if(!node)
{
return NULL;
}
if(is_red(node->lchild))
{
return node->lchild;
}
if(is_red(node->rchild))
{
return node->rchild;
}
return NULL;
}
template<class ... | true |