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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f70fcec15bdb57ff00aba5d73904da1c95202991 | C++ | Wornairz/UniCT | /Prog2/esercizi/logaritmo_decimale.cpp | UTF-8 | 475 | 3.484375 | 3 | [] | no_license | #include <math.h>
#include <iostream>
using namespace std;
double logaritmo(double base, double argomento)
{
double esponente = 1, logaritmo = 0;
while(argomento > 1)
{
if(argomento >= base)
{
logaritmo += esponente;
argomento /= base;
}
else
... | true |
bfb091884cbde63b019f99c9be6522c3af81de26 | C++ | csevier/LunaEXR | /Luna/luna_ray_tracer/src/Ray.cpp | UTF-8 | 431 | 2.640625 | 3 | [] | no_license | #include "Ray.hpp"
namespace luna
{
Ray::Ray(const Vector3d& origin, const Vector3d& direction): mOrigin(origin), mDirection(direction)
{
}
const Vector3d& Ray::Origin() const
{
return mOrigin;
}
const Vector3d& Ray::Direction() const
{
return mDirection;
}
... | true |
aa8156a58d786f0de8b25a76a98aec8ab4b7ff30 | C++ | man-of-steele21/Final | /Problem1.cpp | UTF-8 | 1,200 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <math.h>
#include <iomanip>
#include <unistd.h>
#include <stdlib.h>
#include <gsl/gsl_rng.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#define _USE_MATH_DEFINES
using namespace std;
int main(int argc, char **argv)
{
if (argc != 2)
{
cout << "Invalid number... | true |
1a698c18339b1ed314ebb6148174a86cfff8155f | C++ | nishantvishwamitra/leetcode | /lcp.cpp | UTF-8 | 641 | 3.234375 | 3 | [] | no_license | // Better solution under ExploringRecursion
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if(strs.size() == 0) {
return "";
}
std::string lcp = strs[0];
std::string temp = "";
for(int i = 1 ; i < strs.size() ; ++i) {
std::string::iterator it = strs[i].be... | true |
3d861a3fbac511d81df3042717189e05266a24ef | C++ | byhj/OJ-PAT | /src/Basic/1021. 个位数统计 (15).cpp | UTF-8 | 309 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string str;
while (cin >> str)
{
vector<int> vi(10);
for (const auto &c : str)
++vi[c - '0'];
for (int i = 0; i != vi.size(); ++i)
if (vi[i] != 0)
cout << i << ":" << vi[i] << endl;
}
return 0;
} | true |
23614a5f143195fa68d4c80829442eb029e71b95 | C++ | aceiro/atm_2019 | /CI-APP/Src/FormSelect.cpp | UTF-8 | 4,677 | 3.265625 | 3 | [] | no_license | // Declaração das Bibliotecas internas do C++
#include <iostream>
#include <string>
#include <iomanip> // Biblioteca interna do C++ para trabalhar com alinhamento (width, right, etc)
// Declaração das Bibliotecas internas do Projeto (declação das Classes)
#include "../Include/Form.hpp"
// Uso refinado do Escopo STD
... | true |
d3eb929b5d519a0828814ce6b259e47495dfe2e2 | C++ | Po-Jen/Fluent-Extractor | /src/FileFrameScanner.cpp | UTF-8 | 3,495 | 2.609375 | 3 | [
"MIT"
] | permissive | //
// Created by binroot on 12/14/15.
//
#include "FileFrameScanner.h"
#include <boost/filesystem.hpp>
#include <sstream>
#include <fstream>
using namespace std;
using cv::imread;
FileFrameScanner::FileFrameScanner(std::string filepath) {
m_filepath = filepath;
m_rgb_file_prefix = "aligned_rgb_";
m_xyz_... | true |
e6a66674b4a79f8f97794fed289c672f1e1dd4d2 | C++ | wangxianghust/Cpp-Primer | /13/50.cpp | UTF-8 | 407 | 2.953125 | 3 | [] | no_license | #include "E49_String.h"
#include <iostream>
#include <vector>
using std::vector;
using std::cin;
using std::cout;
using std::endl;
String baz(){
String ret("world");
return ret;
}
void print(const String& s){
for(auto i : s){
cout << i << "";
}
cout << endl << "---";
}
int main(){
const char* s = "hello, w... | true |
51135f056dc5fb3593fc04c9367e0242c18de77a | C++ | oliffur/learning | /Algorithms/Traversals.h | UTF-8 | 5,179 | 4.0625 | 4 | [] | no_license | /* traverses a binary tree in three different orders using two different
* techniques
*
*/
#include <iostream>
#include <stack>
#include <iterator>
#include "TreeNode.h"
using namespace std;
// preorder traverse the tree recursively
void preorderRecursive(TreeNode* root){
// first print out the value of the roo... | true |
f9efc3d1ed723851a39a8f90b04a3d0d05759fbd | C++ | StrongerL/algorithm_cpp | /pta/1007_MaximumSubsequenceSum_20200113.cpp | UTF-8 | 1,169 | 3.140625 | 3 | [] | no_license | /*
来源
https://pintia.cn/problem-sets/994805342720868352/problems/994805514284679168
题目
1007 Maximum Subsequence Sum (25分)
思路
双指针即可,代码很快写出来了,但是被0和负数这种情况困了快一个小时。。。
*/
#include <iostream>
using namespace std;
int nums[10010];
int K, cur_i, cur_j, cur_sum, max_i, max_j, max_sum;
bool exist_zero;
int main() {
ci... | true |
e34f8835f2c9e6eeecd5ceb904a21bfd08f147f2 | C++ | mayanksharma27/DS_and_algo_codes | /dp/house-robber.cpp | UTF-8 | 471 | 2.9375 | 3 | [] | no_license | //https://leetcode.com/problems/house-robber/
class Solution {
public:
int rob(vector<int>& nums) {
if(nums.size() == 0 ) return 0;
int incl_old,incl=nums[0],excl=0;
for(auto it = nums.begin()+1;it!=nums.end();++it){
incl_old =incl;
incl = *it+ excl;
excl... | true |
a326c2036b134aea89a9bb642346b49547c6d19f | C++ | huangbin5/PAT_Advanced | /109-10/1096.cpp | UTF-8 | 1,041 | 3 | 3 | [] | no_license | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
// #define DEBUG
bool isPrime(int n) {
if (n <= 1)
return false;
int sqt = sqrt(n);
for (int i = 2; i <= sqt; ++i) {
if (n % i == 0)
return false;
}
return true;
}
int main() {
#ifdef DEBUG
... | true |
f24ad9f8ec9b83a8d49cf258a3d6ab53b3750ccd | C++ | open-space-collective/open-space-toolkit-physics | /include/OpenSpaceToolkit/Physics/Time/Instant.hpp | UTF-8 | 14,865 | 2.59375 | 3 | [
"Apache-2.0",
"MPL-2.0",
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | /// Apache License 2.0
#ifndef __OpenSpaceToolkit_Physics_Time_Instant__
#define __OpenSpaceToolkit_Physics_Time_Instant__
#include <OpenSpaceToolkit/Core/Types/Integer.hpp>
#include <OpenSpaceToolkit/Core/Types/Real.hpp>
#include <OpenSpaceToolkit/Core/Types/String.hpp>
#include <OpenSpaceToolkit/Physics/Time/DateT... | true |
e4fecd16810ef76f09cd353199a8cdd43b1236aa | C++ | xzrunner/shadergraph | /include/shadergraph/block/Blend.h | UTF-8 | 7,753 | 2.71875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "shadergraph/Block.h"
#include <SM_Vector.h>
namespace shadergraph
{
namespace block
{
class Blend : public Block
{
public:
enum class Mode
{
Burn,
Darken,
Difference,
Dodge,
Divide,
Exclusion,
HardLight,
HardMix,
... | true |
90813136e97cbbcab1c00fd1a0cf2dbf62c0fec5 | C++ | Areklis909/SteganoImages | /lib/ImageHandler/ImageHandler.cpp | UTF-8 | 2,483 | 2.609375 | 3 | [] | no_license | #ifndef IMAGE_HANDLER_CPP
#define IMAGE_HANDLER_CPP
#include <ImageHandler/ImageHandler.hpp>
#include <ConstData/ConstData.hpp>
#include <MessageTooBigException/MessageTooBigException.hpp>
namespace NsImageHandler {
ImageHandler::ImageHandler(const std::string & imagePath, const std::string & pathToWrite) :
imag... | true |
7869176c3c03fb3625ff903790b3eae575a7f929 | C++ | malcolmyeh/CC3K | /werewolf.cc | UTF-8 | 1,599 | 3.203125 | 3 | [] | no_license | #include "werewolf.h"
Werewolf::Werewolf(Posn position, int chamberID)
{
this->Atk = 30;
this->Def = 5;
this->HP = 120;
this->gold = 1;
this->race = "Werewolf";
this->symbol = 'W';
this->hasCompass = false;
this->chamberID = chamberID;
this->position = position;
this->stunned = ... | true |
dfe027ac8261f156c1ec854c3bcf721541e63263 | C++ | osamu-k/CppStudy | /ExpressionCpp001/visitor.h | UTF-8 | 612 | 2.640625 | 3 | [] | no_license | #ifndef VISITOR_H
#define VISITOR_H
class NodeInteger;
class NodeVariable;
class NodeAdd;
class NodeSub;
class NodeMul;
class NodeDiv;
class NodeAssign;
class Visitor
{
public:
virtual void visitInteger( NodeInteger *ni ) = 0;
virtual void visitVariable( NodeVariable *nv ) = 0;
virtual void visitAdd( Node... | true |
43b82df961a4a748a3ca4e1bf0db3ea5e43c2345 | C++ | slux83/libslx | /test/cppunit/sunboundedblockingqueue_test.h | UTF-8 | 5,863 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | /******************************************************************************
[FILE_HEADER_BEGIN]
[FILE_HEADER_END]
******************************************************************************/
#ifndef SBLOCKINGQUEUE_TEST_H
#define SBLOCKINGQUEUE_TEST_H
#include <unistd.h>
#include <cppunit/TestFixture.h>
#includ... | true |
41e7cc92438fc020fe17382097736c522f81293f | C++ | S4ltF1sh/SPOJ | /P141SUMB.cpp | UTF-8 | 519 | 2.953125 | 3 | [] | no_license | //P141SUMB - ROUND 1B - Hoán vị
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
vector<int> DanhDau(5005, 0);
int main()
{
ios_base::sync_with_stdio();
cin.tie();
int n, tmp, Count = 0;
cin >> n;
for (int i = 1; i <= n;... | true |
8c2f0a5bfb9ceb7c3f8ca2d3a2629276d1714f49 | C++ | x-y-z/fast-neural-net | /src/activate_function.h | UTF-8 | 2,707 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | /*
* =====================================================================================
*
* Filename: activate_function.h
*
* Description:
*
* Version: 1.0
* Created: 02/04/2015 11:12:57 AM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Or... | true |
cf29c34e172410d20b8730d33bee3532c077f715 | C++ | aivaraskriksciunas/Home-Defence | /src/characters/Bullet.h | UTF-8 | 663 | 2.78125 | 3 | [] | no_license | #pragma once
#include <cmath>
#include "Ghost.h"
#define BULLET_SIZE 8
class Bullet {
public:
Bullet( int posx, int posy, int direction );
void move();
int checkCollisionWithGhost( std::vector<Ghost*>* ghostList );
int getDamage();
int getX();
int getY();
bool isDead();
... | true |
b6128817339e6edb66d87762c88c94eff4c02101 | C++ | iAmmarTahir/XML-Checker | /XML/XML.h | UTF-8 | 723 | 3.265625 | 3 | [] | no_license | #ifndef XML_H
#define XML_H
#include <iostream>
#include "Stack.h"
using namespace std;
class XML
{
private:
int lineNumber;
string tag;
public:
XML();
XML(const int& _lineNumber,const string& _tag);
~XML();
friend ostream& operator<<(ostream& cout, const XML &rhs);
bool operator==(const string &rhs);
};
XML... | true |
a0296f54e44f4a126ecd1ed64149eb572901849a | C++ | ArashSameni/AP_IUT | /Exercises/10/1.Todo List/Task.cpp | UTF-8 | 1,158 | 2.71875 | 3 | [] | no_license | #include "Task.h"
#include "file.h"
#include <QDebug>
const QString Task::FILENAME = "tasks.json";
int Task::tasksCount = 0;
QJsonObject Task::getTaskAsJson(int id)
{
return getObject(FILENAME, QString::number(id));
}
Task Task::getTask(QJsonObject &obj)
{
Task task(obj["fUsername"].toString(),
o... | true |
e32d22e19cd61fdc3de9492cc22e65c33d49d645 | C++ | kardinal95/multisort_urfu | /multisort_ui/arrays.cpp | UTF-8 | 766 | 4 | 4 | [] | no_license | #include <iostream>
#include <time.h>
#include "arrays.h"
using namespace std;
/*
Fills array with random integers
Input: arr - pointer to array, size - size of array
*/
void fill_random(int * arr, int size)
{
//Generate new seed
srand((unsigned)time(NULL));
// Fill the array
for (int i = 0; i<size; i++)
{
ar... | true |
7e75d2ed4f069487cb65845b90d46835bfbd48e7 | C++ | mohmahkho/competitive-programming | /src/data-structure/sparse_table.cc | UTF-8 | 1,349 | 2.625 | 3 | [] | no_license | template<typename T, bool idempotent, typename F = function<T(const T&, const T&)>>
struct SparseTable {
int n;
F f;
vector<int> lg2;
vector<vector<T>> t;
SparseTable(const vector<T>& a, F f_)
: n(a.size()), f(f_) {
lg2.assign(n + 1, 0);
for(int i = 2; i <= n; ++i) {
lg2[i] = lg2[i >> 1] + 1;
... | true |
1502d64da8c2d0a8f623273b1d4a9eca417721c4 | C++ | pjared/Pioneer-Simulator | /Path.h | UTF-8 | 27,674 | 3.15625 | 3 | [] | no_license | #ifndef PATH_H
#define PATH_H
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
class Path {
private:
string currentLoc = "Navoo";
string nextLoc = "Mount Pisgah";
int famNum = 6; // make this a random number between 3 and 6, family number will deplete fo... | true |
401aab5ab880125c494e796988f31f1b0d74e36d | C++ | dolremi/data_structure | /Linked_list/Kth/main.cpp | UTF-8 | 1,355 | 3.921875 | 4 | [] | no_license | #include "LinkedList.h"
#include <iostream>
using namespace std;
// The problem is find the kth to last element of a singly linked list
// There are three versions of solutions to this problem:
// 1. If the linked list size is known, jsut iterate though the list to find the (size-k)th element in the list
// 2. ... | true |
5b120fc87edbd832542306843610ce497ad3480a | C++ | BasicAlgorithm/SpaceSoccer | /SpaceSoccer/Classes/2do backups/Bombs.cpp | UTF-8 | 456 | 2.515625 | 3 | [] | no_license | #include "Bombs.h"
Bombs * Bombs::create()
{
Bombs* ret = new (std::nothrow) Bombs;
ret->initWithFile("bomba.png");
//ret->setTag(TAG_DOG);
ret->scheduleUpdate();
if (ret) {
ret->autorelease();
return ret;
}
else
{
CC_SAFE_DELETE(ret);
return nullptr;
}
}
Bombs::Bombs()
{
_duration = 0.0f;
_remov... | true |
f9a6b6f83f733b6656289fbec0ba9b7e510fa7d2 | C++ | Jonnipolar/Red-Thunder-s-Pizza-Palace | /Red Thunder's Pizza Palace/src/Models/PizzaSize.cpp | WINDOWS-1250 | 469 | 3.15625 | 3 | [] | no_license | #include "PizzaSize.h"
PizzaSize::PizzaSize() {
this->_size = "Str";
this->price = 1500;
}
PizzaSize::PizzaSize(string _size, int price){
this->_size = _size;
this->price = price;
}
string PizzaSize::get_size() {
return this->_size;
}
int PizzaSize::get_price() {
return this->pr... | true |
b81ebc3bc4ef06243cf15e627c84688c0e33ed39 | C++ | TiAmoPlus/PAT-BaseLevel | /1013. 数素数 (20)/源.cpp | GB18030 | 648 | 3.015625 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
bool sushu(int n) {//жһǷ
for (int t = 2; t <= sqrt(n); t++) {
if (n%t == 0) {
return false;
}
}
return true;
}
int main() {
bool temp;
int M, N,num = 0, n = 1,huanghang=0;
scanf("%d%d", &M, &N);
while (true)
{
n++;
temp = sushu(n);
if (temp == true) {
num++;
... | true |
374c3dcca7770de6379959ca59533358b7f84d7f | C++ | Ibrahim5aad/OpenGL-WorldWithMouseAndKeyboardControls | /vertex.h | UTF-8 | 361 | 2.84375 | 3 | [] | no_license | #pragma once
#include<gl\glm\glm.hpp>
using namespace std;
using namespace glm;
struct vertex
{
glm::vec3 position;
glm::vec3 normal;
glm::vec2 texture;
public:
vertex() = default;
vertex(vec3 _position) :position{ _position }, normal(0, 0, 0){
}
vertex(vec3 pos, vec3 norm, vec2 text) {
position = pos;... | true |
61acacc0b0c2362fdd594d66e75411380134a430 | C++ | monpeco/TDD-with-Catch2 | /unit-convertion/decimal_to_hex.cpp | UTF-8 | 3,609 | 3.46875 | 3 | [] | no_license | #define CATCH_CONFIG_MAIN
#include <iostream>
#include <cmath>
#include <sstream>
#include "catch.hpp"
std::string decimal_to_hex( std::string &_decimal);
std::string decimal_to_hex_digit( std::string &_decimal);
TEST_CASE("Test base case", "Given a string that represents a series of decimal numbers, returns its hex... | true |
5e01d17472093d4bc0b4782ab995093f7e45c04c | C++ | estradjm/Code-Portfolio | /Control_Systems/AddressSign/AddressSignControl.ino | UTF-8 | 3,982 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | //Written by Ruben Marc Speybrouck - Modified by Jenniffer Estrada
// This code controls the address sign in the front door to
// automatically turn on at dusk and off at dawn. Since the
// sign uses 12V at 1000 mA, the Arduino cannot power it directly,
// therefore, the Arduino uses a solid state relay to control th... | true |
b2c7e53bb01624982fffa04ceca2c4a14ab7bfd9 | C++ | gmoryes/Coroutine | /coro.cpp | UTF-8 | 1,769 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <csetjmp>
#include <cstdio>
#include <algorithm>
using std::cout;
using std::endl;
struct Context {
Context(): low(nullptr), high(nullptr), stack(nullptr) {}
char *low;
char *high;
char* stack;
int size;
std::jmp_buf env;
};
Context a_ctx, b_ctx, run_ctx;
void s... | true |
75b8afbc4c3d34818cb0989309f3c9fe9f706253 | C++ | lucaslgr/estrutura-de-dados-cplusplus | /Revisão P1/testesPonteiros.cpp | UTF-8 | 1,114 | 3.5 | 4 | [
"MIT"
] | permissive | #include <iostream>
#define VAL 98
using namespace std;
int main()
{
//TESTE 1
cout << "\n\nTESTE 1" << endl;
int i = 3, j = 5;
int *p = &i, *q = &j;
int resultado = 3*-*p/(*q)+7;
cout << "A saida 9/5 eh:" << 9/5 << endl;
cout << "A saida de 3*-*p/(*q)+7 eh: " << resultado << endl;
//F... | true |
a6962daa19c8471a6527b2b3e4db058a258aeccf | C++ | kailasspawar/DS-ALGO-PROGRAMS | /Strings/ReverseWordsInAString.cpp | UTF-8 | 646 | 3.53125 | 4 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
void rev(char *begin,char *end)
{
char temp;
while(begin < end)
{
temp = *begin;
*begin++ = *end;
*end-- = temp;
}
}
void reverseWords(char *s)
{
char *word_begin = s;
char *temp = s;
cout<<*temp<<endl;
while(*temp)
{
te... | true |
7ca18805a6ab6173e7fbab418e749c53ee156c18 | C++ | alenops/opal | /data structure/上机/双向起泡排序/双向起泡排序.cpp | GB18030 | 805 | 3.375 | 3 | [] | no_license | //˫ij
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
//˳ṹͶ
typedef int datatype;
typedef struct{
int key;
datatype data;
}sequenlist;
void create(sequenlist[],int);
void print(sequenlist[],int);
void dbubblesort(sequenlist[],int);
void main()
{
const int n=10;
sequenlist r[n+1];
create(r... | true |
43aecd4a74993f562732db4c01f296a505ec1dc3 | C++ | andygandara/CFL-Parser | /parser.cc | UTF-8 | 8,798 | 3.3125 | 3 | [] | no_license | //
// Andres Gandara
// parser.cc
//
// Created by Andy Gandara on 3/30/18.
// Copyright © 2018 Andy Gandara. All rights reserved.
//
#include <iostream>
#include <cstdlib>
#include "parser.h"
using namespace std;
// Recursively checks that the variable exists in the scope
bool Parser::variable_exists(Scope* sco... | true |
dcd3d7310d15aa8376c6766bed517cce7f90df8b | C++ | eliray01/dsba-ads2020-hw1 | /main.cpp | UTF-8 | 1,358 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <ctime>
#include <random>
#include <algorithm>
#include <utility>
#include <fstream>
#include "Multiplicator.h"
using namespace std;
int main()
{
srand(time(0));
ofstream Table;
Table.open(R"(C:\Users\fahre_000\dsba-ads2020-hw1\data\output.csv)");
Table.... | true |
af7db261af867d346a7b8c6c350127c449099909 | C++ | TamNguyenMinh2494/C-C- | /DFS/DFS/DFS/DFS.cpp | UTF-8 | 1,616 | 3.1875 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include <conio.h>
#define MAX 20
#define initial 1
#define visited 2
void InputFromFile(int G[][MAX], int &n);
void graph_traversal();
void DFS(int vertex);
void push(int vertex);
int pop();
int isEmpty();
int stack[MAX];
int top = -1;
int vertices;
int adjacent_matrix[MAX][M... | true |
aa54fd7f09b77fd5abf3c9cbcfe369e3a53e182b | C++ | xiaoland/CaiojSolution | /question_test/1017.cpp | UTF-8 | 554 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | // TIME COUNT: 2:24 PASS: 3
#include <cstdio>
#include <sstream>
#include <string>
using namespace std;
int pd(int a) {
stringstream ss;
ss<<a;
string as;
ss>>as;
int asl = as.length();
if(asl < 4) {
if(as[0] == as[asl-1]) {
return 0;
}
}
else {
if(as[... | true |
e8ca9b450ea68bde791b8f9a3d7c6c57bb5eac5e | C++ | SergeyLeus161/Course-work- | /Seller.cpp | UTF-8 | 248 | 2.96875 | 3 | [] | no_license | #include "Seller.h"
Seller::Seller() : salary(0) {}
Seller::Seller(string n) : salary(0), name(n) {}
string Seller::get_name() {
return name;
}
void Seller::add_salary(int sum) {
salary += sum;
}
int Seller::get_salary() {
return salary;
}
| true |
100da3bf8b228d749651cc66a8f65b0d395879ba | C++ | tullisar/EASy68K-Mac | /Sim68K/mac68kutils.cpp | UTF-8 | 3,547 | 2.96875 | 3 | [] | no_license | /***************************** 68000 SIMULATOR ****************************
File Name: mac68kutils.cpp
Version: 1.0 (Mac OS X)
This file contains various routines used in the Mac OS X port of EASy68K
The routines are :
memDistance
Created: 2011-03-17
Robert Bartlett-Schneider
************... | true |
4f53f8d8495f5b1c1fec93960d6da815cf378baa | C++ | anna-porter/Compilers-4301-Fall-2017 | /stage2/stage2.cpp | UTF-8 | 87,960 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <stack>
#include <cstdlib>
#include <fstream>
#include <ctime>
#include <sstream>
using namespace std;
const int MAX_SYMBOL_TABLE_SIZE = 256;
enum storeType {INTEGER, BOOLEAN, PROG_NAME};
enum allocation {YES,NO};
enum modes {VARIABLE... | true |
561e336f2d0ec212d895bbba32653abefd72dd90 | C++ | Jonatankk/codigos | /Codeforces/cf122a.cpp | UTF-8 | 515 | 3.0625 | 3 | [] | no_license | /*
* Leonardo Deliyannis Constantin
* http://codeforces.com/problemset/problem/122/A
*/
#include <stdio.h>
#include <vector>
using namespace std;
int main(){
int n;
bool ans;
vector<int> lucky = {
4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777 };
while(scanf("%d", &n) != EOF){... | true |
e64e5856424bedc9ea08737f0532db8083e0ecdd | C++ | huanjihgh/Object | /object/task/TaskQueue.cpp | UTF-8 | 3,090 | 2.734375 | 3 | [] | no_license |
#include <thread>
#include <mutex>
#include <functional>
#include <queue>
#include <assert.h>
#include"../../include/task/TaskQueue.h"
namespace object {
TaskQueue::TaskQueue() : m_quit(false)
, m_mutex()
, m_condition()
, m_queue()
, m_thread(new std::thread(&TaskQueue::handle, this))
{
}
TaskQueue:... | true |
260a1ffb8bb7269e666f072407a797e5d43831fe | C++ | SuperNinjaFat/smudger | /smudger/smudger.cpp | UTF-8 | 6,321 | 3.09375 | 3 | [] | no_license | // smudger.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <vector>
#include <sstream>
#include <stdlib.h>
#include <time.h>
using namespace std;
const string directoryMaste... | true |
02082b29fe8234858de435c81789f5d9408675a0 | C++ | ArinPoray/C_Projects | /Ass03_C++_final/Ass03_C++_final/Pair.h | UTF-8 | 230 | 2.9375 | 3 | [] | no_license | // Pair.h
#ifndef _PAIR_H
#define _PAIR_H
class Pair
{
double x, y;
public:
Pair() :x(0), y(0){}
Pair(double x, double y) :x(x), y(y){}
Pair operator+(Pair&);
Pair operator/(double);
void Report();
};
#endif | true |
93c67ff3445c5807fa25a043775347d51ccb20d0 | C++ | jigsaw5071/algorithms | /Greedy/JobSequencing.cpp | UTF-8 | 2,137 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
/** =================== JOB SEQUENCING PROBLEM ==================================
=> This is another very interesting problem based on greedy paradigm.
=> This problem can be done in both ways i.e. either by decreasingly sorting by Profit or ... | true |
fa39a61a8a5363f8ec72e89c88695d61107e05a5 | C++ | shinron4/Algorithmmi-Coding | /almostshort.cpp | UTF-8 | 1,849 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
#define MAX 10000000
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define OUT cout <<
#define IN cin >>
#define newline cout << "\n"
#define space cout << " "
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using n... | true |
59453081585c6d09f25acba0e2d61b12a1ebc4d9 | C++ | On-Jin/stf | /src/Engine/Graphic/Skybox.hpp | UTF-8 | 1,215 | 2.609375 | 3 | [
"Unlicense"
] | permissive | #pragma once
#include <glad/glad.h>
#include <string>
#include <list>
#include "Engine/Shader.hpp"
# define SKYBOX_NUMBER_OF_FACES 6
class Skybox {
public:
class ConstructorException : public std::invalid_argument {
public:
ConstructorException(void) noexcept;
ConstructorException(std::string) noexcept;
virt... | true |
d0b97b2cba86769880ae2e6a1d0bdbfe70913869 | C++ | pokevii/GrizzellJoshua_CSC17A_43396 | /Hmwk/Review Homework 1/Gaddis_9thEd_Chap4_Prob10_DaysInMonth/main.cpp | UTF-8 | 1,160 | 3.703125 | 4 | [] | no_license | #include <cstdlib>
#include <iostream>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
int month, year, days;
//Ask the user for a month.
cout << "Enter a month (1-12): ";
cin >> month;
cout << endl;
//Check how many days are in the month the user specified.
//Ma... | true |
f900eb708f3c5297c89beaedb63f6e379bce07c7 | C++ | jtsalisbury/EECE4040-Projects | /HW4/Classes.cpp | UTF-8 | 4,662 | 3.625 | 4 | [] | no_license | #include "Classes.h"
Node::Node(string val) {
m_value = val;
m_next = nullptr;
}
Node::~Node() { }
string Node::getValue() {
return m_value;
}
Node* Node::getNext() {
return m_next;
}
void Node::setNext(Node* next) {
m_next = next;
}
Digraph::Digraph() { }
Digraph::~Digraph() {
Node* current;
Node* next;
... | true |
b2237c0980dd20ca118cda7acfca30cc4e722606 | C++ | moodgalal/problem-solving-with-c- | /Team/main.cpp | UTF-8 | 460 | 2.78125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int n , counter=0, p,v,t;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>p>>v>>t;
if(p==1&&v==1&&t==1)
counter++;
else if(p==1&&v==1)
counter++;
else if(v==1&&t==1)
counter++;
... | true |
7e958625538babc5bc59145b9dd360576f3c8761 | C++ | staplets/419_Project | /Project/BedroomHeader.h | UTF-8 | 3,199 | 2.890625 | 3 | [] | no_license | /***********************************************************
* Author: Shaun Stapleton
* Date Created: 5/04/16
* Last Modification Date: 5/05/16
* Filename: BedroomHeader.h
*
* Overview:
* This file is the header file for Bedroom objects and iteraction of objects.
*
******************************/
//def... | true |
d36e7bc44dba5c327f86a0db6ce598f0c735f514 | C++ | Ahmedv3/Algorytmy_I_Struktury_Danych | /lista2/zad2.cpp | UTF-8 | 1,425 | 3.5625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int tab[1000000];
int licznik1, licznik2, licznik3 =0;
int max(const int t[], int n){
int x = t[n];
while(n--){
licznik1++;
if(x < t[n]){
x = t[n];
}
}
// cout << "Ilosc porownan: " << licznik1 << endl;
return x;
}
int max2(const int t[], int n){... | true |
0cc9bd11accede6070f6710a981f33efe8b8f3c3 | C++ | sreeves/vs-test | /Bread.h | UTF-8 | 578 | 2.96875 | 3 | [] | no_license | /*
Alexis Reeves, Section 10, lexinreeves@gmail.com
Description: Declaration of class Bread. Contains protected variables breadType and BREADPRICE.
Done without pair programming and in Visual Studio.
Late Days: none
*/
#ifndef Bread_header
#define Bread_header
#include <iostream>
#include <string>
#include <sstream>
#... | true |
6f1492c25437e96afbfe8b5a9b7462bc863bcef8 | C++ | recurze/Competitive-Programming | /ds/dsu.cpp | UTF-8 | 634 | 2.96875 | 3 | [] | no_license | class DSU {
public:
DSU(int _n): n(_n), parent(std::vector<int>(n)), size(std::vector<int>(n, 1)) {
std::iota(parent.begin(), parent.end(), 0);
}
void union_set(int a, int b) {
a = find_set(a);
b = find_set(b);
if (a != b) {
if (size[a] < size[b]) {
... | true |
0481e9d8bda53b9e14eb97f84d223544f60bb8bb | C++ | skullbox305/Water-PH-Adjuster | /phSensor.h | UTF-8 | 1,577 | 2.609375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
#include <vector>
#include <mutex>
class phSensor
{
public:
phSensor(int position);
~phSensor();
float getNewPHReading();
float getPHReading();
int getBusAddress();
int getSlotPosition();
float getTempCompensation();
bool setTempCompensation(float newTemp);
... | true |
2d597450e5016542fc74e1c340eca9eaab094c81 | C++ | y-shindoh/binary_heap | /binary_heap.hpp | UTF-8 | 4,948 | 3.59375 | 4 | [] | no_license | /* -*- coding: utf-8; tab-width: 4 -*- */
/**
* @file binary_heap.hpp
* @brief binary heapのテンプレート
* @author Yasutaka SHINDOH / 新堂 安孝
* @note アルゴリズムイントロダクション第1巻を参考に実装した。
*/
#ifndef __BINARY_HEAP_HPP__
#define __BINARY_HEAP_HPP__ "binary_heap.hpp"
#include <cstddef>
#include <cassert>
#include <vector>
#include <u... | true |
45d057030c7a31ee22bc97f8d47451e3a3b34f46 | C++ | ywtseng/NTUPlacement | /src/database/cell_pin_port.hpp | UTF-8 | 532 | 2.796875 | 3 | [] | no_license | #ifndef CELL_PIN_PORT_HPP
#define CELL_PIN_PORT_HPP
#include "../util/type.hpp"
#include "rect.hpp"
class CellPinPort {
public:
CellPinPort();
CellPinPort(CellPinId cell_pin_id, LayerId layer_id, const Rect& rect);
void Print(std::ostream& os = std::cout, int indent_level = 0) const;
// Getters
CellPinI... | true |
cf9fe8d1a5daf694e0706ceae2176b18b77faf1f | C++ | rauf/ctci | /Ch 3 Stacks and Queues/Q3-2.cpp | UTF-8 | 1,465 | 3.8125 | 4 | [] | no_license | #include<iostream>
#include<cstring>
#include<stdio.h>
#define BIG_NUM 1000000
class Node {
public:
int data;
Node *link;
Node(int _data){
data = _data;
link = NULL;
}
};
class Stack{
int *arr;
int top;
int size;
Node *minList;
void addMin(int n) {
if(minList == NULL){
minList = new Node(n);
... | true |
db2c588e2ac5a12a303f86a47949bc1850518b39 | C++ | ca1773130n/ZMorpher | /src/ZEdge.cpp | UTF-8 | 8,094 | 2.703125 | 3 | [
"MIT"
] | permissive | #include "stdafx.h"
#include "ZVert.h"
#include "ZEdge.h"
#include "ZFace.h"
#include "ZMesh.h"
#include "D3DEx.h"
ZEdge::ZEdge( VOID )
{
marked = FALSE;
v1 = v2 = NULL;
twin = next = NULL;
index = 0;
normal.SetValAll( D3DXVECTOR3(0,0,0) );
texcoord.SetValAll( D3DXVECTOR2(0,0) );
}
ZEdge::ZEdge( ZVert* pV... | true |
98b1918bdec96bcef98db308e44ba4cefe3411fd | C++ | shitalbk/C-programs | /dsa/src/fiborecursive.cpp | UTF-8 | 525 | 3.75 | 4 | [] | no_license | //lab work 7 (b)- II
//fibonacci sequence by recursive function
#include<stdio.h>
#include<stdlib.h>
int Fibonacci(int);
main()
{
int n, c;
printf("Enter the number of terms\n");
scanf("%d",&n);
printf("Fibonacci series\n");
for ( c = 0 ; c < n ; c++ )
{
printf("%d\... | true |
b3f90d2404a318ebd759c84dc6ab4bed49ba05bd | C++ | Badhansen/UVa-Online-Judge | /11332 - Summing Digits/11332 - Summing Digits.cpp | UTF-8 | 513 | 2.96875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
long long int digit_sum (long long int number)
{
long long int sum=0;
while (number){
sum=sum+number%10;
number/=10;
}
return sum;
}
int main ()
{
long long int T, number;
while (1){
cin >> number;
if (number==0)
... | true |
b1fecfcb2949c0dac47d7b8468e5f7b8c8917ad7 | C++ | liuluke0325/OOP345workshop | /WS04/at_home/MessagePack.h | UTF-8 | 916 | 2.84375 | 3 | [] | no_license |
/*
Name:HsuehChihLiu
id: 116131186
Date: 6/12/19
*/
#ifndef SICT_MESSAGEPACK_H
#define SICT_MESSAGEPACK_H
#include "Message.h"
#include <iostream>
namespace sict {
//manages a composition of Message objects
class MessagePack {
// The number of objects is defined at run - time by the client module.
Message* m... | true |
1412672b3974a1c5b8a2ae89e7b2bb088479326c | C++ | ayulockin/dataStructureInC | /sorting/merge_sort_final.cpp | UTF-8 | 773 | 3.25 | 3 | [] | no_license | #include<stdio.h>
void merge_sort(int [], int, int);
void merge(int [], int, int, int);
int main(){
int a[20] = {44,55,33,99,88,77,22,11,110,66};
int n = 10;
merge_sort(a, 0, n-1);
for(int i=0; i<n; i++){
printf("%d\t", a[i]);
}
}
void merge_sort(int a[], int l, int r){
int q;
if(l<r){
q = (l+r)/2;
... | true |
9a39d9bf32795ec664b5557000e4cef5f27c52d6 | C++ | leader1118/KHJ-Project | /3D/3D_LIB/3Dlib_Sample/xMap.cpp | UHC | 8,945 | 3 | 3 | [] | no_license | #include "xMap.h"
float xMap::Lerp(float fStart, float fEnd, float fTangent)
{
return fStart - (fStart*fTangent) + (fEnd*fTangent);
}
float xMap::GetHeightmap(int row, int col)
{
return m_VertexList[row * m_iNumRows + col].p.y;// *m_xMapDesc.fScaleHeight;
}
float xMap::GetHeight(float fPosX, float fPosZ)
{
// fPosX... | true |
f0622135390ca0cb703356db7c5219074599aba7 | C++ | RobTillaart/Arduino | /libraries/GY521/examples/GY521_test_2/GY521_test_2.ino | UTF-8 | 1,570 | 2.65625 | 3 | [
"MIT"
] | permissive | //
// FILE: GY521_test_2.ino
// AUTHOR: Rob Tillaart
// PURPOSE: test set/get functions
// DATE: 2020-08-06
#include "GY521.h"
GY521 sensor(0x69);
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.print("GY521_LIB_VERSION: ");
Serial.println(GY521_LIB_VERSION)... | true |
470741f499d42f68a9325a645e8249314ce093fa | C++ | dawidpaweloszek/3S_Game_engine | /3S_game_engine/include/GameLogic/Hierarchy.h | UTF-8 | 1,689 | 2.5625 | 3 | [] | no_license | #pragma once
#ifndef HIERARCHY_H
#define HIERARCHY_H
#include "Application/Application.h"
#include "GameLogic/Proctor.h"
#include "Camera/Camera.h"
#include <vector>
#include "UIRender/UIElement.h"
namespace GameLogic
{
class Hierarchy
{
public:
/* Constructors */
Hierarchy(bool _state = true);
Hierarchy(App... | true |
9ca19a83c80e14bceb020982806626622ffbd264 | C++ | kei1107/algorithm | /problems/Atcoder/ARC063_C.cpp | UTF-8 | 1,968 | 2.890625 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
/*
<url:https://arc063.contest.atcoder.jp/tasks/arc063_a>
問題文============================================================
きつねの次郎と三郎が一次元リバーシで遊んでいます。
一次元... | true |
02ae7f46cc51bf3c0f3232eac67a83af22af2ed1 | C++ | ArtemGen/xray-oxygen | /code/engine.vc2008/xrCore/Buildcpp.cpp | UTF-8 | 952 | 2.625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | #include "stdafx.h"
// computing build id
extern LPCSTR build_date;
extern u32 build_id;
static constexpr char* month_id[12] = {
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
};
static constexpr u32 days_in_month[12] =
{
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
static constexp... | true |
37889d506d286edf8e90203d21cac46499603c5e | C++ | DrScKAWAMOTO/FullereneViewer | /src/Matrix3.h | UTF-8 | 2,664 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | /*
* Project: FullereneViewer
* Version: 1.0
* Copyright: (C) 2011-15 Dr.Sc.KAWAMOTO,Takuji (Ext)
*/
#ifndef __MATRIX3_H__
#define __MATRIX3_H__
class Vector3;
class Quaternion;
class Matrix3 {
// friend classes & functions
// members
private:
double p_xx, p_xy, p_xz;
double p_yx, p_yy, p_yz;
double p... | true |
9a4e0ca834df99b6446632538f7099d20b42e0a7 | C++ | Luke1962/robot | /Prove/ArduinoMAVLink/ArduinoMAVLink.ino/ArduinoMAVLink.ino.ino | UTF-8 | 1,430 | 2.625 | 3 | [] | no_license |
// Arduino MAVLink test code.
//#include <FastSerial.h>
#include <mavlink/include/mavlink.h> // Mavlink interface
// FastSerialPort0(Serial);
void setup() {
Serial.begin(57600);
}
void loop() {
// Define the system type (see mavlink_types.h for list of possible types)
int system_type = MAV_QUADROTOR;
... | true |
9a9a05e78042ded33f43bc17c906077155dcd0bf | C++ | hauke96/glowing-octo-batman | /main.cpp | UTF-8 | 395 | 2.546875 | 3 | [] | no_license | #include <GameManager.h>
#include <iostream>
#include <string>
using namespace std;
// UNDERLINE : \033[4m
// BOLD : \033[1m
// NOTHING : \033[0m
// ROT : \033[31m
// DARK GREEN : \033[32m
// BROWN : \033[33m
// BLUE : \033[34m
// LIGHT GREEN: \033[36m
// GRAY : \033[37m
int main()... | true |
ca874c39146e3f0a8ee501dd8a78ee78597f3ff4 | C++ | nohhyeonjin/BOJ | /DFSBFS/2178.cpp | UTF-8 | 924 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n,m;
int maze[100][100];
int visited[100][100];
int dy[4]={0,1,0,-1};
int dx[4]={1,0,-1,0};
bool inside(int ny,int nx){
if(ny>=0&&nx>=0&&ny<n&&nx<m) return true;
return false;
}
void bfs(){
queue<pair<int,int>> q;
q.push(make_pair(0,0));
visited[0][0... | true |
6b340cc0e028d8a0fcff1a2d792936256c3e2126 | C++ | hongwei7/LeetcodePractice | /70.爬楼梯.cpp | UTF-8 | 395 | 2.765625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=70 lang=cpp
*
* [70] 爬楼梯
*/
// @lc code=start
class Solution {
public:
int climbStairs(int n) {
if (n == 1)
return 1;
int pre1 = 1, pre2 = 2, now = 2;
for(int i = 2; i < n; i ++){
now = pre1 + pre2;
pre1 = pre2;
... | true |
9964a4c095c272e994c352f720d7a76d69441943 | C++ | jorgepuertoesteban/EchosOfNightmare | /EON/include/graphics/VisualBody.h | UTF-8 | 426 | 2.671875 | 3 | [] | no_license | #pragma once
#include "Vec2.h"
class VisualBody : public sf::Drawable {
public:
virtual ~VisualBody() {}
virtual void Initialize(Vec2 tam) = 0;
virtual bool GetVisible() = 0;
virtual void SetPosition(Vec2 pos) = 0;
virtual void SetRotation(float angle) = 0;
virtual void SetVisible(bool aux) = ... | true |
94cca0a95fd8bc738176966b7d2cc5f2921da604 | C++ | fredemmott/jerboa | /src/plugins/JerboaPlaylist/JerboaPlaylist_Implementation.cpp | UTF-8 | 4,611 | 2.6875 | 3 | [] | no_license | #include "JerboaPlaylist_Implementation.h"
#include <QDateTime>
#include <QDebug>
JerboaPlaylist::Implementation::Implementation(Jerboa::TagReader* tagReader, QObject* parent)
:
Jerboa::PlaylistInterface(tagReader, parent),
m_loopMode(LoopNone),
m_shuffleMode(ShuffleNone),
m_currentTrack(-1),
m_nextTrack(-... | true |
dce290357fd727c4deebf916e76546d1d41c4685 | C++ | matusnovak/doxybook2 | /example/src/Audio/AudioManager.hpp | UTF-8 | 928 | 2.953125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "AudioBuffer.hpp"
namespace Engine {
namespace Audio {
/*!
* @brief An audio manager that *accepts* multiple **Audio::AudioBuffer** instances
* @details Lorem Ipsum Donor. Some [Random link with **bold** and _italics_](http://github.com)
* And the ... | true |
220afbb2e27ae352812bf9f7c64c72d911361f87 | C++ | ailyanlu/zoj | /1069.cpp | UTF-8 | 1,142 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#define MAXN 22
using namespace std;
bool isok(bool face[3][MAXN][MAXN], bool newface[3][MAXN][MAXN], int n) {
for(int i = 0; i < 3; ++i)
for(int j = 0; j < n; ++j)
for(int k = 0; k < n; ++k)
if(face[i][j][k] != newface[i][j][k])
return false;
return true;
}
int mai... | true |
5a1528e21e5908a5dcfd53144926613af0c59eca | C++ | chixulub/kattis | /dicegame/dicegame.cpp | UTF-8 | 530 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <cstdint>
using namespace std;
float expected(int a, int b)
{
int n = 1+b-a;
int sum = n*a + (n*n + n)/2;
return sum/float(n);
}
int main(int, char**)
{
float exps[4];
int a,b;
for (int i = 0; i < 4; ++i)
{
cin >> a >> b;
exps[i] = expected(a,b);
}
float gunnar = exps[0] ... | true |
3489d04e81da2f471c4f960585f3d7d6c5d7c205 | C++ | Dan-sensei/Micro-Machines | /Animator.h | UTF-8 | 1,722 | 2.84375 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Animation.h
* Author: dan
*
* Created on 10 de marzo de 2018, 16:25
*/
#ifndef ANIMATION_H
#define ANIMATION_H
#i... | true |
999fe8ab54ee47244b214104dedff378f168e0e9 | C++ | rthaper01/competitive-programming-4-solutions | /Chapter 2/Kattis/unionfind.cpp | UTF-8 | 1,241 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "stdio.h"
using namespace std;
int findSet(int i, int* v) {
if (v[i] == i) {
return i;
}
else {
v[i] = findSet(v[i], v);
return v[i];
}
}
bool isSameSet(int i, int j, int* v) {
return (findSet(i, v) == findSet(j, v));
}
void ... | true |
812e8a81353cf0d9827abaa4415f81ef1c46ec21 | C++ | liuxinren456852/PlaneDetection | /CommandLineOption/src/primitive.h | UTF-8 | 1,795 | 3.203125 | 3 | [] | no_license | #ifndef PRIMITIVE_H
#define PRIMITIVE_H
#include <set>
#include <Eigen/Core>
template <size_t DIMENSION>
class Primitive
{
public:
Primitive(const Eigen::Matrix<float, DIMENSION, 1> ¢er)
: mCenter(center)
{
}
virtual ~Primitive()
{
}
virtual const Eigen::Matrix<float, DIME... | true |
105691ac70ba03a4051a26197f274dfacbbf2d86 | C++ | aaronmjacobs/Restoration | /src/TextureMaterial.h | UTF-8 | 1,252 | 2.671875 | 3 | [] | no_license | #ifndef TEXTURE_MATERIAL_H
#define TEXTURE_MATERIAL_H
#include "PhongMaterial.h"
#include "FrameBuffer.h"
class TextureMaterial : public PhongMaterial {
protected:
GLuint textureID, altTextureID;
GLint uTexture, aTexCoord;
const std::string textureFileName;
const std::string altTextureFileName;
public:
... | true |
81690066e54f904e6c272c8742cd0846ca3b69d1 | C++ | sahilgithub908/coderspree | /AR-VR/devAyushDubey_ayushdubey_2024csit1122_2/FunctionAndArrays/SubarrayProblem.cpp | UTF-8 | 368 | 2.6875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int n,i,j,k;
cin>>n;
int* arr = new int[n];
for(i = 0 ; i < n; i++)
cin>>arr[i];
i=0;
while(i<n){
for(k=i;k<n;k++){
for(j=i;j<=k;j++)
cout<<arr[j]<<" ";
cout<<endl;
}
i++... | true |
53789dffd8cf01971f19fff6ba8cfa1d50a11e71 | C++ | rhaps0dy/UPF-SWERC | /ACM-ICPC-Live-Archive/2013/Europe_Central/6591_bus.cpp | UTF-8 | 261 | 2.625 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
int cache[31];
int main() {
int N;
cin >> N;
cache[0] = 0;
for(int i=1; i<31; i++)
cache[i] = cache[i-1]*2 + 1;
while(N--) {
int n;
cin >> n;
cout << cache[n] << endl;
}
return 0;
}
| true |
eabab0320988c2a9ddf2c6c4a3ae96cd93374c80 | C++ | chavangorakh1999/DataStructureAndAlgorithms | /FactorialUsingRecursion.cpp | UTF-8 | 356 | 3.078125 | 3 | [] | no_license | //
// main.cpp
// FactorialUsingRecursion
//
// Created by Gorakh Chavan on 16/03/20.
// Copyright © 2020 Gorakh Chavan. All rights reserved.
//
#include <iostream>
using namespace std;
int fact(int a)
{
if(a==0)
return 1;
else
return fact(a-1)*a;
};
int main()
{
int z;
... | true |
ec102509f7b11b1a56cc11965d11ad138fc37843 | C++ | denis-gubar/Leetcode | /Tree/1602. Find Nearest Right Node in Binary Tree.cpp | UTF-8 | 829 | 3.234375 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | true |
efe200e93dd3c6b674312d379266a0f00948de48 | C++ | Arthurlpgc/PatternMatchingTool | /src/parser.h | UTF-8 | 3,548 | 3.140625 | 3 | [] | no_license | #include <getopt.h>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
const char* const short_opts = "tce:p:a:h";
const option long_opts[] = {
{"help", no_argument, nullptr, 'h'},
{"count", no_argument, nullptr, 'c'},
{"edit", required_argument, nullptr, 'e'},
{"pattern", required... | true |
0e86668e2244c1204a13d9cb06a78629ab0bdf1f | C++ | Victor-Hamon/Gomoku_AI | /main.cpp | UTF-8 | 539 | 2.5625 | 3 | [] | no_license | #include<iostream>
#include<string>
#include "Commands.h"
#include "SharedFunctions.h"
Incephalon incephalon;
[[noreturn]] int play() {
std::string command;
Vector input, best;
int size = 20;
incephalon.setSize(20);
while (true) {
std::cin >> command;
toupper(command);
for ... | true |
d207fee1ff04e0e53f1e3964a98565334adb0c95 | C++ | elsys/Shaprin_Frameword3D | /src/osgf/OSGF/OSGFKeyboard.h | UTF-8 | 1,023 | 2.71875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vector>
#include <Windows.h>
#include "OSGFInputElement.h"
class OSGFKeyboard :
public OSGFInputElement
{
public:
OSGFKeyboard(Game& game)
:OSGFInputElement(game),
mCurrentState(0xFFFF,1),mPrevState(0xFFFF,1)
{
}
virtual void Update(double dTime)
{
mPrevState = mCurre... | true |
be136802cba743494fa5416cae93518a07652bd5 | C++ | dannybanko/CSS343 | /Project-4/history.hpp | UTF-8 | 977 | 2.828125 | 3 | [] | no_license | //----------------------------------------------------------------------------
// History.h
// Implementation:
// -- This class is responsible for storing the history of customers
// transactions with movie type
// Assumptions:
// -- Inherits all behavior from Transaction parent class, although it has
// a unique... | true |
395f456db4aa6add1ba8f5a7e62abfd0e7c16b20 | C++ | MohamadIsmail/Graphics-project | /FPS Game/FPSglutDesign/Player.cpp | UTF-8 | 760 | 3.125 | 3 | [] | no_license | #include"Player.h"
#include"Utils.h"
Player::Player(double x,double y,double z)
{
m_position.setX(x);
m_position.setY(y);
m_position.setZ(z);
}
Vector3d Player:: getPosition()
{
return m_position;
}
void Player:: setPosition(Vector3d tmp)
{
m_position=tmp;
}
double Player:: getFacing()
{
return m_facing;
}
voi... | true |
b8a3da583ed8f9c832a8675c4acf9ac2663eec94 | C++ | SaberQ/leetcode | /tests/SwapNodesInPairsTest.cpp | UTF-8 | 2,277 | 3.59375 | 4 | [] | no_license | #include "catch.hpp"
#include "SwapNodesInPairs.hpp"
TEST_CASE("Swap Nodes In Pairs") {
SwapNodesInPairs s;
ListNode* head = nullptr;
ListNode* result = nullptr;
SECTION("Sample test") {
ListNode* n = nullptr;
n = new ListNode(4); n->next = head; head = n;
n = new ListNode(3); n->next = head; he... | true |
8c6b84c009f2bdad68c5aee57447095c70b919cb | C++ | sarankaarthik/CPCprep | /Week5/10.cpp | UTF-8 | 1,764 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<int> freq(vector<int> nums,int target)
{
int low = 0;
int high = nums.size() - 1;
int index;
vector<int> a;
if(high < low)
{
a.push_back(-1);
a.push_back(-1);
... | true |
781519962b336e03c2caa20bfa40a000286a93ea | C++ | constantinpape/z5 | /src/test/multiarray/test_xtutil.cxx | UTF-8 | 3,652 | 2.890625 | 3 | [
"MIT"
] | permissive | #include <random>
#include "gtest/gtest.h"
#include "z5/dataset.hxx"
#include "z5/multiarray/xtensor_util.hxx"
namespace z5 {
namespace multiarray {
TEST(XtUtilTest, TestCopyBufferToView) {
const int minDim = 2;
const int maxDim = 6;
for(int dim = minDim; dim <= maxDim; ++dim) {
... | true |
7f5b424c8b739f2b509328fb41f596f81aca0507 | C++ | ArturRodriguesAguiar/Hash_List_BST_AVL | /Main.cpp | ISO-8859-1 | 673 | 2.734375 | 3 | [] | no_license | #include <bits/stdc++.h>
#include "BST.h"
#include "AVL.h"
#include "Array_Hash.h"
#include "Linked_List_Hash.h"
/*C++ tem funes HEAP nativas, mas a lgica de ambas as estruturas
(rvores Binrias e a Heap) foram elaboradas na sintaxe C99. Usei
o C++ s pra funes que usam buffer, que oferece mais praticidade.*/
... | true |
230c709dc1f6833da350d750847fd184fce3d77e | C++ | kgolov/uni-data-structures | /Homeworks/HW-5/Task-3/task-3.cpp | UTF-8 | 3,558 | 3.78125 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include <queue>
#include <string>
using std::queue;
using std::string;
struct Person {
string name;
int timeEntered;
int group;
Person(string name, int group, int entered) {
this->name = name;
this->group = group;
timeEntered = entered;
... | true |