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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c949c28b0a9b9b1f2636f767df0a29bd1111f646 | C++ | danleechina/Leetcode | /archive1/55.cpp | UTF-8 | 728 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
class Solution {
public:
bool canJump(vector<int>& nums) {
if (nums.size() == 0) return false;
if (nums.size() == 1) return true;
int currentMost... | true |
7dcf85a0e5ff27fe06d23cfe3c00166e708cd3ea | C++ | TheGhostHuCodes/CoreCpp | /CoreCpp5OfN.cpp | UTF-8 | 1,188 | 3.78125 | 4 | [] | no_license | #include <string>
#include <ostream>
#include <iostream>
using namespace std;
// Primary template.
template <typename T> struct Kitty {
static void Meow() { cout << "Kitty<T>::Meow()!" << endl; }
};
// Full or Explicit specializaiton.
template <> struct Kitty<const char*> {
static void Meow() { cout << "Kitt... | true |
dd950843daefebe77d86521ea961562666c60f65 | C++ | xubingyue/GP | /httpserver/comm/Util/Helper.cpp | UTF-8 | 6,583 | 2.8125 | 3 | [] | no_license | //
// Created by new on 2016/11/8.
//
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <arpa/inet.h>
#include "Helper.h"
#include "StrFunc.h"
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/if_ether.h>
string Helper::filt... | true |
3f6e0048c476daaf184153f82038669ab65c2bbb | C++ | westsiderz/OpenCVTrainings | /BP24_HarrisCorner/src/HarrisCorner.cpp | UTF-8 | 2,359 | 3.015625 | 3 | [] | no_license | #include <opencv2/opencv.hpp>
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
using namespace cv;
// Apply the Harris Corner Detection operation to an image
void applyHarrisCornerDetection()
{
// Path to the input image
std::string l_pathToInputImage{ "../Resources/car.jpg" };
/... | true |
1f29a67794addc39c8a83b0905f5c51c876143a0 | C++ | pixel-me/Gets_Started | /Lab14_38_Ashutosh.cc | UTF-8 | 1,034 | 3.515625 | 4 | [] | no_license | #include <cstdio>
#define MAX_NAME 20
using namespace std;
class person{
public:
int id;
char name[MAX_NAME];
};
class student: public person
{
public:
/*There is no specific task described in question of lab number 14 to do in student class, hence I'm keeping it as it is.*/
};
class faculty: public person
{
pub... | true |
0205bb279a3b56b74f673bcd795a50f8f457dd91 | C++ | tasmidur/problemsolving | /levelordertraversal.cpp | UTF-8 | 2,072 | 3.484375 | 3 | [] | no_license | #include<bits/stdc++.h>
#include<queue>
using namespace std;
struct BSTNODE{
int data;
BSTNODE* left;
BSTNODE* right;
} ;
BSTNODE* getNewNode(int data){
BSTNODE* newnode=new BSTNODE();
newnode->data=data;
newnode->left=newnode->right=NULL;
return newnode;
}
BSTNODE* insertdata(BSTNODE* root,int data){
... | true |
b9fcf250049c0a4d36ee08b13d2062ee564f6c09 | C++ | hamsham/LightGame | /src/GameSystem.cpp | UTF-8 | 6,327 | 2.84375 | 3 | [
"BSD-2-Clause"
] | permissive | /*
* File: game/ganeSystem.cpp
* Author: Miles Lacey
*
* Created on November 15, 2013, 9:53 PM
*/
#include <chrono> // std::chrono::steady_clock, std::chrono::milliseconds
#include <climits> // UINT_MAX
#include <new> // std::nothrow
#include <utility> // std::move
#include "lightsky/utils/Assertions.h"
#inclu... | true |
539b6710709059ae771a8a196dc4cd6a55512c53 | C++ | gloshkaj/Assembler | /Instruction.cpp | UTF-8 | 5,998 | 3.21875 | 3 | [] | no_license | #include "stdafx.h"
#include "Instruction.h"
#include <sstream>
#include <iterator>
/*
NAME
ParseInstruction - Parses the current line in the file and gets the instruction type.
SYNOPSIS
Instruction::InstructionType ParseInstruction(string &a_buff);
DESCRIPTION
This function will determine the type ... | true |
52367ba1b03083c5a8a662f1a01516a66181ec8e | C++ | explorer85/projects | /enginetest/multiinterface.h | UTF-8 | 1,295 | 2.796875 | 3 | [] | no_license | #ifndef INTERFACE_H
#define INTERFACE_H
#include <QDebug>
namespace multiinterface {
class Base /*:*/ /*public QObject*/ {
public:
virtual ~Base() = default;
void test() {}
};
class IRenderable : virtual public Base {
public:
virtual void render() = 0;
};
class Inputable : virtual public Base {
public:
virt... | true |
722490ba4e9f575de49032ee2c97af212dad9692 | C++ | zrpllvv/ADS-Codeforces | /cd_271_A.cpp | UTF-8 | 569 | 2.9375 | 3 | [
"MIT"
] | permissive | //@author: zrpllvv
//link: https://codeforces.com/contest/271/problem/A
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
using namespace std;
bool func(int god){
set<char> unique;
string s = to_string(god);
int size = s.size();
for(int i = 0; i < size; i++)... | true |
07cf76fe3923f26ad5352d48b86057067e3c5e5a | C++ | TheAnswer/Tools | /SWGHeightDump/engine/thread/Mutex.h | UTF-8 | 1,375 | 3.078125 | 3 | [
"WTFPL"
] | permissive | #ifndef MUTEX_H_
#define MUTEX_H_
// made by Oru
#include "../system.h"
class Mutex {
pthread_mutex_t mutex;
bool doLog;
string lockName;
int lockCount;
int currentCount;
public:
Mutex() {
//mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_init(&mutex, NULL);
d... | true |
b1f884546407eec63aa911d4a92510f432a7096c | C++ | nomigori96/Compi3 | /ParserFunctions_old.cpp | UTF-8 | 8,792 | 2.640625 | 3 | [] | no_license |
#include "ParserFunctions.hpp"
#include "symbol_table.hpp"
#include "hw3_output.hpp"
using namespace output;
SymbolTable symbol_table;
bool is_in_loop = false;
string curr_function_return_type = "";
extern int yylineno;
void CheckMainExists()
{
if (symbol_table.DoesSymbolExists("main") == SYMBOL){
Func... | true |
0bdbc0d8b064be37d601133d75dcc09e1a1da327 | C++ | SabineHU/Raytracer | /src/light/point_light.hh | UTF-8 | 433 | 2.75 | 3 | [] | no_license | #pragma once
#include "light.hh"
#include "vector3.hh"
class PointLight : public Light {
public:
PointLight();
PointLight(const Vect&, const Color&);
PointLight(const Vect&, const Color&, double);
virtual Vect get_light_position() const override;
virtual Color get_light_color() const override;
... | true |
c8752871b53de6d5f505e5c8969130c755f25337 | C++ | Razvan2109/OOP_Project_Laundry | /main.cpp | UTF-8 | 21,861 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <cstring>
#include <typeinfo>
#include <windows.h>
#include <fstream>
using namespace std;
ifstream f;
class haine;
class masina;
class proces
{
char tip[30];
float detergent;
float durata;
public:
friend void calcare(haine&);
... | true |
ff63b82055005986df751b1f40723bd3517cc5e6 | C++ | k-a-z-u/KLib | /test/streams/TestBuffer.cpp | UTF-8 | 3,245 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | /*
* TestBuffer.cpp
*
* Created on: Dec 18, 2013
* Author: kazu
*/
#ifdef WITH_TESTS
#include "../Test.h"
#include <cstdint>
#include "../../streams/Buffer.h"
using namespace K;
TEST(Buffer, insertByte) {
Buffer<uint8_t> buf;
for (unsigned int i = 0; i < 1024; ++i) {
buf.add((uint8_t) i);
}
AS... | true |
7b6236543ac9b39c5ad3ecc5e7ad10bce3238e3c | C++ | rdnelson/Rainier_VM | /vm/Sub.cpp | UTF-8 | 717 | 2.53125 | 3 | [] | no_license | #include "Sub.h"
#include "VM.h"
#include "common/Opcode.h"
Sub::Sub(char* eip)
{
mEipOffset += LoadArgs(2, eip);
}
void Sub::Execute()
{
ResolveValue(1);
unsigned int val1;
unsigned int diff;
switch(subcode[0]) {
case SC_REG:
val1 = VM_INSTANCE()->GetRegister(arguments[0]);
diff = val1 - arguments[1];
... | true |
061ba88425babb07347cfe3e30ab0947176bedff | C++ | zigmundot/qt5dp-4-8 | /main.cpp | UTF-8 | 1,425 | 3.515625 | 4 | [] | no_license | #include <QCoreApplication>
/*
What
Smart pointers in the standard library
Description
Baked right into C++
Why
Just because Qt provides something doesn't mean its the best tool
Example
Test cases
unique_ptr - only one object can point to it
shared_ptr - multiple objects can point to it
https://www.geek... | true |
a4342b35340e2d289f1b85b28e598fd14cad7ea7 | C++ | mahudin/OpenGL-Alchemy | /Solution/mpgk/Wektor.cpp | UTF-8 | 3,751 | 3.21875 | 3 | [] | no_license | #pragma once
#include "Wektor.h"
Wektor::Wektor() {
wspolrzedne = new GLfloat[4];
for (int i = 0; i < 4; i++) {
wspolrzedne[i] = NULL;
}
}
Wektor::Wektor(GLfloat x) :Wektor() {
wspolrzedne[0] = x;
}
Wektor::Wektor(GLfloat x, GLfloat y, GLfloat z) : Wektor() {
wspolrzedne[0] = x;
wspolrzedne[1] = y;
wspolrze... | true |
d656db6095b2c773c2a6eb63a9e79a40db0d55c3 | C++ | haklabo/TwinklebearDev-Lessons | /Lesson8/src/window.h | UTF-8 | 2,560 | 3.203125 | 3 | [
"MIT"
] | permissive | #ifndef WINDOW_H
#define WINDOW_H
#include <string>
#include <stdexcept>
#include <memory>
#include <SDL.h>
/**
* Window management class, provides a simple wrapper around
* the SDL_Window and SDL_Renderer functionalities
*/
class Window {
public:
//The constructor and destructor don't actually do anything as
... | true |
36e2ed78613a16743e64b8b0727848a41e574e78 | C++ | YellowHCH/cmake_practice | /template/sub1/include/myMemoryPool.h | UTF-8 | 3,961 | 3.578125 | 4 | [] | no_license | /*
设计内存池若干
先设计一个固定对象大小的
*/
#ifndef MY_MEMORYPOOL_H
#define MY_MEMORYPOOL_H
#include <stdlib.h>
#include <iostream>
#include <list>
int unit = 0;
int block = 0;
// 固定大小内存池设计
/*
内存池数据结构,基本结构是内存单元unit,内存块block包含块信息和内存单元,由内存池去调用内存块
*/
// 内存块
class myMemoryBlock{
public:
myMemoryBlock() : numFree(numUnit) , nFirst(0... | true |
78bb7a8f072321edfb25990255f7120ddf3baee2 | C++ | Redwanuzzaman/Online-Judge-Problem-Solutions | /Codeforces/Find Square.cpp | UTF-8 | 458 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m, cnt = 0, row = 0, col = 0;
string s;
cin >> n >> m;
for(int i = 0; i < n; i++)
{
cin >> s;
for(int j = 0; j < m; j++)
{
if(s[j] == 'B')
{
cnt++;
row +... | true |
26b0531690229cc3bc6ff057c66ec1b6bbf81ae4 | C++ | tpetrina/rp1 | /2013/3/cetverokut/c-test3.cpp | UTF-8 | 746 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <utility>
#include <string>
#include <set>
#include "cetverokut.h"
using namespace std;
typedef std::pair<double,double> tocka;
int main()
{
// testiramo tipCetverokuta
tocka A(-1,0), B(0,0.5773497), C(1,0), D(0,-0.5773497);
tocka A2(-1,0), B2(0,1), C2(1... | true |
c0fdf35c898f5d165a195bd38a7ab035177efff0 | C++ | vdelgadov/itcvideogame | /Stable/Behaviours/Skirk.cpp | UTF-8 | 3,163 | 2.71875 | 3 | [] | no_license | #ifndef _SKIRK
#define _SKIRK
#include "Actor_States.cpp"
//InfluenceMap* AIController::s_InfluenceMap;
class SkirkEngaging : public AState<Actor> {
private:
static const double attacking_range;
public:
void enter(Actor* a){
cout << "Entering Skirk Engaging" <<endl;
//Enemy = a->getController()->... | true |
99ec3e2c66042c2be932af3fb30dda219503eb81 | C++ | soqutto/practice | /cheetah/3-5.cpp | UTF-8 | 481 | 3.0625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void countStrings(vector<string> s);
void countStrings(vector<string> s){
map<string, int> m;
for(int i = 0; i < s.size(); ++i){
m[s[i]]++;
}
map<string, int>::iterator it = m.begin();
while(it != m.end()){
cout << (*it).first << "" <... | true |
a4a05e3c7adec443f00d6dc5bdc4d5739c24d009 | C++ | anonyxhappie/CodeChef | /begginer/cielrcpt.cpp | UTF-8 | 393 | 2.90625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int two(int);
int main(){
freopen("in.txt", "r", stdin);
int t, a;
cin >> t;
while(t--){
cin >> a;
cout << two(a) << endl;
}
return 0;
}
int two(int n){
int at[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048};
int i=11, count=0;
while(n){
if(n>=at[i]){
... | true |
06d34901d41317f3e62a1c7e9667904ed5beabc1 | C++ | quincinia/school | /cs302/projects/Art Gallery Extra Credit/include/vertex.h | UTF-8 | 1,324 | 3.0625 | 3 | [] | no_license | #ifndef VERTEX_H
#define VERTEX_H
#include <iostream>
#include <vector>
#include <string>
class Edge;
class Vertex
{
friend class DCELVertex;
public:
//Used to generate unique vertex names
static int count;
std::string name;
Vertex(float x, float y);
~Vertex(); //all memory is handled by the Mesh class
... | true |
f0ae4df7df92e8a39c409b84fb162c076fe54cde | C++ | whztt07/acm | /project_euler/11/Sov_05_10_2012.cpp | UTF-8 | 1,311 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int matrix[20][20];
int n = 20;
bool ok(int x, int y) {
return (x>=0&&x<n && y>=0&&y<n);
}
int main() {
for (int i = 0; i < n; ++ i)
for (int j = 0; j < n; ++ j)
cin >> matrix[i][j];
int ans = -1;
... | true |
ed6a29b3e857cccc455df2845026a4deeab752b4 | C++ | ms13r/C- | /List Data Structure/List.hpp | UTF-8 | 9,961 | 3.640625 | 4 | [] | no_license | // The following code was done by Miroslav Sanader.
// Functions are also adapted from Dietel.
// Data Structures; Myers
template <typename T>
List<T>::const_iterator::const_iterator(){ // default zero parameter constructor
current = nullptr;
}
template <typename T>
T & List<T>::const_iterator::retriev... | true |
625c3f0c5394732dfa13749e2da11c9d98358117 | C++ | Rockroyal305/Practice-Problems | /The Game of Life.cpp | UTF-8 | 2,459 | 2.921875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int tests;
cin >> tests;
for(int t = 0; t < tests; t++)
{
int number, iterations, dead = 0;
char cells[1000], new_cells[1000], previous_cells[1000];
cin >> number >> iterations;
for(int i = 0; i < numb... | true |
4977d722f7fd9d588f3d9cd2d6e179ff72962873 | C++ | iosiginer/Reversi | /ClassicLogic.h | UTF-8 | 1,615 | 3.171875 | 3 | [] | no_license | #ifndef REVERSI_CLASSICLOGIC_H
#define REVERSI_CLASSICLOGIC_H
#include "GameLogic.h"
/**
* The classic set of rules for the Reversi Game. It inherits from GameLogic, to make it more easy to find.
*/
class ClassicLogic : public GameLogic {
private:
/**
* Get the directions in which the Player should check ... | true |
6bd07f74237bf2f38bc30b7cc537d7e688e88908 | C++ | Tanjim131/Problem-Solving | /UVa/598.cpp | UTF-8 | 3,743 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <limits>
#include <vector>
#include <sstream>
#include <string>
// will not if there are multiple newspapers with the same name
void combination(const std::vector<std::string> &newspapers, std::vector <std::string> current_subset, int target_subset_size, int index = 0){
// at each ind... | true |
9439136f151336ee3a745b0e5afc4ad36fa3e74e | C++ | ptitzlabs/nyancodec | /include/console_color.hpp | UTF-8 | 2,873 | 2.71875 | 3 | [] | no_license | #ifndef CONSOLE_COLOR_HPP
#define CONSOLE_COLOR_HPP
#pragma once
#include <iostream>
#ifdef __linux__
#define RESET "\033[0m"
#define BLACK "\033[30m" /* Black */
#define RED "\033[31m" /* Red */
#define GREEN "\033[32m" /* Green */
#define YELLOW "\033[33m" /* Yellow */
#define BLUE "... | true |
bfadcf7aaf627aaa5acd2035d4acf9327e72dc1e | C++ | renishalachhani/Practicas_AEDA_19-20 | /prac7_Renisha/nodoAVL.h | UTF-8 | 760 | 2.625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "dni.h"
using namespace std;
template <class Clave>
class nodoAVL {
private:
Clave clave_;
int bal_;
nodoAVL *izdo_;
nodoAVL *dcho_;
public:
inline nodoAVL(Clave clave, nodoAVL<Clave> *izq=NULL, nodoAVL<Clave> *der=NULL): bal_(0), clave_(clave), izdo_(izq), dcho... | true |
c3f74ed07168fd35d96140f4a14bce1a31fa5695 | C++ | 1269934803/LeetCode | /leetcode232.cpp | UTF-8 | 1,926 | 2.96875 | 3 | [] | no_license | /*************************************************************************
> File Name: leetcode232.cpp
> Author: ma6174
> Mail: ma6174@163.com
> Created Time: 2020年02月27日 星期四 22时18分40秒
************************************************************************/
#include<iostream>
#include<cstdio>
#include<cstdlib>... | true |
4d198e6424082f4b39b5fb762b4a9e6c3cbd2c52 | C++ | ajunlonglive/Hands-On-Design-Patterns-with-Qt-5 | /ch02/IntrospectionExample/Person.cpp | UTF-8 | 1,102 | 2.828125 | 3 | [
"MIT"
] | permissive | #include "Person.h"
#include <QVariant>
Person::Person(QObject *parent)
: QObject(parent),
m_name(),
m_birthday(),
m_heightCm(),
m_gender(UNSPECIFIED)
{
// tell the metaobject system about our type
qRegisterMetaType<Person *>();
}
QString Person::name() const
{
return m_name;
}... | true |
30ff452e90fa5095769be29d26994eb5bdd6ba23 | C++ | dscvr-com/online-stitcher | /src/test/slerpTest.cpp | UTF-8 | 2,001 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include "../stitcher/simpleSphereStitcher.hpp"
using namespace std;
using namespace cv;
using namespace optonaut;
void CreateRotationPhiTheta(const double phi, const double theta, Mat &res) {
Mat rPhi, rTheta;
CreateRotationY(phi, rPhi);
CreateRotat... | true |
6f1e299dc34625b04b26e103b69d77e332f272c9 | C++ | UnforeseenOcean/scenegraphhh | /Node.cpp | UTF-8 | 1,629 | 2.625 | 3 | [] | no_license | //
// Node.cpp
// Node
//
// Created by T.K. Broderick on 10/11/14.
//
//
#include "Node.h"
using namespace ci;
using namespace ci::app;
using namespace std;
void Node::setPosition( const ci::vec3& position ){
mPosition = position;
setMatrix( mat4( translate( position ) ) );
}
void Node::setRotation( const ci... | true |
09117f1208ce4d963e5a9e32e6506205adea4172 | C++ | y4my4my4m/ZenithOS | /src/Kernel/BlkDev/DiskDirA.CC | UTF-8 | 4,965 | 2.875 | 3 | [
"Unlicense"
] | permissive | Bool DirNew(CDrive *drive,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain=TRUE)
{//Makes a directory entry in the directory from a $LK,"CDirEntry",A="MN:CDirEntry"$ node.
switch (drive->fs_type) {
case FSt_REDSEA:
return RedSeaDirNew(drive,cur_dir,tmpde,free_old_chain);
case FSt_FAT32:
return FAT32DirNew(dr... | true |
6fe8d9a4937a782152a9cbf5a393c3c20ea085af | C++ | seaslee/rome | /matrix/matrix.h | UTF-8 | 13,308 | 3.046875 | 3 | [] | no_license | /**
* A template class to implement matrix and support element-wise operation on it
*
* This class implements the template matrix. Matrix object can be constructed
* by the following ways:
*
* a. a matrix can be constructed with the matrix_initializer_list (
* a.k, recursive initializer_list). The memory o... | true |
feb8877c630942c3a7386c31009f40ce471113d8 | C++ | Frozen-Team/3FEngine | /src/utils/f_file_loader.cxx | UTF-8 | 632 | 2.703125 | 3 | [
"MIT"
] | permissive | #include "f_file_loader.hpp"
#include <fstream>
#include <fcomponents/f_logger.hpp>
namespace fengine
{
namespace futils
{
FFileLoader::FFileLoader(const FString & file_path)
{
LoadFile(file_path);
}
void FFileLoader::LoadFile(const FString& file_path)
{
std::ifstream in_file;
in_file.open(file... | true |
c635e97f1495fa8940ff1133658e085489ad05dc | C++ | ZzEeKkAa/eolimp | /1948.cpp | UTF-8 | 1,188 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <vector>
#include <queue>
using namespace std;
vector<vector<int> > g;
vector<int> used;
vector<int> inDegree;
vector<int> top;
queue<int> q;
int main(){
ifstream fin("input.txt");
ofstream fout("output.txt");
int n,m,a,b;
int from,to;
vector<int>:... | true |
64c94051574b2eef56fc9d3a5ad71f108c8e0ce2 | C++ | anukiii/GameSims | /CSC8503/CSC8503Common/StateTransition.h | UTF-8 | 836 | 2.8125 | 3 | [] | no_license | #pragma once
#include <functional >
namespace NCL {
namespace CSC8503 {
class State;
typedef std::function <bool()> StateTransitionFunction;
class StateTransition {
public:
StateTransition(State* source , State* dest ,
StateTransitionFunction f)... | true |
5a463670e97c81e549964d0292cee089ebfa2348 | C++ | kannavue/ChartPatternRecognitionLib | /src/math/UnsignedIntRange.h | UTF-8 | 560 | 2.6875 | 3 | [
"MIT"
] | permissive | /*
* UnsignedIntRange.h
*
* Created on: Jul 31, 2014
* Author: sroehling
*/
#ifndef UNSIGNEDINTRANGE_H_
#define UNSIGNEDINTRANGE_H_
class UnsignedIntRange {
private:
unsigned int minVal_;
unsigned int maxVal_;
public:
UnsignedIntRange(unsigned int minVal, unsigned int maxVal);
bool valueWithinRange(un... | true |
82ff3fc948b63003f3446b497f8e7f07b73f70cf | C++ | Nils2332/Timelapsebuild | /Software/Remote-Control/Drivers/Joystick/joycon.cpp | UTF-8 | 1,583 | 2.53125 | 3 | [
"MIT"
] | permissive | /*
* joycon.cpp
*
* Created on: 22.02.2019
* Author: Nils
*/
#include "joycon.h"
#include "math.h"
#include "gpio.h"
#include "adc.h"
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
joycon::joycon(ADC_HandleTypeDef* hadc, uint32_t Channel0, uint32_t Channel1,
GPIO_TypeD... | true |
bec658e825e4e1274e9c93dedb63bd0a52aa59be | C++ | mjiricka/gongfu-tea-timer | /helpers/printer/main.cpp | UTF-8 | 820 | 3.09375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <thread>
#include <chrono>
#include <Printer.h>
using std::cout;
using std::endl;
using std::this_thread::sleep_for;
using std::chrono::milliseconds;
int main() {
Printer printer(true);
const milliseconds sleepTime{100};
const int total = 76;
printer.drawPausedProgressB... | true |
56d75b786fd6445298cb4065e357f55616f4b6b0 | C++ | muhammedozkan/CSE241-Object-Oriented-Programming | /HW6/Iterator.h | UTF-8 | 859 | 2.984375 | 3 | [] | no_license | //============================================================================
// Name : Iterator.h
// Author : MuhammedOZKAN 151044084
// Version :
// Copyright : @pithblood
// Description :
//============================================================================
#include <iostream>
#ifndef IT... | true |
589ae5caca6f1fe2360fcc428afc3834a7024bd1 | C++ | MicuEmerson/AlgorithmicProblems | /campion.edu/MutariCAL/main.cpp | UTF-8 | 1,089 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
ifstream fin("saritura_calului1.in");
ofstream fout("saritura_calului1.out");
int i,j,d,l_next,c_next;
int dl[8]= {-2,2,1,2,2,1,-1,-2};
int dc[8]= {1,-1,2,1,-1,-2,-2,-1};
int a[101][101];
int n,m,k=0,li,ci;
void mutariCal(int a[101... | true |
f58199f1a74023b1931c7225f1655c2d88a3fe92 | C++ | Pentagon03/competitive-programming | /project-euler/volume06/296.cc | UTF-8 | 1,011 | 2.96875 | 3 | [] | no_license | #include <bits/stdc++.h>
long dfs(long a, long b, long c, long d, int n) {
long x = a + c, y = b + d, xy = x + y;
if (xy * 5 > n) return 0;
long ret = 0;
for (long t = 3; ; ++t) {
int l = (t * y - 1) / xy, r = std::min(t - 1, n / xy - t);
if (r >= l) ret += r - l;
else break;
}
return ret + dfs... | true |
f6969fe68a5efc06f70a42088df4098072396c90 | C++ | fpusderkis/TP-Final-Taller-I | /Common/ProtocolTranslator/DataDTO/ChellDTO.h | UTF-8 | 1,278 | 2.515625 | 3 | [] | no_license | #ifndef PORTAL_CHELLDTO_H
#define PORTAL_CHELLDTO_H
#include <Common/ProtocolTranslator/ProtocolDTO.h>
class ChellDTO: public ProtocolDTO {
private:
const int16_t _id;
const int16_t _x;
const int16_t _y;
const int16_t _width;
const int16_t _height;
const int16_t _direction;
const int16_t _... | true |
fac636c4473fc6f800dea4f1f5f4211376dff368 | C++ | Yertugan/acm | /stack_queue/regular.cpp | UTF-8 | 287 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main(){
string s;
cin >> s;
vector<char> br;
int cnt = 0;
for(int i = 0; i<s.length(); i++){
if(s[i] == '('){
br.push_back(s[i]);
}else if(!br.empty()){
cnt++;
br.pop_back();
}
}
cout << 2*cnt;
}
| true |
5f9822c1b8f3cb7189ad77e9f39c952b0965563e | C++ | alexander-jones/NCV | /core/reporting/networkupdatemanager.h | UTF-8 | 2,498 | 2.71875 | 3 | [] | no_license | #ifndef NETWORKUPDATEMANAGER_H
#define NETWORKUPDATEMANAGER_H
#include <QObject>
#include <QThread>
#include <QTimer>
#include "qreportclient.h"
#include "core/ncsneuronset.h"
#include "core/ncsconnectionset.h"
/*!
\class NetworkUpdateManager
\author Justin Cardoza
\editor
\brief This class ma... | true |
bfdb992b7efe817f0176d2468135a52f866e60dc | C++ | zhoulike/algorithms | /leetcode/longest-common-prefix.cpp | UTF-8 | 681 | 3.046875 | 3 | [] | no_license | class Solution {
public:
string longestCommonPrefix(vector<string> &strs) {
if(strs.size() == 0)
return string("");
int shortest = strs[0].size();
for(int i = 1; i < strs.size(); ++i)
if(strs[i].size() < shortest)
shortest = strs[i].size();
... | true |
569c7e0c9b5a7583c8e092433c1f026efd038542 | C++ | bughamal/C- | /Cards - 副本/AAAARule.cpp | GB18030 | 4,150 | 2.703125 | 3 | [] | no_license | #include "AAAARule.h"
IMPLEMENT_DYNCREATE(CAAAARule,CRule)
CAAAARule::CAAAARule(void)
{
}
CAAAARule::~CAAAARule(void)
{
}
// ƵĹ
bool CAAAARule::IsGetCardsRule(CCardsRank* pCardsRank, int nlstID, list<Node*>::iterator iteCursorPos)
{
int num = (*iteCursorPos)->pCards->m_nCardsNum;
// ж Dz
while(i... | true |
bf7403b9976ae63dfbba4f93f904ecf0764bce28 | C++ | MuraliMohanRanganath/GameEngine | /Engine/Physics.h | UTF-8 | 1,245 | 2.625 | 3 | [] | no_license | #pragma once
#ifndef PHYSICS_H
#define PHYSICS_H
#include <vector>
#include "Vector.h"
#include "GameObject.h"
#include "SmartPointer.h"
namespace Engine
{
struct PhysicsInfo
{
double mass;
double coefficientOfDrag;
Engine::Vector forces;
SmartPointer<GameObject> object;
};
class Physics
{
public:
... | true |
409172941855060b0e93b5161a557b44e7c6b73f | C++ | zkrami/SuperLibrary | /C++/Algorithms/String/split.cpp | UTF-8 | 479 | 3.640625 | 4 | [
"Apache-2.0"
] | permissive | #include <vector>
#include <string>
/**
* Splits string into vector
*
* @param string str
* @return vector<std::string>
*/
std::vector<std::string> split(std::string str, char delimiter)
{
std::vector<std::string> words;
int i = 0, j = 0;
while (str[i] != '\0') {
if (str[i] == delimiter) {
... | true |
9b25b50d6d8cc1ea2b9fcb07d7ef1bf0da5417c3 | C++ | zm2417/luogu-cpp | /1739.cpp | UTF-8 | 639 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <stack>
using namespace std;
int main()
{
string word;
cin >> word;
stack<char> s;
for (int i = 0; i < word.size(); i++)
{
if (word[i] == '(')
s.push('(');
else if (word[i] == ')')
{
if (s.empty())
{
... | true |
76d599cb93eea3745513ddb83e1c7736c6551793 | C++ | kbaras2020/Lab7_2020_1 | /Lab7_2020_1/Main.cpp | UTF-8 | 1,215 | 3.828125 | 4 | [] | no_license | #include <iostream>
using namespace std;
#include "Fila.h"
int main()
{
Fila f;
Nova(f);
bool w = true;
while (w) {
cout << "\nEscolha uma opcao:\n";
cout << "1) Entra\n";
cout << "2) Sai\n";
cout << "3) Primeiro\n";
cout << "4) Comprimento\n";
cout << "5) Mostra\n";
cout << "0) Terminar\n";
cout... | true |
18fd5bbb819f97ef2d4470570d86bedb1be48481 | C++ | romiltendulkar/GameOfTheAmazonsV2 | /GameOfTheAmazons/GameOfTheAmazons/Solver.cpp | UTF-8 | 214,464 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | //////////////////////////////////////////////////////////////
/**
@file Solver.cpp
@author Romil Tendulkar
@date 12/06/2019
@brief This class will be used to Solve the board
based on the files given. Taking input from one
and writing to another file
*/
//////////////////////////////////////////////////////////////
#... | true |
4d4d699babe8e2966e8420b6bcc45ddacf1e4163 | C++ | AnsBal/fasttp-library | /include/dyntrace/util/flag.hpp | UTF-8 | 1,425 | 3.46875 | 3 | [] | no_license | /**
* Adds flag operators and check for an enum type
*/
#ifndef DYNTRACE_UTIL_FLAG_HPP_
#define DYNTRACE_UTIL_FLAG_HPP_
#include <type_traits>
namespace dyntrace
{
template<typename E>
struct is_flag_enum : std::false_type {};
template<typename E>
constexpr bool is_flag_enum_v = is_flag_enum<E>::va... | true |
afc2bf227f02fc37368ab26267d60aaba03da480 | C++ | boulware/color-c | /src/bitmap.cpp | UTF-8 | 3,394 | 2.90625 | 3 | [] | no_license | #include "bitmap.h"
#include "math.h"
#include "util.h"
#include "sprite.h"
Bitmap
AllocBitmap(u32 width, u32 height)
{
Bitmap bitmap;
bitmap.width = width;
bitmap.height = height;
bitmap.pixels = (BgraPixel*)malloc(sizeof(BgraPixel)*width*height);
return bitmap;
}
void
DeallocBitmap(Bitmap *bitmap)
{
if(bitm... | true |
51c0652e39bbf10572b1929c0b11d761ff241ee4 | C++ | Manvi-tech/Data-Structures | /Queue/queueUsingList.cpp | UTF-8 | 1,076 | 3.8125 | 4 | [] | no_license |
// queue using linked list
#include <bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int x){
this->data = x;
this->next = NULL;
}
};
class queueUsingList{
public:
Node* head;
Node* tail;
int listSize;
queueUsingList(){
this->head=NULL;
... | true |
6c0574ac6c77c8e7d81f33ecb2a13f66ffdfc0f0 | C++ | rpugase/Algorithms_Hillel | /first/first_test.cpp | UTF-8 | 2,521 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "first_lesson.h"
#include <cassert>
using namespace std;
void test_is_prime();
void test_binary_search();
void test_count_n();
void test_count_logn();
void test_sqrt();
void test_reverse_array();
int main() {
test_is_prime();
test_binary_search();
test_count... | true |
6c0674129dd56fae0c38031ccb96785db14d9164 | C++ | ConalTyre/StudentMod | /StudentModule/Lecture.h | UTF-8 | 608 | 2.65625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "Module.h"
#include <vector>
class Lecture
{
private:
std::string id_;
std::string subjectarea_;
std::vector<Module> modules_;
public:
Lecture();
Lecture(std::string name, std::string email, std::string id, std:: string subjectarea, std::vector<Module> m)... | true |
ea143dfaaefbae787f43eb231ac7b1f733e63a6f | C++ | hackboxlive/CP | /SPOJ/POWPOW2.cpp | UTF-8 | 1,241 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
const int LIM = 1e5;
const long long MODD = 1e9 + 7;
int factors[200200];
int f[200200];
void precompute() {
factors[1] = 1;
for(int i = 2; i <= 2 * LIM; i++) {
if(factors[i] == 0) {
for(int j = i; j <= 2 * LIM; j += i) {
if(factors[j] == 0) {
factors[j] ... | true |
02fc9c205051716ccfecc90a4c7b57f512e2cd96 | C++ | theMorning/katas | /binary_search/BinarySearchTest.cpp | UTF-8 | 1,957 | 3.609375 | 4 | [
"MIT"
] | permissive | #include <sstream>
#include <gtest/gtest.h>
#include "binary_search.hpp"
TEST(BinarySearchTest, EmptyArray) {
int sorted_arr[0] = {};
int find = 0;
int found = binary_search(find, sorted_arr, 0);
ASSERT_EQ(found, -1);
}
TEST(BinarySearchTest, ArrayOfOne) {
int sorted_arr[1] = {0};
int find = 0;
int foun... | true |
128e0ac570ef51a5b4b24b3417d5f9d8abef032b | C++ | zalabjir/MergeSort | /Merge_Sort_6.cpp | UTF-8 | 3,525 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <chrono>
using namespace std;
class Sort {
public:
virtual void merge(vector<int> &arr, int l, int m, int p) = 0;
virtual void sort(vector<int> &arr, int l, int p) = 0;
virtual void printArray(vector<int> &arr)... | true |
879b5adabe4ee94b59a776433bc2755efc2a2b6d | C++ | parasbabbar1612/CPP | /linkedlist1.cpp | UTF-8 | 1,042 | 3.875 | 4 | [] | no_license | #include<iostream>
using namespace std;
class node
{
public:
int data;
node* next;
};
node* head = NULL;
node* tail = NULL;
void addnode(int val)
{
node* temp = new node;
temp->data = val;
temp->next = NULL;
if (head == NULL || tail == NULL)
{
head = temp;
tail = temp;
temp = NULL;
}
else
{
tail->n... | true |
5c8580430c8dfc89a1a49873b9c26a600553acfe | C++ | anuragpratap05/pepcoding | /getmzepaths.cpp | UTF-8 | 760 | 2.875 | 3 | [] | no_license | # pepcoding#include<bits/stdc++.h>
using namespace std;
vector<string> getmzepaths(int sr, int sc, int dr, int dc)
{
if (sr == dr and sc == dc)
{
vector<string > bres;
bres.push_back(" ");
return bres;
}
vector<string> hpath;
vector<string> vpath;
if (sc < dc)
hpath = getmzepaths(sr, sc + 1, dr, dc);
... | true |
519def2e35db17ab5ff4ac5f9085aaab8622bfce | C++ | io-io/study-cpp | /pr2/task1.cpp | UTF-8 | 436 | 3.03125 | 3 | [] | no_license | #include <iostream>
const int n=3;
struct cb
{
char name[20];
float weight;
int blablabla;
};
using namespace std;
int main() {
cb wow[n];
for (int i = 0; i < n; ++i)
{
cin >> wow[i].name >> wow[i].weight >> wow[i].blablabla;
cout << endl;
}
for (int i = 0; i < n; ++i)
... | true |
a4d61da52b511266031832d083bd39a00867add2 | C++ | mbruening18/CS172-HW06 | /CS172-HW#06/CS172-HW#06/CircleClass.hpp | UTF-8 | 978 | 3.25 | 3 | [] | no_license | //
// CircleClass.hpp
// CS172-HW#06
//
// Created by Megan Bruening on 11/4/16.
// Copyright © 2016 Megan Bruening. All rights reserved.
//
//
#ifndef CircleClass_hpp
#define CircleClass_hpp
#include <stdio.h>
//EX06_04 – Liang Programming Exercise 14.3: The Circle class
//creates a circle class
class Circle
{... | true |
38fb4b7d06f2f3b1b5eecf14ac82a62d64c14734 | C++ | moAmaan/Assignments | /11_1.cpp | UTF-8 | 1,849 | 4 | 4 | [] | no_license | #include<iostream>
using namespace std;
class Bank
{
string name;
long int accountn;
double balance;
char type;
double new_balance(double amt)
{
balance+=amt;
return balance;
}
public:
void input()
{
cout<<"enter name of depositer";
cin... | true |
1af8ddec477b4822478325ae1294a5f0edc638d6 | C++ | toby0zmy/NoahGameFrame | /NFComm/NFKernelPlugin/g3dlite/Include/RegistryUtil.h | UTF-8 | 2,661 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | /**
@file RegistryUtil.h
@created 2006-04-06
@edited 2006-04-06
Copyright 2000-2006, Morgan McGuire.
All rights reserved.
*/
#ifndef G3D_REGISTRYUTIL_H
#define G3D_REGISTRYUTIL_H
#include "platform.h"
#include "g3dmath.h"
// This file is only used on Windows
#ifdef G3D_WIN32
#include <str... | true |
8b43e7b20c1d66805c2cbe216c91be3b8861d5f8 | C++ | SineadOSullivan/gazebo | /Project/behavior/avoidBoundary.cpp | UTF-8 | 2,671 | 2.828125 | 3 | [] | no_license | #include "avoidBoundary.h"
using namespace gazebo;
using namespace std;
AvoidBoundary::AvoidBoundary()
: Behavior(1.0d)
{
}
AvoidBoundary::AvoidBoundary(double kBoundary)
: Behavior(kBoundary)
{
}
math::Vector3 AvoidBoundary::avoidBoundarySubsumption(math::Vector2d minimum, math::Vector2d maximum, math::Vec... | true |
9a10fcb34564cfb7bad8e03cce08c7dec4084458 | C++ | sibivel/nrc-sumo-2018 | /move_forward/move_forward.ino | UTF-8 | 3,243 | 2.828125 | 3 | [] | no_license | //TODO: Integrate Gyro
//TODO: STATES!!!!!
// probably need to do something that puts the robot into a state where it will get back to the point that it can move normally before allowing any other movements except for those of higher priority
#define RS A9 // Right Sensor (looking at it from the front with wires g... | true |
cd518e70ea98544b00eed949748132f745dcbf24 | C++ | itsabhijeet/Leetcode-ChallengeSols | /Odd Even Linked List.cpp | UTF-8 | 1,346 | 3.390625 | 3 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* oddEvenList... | true |
771449a758275fb0be2b11b44572a549b6d6233e | C++ | shanesteer/Word-Calculator | /BarChart.h | UTF-8 | 384 | 2.828125 | 3 | [] | no_license | #ifndef BARCHART_H
#define BARCHART_H
using namespace std;
#include <string>
#include <vector>
class BarChart
{
public:
BarChart(vector<string> wordHolding, vector<int> arrayOfWords, float myTotalSize);
void createBarChart();
void printBarChart();
private:
vector<string> wordHolding;
vec... | true |
85ec162ff61e27d18e19c56c9ea57e22d3202942 | C++ | AHelper/llvm-z80-target | /lib/Support/ErrorHandling.cpp | UTF-8 | 2,515 | 2.546875 | 3 | [
"NCSA",
"Spencer-94",
"BSD-3-Clause"
] | permissive | //===- lib/Support/ErrorHandling.cpp - Callbacks for errors ---------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | true |
31ae55cdf73e5157a3e16c33134e41b3d768c19d | C++ | rpgki/Pry1 | /LstAdy.h | UTF-8 | 2,334 | 3.25 | 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: LstAdy.h
* Author: Carlos
*
* Created on 6 de septiembre de 2016, 11:05 PM
*/
#ifndef LSTORDADY_H
#d... | true |
a28bab576de71347e04760aeed7dee71ead9118f | C++ | moevm/oop | /8304/Ryzhickov Alexander/Ryzhickov_Alex_lr7/MyGame/Gamer/Gamer.cpp | UTF-8 | 7,594 | 2.765625 | 3 | [] | no_license | //
// Created by Alex on 01.05.2020.
//
#include <iostream>
#include "Gamer.h"
#include "../Exceptions/UpdateUnitPositionExeption/CellNotFreeException.h"
using namespace Logging;
using namespace MyGameException;
namespace MyGame {
Gamer::Gamer(Field *field, Logger *logger, int xPositionBase, int yPositionBase, G... | true |
a51b3c9e01d27acaa63738c7bc32247a74dc3e19 | C++ | StevensDeptECE/CPE390 | /old/2021S/02c++fundamentals/02loops.cc | UTF-8 | 848 | 3.5 | 4 | [] | no_license | #include <iostream>
namespace stevens {
int x; // global variables are initialized to zero by default
};
// 1 + 2 + 3 + 4 + .... + 100
// 100 + 99 + 98 + ... + 1
// n(n+1)/2
void f() {
int xxx =2;
int yyy =2;
int sum; // not variables on the stack (in a function!)
// i are a good programmer
for (int i ... | true |
423b6a41056fade893f3e8f4f0f62c43ea823452 | C++ | apopovicius/pg | /cpp/small_stuff/naive.cpp | UTF-8 | 891 | 3.421875 | 3 | [] | no_license | #include <iostream>
class Animal {
public:
virtual void speak() = 0;
};
class Cat: public Animal {
CatSpeakBehaviour behaviour = new CatSpeakBehaviour();
public void speak() ovveride{
std::cout << behavior.Speak();
}
};
class Dog: public Animal {
DogSpeakBehaviour behaviour = n... | true |
b17bf23405087012a4c2c61c272aab48f8c0d9b7 | C++ | tejasborkar74/Recursion-codes | /Sort an array using recursion.cpp | UTF-8 | 887 | 3.015625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
// Sort array using Recursion
void shiftarray(vector<int> &arr,int idx,int last)
{
int temp = arr[last];
for(i... | true |
62a646e9a9f3ebf6712baec63f6c153f3b13fb15 | C++ | Al7ech/ProblemSolving | /algospot/src/canadatrip.cpp | UTF-8 | 1,108 | 2.90625 | 3 | [] | no_license | #include <stdio.h>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <string.h>
#include <iostream>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;
typedef struct City
{
int L,M,G;
}city;
int T;
int N,K;
vector<city> D;
ll count(int x)
{
ll ret... | true |
9501dd3edf2d288cf2f8f9aa0a0551ecec0881b8 | C++ | Alfeim/njuee_LeetCode_Solutions | /Cpp/Submit Records/705. Design HashSet.cpp | UTF-8 | 952 | 3.46875 | 3 | [] | no_license | /********************************************
作者:Alfeim
题目:设计哈希集合
时间消耗:128ms
解题思路:最直接的散列表的生成方式,即哈希函数为 键值%(大于最大值的最接近的一个素数)
********************************************/
class MyHashSet {
public:
/** Initialize your data structure here. */
MyHashSet():hash_container(1000007,0){
}
void add(in... | true |
10d9374ca7b6f73af2077e81de437a5c2a891dbd | C++ | ancutahij/CarStore | /CarStore/RepositoryTests.cpp | UTF-8 | 1,773 | 3.28125 | 3 | [] | no_license | #include"Tests.h"
void Test::addTests()
{
Repository repo;
Car car1{ "223","Toyota","x345", "family" };
Car car2{ "245", "Audi", "24", "trip" };
assert(repo.getSize() == 0);
repo.addNewElement(car1);
assert(repo.getSize() == 1);
repo.addNewElement(car2);
assert(repo.getSize() == 2);
bool exceptionThrown = ... | true |
75d711b1fb3ba0cca289f2113f279c3e08851de1 | C++ | csalles/maratona | /1489_old.cpp | UTF-8 | 4,397 | 2.8125 | 3 | [] | no_license | #include <vector>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
using namespace std;
const int INF = 1000000;
struct Edge {
int u, v, w;
Edge(int u, int v, int w) : u(u), v(v), w(w) {}
// order edges by weight
bool operator <(const Edge& x) const {
return w < x.w;
... | true |
3939ec2c96a1b72520017fbb695b657ffacca568 | C++ | Karmiska/Darkness | /darkness-shared/include/ecs/ComponentData.h | UTF-8 | 1,799 | 2.921875 | 3 | [] | no_license | #pragma once
#include "containers/vector.h"
#include "ComponentTypeStorage.h"
#include "Entity.h"
#include <stack>
namespace ecs
{
constexpr size_t PreferredChunkSizeBytes = 16 * 1024;
class Chunk
{
public:
Chunk(ComponentArcheTypeId archeType)
: m_used{ 0 }
{
... | true |
31e380252d6bfb5908ebbecb393d5475f2d38934 | C++ | annie-anna/ve280-codes | /project2/p2.cpp | UTF-8 | 7,946 | 3.4375 | 3 | [] | no_license | #include<iostream>
#include<cstdlib>
#include "p2.h"
using namespace std;
static bool odd(int num);
// EFFECTS: Returns true is num is odd, returns false otherwise.
static list_t unique_helper(list_t list);
// EFFECTS: Returns a new list comprising of each unique element
// in "list". The order is determine... | true |
51d5a32165be2799c1cea4e6f4d4db473e355df9 | C++ | Cemetry/Problem_Solving | /Newton_Interpolation/main.cpp | UTF-8 | 795 | 3.21875 | 3 | [] | no_license | /*
**Author:Tanim Ahmed Bijoy
Kuet,khulna,Bangladesh
***Newton_interpolation.cpp
**/
#include<iostream>
using namespace std;
int main()
{
int n,n1,i,j;
float x[100],f[100],point,sum=0,mult;
cout<<"Enter the number of data?"<<endl;
cin>>n;
cout<<"Enter the corresponding value of x and ... | true |
282c0a9d2ad1120581244a22010ff025e73b5310 | C++ | BrianSzuter/CppFundamentals | /ArrayAndStringManipTests/TimeConversionTests.cpp | UTF-8 | 2,390 | 3.09375 | 3 | [] | no_license | #include "stdafx.h"
#include "CppUnitTest.h"
#include "TimeConversion.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace std;
using namespace ArrayAndStringManip;
namespace ArrayAndStringManipTests
{
TEST_CLASS(TimeConversionTests)
{
public:
TEST_METHOD(ToMilitaryTime_12AM)
{
... | true |
42355b4099e55522428f7b594acbaf9f4db72069 | C++ | enneking/raptor_engine | /slot.inl | UTF-8 | 802 | 2.765625 | 3 | [] | no_license |
template<class TListener, class ... FuncArgs>
Slot<TListener, FuncArgs...>::Slot(TListener* const obj, void(TListener::* const func)(FuncArgs...)) : obj_(obj), func_(func)
{
}
template<class TListener, class ... FuncArgs>
void Slot<TListener, FuncArgs...>::Process(FuncArgs... args)
{
(obj_->*func_)(args...);
}
tem... | true |
5c1226910cadc14d279273ca34ea193f2427e2fe | C++ | mineawesomeman/JankMonopoly | /src/Board.cpp | UTF-8 | 2,404 | 2.796875 | 3 | [] | no_license | /*
* Board.cpp
*
* Created on: Mar 18, 2021
* Author: daraw
*/
#include "Board.h"
#include <iostream>
#include "Definitions.h"
Board::Board() {
// TODO Auto-generated constructor stub
spacesP = (Space**)malloc(sizeof(Space*) * 32);
*(spacesP+0) = new Space(GO,0,(char*)"GO");
*(spacesP+... | true |
8d3072ba3a0537456a060fce4a403b2144a70d4b | C++ | halfclear/easynet | /test/SignalHandlerMgr.ut.cpp | UTF-8 | 8,084 | 2.6875 | 3 | [
"BSD-2-Clause"
] | permissive | #include <signal.h>
#include <sys/types.h>
#include <string.h>
#include <cstring>
#include <string>
#include <iostream>
#include "utils/TimeUtil.h"
#include <test_harness.h>
#include <thread>
#include <chrono>
#include <future>
#include <sys/wait.h>
#include "EventLoop.h"
#include "SignalHandler.h"
#i... | true |
56c4958d5ded0e122448820529462e7054445f79 | C++ | Cosmos547/rts_moving_simulation | /SceneTexture.cpp | UTF-8 | 458 | 2.640625 | 3 | [] | no_license | #include <SFML/Graphics.hpp>
#include <iostream>
#include "SceneTexture.h"
SceneTexture::SceneTexture(float xpos, float ypos, float xsize, float ysize, std::string textureName) : SceneObject(xpos, ypos, xsize, ysize) {
t.loadFromFile(textureName);
rect = sf::RectangleShape(sf::Vector2f(xsize, ysize));
rect... | true |
528bd1ad3977d9f7b3b14d7ada97a1a491368d34 | C++ | perandersson/attributes | /attributes/MutableClass.cpp | UTF-8 | 8,243 | 2.6875 | 3 | [] | no_license | #include "MutableClass.h"
#include "MutableMethod.h"
#include "MutableAttribute.h"
#include "MutableClassLoader.h"
#include "MethodPostProcessor.h"
#include "ClassPostProcessor.h"
#include <algorithm>
#include <set>
static const string GetProcessorName(const string& className) {
return string("PostProcessor<" + class... | true |
ceb4679f2212bcb7b5b779efb78071dc24a78a2e | C++ | rishabhSharmaOfficial/CompetitiveProgramming | /MustDo_GeeksForGeeks/Arrays/inversion-of-array.cpp | UTF-8 | 1,633 | 3.40625 | 3 | [] | no_license | /*
Count inversions of array
pairs such that
a[i] > a[j] and i < j
*/
/*
Approach 1 - Check every pair O(n^2)
Approach 2 - Use Merge Sort O(nlogn)
Merge sort's merge step gives us two sorted arrays left half and right half
example -
12345 134
if L[i] > R[j]
then all pairs -> (i,j) (i+1,j) (i+2,j) ... (n1-1,... | true |
4a952de2daebdfded91094290ab09737be16a19f | C++ | jgrugru/arduino_projects | /ultrasonic_accuracy_test/ultrasonic_accuracy_test.ino | UTF-8 | 726 | 3.09375 | 3 | [] | no_license |
//specify pins for communicating with the sensor
byte trig_pin = 10;
byte echo_pin = 9;
//list all function headers
void sendPulse();
double calculateDistance(double);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(trig_pin, OUTPUT);
pinMode(echo_pin, INPUT);
}
void lo... | true |
d1fb04b752b2840345d4572ce4b76e17e05b0c46 | C++ | zhanrui/apollo | /bmjcui/src/state/common/checktaskgroup.cpp | UTF-8 | 2,866 | 2.5625 | 3 | [] | no_license | #include "checktaskgroup.h"
#include "checktask.h"
#include <QList>
CheckTaskGroup::CheckTaskGroup(QObject* parent,const QString& scenename, const int weight, const QList<CheckTask*> & tasks)
: QObject(parent)
{
this->enabled = true;
this->weight = weight;
this->scenename = scenename;
this->start ... | true |
9def292c6f8479bad39eb7dfd4f3897b83e0cb1b | C++ | BilalAli181999/Programming-Fundamentals-in-C_Plus_Plus | /Call charges/Call charges/Source.cpp | UTF-8 | 1,740 | 3.09375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
float startingTime, noMinutes;
cout << "Enter starting time";
cin >> startingTime;
cout << "Enter no of Minutes";
cin >> noMinutes;
float totalTime;
totalTime = startingTime +( noMinutes/60);
int a,b;
int minutes = totalTime - (int)totalTime;
if (minutes > ... | true |
0db180cd9c798dd4452e77ba20280a37307bb152 | C++ | LeeDoona/Algorithm | /Sudoku/main.cpp | UTF-8 | 626 | 2.71875 | 3 | [] | no_license | #include "sudoku.h"
#pragma warning(disable:4996)
#pragma warning(disable:4101) //didn't use variable
int main()
{
int i, j, k;
int testNum;
FILE *inFile = fopen("input.txt", "r");
fscanf(inFile, "%d", &testNum);
try
{
if(inFile == NULL) throw InputFileError;
}catch(int InputFileError) {
printf("input f... | true |