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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c129eb610f173a272881d27d7ac42430dcfe5f7c | C++ | hnlylmlzh/cs | /EncapsulateInterfaceInherit/11_1/1.cpp | GB18030 | 553 | 2.921875 | 3 | [] | no_license | #include "A.h"
int main()
{
A* pa = new A();
pa->f();
B* pb = (B*)pa;
// е˼ģォpaתΪָB͵ָ벻٣ûиµֵ
// ָǿ飬new A()зصڴзA͵һĵַ@.@~.Ǻ½
// ָB͵ָpb,ΪpaһҲָnewǸġ
pb->f();
delete pa, pb;
pa = new B();
pa->f();
pb = (B*)pa;
pb->f();
return 0;
} | true |
95675b076478f24b5d2e9bfd1632da765471cec5 | C++ | Miao4382/Starting-Out-with-Cplusplus | /Chapter 5/Programming Exercise/5.cpp | UTF-8 | 584 | 3.171875 | 3 | [] | no_license | //5. Membership Fees Increase
#include<fstream>
#include<iostream>
#include<iomanip>
int main()
{
double charge=2500;
const double RATE = 1.04;
std::ofstream cout;
cout.open("D:\\5.txt");
cout << "Year" << std::setw(15) << "Charge" << std::endl;
cout << "--------------------\n";
cout << std::setw(2) << "0" << ... | true |
3f652bb9b7cbf7d125cdf95a8e98dab54627f2ca | C++ | jjchromik/hilti-104-total | /hilti/passes/id-resolver.h | UTF-8 | 1,144 | 2.953125 | 3 | [
"BSD-2-Clause"
] | permissive |
#ifndef HILTI_ID_RESOLVER_H
#define HILTI_ID_RESOLVER_H
#include "../pass.h"
namespace hilti {
namespace passes {
/// Resolves ID references. It replaces nodes of type ID with the node that
/// it's referencing.
class IdResolver : public Pass<> {
public:
IdResolver() : Pass<>("hilti::IdResolver", true)
{
... | true |
fb0592ec7a4103094545842ab5793a96be3cd1e6 | C++ | CalebJohnstone/COS214-Software-Modelling | /1/Predator.h | UTF-8 | 1,300 | 2.984375 | 3 | [] | no_license | #ifndef Predator_H
#define Predator_H
#include <iostream>
#include <string>
#include "PredatorState.h"
#include "PredatorMemento.h"
#include "Prey.h"
using namespace std;
class Predator {
public:
//constructor and destructor
Predator(int healthPoints, string huntingMethod, int damage, string spe... | true |
66642a48333c37d4660a5ab53e39813731a7072d | C++ | prateek200/Data-Structures-and-Algorithm | /Linked List 2/Swap two Nodes of LL.cpp | UTF-8 | 742 | 3.53125 | 4 | [] | no_license | /****************************************************************
Following is the class structure of the Node class:
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
... | true |
798e7e0ea44d202bf1bc638ca917dbbd22f74634 | C++ | Warzecha/Cpp-course | /lab5/textpool/TextPool.cpp | UTF-8 | 1,339 | 2.953125 | 3 | [] | no_license | //
// Created by torzmich on 27.03.18.
//
#include "TextPool.h"
namespace pool
{
TextPool::TextPool() {
}
size_t TextPool::StoredStringCount() const {
return set.size();
}
TextPool::~TextPool() {
set.clear();
}
std::experimental::string_view TextPool::Intern(const s... | true |
2cf5522c214de01971792c17adf7c336c1cbf22c | C++ | ffeng271/recoded | /src/zzScenes/zzCloudyScene/emoji.cpp | UTF-8 | 950 | 2.53125 | 3 | [
"MIT"
] | permissive | //
// emoji.cpp
// cloudZZRecode1
//
// Created by Ann Kidder on 11/13/17.
//
//
#include "emoji.hpp"
Emoji::Emoji(){
}
void Emoji::setup(int x, int y, ofImage * icon){
x_start = x;
img = icon;
emojiSpeed = 1;
emojiSize = 1; //img->getWidth();
y_val = y;
creation_time = ofGetElapsedTimef()... | true |
7d92e0704d2681fe1a93f5bf4ab06ce0424a7e1a | C++ | 1plus1equals2/practise | /src/accelerated_cpp/chapter03/output_format.cpp | GB18030 | 1,500 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <ios>
#include <iomanip>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::string;
using std::streamsize;
using std::setw;
/*
setfill(c) ַΪc
setprecision(n) ʾСΪnλ
setw(n) Ϊnַ
setioflags(ios::fixed) ̶ĸʾ
setioflags(ios::scientific) ָ... | true |
f919440606f47a87dd5626879a86e6e9f208c52f | C++ | djeemie2000/MidiPlayground | /DueSerialReadTest/DueSerialReadTest.ino | UTF-8 | 621 | 2.734375 | 3 | [] | no_license | void setup() {
// put your setup code here, to run once:
const int OutBaudRate = 115200;
Serial.begin(115200);
Serial.println("Listening...");
const int InBaudRate = 31250;//19200;//9600;
Serial3.begin(InBaudRate);
}
void loop() {
// put your main code here, to run repeatedly:
int Cntr = 0;
while(tru... | true |
87a4e680849311c177dc6d64569ee6525de1c675 | C++ | itay-rafee/cpp_snowman_b | /MyMain.cpp | UTF-8 | 1,419 | 3.078125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <stdexcept>
#include <math.h>
#include <thread>
#include <chrono>
#include "snowman.hpp"
using namespace std;
// using namespace ariel;
int build_snowman()
{
int ans = 0;
int len = 8;
for (size_t i = 0; i < len; i++)
{
ans = ans + pow(10, i) * (rand() % 4 + 1);
... | true |
8dbbbef42ae8d0c7995b27c6fa754ab879e0ffae | C++ | JasperStas/THO78-Roborescue | /Kjeld_Perquin/QT_Map_Test/map.cpp | UTF-8 | 1,253 | 3.40625 | 3 | [] | no_license | #include "map.h"
#include <iostream>
Map::Map():
nrOfRows(0),
nrOfColumns(0)
{
}
Map::Map(int rows, int columns):
nrOfRows(rows),
nrOfColumns(columns)
{
for(int i = 0; i < nrOfRows * nrOfColumns; i++)
{
tiles.push_back(new Tile);
}
}
Tile* Map::getTile(int row, ... | true |
3ee01f7e2697f98837de5d2e05670b6bff3c72e3 | C++ | burybury/traffic_counter_old_vs | /Sunbeam Alpine/src/road/RoadDetector.cpp | UTF-8 | 4,737 | 2.515625 | 3 | [] | no_license | #include <road\RoadDetector.h>
#include <helper\Multiplex.h>
#include <iostream>
#include <opencv2\calib3d.hpp>
#include <opencv2\imgproc.hpp>
#include <opencv2\core.hpp>
#include <tuple>
using namespace cv;
using namespace std;
cv::Mat RoadDetector::largest_contour_mask(const cv::Mat& src)
{
double area{ 0 }, larges... | true |
2adb399b7645c8963f0c75565969ed891f928f9a | C++ | BlitzZart/CuteLilWebserver | /CuteLilWebserver/CuteLilWebserver/CLWS.h | UTF-8 | 3,867 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <atomic>
#include <map>
#include "ClientConnection.h"
#pragma comment(lib, "Ws2_32.lib")
#define DEFAULT_PORT "27015"
std::map<ClientConnection*, ClientConnection> connections;
int error = 0;
SOCKET initServer() {
WSADATA wsaData;
int iResult;
// Initialize Winsoc... | true |
7b4274f0debc905d9f6768f067b1fd462ee573e7 | C++ | Shivamj075/CodeForBetter | /ArithmeticSlices.cpp | UTF-8 | 1,058 | 2.90625 | 3 | [] | no_license | //LeetCode
class Solution {
public:
int numberOfArithmeticSlices(vector<int>& A) {
if(A.size()<3)
return 0;
int i=0,j=1,k=2,len=2,ans=0;
while(k<A.size()){
if(A[k]-A[k-1]==A[j]-A[i]){
len++;
k++;
continue;
}
... | true |
7a339d803ff831e0dd42d3bfc962ef4cf2e3a3bc | C++ | PranavRayudu/Advent-of-Code-2020 | /day21_1.cpp | UTF-8 | 3,182 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <sstream>
#include <algorithm>
// https://adventofcode.com/2020/day/21
using namespace std;
// trim from start (in place)
static inline void ltrim(string &s) {
s.erase(s.begin(), find_if(s.begin(), s.end(), [](unsigned char ch) {
... | true |
b01d8dea01dce06abdc2decf64eb90b6f0c06e8b | C++ | hashinisenaratne/SIFEB | /Module Codes/Prototype - Techno/Sonar/Sonar.ino | UTF-8 | 1,880 | 3.140625 | 3 | [] | no_license | #include <Wire.h>
#include <NewPing.h>
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is r... | true |
7bd19c98884824758154fc9d44c9ae0722f76c6e | C++ | hiliuyin/LeetCodeOJ | /Algorithms/137.SingleNumberII.cpp | UTF-8 | 1,472 | 3.71875 | 4 | [] | no_license | /*
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
*/
// Solution 1: O(N) solution
int singleNumber(std::vector<int>& nums)
{
std::map<int, int> m;
... | true |
c2ee1f0d832991225b38b0a0073c2aa14b832fd9 | C++ | HighPerMeshes/highpermeshes-dsl | /include/HighPerMeshes/dsl/loop_types/free_loops/ForEachEntity.hpp | UTF-8 | 1,203 | 2.75 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2017-2020
//
// Distributed under the MIT Software License
// (See accompanying file LICENSE)
#ifndef DSL_LOOPTYPES_FREELOOPS_FOREACHENTITY_HPP
#define DSL_LOOPTYPES_FREELOOPS_FOREACHENTITY_HPP
#include <utility>
#include <HighPerMeshes/dsl/meshes/Range.hpp>
namespace HPM
{
//!
//! ForEachE... | true |
72237cf96c1310d85c7dc44886dd5c2043e4d6d8 | C++ | adrianrocamora/kng | /cpp/unordered_multimap/unordered_multimap_empty.cpp | UTF-8 | 357 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <unordered_map>
int main()
{
std::unordered_multimap<int,int> first;
std::unordered_multimap<int,int> second = {{1,10},{2,20},{1,15}};;
std::cout << "first " << (first.empty() ? "is empty" : "is not empty" ) << std::endl;
std::cout << "second " << (second.empty() ? "is empty" : "is not... | true |
6f084e88cfea68d4c7dc80bbfb5af5826b5ba6a5 | C++ | colehawkins3/Unit6_Hawkins_Task_4 | /main.cpp | UTF-8 | 538 | 3.109375 | 3 | [] | no_license | //Stephen Hawkins 2/20/19
//Unit 6 Assignment - Sorting
#include <iostream>
#include "accounts.h"
#include <algorithm>
using namespace std;
void printArray(int[], int);
int main()
{
cout << "\nStart: " << cpuTime() << endl;
sort(accountBalances, accountBalances+maxAccounts);
printArray(accountBalances, maxAcc... | true |
51b8fb650e64591729aaa228fed44f90442db75a | C++ | Kochise/3dglrtvr | /Software rasterizer/Luke Thatcher/3DRasterizer/src/Intro3D/DepthBuffer.cpp | UTF-8 | 1,645 | 3.1875 | 3 | [] | no_license |
#include "stdafx.h"
#include "DepthBuffer.h"
#include <math.h>
DepthBuffer::DepthBuffer(UINT width, UINT height)
{
this->width = width;
this->height = height;
this->size = this->width * this->height;
this->data = new float[this->size];
this->dims = Vector2((float)(this->width - 1), (float)(this->heigh... | true |
bcfb72242dc20c765a139e4d0ae27e720058b33d | C++ | AlanWills/Celeste | /Celeste/Source/Resources/3D/Model.cpp | UTF-8 | 6,240 | 2.6875 | 3 | [] | no_license | #include "Resources/3D/Model.h"
#include "SOIL2/SOIL2.h"
namespace Celeste::Resources
{
//------------------------------------------------------------------------------------------------
Model::Model() :
m_meshes()
{
}
//----------------------------------------------------------------------------------... | true |
5f66fd480ff9c52307edecf720ce638982c8776f | C++ | RomanCrm/RPG | /ConsoleApplication84/ConsoleApplication84/MOBS.h | WINDOWS-1251 | 982 | 2.515625 | 3 | [] | no_license | #pragma once
#include "stdafx.h"
class MOBS
{
public:
std::string Name; //
int HealthPoint; //
int Damage; //
int Armor; //
int ExpFromMob; // ,
int NextLvlHp; // , .
int NextLvlArmor; // , .
int NextLvlExp; // , .
int NextLvlDamage; // , .
void RandNextLvl1MobsStats(); // ... | true |
64a4252c603f6a079f2bb4a3b5989979a91b4219 | C++ | zhouzilong2020/Design_Pattern_Class_Design_2020 | /State_Factory_Template_Builder_Prototype/Component/IComponent.h | UTF-8 | 963 | 3.015625 | 3 | [] | no_license | #ifndef I_COMPONENT
#define I_COMPONENT
#include "config/ComponentType.h"
/**
* Interface
* 场馆内部件的接口,实现了prototype
*/
namespace facility {
class IComponent {
protected:
/// 部件的种类
ComponentType _componentType;
/// 部件的id
int _id;
/**
* 部件的构造函数
* @pa... | true |
cf68dba3302e9a891bddf4286b981dcf94c4697f | C++ | zhiayang/mx | /source/Loader/Memory/PhysMM.cpp | UTF-8 | 5,042 | 2.5625 | 3 | [] | no_license | // PhysMM.c
// Copyright (c) 2011-2013, <zhiayang@gmail.com>
// Licensed under Creative Commons Attribution 3.0 Unported.
// Implements functions to allocate physical memory.
#include "../FxLoader.hpp"
namespace Memory
{
static FPL_t* CurrentFPL;
static uint32_t FPLBottomIndex;
static uint32_t NumberOfFPLPair... | true |
c5608a466bef0e1066697b57312de554942cb150 | C++ | flaming-snowman/pps | /2020-2021/summer-contest-2/Factor/factor.cpp | UTF-8 | 391 | 2.546875 | 3 | [] | no_license | // Submission by Alex Proshkin
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
double end = n;
while (n % 2 == 0) {
n /= 2;
cout << 2 << ' ';
}
for (int i = 3; i <= sqrt(n); i+=2) {
while (n % i == 0) {
n /= i;
... | true |
51294885739ad8970415017b2d340546e0a0d4a0 | C++ | chuzui/courses | /cs106x/assign-2-adts/maze-generator/src/maze-generator.cpp | UTF-8 | 3,028 | 3.3125 | 3 | [] | no_license | /**
* File: maze-generator.cpp
* ------------------------
* Presents an adaptation of Kruskal's algorithm to generate mazes.
*/
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
#include "console.h"
#include "simpio.h"
#include "maze-graphics.h"
#include... | true |
bc5c4111f6ba51b1b9f70d40be49cc9b23fbe5d3 | C++ | abdulkarim723/Hotel-Reservation-System | /include/Date.hpp | UTF-8 | 657 | 2.921875 | 3 | [
"MIT"
] | permissive | #ifndef Date_HPP
#define Date_HPP
#include "HotelException.hpp"
#include <iostream>
#include <regex>
const std::regex date_expr("^\\s*[0-9]{2}\\s*.\\s*[0-9]{2}\\s*.\\s*(19|20)[0-9]{2}\\s*$");
class Date {
private:
std::string day_;
std::string month_;
std::string year_;
static const int... | true |
98aa012858d111b525184052ed2b46677291cf1b | C++ | Catanova/C-plus-plus | /C++/4_counter_and_whileLoop.cpp | UTF-8 | 430 | 3.25 | 3 | [] | no_license | # include <iostream>
using namespace std;
int main ()
{
float a, b;
cout << "enter a value: ";
cin >> a;
int count =0;
//while(a >0 && a < 10) // while accept only range number.
while(0<a<10 && a !=-9)
// while (a !=-9) -9 is our sentinel value
{
cout << "enter a value: ";
cin >> a;
... | true |
e4d19a8e43d554e93a190242f0e17f7368e29b0b | C++ | jacocal/software | /examen/primerParcial/Iterator.hpp | UTF-8 | 754 | 3.03125 | 3 | [] | no_license | #include "Aggregate.hpp"
#pragma once
template <class T>
class Iterator {
//friend class Aggregate;
protected:
int indx;
Iterator(){}
Aggregate<T>* lista;
public:
Iterator(const Aggregate<T>& lista) : indx(0)
{
this->lista = lista;
... | true |
34e5ba474e66c662fc345fea643132390be7a89b | C++ | Tovermodus/monte_carlo_methods | /MikadoMonteCarlo/Medium.cpp | UTF-8 | 10,238 | 3 | 3 | [] | no_license | //
// Created by tovermodus on 12/2/20.
//
#include <sstream>
#include "Medium.h"
Medium::Medium(const MediumParameters ¶ms, std::mt19937 &rng) : parameters(params)
{
initialize_cells();
initialize_rods(rng);
if (cells[0]->get_height() < params.rod_length || cells[0]->get_height() < params.rod_length)
throw ... | true |
1f0312acf36f95c8628b52c909fd9dec46b899e4 | C++ | alexandraback/datacollection | /solutions_5709773144064000_1/C++/lunae/B.cpp | UTF-8 | 420 | 2.671875 | 3 | [] | no_license | #include <cstdio>
#include <vector>
using namespace std;
int main() {
int T;
scanf("%d",&T);
for (int tc=1; tc<=T; tc++) {
double C, F, X;
scanf("%lf%lf%lf", &C, &F, &X);
double answer = X / 2.0;
double speed = 2.0;
double t = 0;
while (t < answer) {
double t2 = t + C / speed;
answer = min(answer, ... | true |
fbee95062c61a88e0a427e64cbf7d426241f6ffa | C++ | zizaimengzhongyue/cpp | /demo/interface.cpp | UTF-8 | 516 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Car {
public:
virtual double getPrice() = 0;
};
class Benze : public Car {
public:
double getPrice() { return 300000; }
};
class Audi : public Car {
public:
double getPrice() { return 200000; }
};
int main()
{
vector<Car*> cs;
Ben... | true |
e80516f2e3e7201b477e5ce60add279441dc48d3 | C++ | njoy/constants | /src/constants/map.hpp | UTF-8 | 796 | 2.984375 | 3 | [
"BSD-2-Clause"
] | permissive | template< typename Value, typename Uncertainty >
struct Map_t{
Value value;
Uncertainty uncertainty;
constexpr Map_t( Value v, Uncertainty u ):
value( v ),
uncertainty( u )
{ }
template <typename Key>
constexpr decltype(auto) operator[](Key&& key) & {
return static_cast<Value&>(value)[
... | true |
2e6988b46bd9d1d688bd0662870dd1d02c342631 | C++ | lucabecci/cpp_programming | /basics/loops/do_while.cpp | UTF-8 | 242 | 3.296875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
float pi = 3.14;
do
{
cout << "The short value of PI is: ";
cout << pi << endl;
}
while(pi == 3.14);
cout << "Closing the program..." << endl;
} | true |
3affa9900101bc575064aa5c59bc1a30952a20fa | C++ | alexandraback/datacollection | /solutions_5769900270288896_0/C++/slitvinov/B.cpp | UTF-8 | 1,526 | 2.578125 | 3 | [] | no_license | #include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
// q.push(el);
// q.front(); q.pop();
#include <sstream>
// ostringstream buf;
#include <cstdio>
// sscanf(time.c_str(), "%d:... | true |
79899feb49b19b4e6fc5e3966b45958c519a312e | C++ | wcfulton2/Advanced-Cpp | /Seminar 1 Programming Exercise 2/Seminar 1 Programming Exercise 2/Programming Assignment 2.cpp | UTF-8 | 5,328 | 3.6875 | 4 | [] | no_license | //Program Name: Student Test Grader
//Description: Grade student tests from data in a file using dynamic arrays
//Developer: Bill Fulton of Baker College
//Date: 21 February 2017 - Winter
#include <string>
#include <iostream>
#include <fstream>
#include <regex>
using namespace std;
//function prototypes
void gradeTe... | true |
0d43862a629ae05609e6908a15c5af58cba25942 | C++ | nopesir/pds-project | /server/SymStyle.cpp | UTF-8 | 1,597 | 3.109375 | 3 | [] | no_license | //
// Created by gheb on 31/07/20.
//
#include "SymStyle.h"
SymStyle::SymStyle()
: is_bold(false), is_italic(false), is_underlined(false), font_family(DEFAULT_FONT_FAMILY), font_sz(DEFAULT_FONT_SIZE),
alignment(DEFAULT_ALIGNMENT), color(DEFAULT_COLOR) {}
SymStyle::SymStyle(bool isBold, bool isItal... | true |
1b465a25f77017054ad2a86b50fa55040984a642 | C++ | siewkee/Data-Processing-Program | /src/Shared_Functions.cpp | UTF-8 | 13,595 | 3.328125 | 3 | [] | no_license | #include "A03_Header.h"
#include "MyTemplates.h"
vector<Point2D> Points_2D;
vector<Line2D> Lines_2D;
vector<Point3D> Points_3D;
vector<Line3D> Lines_3D;
void display_menu(string filtering_c, string sorting_c, string sorting_or)
{
cout << "\nStudent ID : 5986606" << endl;
cout << "Student Name : Hung Sie... | true |
a4863d38dd1f05b61b11349c4fd1bc6d8e7b16ae | C++ | LorenzoLeonardini/competitive | /UVa/102 - Ecological Bin Packing/102.cpp | UTF-8 | 1,619 | 2.96875 | 3 | [] | no_license | /**
UVa 102 - Ecological Bin Packaging
by Lorenzo Leonardini
Submitted: 2018-08-19
Accepted 0.010 C++
*/
#include <stdio.h>
#include <algorithm>
// Yeah... I over-complicated everything...
int main(void)
{
int bottles[9];
while(scanf("%d %d %d %d %d %d %d %d %d", bottles, bottles + 1, bottles + 2, bottle... | true |
575677973e037f7f6691c62b31446a1c6a23080d | C++ | thaoc-demo/cpp_array | /scratch.cpp | UTF-8 | 336 | 3.46875 | 3 | [] | no_license | #include<iostream>
using namespace std;
void test(int* a, int size){
for(int i=0; i<size; i++){
cout << a[i] << endl;
}
}
int main(){
int a[] = {3,1,2,5,4};
int *b = a;
// test(b, 5);
int *c = new int[3] {1,2,3};
cout << sizeof(c)/sizeof(c[0]);
// test(c, 3);
... | true |
0e2c507e3ea28e3ad5f6f697604dadcd88a50b2d | C++ | pv-912/Programming | /C++ Files/Previous/Finalised/rearangeArrayPositiveAndNegative.cpp | UTF-8 | 865 | 3.515625 | 4 | [] | no_license | //Given an array of positive and negative numbers, arrange them such that all negative integers appear before all the positive integers in the array without using any additional data structure like hash table, arrays, etc. The order of appearance should be maintained.
//Examples:
//Input: [12 11 -13 -5 6 -7 5 -3 -6]... | true |
582429896d4657e82517caf6e9ec4f870547291b | C++ | ASGitH/aie-Code-Design-And-Data-Structures | /.vs/Implicit_Conversions_and_Casting/main.cpp | UTF-8 | 1,688 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include "raylib/raylib.h"
//#include "originalClass.h"
//#include "newerClass.h"
//int main() {
// originalClass ma;
// newerClass mb = ma;
//
// // For the Closed Exercise (Newer2Original),...
// // ... <Step Four>: Now we create a new object for our...
// // ... Newer Class, as well as our Origi... | true |
9ce40c2d742a7e5b7bc92bda3d0ab7a3e4f62720 | C++ | raokartikkumar24/CodingCompetition | /HackerEarth/March2018Circuit/missile_bombing.cpp | UTF-8 | 540 | 3.171875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int Matarray[1002][1002] = {{0}};
void solve(int P, int A, int B, int C , int D) {
for(int i = A; i <= C; i++) {
for(int j = B; j <= D; j++) {
Matarray[i][j] ^= P;
}
}
}
void printMatrix(int N) {
for(int i = 1; i <= N; i++) {
for(int j = 1; j <= N; j++) {
c... | true |
72fcb155670251393a953c49ed066f0f092f6012 | C++ | tinglai/Algorithm-Practice | /LeetCode/Search in Rotated Sorted Array II/main.cpp | UTF-8 | 1,593 | 3.46875 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Solution{
public:
bool search(int A[], int n, int target){
if(n == 0) return false;
if(n == 1) return target == A[0];
if(A[0] < A[n - 1]) return binarySearch(A, 0, n - 1, target);
else if(A[0] > A[n - 1]) return help(A, 0, n - 1, target);
else{
int i = 1... | true |
3aa1902145954b1bd016b07fdba23e33312d479d | C++ | EBPkobli/Cpp_ASCIIOyun | /OyunSistem.cpp | UTF-8 | 3,002 | 2.671875 | 3 | [] | no_license | #include "OyunSistem.h"
void OyunSistem::OyunYukle(const char * harita) const
{
int k = 0;
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 36;j++)
{
cout << harita[k];
k++;
}
cout << endl;
}
}
void OyunSistem::konsolTemizle(const HANDLE & KonsolHWND) const
{
COORD coordScre... | true |
5916929ec34d9e5e53b479d58700d03276dec2c3 | C++ | zhongfq/cocos-lua | /frameworks/cclua/src/cclua/Socket.h | UTF-8 | 1,938 | 2.6875 | 3 | [
"MIT"
] | permissive | #ifndef __CCLUA_SOCKET_H__
#define __CCLUA_SOCKET_H__
#include "cclua/runtime.h"
#include <string>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <stdint.h>
NS_CCLUA_BEGIN
#define BUF_SIZE 512
typedef struct buf_t {
struct buf_t *next;
int offset;
int size;
uint8_t data[B... | true |
fabe1d9f188f00a886db6efb347b6ed96fb8649e | C++ | adamap/code-test2 | /217containdupI.cpp | UTF-8 | 646 | 3.609375 | 4 | [] | no_license |
//Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
class Solution {
public:
bool containsDuplicate(vector<int>& nums)
{
if ( nums.size() <... | true |
f3dec561b9e1d61f54d4d06cf8215c6aca184fb3 | C++ | RicardoTaverna/PUCPR_2019 | /ExperienciaCriativa/sketch_apr04a/sketch_apr04a.ino | UTF-8 | 3,924 | 2.53125 | 3 | [] | no_license | unsigned int potenciometro;
float pwm;
unsigned int tempoPadrao = 2000;
unsigned int tempoAgregado = 10000;
float tempoS;
float tempoP;
unsigned int tempoPedestre = 15000;
unsigned int chamaSemafP;
void semaforoPedestre(){
if(chamaSemafP == 1){
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
... | true |
d9b9d8b30226649e43b66aa85453ba2a75f66949 | C++ | AndreiHokage/Game_XO | /Game_XO/Game.cpp | UTF-8 | 518 | 3.0625 | 3 | [] | no_license | #include "Game.h"
bool Game::operator==(const Game& game) const noexcept {
return this->id == game.id;
}
/*Game& Game::operator=(const Game& game) { //It's doesn't want to change the id
this->dim = game.dim;
this->player = game.player;
this->table = game.table;
this->state = game.state;
return *this;
}*/
ostr... | true |
9616c32d47fdff93208a084af660deda6ed4ddcb | C++ | Pengsc0616/IAmAwesome | /655. Medium - Print Binary Tree.hpp | UTF-8 | 1,211 | 3.328125 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | true |
bd09af965675d14f87df6779d272dbb26781f971 | C++ | KaranTalreja/LeetCode | /src/heaters/solution.cpp | UTF-8 | 946 | 3.234375 | 3 | [] | no_license | class Solution {
public:
int findHeater(int house, vector<int>& heaters) {
int start = 0;
int end = heaters.size();
while (end - start > 1) {
int mid = start + (end - start)/2;
if (heaters[mid] <= house) start = mid;
else end = mid;
}
int retval = abs(heaters... | true |
11f60d86805392aee05102134d52ab4aceef609f | C++ | vividos/MultiplayerOnlineGame | /src/Server/GameServer/ServiceControlManager.hpp | UTF-8 | 1,408 | 2.703125 | 3 | [] | no_license | //
// MultiplayerOnlineGame - multiplayer game project
// Copyright (C) 2008-2014 Michael Fink
//
/// \file ServiceControlManager.hpp Win32 Service Control Manager (SCM) access
//
#pragma once
/// \brief Win32 classes
namespace Win32
{
// forward references
class ServiceInfo;
/// service control handle type
typedef s... | true |
67ac2731a0c43521e3a739a6ce6d269fbdca2af1 | C++ | cnsuhao/galaxy3d | /engine/lib/src/Matrix4x4.h | UTF-8 | 2,160 | 2.96875 | 3 | [] | no_license | #ifndef __Matrix4x4_h__
#define __Matrix4x4_h__
#include "Vector3.h"
#include "Vector4.h"
#include "Quaternion.h"
namespace Galaxy3D
{
//column major
class Matrix4x4
{
public:
Matrix4x4(){}
Matrix4x4(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, fl... | true |
10f00b3c294ce27d6c1ed502ac94b07987165c09 | C++ | CodeeChallenge/GetIntoRocket | /sol47.cpp | UTF-8 | 542 | 2.875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void func(int* Arr,int n);
int main(){
int a[]={2,1,3,4,1,2,5,7,1,2,5,4,3,7,2};
int n = sizeof(a)/sizeof(a[0]);
for(int i=0;i<n;i++)
printf("%d ",a[i]);
func(a,n);
printf("\n");
for(int i=0;i<n;i++)
printf("%d ",a[i]);
return 0;
}
int func(int* Arr,int n){
int m... | true |
92c880fe511922100f0d2da9995134dd52f8e8e7 | C++ | PawelKapusta/ImplementationOfGrapghUsingAdjacentList | /Vertex.h | UTF-8 | 931 | 3.234375 | 3 | [] | no_license | //
// Created by sony on 23.04.2020.
//
#ifndef ZADANIE7A_VERTEX_H
#define ZADANIE7A_VERTEX_H
#include <iostream>
using namespace std;
#define MAX 1000
int size = 0;
class Vertex {
public:
int valueTab[MAX] = {};
int valueOfVertex = 0;
int id = 0 ;
public:
void setVertexValue(int value){
... | true |
e97dff51300496da1d9c336283ff2ee616bcfd55 | C++ | rodrigoms2004/ancientCStudies | /Agit/CPP/Projetos/ListaLigada/lista.h | UTF-8 | 1,408 | 3.53125 | 4 | [] | no_license | #ifndef LISTA_H
#define LISTA_H
#include <iostream>
using namespace std;
template <typename TIPO> //template <class TIPO> class Lista
class Lista
{
private:
struct Node
{
TIPO valor;
Node *next;
};
Node *root;
unsigned int numero_de_elementos;
unsigned int construidos;
unsi... | true |
7c61f131f25d85a7a3fbc1ca4e98e63fff676b2a | C++ | zraul/LeetCode | /Powxn/Powxn.cpp | UTF-8 | 274 | 2.859375 | 3 | [] | no_license | //
// Created by 郑巍 on 2020/1/9.
//
#include "Powxn.h"
double Powxn::myPow(double x, int n) {
if (n == 0) {
return 1;
}
if (n < 0) {
n = -n;
x = 1/x;
}
return (n % 2 == 0) ? myPow(x * x, n / 2) : x * myPow(x * x, n / 2);
} | true |
0b475fd69070b4a7d120c7e6b311627e0b527b83 | C++ | SashenGovender/BattleShip | /SashenGBattleBot/PlayGame.cpp | UTF-8 | 9,012 | 2.90625 | 3 | [] | no_license | #include "PlayGame.h"
#include "windows.h"
PlayGame::PlayGame(std::string playerKey, std::string workingDir)
{
_jsonGameState = nullptr;
_playerKey = playerKey;
_workingDir = workingDir;
_gameState = new GameState();
_previousJsonGameState = nullptr;
_shootingAI = nullptr;
}
PlayGame::~PlayGame()
{
... | true |
1a8afaf8d6e2de9ff30bb7c538231f5206ab4aa4 | C++ | hwinter/HyLoop | /c_codes/hdw_rk4.cc | UTF-8 | 1,448 | 3.140625 | 3 | [] | no_license |
//Include a i/o library
#include <iostream>
#include <math.h>
using namespace std;
//////////////////////////////////////////////////////////////////
/*
*/
//////////////////////////////////////////////////////////////////
double derivs(double x0, double y0){
double y;
y=2.0*x0;
return(y);
}
/////////////... | true |
87d81c9f30ea3631161df98e8d11c7f882da3203 | C++ | malhayek2/cs4550-p01 | /scanner.cpp | UTF-8 | 1,827 | 3.046875 | 3 | [] | no_license | #include <string>
#include <cstdlib>
using namespace std;
#include "scanner.h"
#include "debug.h"
ScannerClass::ScannerClass(const char *file)
{
MSG("Initializing ScannerClass object");
/*mLineNumber set = 1 */
this->mLineNumber=1;
this->mFin.open(file,ios::binary);
if(!mFin)
{
MSG("failed to read input file")... | true |
6ffbee60c7ada116945e626341d72a5f9c871eb8 | C++ | krovyakovmikhail/repohomework | /DZ_lesson_2.cpp | UTF-8 | 3,672 | 3.171875 | 3 | [] | no_license | // DZ_lesson_2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <vector>
#include <algorithm>
template <typename T> // шаблонная функция обмена значений в указателе.
void Swap(T* A, T* B)
{
T buf = *A;
*A = *B;
*B = buf;
... | true |
b392f59e19e4bde684d58fe7549cfbcf443af3a6 | C++ | XiaotianJin/Templates | /被遗弃的角落/bitset.cpp | UTF-8 | 964 | 2.75 | 3 | [] | no_license | LL lowbit(LL x)
{
return x & (-x);
}
struct Bit
{
LL p[maxn/64+5];
int n;
int len;
Bit(int n = 0):n(n)
{
memset(p,0,sizeof(p));
len = n/64 + (n%64 != 0);
}
void setbit(int o)
{
int id = o/64;
int tid = o%64;
p[id] |= (1ULL << tid);
//... | true |
cf3cd94edb404ca03e8f1311ce67bf5d69d6932b | C++ | WhiZTiM/coliru | /Archive/da9cf86ee07cf209cda8cb24967a9ce6-f674c1a6d04c632b71a62362c0ccfc51/main.cpp | UTF-8 | 2,756 | 3.34375 | 3 | [] | no_license | #include <functional>
#include <type_traits>
#include <iostream>
/* The usual stuff */
template<typename T>
using EnableIf = typename std::enable_if<T::value, int>::type;
template<typename...>
struct void_ { using type = void; };
template<typename... T>
using Void = typename void_<T...>::type;
namespace detail {
... | true |
9c323a305d1b6cf202e0f2ed6b46e847bb67c2f0 | C++ | Gavinysj/Answer-for-leetcode | /Climbing Stairs/Climbing Stairs/main.cpp | UTF-8 | 970 | 3.40625 | 3 | [] | no_license | //
// main.cpp
// Climbing Stairs
//
// Created by XTBlock on 14/12/30.
// Copyright (c) 2014年 XTBlock. All rights reserved.
//
/*
Question:
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?... | true |
e705b26fdc15d983c91717a1417aa83156897081 | C++ | BlitzModder/dava.engine | /Modules/TArc/Sources/TArc/Utils/Private/ReflectionHelpers.cpp | UTF-8 | 1,076 | 2.53125 | 3 | [] | permissive | #include "TArc/Utils/ReflectionHelpers.h"
#include <Reflection/Reflection.h>
#include <Reflection/ReflectedTypeDB.h>
namespace DAVA
{
void ForEachField(const Reflection& r, const Function<void(Reflection::Field&& field)>& fn)
{
Vector<Reflection::Field> fields = r.GetFields();
for (Reflection::Field& f : field... | true |
5865f7cd10761726f4a231102a7ed74f018836ee | C++ | Woloda/Lab_9_2_A | /UnitTest(Lab_9.2(A))/UnitTest(Lab_9.2(A)).cpp | UTF-8 | 767 | 2.75 | 3 | [] | no_license | #include "pch.h"
#include "CppUnitTest.h"
#include "../Lab_9.2(A)/Lab_9.2(A).cpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTestLab92A
{
TEST_CLASS(UnitTestLab92A)
{
public:
TEST_METHOD(TestMethod1)
{
int kil_student = 2;
student* s = new student[kil_student];
s[... | true |
0550fb7d12aea04b4cba7660f95de68603c7799a | C++ | Evil-crow/CPP | /Essential_CPP/Programming_with_Templete/handling_templete_type_parameters.cpp | UTF-8 | 1,550 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
template <typename elemType>
class btNode {
public:
btNode();
btNode(elemType temp);
private:
elemType _val;
int _cnt;
btNode *_lchild;
btNode *_rchild;
};
template <typename valType>
class binaryTree {
public:
friend class btNode;
... | true |
19770715122804b17d2812f7d6f6a7c869bce85a | C++ | RollerSimmer/Guildhall-Projects | /SD2/SimpleMiner/Code/Game/Entity.cpp | UTF-8 | 5,738 | 2.765625 | 3 | [] | no_license | #include "Game/Entity.hpp"
#include <cmath>
#include "Game/GameCommon.hpp"
#include "Engine/Math/MathUtil.hpp"
#include "Engine/Math/Disc2.hpp"
Entity::Entity(const Vector2& pos,float radius,float speed)
: m_pos(pos)
, m_vel(0.f, 0.f)
, m_orientationDegrees(0.f)
, m_graphicsRadius(radius)
, m_physicsRa... | true |
1485ff96ebb735601d84ad366f2eec6d7d318bd3 | C++ | Timoniche/ITMO | /ALGO_LABS/Algorithms1course/LCAIssues/E.cpp | UTF-8 | 2,021 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
const int MAXN = 200010;
//9 3 2 4 2 1 2 5 1 1 6 7 6 6 8 8 9
//Possible answer: 0 1 2 2 1 1 6 6 8
//3 1 2 2 3
//Possible answer: 2 0 2
vector<bool> isVisited;
vector<int> adj[MAXN];
vector<int> subTreeSize;
vector<bool> isCut;
vector<int> ans;
unsigned int n;... | true |
0b321e5776f35ba011d73d33ff9bcb3466e726ed | C++ | AxlFullbuster/File-Rename | /test/catch2-tests.cpp | UTF-8 | 2,853 | 3.359375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <catch.hpp>
#include <boost/filesystem.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using std::fstream;
using std::string;
using std::vector;
using std::cout;
using std::endl;
namespace fs = boost::filesystem;
/*
*methods and variables for testing
*/
... | true |
fa3e8c14f3bc331f41ce4551fd6cd42aecd70070 | C++ | neilstc/TAKI | /Player.cpp | UTF-8 | 2,237 | 3.578125 | 4 | [] | no_license | /*Neil Michaeli 203536818*/
/*Yair Ivgi 308275601*/
#include "Player.h"
#include "Game.h"
Player::Player(){
this->name = "" ;
this->numOfCards = 0;
}
Player::Player(const string name,const int numOfCards){
this->name = name;
this->numOfCards = numOfCards;
fillCards();
}
Player::Player(const P... | true |
0d1ba012f1dde655bfcbd75caa81587388cdc116 | C++ | dimrirahul/programming | /codeforces/350/D/D.cc | UTF-8 | 1,413 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
using VI = vector<int>;
const bool dbg = !true;
struct D {
int n, k, maxCookies;;
VI a, b;
bool canMake(int cks) {
int rem = k;
for (int i = 0; i < b.size(); i++) {
int diff = b[i] - a[i] * cks;
if (diff >=... | true |
0698a34be8f06069b5f227b63c343696b8245135 | C++ | Joseph-Laithwaite/smart-greenhouse-university-fyp | /Arduino/SensorLibraries/StandardAnalogSensor.cpp | UTF-8 | 1,106 | 2.796875 | 3 | [] | no_license | /*
* StandardAnalogSensor.cpp
*
* Created on: 9 Mar 2018
* Author: josephlaithwaite
*/
#include "StandardAnalogSensor.h"
StandardAnalogSensor::StandardAnalogSensor(uint8_t sensorPinNumber, uint8_t powerPinNumber) {
// TODO Auto-generated constructor stub
this->sensorPinNumber = sensorPinNumber;
this->... | true |
893d2d67abec7ce3ff3e51945a2b1b1b5c33a103 | C++ | GeekSprite/iOS-Algorithm | /linkedList/leetcode/easy/hasCycle.h | UTF-8 | 1,604 | 3.28125 | 3 | [] | no_license | //
// hasCycle.h
// linkedList
//
// Created by junl on 2019/7/17.
// Copyright © 2019 junl. All rights reserved.
//
#ifndef hasCycle_hpp
#define hasCycle_hpp
#include <stdio.h>
#include "singlyLinkedList.h"
namespace leetcode {
/*
141.给定一个链表,判断链表中是否有环。
为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索... | true |
fcc047d469a5399a9cdf34c3406ed3895b76dee9 | C++ | prw/montecarloraytracer | /vector.cpp | UTF-8 | 669 | 3.28125 | 3 | [] | no_license | #include <cmath>
#include "vector.h"
Vector::Vector():Point(){}
Vector::Vector(double xx, double yy, double zz):Point(xx, yy, zz){}
Vector::Vector(double vals[]):Point(vals){}
void Vector::cross(Vector &a, Vector &b){
x=a.y*b.z - a.z*b.y;
y=a.z*b.x - a.x*b.z;
z=a.x*b.y - a.y*b.x;
}
double Vector::dot(Ve... | true |
c01383415dda51886647d213d406ab0b3601dfd0 | C++ | arnavkundalia/Algorithms-and-Data-Structres_Extra | /Dynamic Programming/Subset-Sum-Problem.cpp | UTF-8 | 954 | 3.140625 | 3 | [] | no_license | /*
Problem URL :- https://practice.geeksforgeeks.org/problems/subset-sum-problem/0
*/
#include<bits/stdc++.h>
using namespace std;
bool subsum(int arr[], int n, int sum) { // recursive solution
// base case
bool dp[n+1][sum+1];
for(int i=0; i<=n; i++) {
for(int j=0; j<=sum; j++) {
if(... | true |
631c80315a9464208796298952f318d1a6978420 | C++ | WhiZTiM/coliru | /Archive2/6d/a776855a686ce5/main.cpp | UTF-8 | 1,624 | 3.84375 | 4 | [] | no_license | #include <iostream>
#include <type_traits>
#include <cstddef>
template <typename... Types>
struct Foo;
template <typename T, typename... Types>
struct Foo<T, Types...> : Foo<Types...>
{
// bring get() member functions from parent class into current scope
using Foo<Types...>::get;
Foo(T membe... | true |
0068f2ef1185c56dc08f9107a6a4a82f5946723e | C++ | xUhEngwAng/oj-problems | /thuoj/等差数列.cpp | UTF-8 | 2,293 | 2.890625 | 3 | [] | no_license | #include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
struct entry{
int row, col, value;
entry() = default;
entry(int r, int c, int v): row(r), col(c), value(v){}
};
bool cmp(const entry &one, const entry &two){
if(one.row == two.row)
return one.col < two.col;
return ... | true |
c675fa162e943817510d51ace7c49fec324f3289 | C++ | acrowise/kaacore | /src/log.cpp | UTF-8 | 1,973 | 2.8125 | 3 | [
"MIT"
] | permissive | #include <cstring>
#include <SDL.h>
#include "kaacore/exceptions.h"
#include "kaacore/log.h"
namespace kaacore {
bool logging_initialized = false;
LogLevel
get_logging_level(const LogCategory category)
{
return static_cast<LogLevel>(
SDL_LogGetPriority(static_cast<int>(category)));
}
void
set_logging... | true |
1c6f1198a7eea44a4ff5ebcc461ab09c63b4e810 | C++ | GT-IEEE-Robotics/2018 | /Distance Sensing/beaglebone_i2c_distance/app_note.cpp | UTF-8 | 3,703 | 2.90625 | 3 | [] | no_license | /**
* Quickstart to get distance measurements from VL6180 infrared laser time-of-flight based distance sensor
* adapted from Hamblen's mbed example code in the Application Note
*/
// new headers for beaglebone linux to use to comm to i2c bus 0, pins 19,20 for scl,sda (serial clock, serial data)
#include <linu... | true |
e2bd184e977ce367a6baa01710c294487b646fa9 | C++ | caurdy/Secret-Messages | /self_destructing.h | UTF-8 | 1,154 | 2.796875 | 3 | [] | no_license | #ifndef SELF_DESTRUCTING_H
#define SELF_DESTRUCTING_H
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <ios>
using std::ostream; using std::istream;
class SelfDestructingMessage {
private:
vector<string> messages_;
long remaining_views_=0;
vector<long> vie... | true |
f1fbbf5d62351551099de5f5f1acffaa76010b70 | C++ | DonaldWhyte/parcel-game-engine | /include/Exceptions.h | UTF-8 | 1,962 | 3.390625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* File: Exceptions.h
* Author: Donald
*
* Created on December 18, 2008, 7:40 PM
*/
#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
#include <string>
#include <iostream>
namespace parcel
{
namespace debug
{
/* Generic exception class. All other exceptions derive from this. */
class E... | true |
504dd9f6d118bc13ef1842f69a1a89ebef9f48c1 | C++ | Norseman055/immaterial-engine | /libs/dev/Math/MathEngine/QuatApp.cpp | UTF-8 | 2,353 | 2.921875 | 3 | [
"MIT"
] | permissive | /*****************************************************************************/
/* */
/* File: QuatApp.cpp */
/* */
... | true |
ccdfbf67540a0d1d18d32c2a4c33ccbbd0140629 | C++ | mdcurtis/micromanager-upstream | /DeviceAdapters/PICAM/PICAMParam.h | UTF-8 | 15,388 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef _PICAM_PARAM_H_
#define _PICAM_PARAM_H_
#include "DeviceBase.h"
#include "PICAMAdapter.h"
#include <algorithm>
#include <iterator>
#ifndef WIN32
typedef long long long64;
#endif
/***
* A base class for PICAM parameters. This is used for easy access to specific camera parameters.
*/
class PvParamBase
{
... | true |
a34629aa5c26aa358555e50b4a44a0b6e235f79a | C++ | saisrivatsan/Codeforces | /109/B.cpp | UTF-8 | 711 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define LL long long int
bool cmp(pair<LL,LL> l, pair<LL,LL> r)
{
if(l.second == r.second)
return l.first > r.first;
else
return l.second > r.second;
}
int main()
{
LL n,i,j,k,a,b;
cin>>n;
vector <pair<LL,LL> > A... | true |
52b4ceb5dd20f70aed35c76aecdcbc18c4c78a92 | C++ | wangjiangxing/GitDS | /BiTree/BiTree/BiTree.cpp | UTF-8 | 2,596 | 2.984375 | 3 | [] | no_license | // BiTree.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "pch.h"
#include "LiQueue.h"
ElemType dat = 1;
LinkQueue Q=(LinkQueue)malloc(sizeof(LiQueue));
int sumNoLeafNum = 0;
int main()
{
BiTree T;
createTree(T, 3);
preOrder(T);
printf("*****************************\n");
inOrder(T);
printf("*******************... | true |
6e1748fca85f9ab6a409171073f4997be1477ec2 | C++ | zbierak/bento | /src/gather/gather-registry.h | UTF-8 | 2,501 | 2.6875 | 3 | [] | no_license | /*
* gather-registry.h
*
* Created on: Nov 13, 2013
* Author: zbierak
*/
#ifndef GATHER_REGISTRY_H_
#define GATHER_REGISTRY_H_
#include <boost/shared_ptr.hpp>
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
#include "gather-message-info.h"
namespace bento {
/*
* GatherRegistry acc... | true |
21bacb2bec51937738c8b17ff3a8662b97239ac8 | C++ | scheuchi/MadMummies | /code/MadMummies/MadMummies/src/Engine/Core/Mesh.h | UTF-8 | 1,017 | 2.625 | 3 | [] | no_license | #pragma once
#include "Transformable.h"
#include "Shader.h"
#include "Texture.h"
#include "VertexBufferObject.h"
#include <vector>
class Mesh : public Transformable
{
typedef Transformable Base;
public:
Mesh(void);
virtual ~Mesh(void);
virtual void Update(double deltaT);
virtual void Rende... | true |
f3b582c586af53a7d1fdaa87be31f10b106d264d | C++ | Ishank-Gupta/CPP_code | /HybridInheritance.cpp | UTF-8 | 370 | 2.78125 | 3 | [] | no_license | #include <iostream>
#pragma pack(4)
using namespace std;
class CA {
public:
int a;
};
class CB :virtual public CA {
public:
int b;
};
class CC :virtual public CA {
public:
int c;
};
class CD : public CB, public CC {
public:
int d;
};
int main()
{
cout << "Size of the CA object : " << s... | true |
223db8f5e65971115a734b6bf9d1910abea9c3ee | C++ | devoidofreason/ChessGame | /include/Bishop.cpp | UTF-8 | 1,178 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "Bishop.h"
std::vector<Square*> Bishop::possibleSquares(Board* board, Square* square){
std::vector<Square*> ret;
int x = square->getX(), y = square->getY();
int i, j;
i = x - 1;
j = y - 1;
while(board->onBoard(i,j)){
if(!board->board[i][j]->getPiece())
ret.push_back(board->board[i][j]);
else{
... | true |
0c588f5f3d7847fbdf428affc8e6c27321afc61b | C++ | bengross234/CSE332S-FL2020 | /oop_work-evinlanedavidstudio16-21/SharedCode/SimpleFileSystem.cpp | UTF-8 | 1,863 | 3 | 3 | [] | no_license | // define methods of SimpleFileSystem class here
#include "SimpleFileSystem.h"
#include "TextFile.h"
#include "ImageFile.h"
#include <iostream>
using namespace std;
set<string> SimpleFileSystem::getFileNames() {
set<string> fileNames;
//iterate over allFiles, adding names to set
map<std::string, AbstractFile*>::i... | true |
dc4f5f6a0661fd7cacb8536a49448d3fa5b4e25d | C++ | hyemmie/algorithm_study | /Backjoon/Tree/13016.cpp | UTF-8 | 1,723 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
int diameterStart, diameterEnd, maxLength = 0;
int distanceFromStart[50001], distanceFromEnd[50001], visited[50001];
vector<pair<int,int>> roads[50001];
void dfs(int pos, int length) {
// 이미 방문했으면 통과
if(visited[pos]... | true |
b43947362b77206084b370c9b8645283eb6170b9 | C++ | V2beach/Algorithm-exercise | /浙大PAT/A1071.cpp | UTF-8 | 1,319 | 3.09375 | 3 | [] | no_license | #pragma warning(disable: 4996)
#include <map>
#include <string>
#include <iostream>
using namespace std;
bool isAlphanumeric(char &character) {
if (character >= '0' && character <= '9')
return true;
else if (character >= 'a' && character <= 'z')
return true;
else if (character >= 'A' && character <= 'Z') {
c... | true |
9694566beda7717fbffc8cebdd5339a60743686f | C++ | starptr/Simple-Statistics | /Simple Statistics/main.cpp | UTF-8 | 5,326 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <vector>
//for testing constructor feeder
#include <array>
#include <stack>
#include <queue>
#include <deque>
#include <forward_list>
#include <list>
#include "llist.h"
#include "simple_stats.h"
#include "randomdata.h"
#include "pair.h"
int main(int argc, char* argv[]) {
Random_data<in... | true |
5eba5fd258cb7bd546f969ee8dc6a19f047b35da | C++ | Sankalpbp/KarumanchiProblems | /searching/closestToZero.cpp | UTF-8 | 734 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
using namespace std;
int pairSum(int * arr, int n) {
int closestSum = arr[0] + arr[1];
int sum = 0;
for(int i = 0; i < n - 1; ++i) {
sum = 0;
for(int j = i + 1; j < n; ++j) {
sum = arr[i] + ar... | true |
4d867b614539bf086908fa493b5c1f18773cb491 | C++ | kohyatoh/contests | /pku/2410/2410.cpp | UTF-8 | 1,070 | 2.75 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i=0; i<(int)(n); i++)
using namespace std;
string enc(int n) {
string s;
rep(i, 8) { s += n%2+'0'; n/=2; }
reverse(s.begin(), s.end());
return s;
}
int dec(const string& s) {
int n=0;
rep(i,... | true |
f4f4173166faa66c332580a390891bbfe8ee7169 | C++ | nabond251/gardener | /main.cpp | UTF-8 | 1,359 | 2.828125 | 3 | [] | no_license | /**
* @brief Gardener main application.
*/
#include "main.h"
#include <iostream>
#include <wiringPi.h>
#include "config.h"
#include "gardener.h"
#include "pump.h"
#include "timer.h"
#include <ctime>
using namespace gardener;
using namespace std;
const int PWM0_pin = 1; /* GPIO 1 as per WiringPi, GPIO18 as per B... | true |
b2e1205c8dadac11f3da056305514f5ada53f46d | C++ | umamibeef/SpeedRoute | /SpeedRoute/FileParser.cpp | UTF-8 | 4,172 | 2.96875 | 3 | [] | no_license | //
// FileParser.cpp
// SpeedRoute
//
// Created by Michel Kakulphimp on 2018-03-24.
// Copyright © 2018 Michel Kakulphimp. All rights reserved.
//
#include "FileParser.hpp"
#include "Types.h"
int g_enlargementFactor = SPACE_ENLARGEMENT_FACTOR;
FileParser::FileParser(std::string netFilename, std::string placemen... | true |
0d86037c7718f15341e533b5bba5c1e60ea68d9d | C++ | amirharati/hunter_trainer | /spectrogram/spectrogram_test.cc | UTF-8 | 3,215 | 2.84375 | 3 | [] | no_license | // file: spectrogram_test.cc
//
// isip include files
//
#include "spectrogram.h"
// spectrogram: automated sound comparison utility
//
// This is a driver program that demonstrates the functionality
// of the sound comparison module.
//
long readfile(double **sig,char *filename);
int savefile(double *si... | true |