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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
48daaa44516aa669a2f9ea6ecce182c70501ab6f | C++ | YessicaCh/Computacion-Bioinspirada | /bioinspirada-master/Agentes/Agente.h | UTF-8 | 6,977 | 3.078125 | 3 | [] | no_license | #ifndef AGENTE_H_INCLUDED
#define AGENTE_H_INCLUDED
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <iostream>
#include <math.h>
#include "Nido.h"
using namespace std;
int Contener(vector <vector<int>> aux, int x, int y) //funcion para saber si una cordenada esta contenido en un vector de vectores
{
... | true |
f812e06ad3e6ff17c646d83ccf71149e813517e0 | C++ | kmichalk/xlib | /xlib/xlib/thread_safe.h | UTF-8 | 7,777 | 3.125 | 3 | [] | no_license | #ifndef _X_THREAD_SAFE_H_
#define _X_THREAD_SAFE_H_
#include "result.h"
#include "xrnd.h"
#include "byte.h"
namespace x
{
class lock
{
private:
public:
static byte* disabler_;
void* volatile user_;
bool volatile locked_;
__forceinline void set_lock_(void* user)
{
locked_ = true;
user_ = user;
... | true |
08648d30ddfa9358e50de75001f62fab37692140 | C++ | murar8/self-balancing-car | /src/Encoder.cpp | UTF-8 | 1,664 | 2.65625 | 3 | [] | no_license | #include "Encoder.h"
#include <PinChangeInterrupt.h>
#include <util/atomic.h>
#define ISR_HANDLER(n) [] { instances[n]->_onPulse(); }
typedef void (*Handler)(void);
static Encoder *instances[2];
static Handler handlers[2] = {ISR_HANDLER(0), ISR_HANDLER(1)};
Encoder::Encoder(float sample_time, uint8_t pin_phase_a, ... | true |
47ce535d94f9ae0ecde76a5ecda0fff42041af69 | C++ | bdorhan/Sheet-3 | /Vehicle.cpp | UTF-8 | 1,138 | 3.546875 | 4 | [] | no_license | #include "Vehicle.h"
// WARNING: this file is only function definition of the class declared in Vehicle.h
Vehicle :: Vehicle() {
company = " ";
enginePower = "0";
YearOfProduction = "0";
maxSpeed = "0";
}
Vehicle :: Vehicle(string c, string e, string y, string m) {
company = c;
enginePower = e;... | true |
45030118a1ddfaac29bedce6b24e7a20e26c3c32 | C++ | yogendrarp/udemyc- | /files/parsing.cpp | UTF-8 | 607 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <sstream>
int main()
{
std::string in_file_path = "population.txt";
std::ifstream in_file;
in_file.open(in_file_path);
if (!in_file.is_open())
{
return 1;
}
while (in_file)
{
std::string line;
getline(in_file, li... | true |
6938fe6309767c338d8d2e4d672a6d5eebb040d0 | C++ | SpaceCat-Chan/OpenGL_SDL | /OpenGL_SDL/ECS/Components/Transform/Transform.cpp | UTF-8 | 760 | 2.578125 | 3 | [] | no_license | #include "Transform.hpp"
#include "ECS/ECS.hpp"
glm::dmat4x4 Transform::CalculateFull(const World &GameWorld, size_t id, bool UseBackup) const
{
glm::dmat4x4 Result(1);
for (auto &Matrix : Tranformations)
{
if (Matrix.first == Type::AutoPosition)
{
if (GameWorld[id].Position() && !UseBackup)
{
... | true |
1548f6c2997acefe60978c79e36cf44fc82c06c1 | C++ | Shin-jun/Network | /Lecture5_Server/Lecture_Server/TCPServer_Fix.cpp | UHC | 3,875 | 2.859375 | 3 | [] | no_license | #pragma comment(lib, "ws2_32")
#include <WinSock2.h>
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#define SERVERPORT 9000
#define BUFSIZE 50
// Լ -->
void err_quit(const char* msg) {
exit(1);
}
// Լ
void err_display(const c... | true |
2549e9c29cea438dbc858b2385cfb09af710e435 | C++ | tristanred/MicroEngine | /projects/tester/DinoCharacter.cpp | UTF-8 | 1,599 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "DinoCharacter.h"
DinoCharacter::DinoCharacter(GameEngine* engine) : GameObject(engine)
{
this->DinoSprite = NULL;
}
DinoCharacter::~DinoCharacter()
{
// this->GetEngine()->DestroyObject(this->DinoSprite);
}
void DinoCharacter::Setup(GameModule* currentModule)
{
this->DinoSprite = currentModule-... | true |
9de715880d82ec02689d9bd9e74879ae229a7403 | C++ | huanghongxun/ACM | /vijos/p1391.cpp | UTF-8 | 804 | 2.75 | 3 | [
"Unlicense"
] | permissive | #include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#define N 2005
using namespace std;
struct Edge
{
int to, rp;
Edge(int t, int r) {
to = t;
rp = r;
}
};
typedef vector<Edge>::iterator iter;
vector<Edge> graph[N];
int main()
{
int a, b, r, n;
cin.sync_with_stdio(false);
cin>>n;
wh... | true |
24e556848d3ac6f929c152f013a4085d905b5ff0 | C++ | Montia/nest | /code/nest/lab1/l1e3_diff_tid_kernel.cc | UTF-8 | 759 | 2.609375 | 3 | [
"MIT-Modern-Variant"
] | permissive | #include <cstring>
#include "system.h"
#ifndef THREAD_NUM
#define THREAD_NUM 3
#endif
#ifndef PRINT_NUM
#define PRINT_NUM 2
#endif
void PrintTid(void *p)
{
int which = (int)p;
for (int i = 0; i < PRINT_NUM; i++)
{
DEBUG('e', "*** thread %d's tid is %d ***\n", which, GetTid());
... | true |
af98b4445c8edece75666b592245d934f1c8d27d | C++ | glebzhut/lab1 | /Demo.cpp | UTF-8 | 2,468 | 3.546875 | 4 | [] | no_license | #include "Graph.h"
void Demo()
{
cout << "Hello user. Now I show you what can this program." << endl;
cout << "Let's start from Dishones Dice. This default dice: ";
DishonestDice d;
cout << d << endl;
cout << "This is a dice with 10 edges: ";
d = DishonestDice(10);
cout << d << endl;
try
{
cout << "This is ... | true |
107cf24d726280d16ab8d1fb798037cbfd9518b3 | C++ | mjssw/NetworkConnect | /src/Thread.h | UTF-8 | 764 | 2.96875 | 3 | [] | no_license | #ifndef THREAD_H
#define THREAD_H
#include <stdint.h>
#ifdef WIN32
#include <windows.h>
#else
#include <pthread.h>
#endif
/**
* 线程基类,实现类仅需实现Run函数,调用Start启动线程
*/
class Thread
{
private:
#ifdef WIN32
static DWORD __stdcall StartRoutine(LPVOID lpParameter);
#else
static void * StartRoutine(void * ... | true |
e4486cbc185af83d9e791e845f1a1dde6f4483db | C++ | rajeev921/Algorithms | /LeetCode/All_Problem/Tree/426.cpp | UTF-8 | 2,411 | 4.15625 | 4 | [] | no_license | /* Convert Binary Search Tree to Sorted Doubly Linked List
Convert a Binary Search Tree to a sorted Circular Doubly-Linked List in place.
You can think of the left and right pointers as synonymous to the predecessor
and successor pointers in a doubly-linked list. For a circular doubly linked
list, the predecess... | true |
77c0830a51d74ff141913bc9028ecf914d6140ec | C++ | gav1n-cheung/PCL_Study | /Segmentation/NoteOfSegmentation/NoteOfRegionGrowingRGB.cpp | UTF-8 | 3,013 | 2.609375 | 3 | [] | no_license | ////
//// Created by cheung on 2021/6/12.
////
///*基于颜色的区域生长分割算法
// * 在本教程中,我们将学习如何使用pcl::RegionGrowingRGB类中的实现的基于颜色的区域增长算法。
// * 基于颜色的算法和基于曲率的算法主要有两个主要区别。第一个是它使用颜色而非法线。第二个是它使用合并算法进行过分割和欠分割控制。
// * 分割后,尝试合并颜色相近的簇。两个相邻的平均颜色差异很小的簇被合并在一起。然后进行第二个合并步骤。在此步骤中,每个集群都通过
// * 其包含的点数进行验证。如果这个值小于用户定义的阈值,则当前集群将与最近的相邻集群合并。
// */
//#i... | true |
e69c6390506be9f368994cc8d621c3029434a8cd | C++ | ymladeno/OOPaint | /plugins/BasicShapes/BasicShapes.cpp | UTF-8 | 637 | 2.515625 | 3 | [] | no_license | /*
* BasicShapes.cpp
*
* Created on: 22 Mar 2018
* Author: osboxes
*/
#include <iostream>
#include <memory>
#include "Circle.hpp"
#include "Rectangle.hpp"
#include "../../inc/ShapeRegistry.hpp"
extern "C" void registerMakers(ShapeRegistry& registry ) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
reg... | true |
1301f5d65d433e5a0fd04742ba753e96067cdb0e | C++ | KiMC2/SelfStudyCpp | /2일차/default_param_with_declare.cpp | UTF-8 | 321 | 2.984375 | 3 | [] | no_license | #include <iostream>
using namespace std;
// 함수 원형에 디폴트 선언 가능. 하지만 독특하다.
int TestFunc(int = 10);
int TestFunc(int nParam){
return nParam;
}
int main(int argc, char *argv[]){
std::cout << TestFunc() << std::endl;
std::cout << TestFunc(20) << std::endl;
return 0;
} | true |
47b303b255627d61258f9f473b0ce5ba2855a5f9 | C++ | emreercelebi/Advent-of-Code | /Day 2/checkSumCalculator.cpp | UTF-8 | 1,912 | 3.9375 | 4 | [] | no_license | /*************************************************************
Advent of Code:
Day 2
Challenge 1
Take an input file where each line is a string of lowercase
letters. The task is to count how many lines have exactly two
of any character, and how many lines have exactly three of any
character, then calculate the ... | true |
561fe5d395f9d4e483689c6ad737fcd19b88a7a7 | C++ | nihk/Cap-Man | /Cap-Man/Sprite.cpp | UTF-8 | 514 | 3.046875 | 3 | [] | no_license | #include "Sprite.h"
#include "Renderer.h"
Sprite::Sprite(Texture& texture, Rect source)
: mTexture(texture)
, mSource(source) {
}
Sprite::Sprite(const Sprite& other)
: mTexture(other.mTexture)
, mSource(other.mSource) {
}
Sprite::~Sprite() {
}
Sprite& Sprite::operator=(const Sprite& other) {
... | true |
8201bb3cc906a221488ceb97b60bc836f6e0e53f | C++ | en30/online-judge | /aoj/ALDS1_3_D.cpp | UTF-8 | 799 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
struct puddle {
int area;
int x;
};
int main () {
stack<int> down;
stack<puddle> s;
char c;
int x = 0;
while(cin >> c) {
x++;
if(c == '\\') {
down.push(x);
} else if(c... | true |
1c607d887a9334a5b8f32c8ee446c81a8188639b | C++ | likunjk/Algorithm | /sub_structure_of _tree.cpp | UTF-8 | 1,314 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef unsigned long long ull;
const int N = 1009;
int A[N][2]; //因为是二叉树,因此不必使用数组
int B[N][2];
int valueA[N];
int valueB[N];
bool dfs(int a, int b)
{
if(b==0) //为0表示不存在该节点
return true;
//若要是子树, 则必须左右子树一一对应
if(a==0 || valueA[a]!=valueB... | true |
bfd2977edc475f78b075abe8d490bee08994bdc7 | C++ | Jyrgal/eggPickup | /pickup___dropoff/pickup___dropoff.ino | UTF-8 | 3,916 | 2.984375 | 3 | [] | no_license | #include <Servo.h>
Servo servo1; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pickup_open_servo = 0;
int pickup_close_servo = 0;
int initial_distance = 0;
int picked_up = 0;
int dropoff = 1;
int servo_dropoff = 0;
int complete = 0;
int dropoff_start = 0;
int tri... | true |
f66c4dbf30c38fe1195ac4fd201f1ceec06dc227 | C++ | wolfdan666/WolfEat3moreMeatEveryday | /history_practice/2019.4/2019.4.24/D_zoj3822_概率dp.cpp | UTF-8 | 4,185 | 3.109375 | 3 | [] | no_license | // 2019年4月24日16:20:52再次看题,希望20mins后就完成
// 2019年4月24日16:59:44 由于没有学这部分,所以只看懂了第二种解法,然后就用第二种解法
// 2019年4月24日17:02:36 发现ZOJ只是单独地不能交B题...
// 概率dp(暂时还没有补这部分)
// 首先求出 放置到前i行 前j列时刻,棋盘中 放置 k棋子个数的 概率。
// 然后递推。
// 我们发现,总共四种状态。
// 1 当前行当前列有,我们可以在之前已经合法的地方在加一个。
// 2当前列没有 n-j+1 *i
// 3 当前行没有
// 4 当前行 当前列都没有
/*#include <queue>
#incl... | true |
3e8e0c4b09275d433ae5edc6ecb5782b9bc79205 | C++ | LionCoder4ever/algorithm | /cpp/121.买卖股票的最佳时机.cpp | UTF-8 | 427 | 3 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=121 lang=cpp
*
* [121] 买卖股票的最佳时机
*/
// @lc code=start
class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
int ans = INT_MIN;
int buy = INT_MAX;
for(int i =0;i<n;i++) {
buy = min(buy, prices[i]);
... | true |
05a14c19429d9ead85e18f5e01b19c95946e8410 | C++ | gaolu/Leetcode | /distinctSubsequences.cpp | UTF-8 | 465 | 2.578125 | 3 | [] | no_license | class Solution {
public:
int numDistinct(string S, string T) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
vector<int> dp(T.size() + 1);
dp[T.size()] = 1; // choose nothing
for(int i = S.size() - 1; i >= 0; i--){
for(int j = 0; j ... | true |
2b9ff858cabf2e3ebb611343dcdb7548d37dbb44 | C++ | niekbouman/ctbignum | /include/ctbignum/utility.hpp | UTF-8 | 2,071 | 2.828125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | //
// This file is part of
//
// CTBignum
//
// C++ Library for Compile-Time and Run-Time Multi-Precision and Modular Arithmetic
//
//
// This file is distributed under the Apache License, Version 2.0. See the LICENSE
// file for details.
#ifndef CT_UTILITY_HPP
#define CT_UTILITY_HPP
#include <ctbignum/bigint.hpp>
... | true |
e026278afe32cd068b08b3824accd87d4c5caecb | C++ | nya3jp/icpc | /uva/solved/104/10424-nya.cc | UTF-8 | 1,161 | 3.40625 | 3 | [] | no_license | /*
* UVA 10424 Love Calculator
* 2005-07-16
* by nya
*/
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
int value_of_name(const std::string& name) {
int n = name.size();
int value = 0;
for(int i=0; i<n; i++) {
char c = name[i];
if ('A' <= ... | true |
5fb5d65f4be18e038d8597affb273e778c3fda75 | C++ | KeyMaker13/C-plus-plus | /Pearson Books/Data Abstraction And Problem Solving With C++ 5e/src/ByName/c11/PQ.cpp | UTF-8 | 824 | 3.296875 | 3 | [] | no_license | /** @file PQ.cpp
* ADT priority queue.
* A heap represents the priority queue. */
#include "PQ.h" // header file for priority queue
bool PriorityQueue::pqIsEmpty() const
{
return h.heapIsEmpty();
} // end pqIsEmpty
void PriorityQueue::pqInsert(const PQueueItemType& newItem)
throw(PQueueException)
{
tr... | true |
888d32a27846909a98f4196c4ec13917b5c4551a | C++ | Aaron-Cai/brainfuck | /branfuck/Source.cpp | UTF-8 | 3,670 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <stdio.h>
using namespace std;
const unsigned byteSize = 30000;
class Interpreter
{
public:
enum InterpretingState
{
NORMAL, LOOP_END, ERROR
};
Interpreter(bool de = false)
{
byte = new char[byteSize];
memset(byte, 0, byteSize*sizeof(char))... | true |
81ab01c2af86e65d81c11534de9d0431235151a6 | C++ | yeoneei/algorithm | /backjoon/17281.cpp | UTF-8 | 1,657 | 2.59375 | 3 | [] | no_license | //
// 17281.cpp
// backjoon
//
// Created by 조연희 on 29/03/2020.
// Copyright © 2020 조연희. All rights reserved.
//
#include <iostream>
#include <vector>
#include <deque>
using namespace std;
int n;
vector<vector<int>> vc;
int play[9];
bool check[9];
int answer=0;
void getScore(){
int ening=0,j=0,scroe=0;
wh... | true |
e182dfab60909e0e5582b53ddb6ae78a454b3044 | C++ | Lancelot0902/LeetCode | /leetcode/17.LetterCombination/solution.cpp | UTF-8 | 949 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
#include <string>
void dfs(std::map<char, std::string> &m, std::vector<std::string> &res, std::string &str, int pos)
{
if (pos == str.size())
return;
std::string s = m[str[pos]];
int n = res.size();
for (int i = 0; i != n; ++i)
{
... | true |
5bd8bbd386b19d0fd6fe5756a21e4b5b69e1494f | C++ | yashika66011/Daily-DSA-Coding | /Arrays/MaxMinInArray.cpp | UTF-8 | 958 | 3.921875 | 4 | [
"MIT"
] | permissive | /*
Find Max and Min elements in an Array
Time Complexity: O(N)
*/
#include<iostream>
using namespace std;
struct Pair
{
int min;
int max;
};
struct Pair getMinMax(int arr[], int n) {
struct Pair P;
if(n==1) {
P.min = P.max = arr[0];
return P;
}
if(arr[0] > arr[1]) {
... | true |
888dcc8b25b7530036cc8466f061c9c7092ef162 | C++ | sogapalag/problems | /codejam/2019_1a_b.cpp | UTF-8 | 2,346 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
template <typename T=int>
T exgcd(T a, T b, T& x, T& y) {
if (!a) { x = 0; y = 1; return b; }
T d = exgcd(b%a, a, y, x);
x -= b/a * y;
return d;
}
// watch out potential overflow!
template <typename T>
T crt(T a1, T a2, T n1, T n2) {
T m1, m2;
asse... | true |
eef9b1a8c7d8934bd3e2c33974b8965d7c1497ec | C++ | heisai/Buffer | /Buffer.h | UTF-8 | 1,253 | 3.234375 | 3 | [] | no_license | #ifndef BUFFER_H
#define BUFFER_H
#include<iostream>
#include<cstring>
#include<assert.h>
using namespace std;
class Buffer
{
public:
explicit Buffer();
virtual ~Buffer();
public:
void PutUint8(uint8_t value);
void PutUint16(uint16_t value);
void PutUint32(uint32_t value);
void PutUint64(uint64... | true |
ff6477862ff273e1f646ad1a55b796a937fe226c | C++ | kangsanguk/C_study | /hw32.cpp | UHC | 1,693 | 3.5625 | 4 | [] | no_license | #include<stdio.h>
#pragma warning(disable:4996)
int inputUInt(const char *msg);
double inputDouble(const char *msg);
int ipow(int aVal1,int aVal2);
double fpow(double aVal1, int aVal2);
void myflush();
int main()
{
int num1, pNum,result1;
double num2,result2;
num1 = inputUInt(" * ԷϽÿ:");
pNum = i... | true |
cdc4df7f387235114981ba4bf926b1cf9788e5b9 | C++ | krpraveen0/cpp-resource | /oops/class-10/mem-func-overriding.cpp | UTF-8 | 599 | 3.515625 | 4 | [] | no_license | //overiding of member function--
//overriding is the proces in which we try to redefine the base class functions
// in its child/derived class
//note: a function can be overriden only if both the child class and parent class
//function have the same name as well as same number of arguments.
#include<iostream>
using n... | true |
4beb9a33371a2f96aa9700bbd3a0a30c604a637c | C++ | necokeine/eos | /plugins/sql_db_plugin/fifo.h | UTF-8 | 1,735 | 3.203125 | 3 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | /**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#pragma once
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <utility>
#include <vector>
#include <boost/noncopyable.hpp>
namespace eosio {
template<typename T>
class fifo : public boost::noncopyable {
public:
enum class behav... | true |
59302c1f70fad4d7f266ac6ef0f6758b542cad1d | C++ | andreiburov/db | /database/slotted/TID.h | UTF-8 | 1,245 | 2.96875 | 3 | [] | no_license | #ifndef DB_TID_H
#define DB_TID_H
#include <cstdint>
#include <functional>
struct TID {
// sizeof 64 bits
uint16_t slot_id;
uint64_t page_offset : 48;
static const uint64_t SLOT_MASK = 0xFFFF000000000000;
static const uint64_t PAGE_MASK = 0xFFFFFFFFFFFF;
TID(uint16_t slot_id, uint64_t page_o... | true |
00aaec23dde935779e72a1707f6a88e1cd1e7575 | C++ | sofi-moshkovskaya/C-plus-labs | /lab_16/2.cpp | WINDOWS-1251 | 686 | 3.15625 | 3 | [] | no_license | /*
2. , , ,
.
Moshkovskaya Sophia
18.03.2019*/
#include <iostream>
#include <conio.h>
using namespace std;
void main()
{
char surname[50];
char name[50];
char patronymic[50];
cout << "Input your Surname, Name, Patronymic by space." << endl;
cin >> surname >> name >> pat... | true |
71398e19da0123f5df76c964b6b748196954d591 | C++ | TatTangpirul/h3 | /Donut.cpp | UTF-8 | 432 | 2.515625 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,song;
cin>>n;
deque<int> dq;
for (int i=0;i<n;i++){
cin>>song;
dq.push_back(song);
}
cin>>n;
for (int i=0;i<n;i++){
char c;
cin>>c>>song;
if (c=='B') dq.push_back(song);
else dq.pu... | true |
9da646e3cc5644f30f981759ca66c20a6196034a | C++ | SpencerMichaels/evdevw | /include/evdevw/Event/Event.hpp | UTF-8 | 3,525 | 2.796875 | 3 | [
"MIT"
] | permissive | #ifndef EVDEVW_EVENT_HPP
#define EVDEVW_EVENT_HPP
#include <libevdev/libevdev.h>
#include "../Enum.hpp"
#include "../Utility.hpp"
#define DECLARE_EVENT_TYPE(_raw_type, _type, _code_type, _value_type) \
namespace event { \
struct _type : public Event<_raw_ty... | true |
440d54f63872ecdaa8d8010413c2ac31ac18dda0 | C++ | Starnett/TouchEvolved | /TouchEvolved/GLUT Apparatus/Mouse.cpp | UTF-8 | 2,931 | 3.015625 | 3 | [] | no_license | /*
* mouse.c
* -------
* Mouse callbacks for the canvas. Currently a little clunky, because
* all rotations are in terms of the original axes of the model, rather
* than the transformed axes of the current viewpoint.
*
* You shouldn't have to modify anything in this file.
*/
#include <stdio.h>
#include <stdlib... | true |
b5c5616c86c61dd3970d771231ca688fad007378 | C++ | skl7028320/Udemy_Advanced_Cpp | /OverloadingTheDereferenceOperator/src/overloading_the_dereference_operator.cpp | UTF-8 | 271 | 2.671875 | 3 | [] | no_license | /*
* overloading_the_dereference_operator.cpp
*
* Created on: 14 Mar 2021
* Author: Bowen Li
*/
#include <iostream>
#include "Complex.h"
using namespace std;
using namespace advanced_cpp;
int main() {
Complex c1(2, 4);
cout << *c1 << endl;
return 0;
}
| true |
17c594655f18c8807736c898d629f8453db1295a | C++ | xnyuq/CompetitiveProgramming | /atcoder/abc218/C.cpp | UTF-8 | 2,369 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container:... | true |
bd11547a15ca77fc2e5916cafc8e9d6bea414eae | C++ | pan-dan/intro | /Inheritance/Academy/Student.cpp | WINDOWS-1251 | 1,286 | 3.171875 | 3 | [] | no_license | #include "Distributed.h"
const string& Student::get_university()const
{
return university;
}
const string& Student::get_speciality()const
{
return speciality;
}
const string& Student::get_group()const
{
return group;
}
const double Student::get_rating()const
{
return rating;
}
void Student::s... | true |
c4b66202f54a246c729d731c385c560417c9456c | C++ | Tifloz/Tek2 | /Piscine_CPP/cpp_d14m_2018/ex00/main.cpp | UTF-8 | 478 | 2.515625 | 3 | [] | no_license | #include "Lemon.hpp"
#include "Banana.hpp"
/*
** EPITECH PROJECT, 2022
** cpp_d14m_2018
** File description:
** Created by Florian Louvet,
*/
int main()
{
Lemon l;
Banana b;
std::cout << l.getVitamins() << std::endl;
std::cout << b.getVitamins() << std::endl;
std::cout << l.getName() << std::endl;
... | true |
689be05142b2f0f78f2495e614bb4fa416a1e8f6 | C++ | ChadFunckes/CU_Denver_CSCI2312 | /Project2/quadratic.cpp | UTF-8 | 2,771 | 3.46875 | 3 | [] | no_license | // Chad S Funckes
// CSCI 2312
// QUADRATIC CLASS IMPLEMENTATION
//
// See Quadratic.h for documentation
#include <iostream>
#include "Quadratic.h"
#include <cmath>
#include <cassert>
using namespace std;
namespace Funckes_PA2{
/// Constructors
quadratic::quadratic(){
a = 0;
b = 0;
c = 0;
};
quadratic::quadratic(d... | true |
7b0913ef56926646700d0305da90ac2e9bc7f5c8 | C++ | TechStuffBoy/ArduinoDev | /Sketch Files/MQTT_4_SENSOR/MQTT_4_SENSOR.ino | UTF-8 | 3,459 | 2.578125 | 3 | [] | no_license | //Including necessary libraries.
#include<SPI.h>
#include<Ethernet.h>
#include<PubSubClient.h>
// Assigning analog input pins
int proximity_1=2;
int proximity_2=3;
int temp_sensor=A0;
int moisture_sensor=A1;
//assigning output pins
int proximity_1_trigger=4;
int proximity_2_trigger=5;
int temp_sensor_trigger=6;
int m... | true |
c32ea01df8115d3693153ac723881b177cbe7083 | C++ | munib10mufc/Banking-System | /ChequeBook.h | UTF-8 | 560 | 2.546875 | 3 | [] | no_license | #ifndef ChequeBook_H
#define ChequeBook_H
#include "Cheque.h"
#include "CurrentAccount.h"
#include <vector>
using namespace std;
class Cheque;
class ChequeBook
{
int chequeBookId;
int accountID;
vector < Cheque *> cheques;
public:
ChequeBook(int c = 0 , int accID = 0);
void setChequeBookId(int );
void setAccou... | true |
af782152d312840680bec9efb55ee9d16a091c9f | C++ | ase09/Project-Assignment | /socket/EchoServer/EchoServer.cc | UTF-8 | 1,228 | 3.1875 | 3 | [] | no_license | /*
* File: main.cpp
* Author: sanath
*
* Created on July 20, 2009, 3:17 PM
*/
#include <stdlib.h>
#include <iostream>
#include <string>
#include "ServerSocket.hh"
#include "SocketException.hh"
using namespace std;
int main(int argc, char* argv[]) {
cout << "EchoServer is Running...." << endl;
try {
... | true |
583b334b1682ca5fd5739644689699276dc627d9 | C++ | itroot/university-tasks | /old/sources/kurs4/tviz/tmath/Vector3D.h | UTF-8 | 2,768 | 3.59375 | 4 | [] | no_license | #ifndef VECTOR3D_H_
#define VECTOR3D_H_
template<class T> class Vector3D {
public:
Vector3D();
Vector3D(const T& in_x, const T& in_y, const T& in_z);
~Vector3D();
// minus
Vector3D& operator-=(const Vector3D& rhs);
Vector3D operator-(const Vector3D& rhs);
// plus
Vector3D& operator+=(c... | true |
b2e4ef63c1745387fc2842327a7e04a2f4ff8690 | C++ | rishirv/competitive-programming | /USACO Training/4/4.3/buylow/buylow.cpp | UTF-8 | 2,334 | 2.828125 | 3 | [] | no_license | /*
ID: verma.r1
PROG: buylow
LANG: C++11
*/
//Repl.it BlindEnormousPony
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
using namespace std;
//Begin bigint class (needs string and algorithm)
char get(string a, int b){
if(b<a.length())
return a[b];
else
return '0';
}
string ... | true |
56d89ba7027378900463424b6c11f4fddf72e511 | C++ | Nikhil-Dingane/codechef | /easymath.cpp | UTF-8 | 822 | 3.4375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int sumOfDigit(int no){
int sum = 0;
while(no != 0){
sum = sum + (no%10);
no = no / 10;
}
return sum;
}
int prodOfMaxSum(int *arr, int n){
int productWithMaxSum = 0;
for(int i = 0; i < n; i++){
for(int j = (i + 1); j < n; j++){
... | true |
8ef6d5ce5e00e68b5d0e939c53c5c05b8362b04c | C++ | portaloffreedom/tol-controllers | /RoombotController/RLPower/include/Values.h | UTF-8 | 4,958 | 3.03125 | 3 | [] | no_license | #ifndef VALUES_H
#define VALUES_H
#include <tinyxmlplus.h>
#include <cstddef>
#include <iostream>
#include <valarray>
namespace POWER
{
class Values
{
public:
/**
* Class name for XML
*/
static const std::string XML_NAME;
// <editor-fold defaultstate="collapsed" desc="Constructors">
/**
* C... | true |
7e278960df6b02211182f8965bbdde5f25c2c63d | C++ | HoldenGao/oops | /src/application/MatExpTest.cpp | UTF-8 | 3,085 | 2.65625 | 3 | [] | no_license | #include "include/app/app.h"
#include "include/math/MatExp.h"
#include <complex>
#include "include/math/krylov_expv.h"
cx_mat MAT;
cx_vec VEC;
vec TIME_LIST;
SumKronProd SKP;
cx_double PREFACTOR;
void prepare_data(string filename);
void test_small_mat();
cx_mat test_large_mat();
cx_mat test_large_mat_sparse();
cx_... | true |
150610b6be9ea80c3a0dec9c359b3434882bbcfd | C++ | GitJoeBentley/SpaceInvaders | /include/Invader.h | UTF-8 | 962 | 3.125 | 3 | [] | no_license | #ifndef INVADER_H
#define INVADER_H
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
class Invader : public sf::RectangleShape
{
public:
enum Status {Visible,Hit,Invisible};
Invader();
virtual ~Invader();
Status getStatus() const { return status; }
void ... | true |
7bf1125c1a96ad05a5e9aeb723593838f0c633fb | C++ | AnanyaKumar/competition-programs | /stackingnumbers.cpp | UTF-8 | 1,941 | 2.5625 | 3 | [] | no_license | /**
* Australian Informatics Olympiad Senior 2003, Q2
* Ananya Kumar, 2011
* NUS High School
*/
#include <cstdio>
#include <algorithm>
using namespace std;
#define MAXN 32
#define MAXB 35000
int best[MAXB];
bool done[MAXN] = {false};
int cur[6];
int choice[MAXN];
int bestChoice[MAXN];
int s, b;
int highs = 0;
... | true |
134692162f5bfe379954f04393b60991f33aa30c | C++ | Nebul5/CS372Final | /monsterArm.cpp | UTF-8 | 455 | 2.640625 | 3 | [] | no_license | // ************************** //
// monsterArm.cpp //
// by Jake Conner //
// ************************** //
#include "monsterArm.h"
// hit
void monsterArm::hit(attackEvent e) {
if (e.blunt() && _strength > 0) {
if (e.damage() >= _strength) {
_monster->injure("nursing a broken arm.");
... | true |
d6483eccb224536e6f17421dc3ca5fab23de64f5 | C++ | myqcxy/Sophomore | /c++/coordinate.cpp | UTF-8 | 332 | 2.734375 | 3 | [] | no_license | #include"coordinate.h"
#include<math.h>
coordinate::coordinate(double a,double b)
{
setdate(a,b);
}
void coordinate::setdate(double a, double b)
{
x = a;
y = b;
}
double coordinate::distanceToOrigin()
{
return sqrt(x*x+y*y);
}
double coordinate::coordinate_x()
{
return x;
}
double coordinate::coordinate_y()
{
r... | true |
cd49806cc74ec2e0b84c1a50f85c76bd732452e9 | C++ | ejawe/cpp | /CPP08/ex00/main.cpp | UTF-8 | 1,770 | 2.546875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | true |
20f5482668f8b08aa13e590a9fbd693b17b8f614 | C++ | millanlaboratory/cnbiros_wheelchair | /examples/example_sonars_setaddress.cpp | UTF-8 | 1,882 | 2.921875 | 3 | [] | no_license | #include "cnbiros_wheelchair/Sonar.hpp"
#include <iostream>
void usage( char *x ) {
printf( "usage: %s /dev/ttyUSB0\n", x );
}
int main(int argc, char *argv[])
{
std::string s;
int retval, revision, err;
unsigned char current_addr, new_addr;
char msg[256];
cnbiros::wheelchair::Sonar *sr;
if ( argc == 2 ) {... | true |
a727174a91bfa32f73471cb1df7f8d7994cf7350 | C++ | Camicam311/Educational-Projects | /3D Computer Graphics/SceneGraphs and Culling/window.cpp | UTF-8 | 2,079 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <GL/glut.h>
#include "Window.h"
#include "Matrix4.h"
#include "main.h"
#include "Vector3.h"
#include "Robot.h"
#include "FrustumG.h"
using namespace std;
int Window::width = 512; // set window width in pixels here
int Window::height = 512; // set window height in pi... | true |
39aa582c7c6bb94ee6db16cf1b8eb5eb8ef6b480 | C++ | lukytto/SFML-console | /console.cpp | UTF-8 | 6,157 | 3.125 | 3 | [] | no_license | #include "pch.h"
#include "console.h"
Menu::Menu(float width, float height)
{
if (!font.loadFromFile("RAVIE.ttf"))
{
std::cerr << "Error! Failed to open the font file!" << std::endl;
}
menu[0].setFont(font);
menu[0].setFillColor(sf::Color::Green);
menu[0].setString("Window");
menu[0].setPosition... | true |
9305cdf6d67ddf80f78504afca1bb0ce1876d854 | C++ | LEX0RE/PI2020 | /Sources/Scenes/MainMenu.hpp | UTF-8 | 3,829 | 2.65625 | 3 | [] | no_license | /// \file MainMenu.hpp
#ifndef MAINMENU_HPP
#define MAINMENU_HPP
#include "../Scene.hpp"
#include "../Event.hpp"
#include "../GLContext.hpp"
#include "../VisualComp.hpp"
#include "../SceneManager.hpp"
#include "../VisualComponents/Label.hpp"
#include "../VisualComponents/Image.hpp"
void OnClickNewGame(VisualComp* v);
... | true |
da31bbd9ca6b37c440dbc7b9e379f5f219502309 | C++ | Tasselmi/algorithms_in_cpp | /chapter08/equivalenceClasses.cpp | UTF-8 | 3,302 | 3.140625 | 3 | [] | no_license | ////
//// Created by Apple on 2020/6/23.
////
//
//#include "ArrayStack.h"
//#include <utility>
//#include <array>
//
//int main()
//{
// const int n = 22; //22个元素
// const int r = 11; //11个数对
//
// using pint = std::pair<int, int>;
// array<pint, r> pairs; //11个数对
// pairs[0] = pint(1, 5);
// pairs[1... | true |
aebc9592bf56abe557d7efbec095d24de6784467 | C++ | EImethod/CourseProject | /Unix文件系统模拟--王俊俏,蔡毅,陈浩,陈佳明/UnixFileManage.cpp | UTF-8 | 22,549 | 3.0625 | 3 | [] | no_license |
/*
操作系统大型实验 Unix 文件管理系统
Author: 王俊俏(zjut_DD)
*/
/*
第0块为引导块,存放用户名和密码等
第1块为系统初始化块,存放空闲i节点号栈,空闲盘快号栈等
第2~IB_num+1为i节点块
第IB_num+2~B_numb-1为数据块
*/
#include<iostream>
#include<stdio.h>
#include<string>
#include<time.h>
using namespace std;
#define B_size 1024 //块大小字节数
#define B_num 4096 //盘快数目 调试用128 最后用4096
#def... | true |
8536d92b73e7580f193619bbe7c8da550579615e | C++ | sauravsi/jitd-cpp | /src/concatNode.cpp | UTF-8 | 384 | 2.609375 | 3 | [] | no_license | #include "concatNode.h"
#include "cog.h"
#include "cogTypes.h"
using namespace std;
concatNode::concatNode( cog* &l, cog* &r )
: cog(CONCAT),
left(l),
right(r)
{}
cog* concatNode::getLeft(){
return left;
}
cog* concatNode::getRight(){
return right;
}
void concatNode::setLeft(cog* &l){
left ... | true |
1808075597790ef995e9857fe654c8dd3c628908 | C++ | patr-schm/surface-maps-via-adaptive-triangulations | /src/SurfaceMaps/Viewer/ColorGenerator.cc | UTF-8 | 1,680 | 2.609375 | 3 | [
"MIT"
] | permissive | /*
* This file is part of
* Surface Maps via Adaptive Triangulations
* (https://github.com/patr-schm/surface-maps-via-adaptive-triangulations)
* and is released under the MIT license.
*
* Authors: Patrick Schmidt, Janis Born
*/
#include "ColorGenerator.hh"
#include <SurfaceMaps/Viewer/Colors.hh>
namespace Sur... | true |
7ccd8a79516dc3a23970387cbcf529e78d03a883 | C++ | Vineeth-97/iiser | /PHY_423/hw1/qn05_vineeth.cpp | UTF-8 | 626 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include<cmath>
#include<fstream>
#include<iomanip>
using namespace std;
double gauss( float x , float a, float m)
{
return exp((-1/2)*(1/(a*a))*(x-m)*(x-m))/(2*4.0*atan(1.0)*a);
}
int main()
{
ofstream gfile ("gaussian.txt");
gfile<<"+------------+------------+\n";
gfile<<"| x | ... | true |
197a3be19e9b90955c98c68e91754962e9b03723 | C++ | ColinRaine/CPP_Projects | /Project4_CM/Source.cpp | UTF-8 | 6,015 | 4.09375 | 4 | [] | no_license | /*
Colin Martinez
Project 4
10/13/2017
This Program displays a menu with various account options for the user
to add, change, or display account information.
*/
#include <iostream>
#include <string>
using namespace std;
// Abstract Data Types
struct CustomerAccount
{
string cust_name;
string... | true |
817240a276bea4a1c73c00f5c9943ee79b294972 | C++ | KeshavChawla/Customized-Job-Parser | /job_parser_helper.cc | UTF-8 | 2,102 | 2.984375 | 3 | [] | no_license | /*******************************************************
* Copyright (C) 2021 Keshav Chawla
* hello [at] keshavchawla.com
*
* This file is part of Job Parser Project.
*
* Unauthorized copying of this file, via any medium is strictly prohibited
*
* Job Parser Project can not be copied and/or distributed without... | true |
c37df7d9ec02d9726ae401579575ad67b00c6551 | C++ | AtigPurohit/Data-Structures-and-Algorithm | /Vector/vectorsort.cpp | UTF-8 | 467 | 2.828125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> v;
int data;
for (int i = 0; i < n; i++)
{
cin>>data;
v.push_back(data);
}
cout<<"Before sort - ";
for(auto i= v.begin(); i != v.end(); ++i)
cout<<*i<<" ";
cout<<endl;
so... | true |
6ce734cced3a478f206cb829560c4e43afa8f28a | C++ | coaldigger1234/Final_Project | /V2_McIntyre_Robbins_Final_Project/GameManager.cpp | UTF-8 | 6,214 | 2.53125 | 3 | [] | no_license | //
// Created by Owner on 4/19/2021.
//
#include "GameManager.h"
#include <iostream> // for standard input/output
#include <fstream>
using namespace std; // using the standard namespace
#include <random>
#include <ctime>
#include <string>
#include <SFML/Graphics.hpp> ... | true |
3a8697918a44bd0180bc323b5d889c4ae8674a01 | C++ | Tenderest/CPP-Learning | /Cpp_Primer_Plus/Chapter4/numstr-correct.cpp | UTF-8 | 616 | 3.5625 | 4 | [] | no_license | // numstr.cpp -- following number input with line input
#include <iostream>
int main(void)
{
using namespace std;
cout << "What year was your house built?\n";
int year;
/* Correct */
/* 1 */
cin >> year;
cin.get(); // or cin.get(ch);
/* 2 */
(cin >... | true |
06c85b8b8fb3e99bfc66550677a4804cb93fabec | C++ | dooleyet/ECE387_GroupProject | /FlexiForceEdits.ino | UTF-8 | 878 | 2.984375 | 3 | [] | no_license | //From the bildr article http://bildr.org/2012/11/flexiforce-arduino/
int flexiForcePin = A0; //analog pin 0
int transPin = 7;
int n = 0;
void setup(){
//Pin for transisto r gate
pinMode(2, OUTPUT);
pinMode(7, OUTPUT);
Serial.begin(9600);
//Turn alarm on
digitalWrite(2, HIGH);
digitalWrite(7, LOW);
}
v... | true |
f714d112b72cea70b2d5a1c4bdd293ca50a10ae9 | C++ | envamp/Augmentations | /augs/entity_system/world.cpp | UTF-8 | 1,563 | 2.515625 | 3 | [] | no_license | #include "world.h"
#include "processing_system.h"
#include "../../game_framework/messages/new_entity_message.h"
namespace augs {
world::world(overworld& parent_overworld) : parent_overworld(parent_overworld) {}
void world::initialize_entity_and_component_pools(int maximum_elements) {
entity_pool_capacity = maximu... | true |
1492ba0ee8a3fa47841934c96dbc5421146236cf | C++ | shanche/Notes | /Quant/B组(组长:陈聪)/Quizzes/Quiz1_Sep29/quiz1_code_/quiz1Pro17.cpp | UTF-8 | 468 | 3.625 | 4 | [] | no_license | #include<iostream>
using namespace std;
float maxProfit(float prices[], int size) {
if (size <= 1) return 0.0;
float profit = 0.0;
for (int i = 1; i < size; i++) {
float diff = prices[i] - prices[i-1];
if (diff > 0.0) {
profit += diff;
}
}
}
int main() {
float p... | true |
f93df853ea706424979019d38159a7761e3f77e6 | C++ | AaronLin98/Algorithm | /Course Design_Approximation Algorithm in Steiner Tree/Course Design.cpp | GB18030 | 23,066 | 2.921875 | 3 | [] | no_license | #include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<fstream>
#include<algorithm>
using namespace std;
#define MAX 100
#define PI 3.1416
typedef struct POINT //
{
double x;
double y;
int index;
friend bool operator < (struct POINT const &v1, struct POINT c... | true |
1fce97e2fdb1c1489d7ff66a754497619b1fb98a | C++ | deepdivenow/otus_task6 | /matrix.cpp | UTF-8 | 238 | 2.953125 | 3 | [] | no_license |
#include <iostream>
#include "Matrix.h"
using namespace std;
int main() {
Matrix<int,-1> m;
m[1][2]=5;
m[1][3]=6;
m[1][4]=7;
m[1][5]=8;
for(auto c: m)
{
cout << c.second << endl;
}
return 0;
} | true |
608ef894d8ef0a24dea0f1b320bfa75b58efe48f | C++ | duliang1994/LeetCode | /022. Generate Parentheses/Generate Parentheses.cpp | UTF-8 | 1,068 | 3.015625 | 3 | [] | no_license | class Solution {
public:
vector<string> generateParenthesis(int n) {
vector<string> res;
DFS(0, 0, "", n, res);
return res;
}
void DFS(int left, int right, string path, int n, vector<string>& res){
if(right > left || left > n || right > n) return;
if... | true |
0de1f589166cb7bf0b026e5e5324c504971df8c7 | C++ | Creatiox/workaton-esp32 | /Ejemplos/7. Ingresar Credenciales WiFi - ESP32 Modo AP/src/main.cpp | UTF-8 | 11,752 | 3.171875 | 3 | [] | no_license | // NOTE Explicación Ejemplo
/*
* Ejemplo de conexión a WiFi por medio de un Smartphone:
? Connection to WiFi through a Smartphone:
En este ejemplo, se utiliza la librería "AutoConnect", la cual crea un Portal de Conexión para
ingresar las credenciales de una red WiFi por medio de un navegador en un Smartphone.
... | true |
064b38476f294ac47e56c5cff74be0ea97fa2835 | C++ | Irfan995/ArduinoCodes | /MyAvoidRobot/MyAvoidRobot.ino | UTF-8 | 2,192 | 2.53125 | 3 | [] | no_license |
#define inA 13
#define inB 3
#define inC 9
#define inD 8
#define ena 7
#define enb 6
int base_L=75;
int base_R=75;
int trigPin = 12; //Trig - green Jumper
int echoPin = 5; //Echo - yellow Jumper
long duration, cm, inches;
long distance=15;
int flag=0;
///////////////////////////////////////////////////////////... | true |
4224f5ecf636965e0b47f28be165d4e1c366222a | C++ | AaronFlower/leetcode | /239-Sliding-Window-Max/solution.h | UTF-8 | 4,384 | 3.546875 | 4 | [] | no_license | #ifndef LEETCODE_SOLUTION_H__
#define LEETCODE_SOLUTION_H__
#include <vector>
#include <queue>
#include <set>
using std::vector;
using std::priority_queue;
using std::pair;
using std::make_pair;
using std::multiset;
using std::deque;
class Solution
{
public:
/**
* 使用 deque 和 heap 的方法一样。
*/
vector<i... | true |
ff45884fca62fbc3c845828042218618af3220ac | C++ | Mular8/NOKIA-PK | /COMMON/Traits/EnumTraits.hpp | UTF-8 | 3,561 | 3.25 | 3 | [] | no_license | #pragma once
#include <type_traits>
#include <utility>
#include <stdexcept>
namespace common
{
template <typename Enum, typename Return=std::underlying_type_t<Enum>>
constexpr Return enumUnderlyingValue(Enum value)
{
return static_cast<Return>(value);
}
template <typename Enum, typename Value = std... | true |
c1c8d539b548b9f770c37fba2d508bb2c728dbb7 | C++ | grai2022/leetcode_accepted | /31nextPermutation.cpp | UTF-8 | 1,247 | 3.390625 | 3 | [] | no_license | /*
Problem -
https://leetcode.com/problems/next-permutation/submissions/
*/
class Solution {
public:
void nextPermutation(vector<int>& nums) {
int length = nums.size() -1;
int swapIndex = -1;
for(int i = length ; i>0;i--){
if(nums[i] > nums[i-1]){
swapIn... | true |
d71590a812e6cd6572dae750467dc28861d6d4d0 | C++ | dotnet/dotnet-api-docs | /snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp | UTF-8 | 1,873 | 3.421875 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | //<SNIPPET1>
using namespace System;
using namespace System::IO;
using namespace System::Text;
using namespace System::Security::Cryptography;
int main()
{
array <Byte>^ originalBytes =
ASCIIEncoding::ASCII->GetBytes("Here is some data.");
//Create a new RC2CryptoServiceProvider.
RC2CryptoService... | true |
dc2696954e40dd072aa35e8d7c9e59da87abdca7 | C++ | iczero/i-cant-opengl | /src/main.cpp | UTF-8 | 2,421 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "window.hpp"
#include "shaders.hpp"
#include "geometry.hpp"
constexpr int DEFAULT_WIDTH = 800;
constexpr int DEFAULT_HEIGHT = 600;
// why terminate... | true |
4991502672d8e13df7b1e8235b83aa6f5afefa29 | C++ | rtpax/redblack | /rb_tree.hh | UTF-8 | 4,749 | 2.84375 | 3 | [
"MIT"
] | permissive | #ifndef RB_TREE_HH
#define RB_TREE_HH
#include <functional>
#include <utility>
#include <memory>
#include <limits>
#include "rb_iterator.hh"
#include "rb_node.hh"
template<class T, class Cmp = std::less<T>, class Alloc = std::allocator<T>>
class rb_tree {
friend rb_test<T,Cmp,Alloc>;
public:
typedef rb_itera... | true |
470bf3fcb54cb11df6cf98c2855496edde34d349 | C++ | stden/inf_ege | /cpp/Kabc/main.cpp | UTF-8 | 314 | 3.140625 | 3 | [] | no_license | #include <iostream>
int main() {
//double a * x + b = 0 ;
double a = 2;
double b = 4;
std::cout << "a = ";
std::cin >> a;
std::cout << "b = ";
std::cin >> b;
double x = -b / a;
std::cout << "x = " << x << std::endl;
std::cout << "a * x + b = " << (a * x + b) << std::endl;
return 0;
}
| true |
89b3b5251f0196958039e7572b904991ad0730e9 | C++ | pblxptr/Malware-families-detector | /src/gui/src/predictdialog.cpp | UTF-8 | 988 | 2.5625 | 3 | [] | no_license | #include <QtWidgets/QFileDialog>
#include <QtWidgets/QMessageBox>
#include "../include/predictdialog.hpp"
#include "ui_predictdialog.h"
PredictDialog::PredictDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::PredictDialog)
{
ui->setupUi(this);
ui->filepathTextEdit->setReadOnly(true);
}
PredictDia... | true |
1dc13da30f591fadc0988191453d132861f89216 | C++ | jseric/3D-KD_Tree | /solution/3D-Vanity-KD_Tree/Engine/Repository/KD Tree/Tree/Tree.cpp | UTF-8 | 17,243 | 3.390625 | 3 | [] | no_license | #include "pch.h"
#include "Tree.h"
#include "../Macros/KDTreeMacros.h"
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <limits>
#include <sstream>
namespace vxe
{
#pragma region Private
/// Allocate new node
Node* Tree::CreateNewNode(const DirectX::VertexPosition& targ... | true |
7d2bb096c4e1090668e30e90442428463de86543 | C++ | kyordhel/FSEm | /practica07/src/arduino-test-dc.cpp | UTF-8 | 1,500 | 3.015625 | 3 | [
"MIT"
] | permissive | /*
* arduino-test-dc.cpp
*
* Author: Mauricio Matamoros
* Date: 2020.03.01
* License: MIT
*
* Controls the power output of a resistive load using
* zero-cross detection and a TRIAC. Code for Arduino UNO
*
*/
#include <avr/io.h>
// Digital 2 is Pin 2 in UNO
#define ZXPIN 2
// Digital 3 is Pin 3 in UNO
#define TRIA... | true |
f544030517ca21df5d516d7f1795781fa63a0144 | C++ | NielsBeyen/i2c_pi_trex_master_student | /I2C.cpp | UTF-8 | 367 | 2.546875 | 3 | [] | no_license | #include "I2C.h"
#include <string.h>
namespace TRexLib{
/*
* Constructor
*
* @device the device path of the I2C bus (for example /dev/i2c-1)
* @i2caddress the I2C slave device address
*/
I2C::I2C(const char * device, int i2caddress)
{
// Copy the device path
... | true |
aa53a01f9edea2f147ee96afb493ab70e49b9f88 | C++ | Jiltseb/Leetcode-Solutions | /solutions/473.matchsticks-to-square.246166430.ac.cpp | UTF-8 | 945 | 3.046875 | 3 | [
"MIT"
] | permissive | class Solution {
public:
bool makesquare(vector<int> &nums) {
return nums.size() && canPartitionKSubsets(nums, 4);
}
bool canPartitionKSubsets(vector<int> &nums, int k) {
int sm = 0;
for (int n : nums)
sm += n;
if (sm % k)
return false;
sm /= k;
int n = nums.size();
vec... | true |
cac149b95c207accfb3eab06ebb144b60e8914cc | C++ | hectorpla/Leetcode | /Tree/populate_next.cpp | UTF-8 | 1,064 | 3.4375 | 3 | [] | no_license | #include "TreeLinkNode.h"
#include <iostream>
using namespace std;
class Solution {
public:
void connect(TreeLinkNode *root) {
helper(root);
}
void helper(TreeLinkNode *root) {
if ( !root ) return;
if ( root->left ) {
root->left->next = root->right;
if ... | true |
b723dc1c55142d7acaf4e9271139904dda6428b5 | C++ | ParagSaini/Competitive-Practice | /Babbar_series/Sets and Map/Intermediate/SubArrayWithzeroSum.cpp | UTF-8 | 899 | 3.828125 | 4 | [] | no_license | #include <iostream>
#include<vector>
#include<unordered_set>
using namespace std;
// Time complexity = O(n); very nice
// whenever we find the subarray with sum 0, the sum of total
// array till that is equal to some previous sum.
/* ex: ar = {5,4,2,-3,1,6}; subarray with sum 0 = {2,-3,1};
sum till element 1... | true |
2d0390907b0dfc1a9fa34b1e56582389f532ed5c | C++ | escape0707/usaco_trainings | /race3.cpp | UTF-8 | 2,655 | 3.28125 | 3 | [] | no_license | /*
ID: totheso1
LANG: C++14
TASK: race3
*/
#include <algorithm>
#include <fstream>
#include <iterator>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
static ifstream fin("race3.in");
static ofstream fout("race3.out");
#define endl '\n'
template <typename T>
T fin_get() {
return *istre... | true |
c08473552294d7d746d667504e2bbac32b8bfac9 | C++ | shadeops/euled-up | /Week_8_Boid_Simulation/brd/scene.cpp | UTF-8 | 2,783 | 3.046875 | 3 | [] | no_license | #include <random>
#include "scene.h"
Scene::Scene(int num_boids)
{
std::default_random_engine generator;
std::uniform_int_distribution<> distr_pos_x(0, screen_width);
std::uniform_int_distribution<> distr_pos_y(0, screen_height);
std::uniform_real_distribution<> distr_vel(-0.5, 0.5);
for (int i =... | true |
f68aa18c093ea00340c10265dc9b398ae4d5bdee | C++ | knupel/Rope_of_framework | /rope/function/rand_fast.cpp | UTF-8 | 1,748 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | /**
* ROPE FUNCTIONS
* v 0.1.0
* 2020-2020
*/
#include "./rand_fast.hpp"
#include "../template/utils/r_utils.hpp"
/**
* RANDOM FAST
*/
/**
* random fast
* https://en.wikipedia.org/wiki/Xorshift
*/
// fast 128
float random_fast_128(vec4<uint32_t> &seed, float max) {
float res = random_fast_128(seed) / static_cast<flo... | true |
e66c7d3e56e4a1df1dfb1a502b84d224a1bb4224 | C++ | manproffi/CPP_pool | /d04/ex00/Sorcerer.hpp | UTF-8 | 1,494 | 2.640625 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Sorcerer.hpp :+: :+: :+: ... | true |
4c36f7ca0feb24e569900596360f562bcc3f9b2d | C++ | OOP2019lab/lab8-182171Naeemraza | /date_impl.cpp | UTF-8 | 2,352 | 3.765625 | 4 | [] | no_license | #include"date.h"
static string monthNames[13] = {"","January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} ;
Date::Date()
{
year=2000;
month=1;
day=1;
}
Date::Date(int m,int d,int y)
{
if(y<=2100&&y>=1800)
year=y;
if(... | true |