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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
81b53d8b09310d59b2a59e469963b45c4e5bc64f | C++ | ChrisMStump/ompLoop | /mergesort.cpp | UTF-8 | 2,947 | 3.28125 | 3 | [] | no_license | #include <omp.h>
#include <stdio.h>
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <algorithm>
#include <math.h>
#include <chrono>
#ifdef __cplusplus
extern "C" {
#endif
void generateMergeSortData (int* arr, size_t n);
void checkMergeSortResult (in... | true |
4e577ceac11c5c022e9c9560e5f9da2dff571aed | C++ | wmjtxt/LeetCode | /CppSolution/821. Shortest Distance to a Character.cpp | UTF-8 | 598 | 3.046875 | 3 | [] | no_license | ///
/// @file :821. Shortest Distance to a Character.cpp
/// @author :wmjtxt(972213032@qq.com)
/// @date :2018-10-21 21:24:21
/// @quote :
///
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> shortestToChar(string S, char C) {
int n = S.size();
... | true |
a3eaa71215b7a3f3c7f11823efa2800371580748 | C++ | AlexR1712/tpdatos-cyberchamuyo | /TpDatos/BloqueNodo.cpp | UTF-8 | 801 | 2.734375 | 3 | [] | no_license | /*
* BloqueNodo.cpp
*
* Created on: Oct 17, 2012
* Author: lucasj
*/
#include "BloqueNodo.h"
BloqueNodo::BloqueNodo(long tamanoBloque):Bloque(tamanoBloque) {
}
BloqueNodo::~BloqueNodo() {
}
void BloqueNodo::print(std::ostream& oss) const {
}
void BloqueNodo::input(std::istream& oss) const {
}
void B... | true |
07696c19f971ba2628643f51d89f7611fda035ce | C++ | hduuong/Banking-Operation-Simulation | /STermBond.h | UTF-8 | 808 | 3.0625 | 3 | [] | no_license | //
// STermBond.h
// lab5
// Short-Term Bond account class
//
#ifndef lab5_STermBond_h
#define lab5_STermBond_h
#include "Account.h"
using namespace std;
//------------------------------ class STermBond ------------------------------
// STermBond class: inherits Account class. Has all standard account
// beha... | true |
f4da35e954127542b4d1e928ed1d326a26f44e92 | C++ | sajalagrawal/BugFreeCodes | /LeetCode/30-Day LeetCoding Challenge/Happy Number.cpp | UTF-8 | 717 | 3.09375 | 3 | [] | no_license | //#include<bits/stdc++.h>
class Solution {
public:
map<int, bool> seen;
bool isHappy(int n) {
cout<<"input="<<n<<endl;
if(n==1)return true;
while(true){
n=sumOfSq(n);
cout<<"n="<<n<<endl;
if(n == 1)return true;
if(seenBefore(n))return... | true |
bed6f8533c92f81d31a9904d05591f6ec5671545 | C++ | gordicaleksa/MicrosoftBubbleCup2018 | /Round1/p1_BigSnowfall.cpp | UTF-8 | 5,298 | 3.625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
// just some shortcuts I generally like to use when competing
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
#define all(v) (v).begin(), (v).end()
// I am a big fan of OOP when I have time to implement it on competitions
class Graph
{
int n; //... | true |
c31e1218354ac8e1df8d9e7b220d2d9aa905fe0a | C++ | Ragora/EasyLua | /source/easylua.cpp | UTF-8 | 5,299 | 2.9375 | 3 | [
"MIT"
] | permissive | /**
* @file easylua.cpp
* @brief Source file implementing non-templated logic in EasyLua.
*
* This software is licensed under the MIT license. Refer to LICENSE.txt for
* more information.
*
* @date 8/10/2016
* @author Robert MacGregor
* @copyright (c) 2016 Robert MacGregor
*/
#include <easylua.hpp>
n... | true |
e10f332b2e0984df210e4c961d466898dcb8f66e | C++ | hoguea08/ArnaMngmntPrj | /parking.cpp | UTF-8 | 5,315 | 3.59375 | 4 | [] | no_license | #include "bank.h"
#include "parking.h"
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
/// Reads parking data from text file
void Parking::readParkingData(std::fstream& infile)
{
infile >> section >> space >> price >> available;
return;
}
/// Parking menu options
void parkingOp... | true |
7a1fbec68bd6936e7c9c3c3d5fc6821aa7cb9981 | C++ | TZVK/sfml_test_game | /snippets/ttt/main.cpp | UTF-8 | 941 | 2.5625 | 3 | [] | no_license | //#include <SFML/Graphics.hpp>
//#include <iostream>
//#include "Field.h"
//#include <cstring>
//#include <cstdlib>
#include "View.h"
#include "Controller.h"
/*
void drawEverything(sf::RenderWindow &window){
for (std::vector<sf::Text>::iterator iter = shapeContainer.begin(); iter != shapeContainer.end();iter++)
... | true |
acc5f02a34d96ef292688e87f0d4885afba233b0 | C++ | jjzhang166/WinNT5_src_20201004 | /NT/printscan/print/spooler/spllib/dnode.inl | UTF-8 | 1,927 | 2.90625 | 3 | [] | no_license | /*++
Copyright (c) 1998 Microsoft Corporation
All rights reserved.
Module Name:
dnode.inl
Abstract:
Node template class.
Author:
Weihai Chen (WeihaiC) 06/29/98
Revision History:
--*/
template <class T, class KEYTYPE>
TDoubleNode<T, KEYTYPE>::TDoubleNode(void):
m_Data... | true |
d3be2ec68fea5872f8fa4e89d822de5ee2aabe47 | C++ | facebook/hermes | /external/llvh/include/llvh/IR/TypeBuilder.h | UTF-8 | 13,658 | 2.59375 | 3 | [
"MIT",
"NCSA",
"LLVM-exception",
"Apache-2.0"
] | permissive | //===---- llvm/TypeBuilder.h - Builder for LLVM types -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | true |
c07d75bd6d37915d3a9e2b8043080a41bcda1eed | C++ | littlepretty/BNU-Extended-Hotspot | /SelfMadeTimer.cpp | UTF-8 | 3,224 | 3.296875 | 3 | [] | no_license | #include "SelfMadeTimer.h"
#include <iostream>
#include <fstream>
SelfMadeTimer::SelfMadeTimer(void)
{
}
SelfMadeTimer::SelfMadeTimer(std::string pName):projectName(pName)
{
timeStatisticFileName=new char[pName.length()+64];
sprintf(timeStatisticFileName,"%s_running_time.log",pName.c_str());
}
SelfMadeTimer::~Sel... | true |
3d01bb0d76702f4e7b3759d79e430c55c2d120b4 | C++ | MichaelMIL/ESP-Arduino-IOT | /MCU/wifi.ino | UTF-8 | 1,084 | 2.65625 | 3 | [] | no_license |
void reconnect() {
// Loop until we're reconnected
int counter = 0;
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Create a random client ID
String clientId = "ESP8266Client-";
clientId += roomGroup.c_str();
// Attempt to connect
if (client.connect(client... | true |
a04916875dcfc67e547a3aa65bb0e4ee9157a175 | C++ | Yhgenomics/maraton-cli | /src/FileDownloader.cpp | UTF-8 | 1,749 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "FileDownloader.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <string.h>
FileDownloader::FileDownloader( bool* cancel ) { cancel_ = cancel; }
FileDownloader::~FileDownloader() {}
size_t FileDownloader::DownloadCallBack( void* pBuffer , size_t nSize , size_t nMemByte... | true |
8d4a57e05766867bfd67935f48d6c157a723b8c5 | C++ | Staszek1903/AndroidSFMLTemplate | /PlatformerStuff/colidable.cpp | UTF-8 | 6,790 | 2.890625 | 3 | [] | no_license | #include "colidable.h"
Colidable::Colidable()
{
}
bool Colidable::is_colliding(const Colidable &other, ColisionData &data) const
{
sf::FloatRect bb1 = getGlobalBounds();
sf::FloatRect bb2 = other.getGlobalBounds();
if(!AABBCollision(bb1, bb2))
return false;
// MAGIA STACK OVERFLOW:
// k... | true |
d69bf168656494513c36a0f712549be4bd050869 | C++ | ldelgiud/AlgoLabHS19 | /week_07/diet/main.cpp | UTF-8 | 1,788 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <utility>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
#include <CGAL/Gmpz.h>
// choose input type (input coefficients must fit)
typedef int IT;
// choose exact type for solver (CGAL::Gmpz or CGAL::Gmpq)
typedef CGAL::Gmpz ET;
// program and solution types
t... | true |
24e7db85b2845d4661cd19e9b597c5756c534809 | C++ | timmitee10/Game-C- | /Game/Connection.h | UTF-8 | 388 | 2.59375 | 3 | [] | no_license | #pragma once
#include "Socket.h"
#include "PacketManager.h"
namespace NodelNet
{
class Connection
{
public:
Connection(Socket& socket, IPEndPoint ipEnd);
void Close();
Socket& GetSocket();
IPEndPoint GetIPEndPoint() const;
PacketManager pm_incoming;
PacketManager pm_outgoing;
char buffer[Constants::ma... | true |
a61de2a9b9d857bc714420b0d41f0accc3f33ecf | C++ | jk007-m/OOP-CPP-2016-2017 | /compile.cpp | UTF-8 | 461 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <exception>
using namespace std;
void fail(int a = 0)
{
///int x[10];
try
{
///x[15] = 3;
if (a != 0)
throw a;
}
catch(...)
{
throw;
}
}
int main ()
{
try
{
fail(5);
}
catch(in... | true |
105feeeb88ebea268063339cfffeaa8ffd47ee8a | C++ | jking79/KUEWKinoAnalysis | /src/Systematics.cc | UTF-8 | 11,009 | 3 | 3 | [] | no_license | #include "Systematics.hh"
#include "CategoryTree.hh"
///////////////////////////////////////////
////////// Systematic class
///////////////////////////////////////////
Systematic::Systematic(const string& label){
m_Label = label;
m_IsUp = true;
}
Systematic::~Systematic(){ }
std::string Systematic::Label() ... | true |
c0a9271976eb18737ea0597196439762230265de | C++ | iitalics/cyber-like | /src/ui/UI.cpp | UTF-8 | 2,513 | 2.640625 | 3 | [] | no_license | #include "UI.h"
#include "constants.h"
#include <sstream>
#include <boost/format.hpp>
namespace ui {
UI::UI ()
{
}
void UI::process_action (Action ac)
{
game_state.process_action(ac);
}
void UI::render (disp::Display& g)
{
using namespace disp;
int cx = (g.width() - viewport_width) / 2;
int cy = (g... | true |
16791c2fcabae012105e136903e37c90de3d7c64 | C++ | TheMadDodger/Spartan-Engine | /SpartanFramework/Bone.cpp | UTF-8 | 1,886 | 2.546875 | 3 | [] | no_license | #include "stdafx.h"
#include "Bone.h"
#include "TransformComponent.h"
#include "SceneManager.h"
#include "GameScene.h"
#include "Skeleton.h"
namespace SpartanEngine
{
Bone::Bone(float length, float rotation) :
m_Length(length), m_Rotation(rotation), GameObject("Bone")
{
}
Bone::~Bone()
{
if (!GetGameScene())... | true |
8fedf56a962eabc19ecc0ffc4edc62bce99058c4 | C++ | hcab14/HFMonitor | /test/test_shm_main.cpp | UTF-8 | 343 | 2.578125 | 3 | [] | no_license | // -*- C++ -*-
// $Id$
#include <iostream>
#include <string>
#include "shared_memory_mutex.hpp"
int main(int argc, char* argv[])
{
if (argc != 2) return 0;
std::string mode(argv[1]);
if (mode == "parent") {
shm_manager_parent s("XX");
sleep(10);
}
if (mode == "child") {
shm_manager_child s("XX... | true |
685cd85b6ac02ca91c97e08b27251aa740b97d6f | C++ | BupTy03/TanksFramework | /src/ArmoredWall.cpp | UTF-8 | 1,173 | 2.734375 | 3 | [] | no_license | #include "ArmoredWall.hpp"
#include "Tank.hpp"
#include "Bullet.hpp"
#include <cassert>
namespace tf
{
ArmoredWall::ArmoredWall(const sf::Vector2f& sz, const sf::Vector2f& pos)
: Wall(sz, pos)
{
setFillColor(sf::Color{100, 33, 33});
setBorderColor(sf::Color{68, 21, 21});
}
void ArmoredWall::handleColli... | true |
353e235f5fcf31066e667bb2f350b31cb2176c8a | C++ | ennbelle/CSC17B_Battleship_Group1 | /Battleship_V6/PlayerData.cpp | UTF-8 | 397 | 2.578125 | 3 | [] | no_license |
#include "PlayerData.h"
PlayerData::PlayerData(){
gridData = new Grid;
playerName = new char;
}
Grid *PlayerData::returnGridData(){
return gridData;
}
char *PlayerData::returnPlayerName(){
return playerName;
}
PlayerData::~PlayerData(){
delete gridData;
delete playerName;
}... | true |
274bc58a6073049d4870cb0d284a6c5ada54b5f1 | C++ | smakethunter/Komiwojazer | /tsp.cpp | UTF-8 | 6,844 | 2.765625 | 3 | [] | no_license | //
// Wojciech Pełka 302895
//
#include "tsp.hpp"
#include <sstream>
std::vector<double> TSP_cost_matrix::find_min_row() {
std::vector<double> min_row;
for (const auto& i: cost_matrix){
double temp_cost=200;
for(const auto& val: i){
if(val<temp_cost){
temp_cost=val;... | true |
5624701ee6339d46114bbc5c0eaf55d09fb16b47 | C++ | morganpobr/LCUD | /Cylinder.cpp | UTF-8 | 833 | 3.5625 | 4 | [] | no_license | /**
* @brief Cylinder class methods
*
* @details
* This file implements the cylinder class member methods;
* It consists of the constructor, and a toString method
*
* @author Jerry Iu
*/
#include "Cylinder.h"
/**
* @brief cylinder constructor
*
* @details
* calculates and s... | true |
b07bd0bfdbac42884932c1add2cd7aef7953cf82 | C++ | HaiyangXu/EECS-466-Project | /src/voronoi_diagram/point.h | UTF-8 | 566 | 2.59375 | 3 | [] | no_license | #ifndef VORONOIDIAGRAM_POINT_H_
#define VORONOIDIAGRAM_POINT_H_
#include <memory>
#include <vector>
namespace voronoi_diagram
{
typedef struct Point_
{
float x, y, z;
Point_(float x, float y, float z=0) :
x(x), y(y), z(z)
{}
} Point;
typedef std::shared_ptr<Point> PointPtr;
typedef Point Site;
typed... | true |
1ec492e025db43acbabae2cb716d423952cc5f4a | C++ | utku25/RGB_led_kullan-m- | /RGB_led_otomatik.ino | UTF-8 | 755 | 2.546875 | 3 | [] | no_license | #define red 4
#define green 3
#define blue 2
void setup() {
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
void loop() {
digitalWrite(red,HIGH);
digitalWrite(green,LOW); //kırmızı yanacak
digitalWrite(blue,LOW);
delay(1000);
digitalWrite(red,LOW);
digitalWrite... | true |
45653eeaf8904dee6c757103debd2a90a00c9e17 | C++ | reservedname/leetCode | /1001. 害死人不偿命的(3n+1)猜想 (15).cpp | UTF-8 | 276 | 2.984375 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
int count = 0;
void loop(int a){
if(a==1) return;
++count;
if(a%2==0){
a/=2;
loop(a);
} else {
a=(3*a+1)/2;
loop(a);
}
}
int main(){
int a = 0;
scanf("%d",&a);
loop(a);
printf("%d\n", count);
}
| true |
e02259ee19a459a31b91bcec4eb7b7ab544aac2b | C++ | naoki-yoshioka/braket | /ket/include/ket/control.hpp | UTF-8 | 9,396 | 3.140625 | 3 | [
"MIT"
] | permissive | #ifndef KET_CONTROL_HPP
# define KET_CONTROL_HPP
# include <cstdint>
# include <type_traits>
# include <ket/qubit.hpp>
namespace ket
{
template <typename Qubit>
class control
{
using qubit_type = Qubit;
qubit_type qubit_;
public:
using bit_integer_type = typename qubit_type::bit_integer_type;
... | true |
fab4777f6f039912d1049e93bdf699956cbd2e53 | C++ | gonini/Codility-Lesson | /Lesson5/CountDiv/countDiv.cpp | UTF-8 | 670 | 2.984375 | 3 | [
"MIT"
] | permissive | // you can use includes, for example:
#include <algorithm>
#include <vector>
#include <cstring>
#include <cmath>
#include <iostream>
#include <set>
#define MAX 100001
// you can write to stdout for debugging purposes, e.g.
// cout << "this is a debug message" << endl;
using namespace std;
int solution(int A, int B, ... | true |
60e96b97e4bbb2813704519a9f673917c77c93aa | C++ | Mistymush/The_Rock_Lives | /RockLives/LevelGoal.cpp | UTF-8 | 961 | 2.578125 | 3 | [] | no_license | /*
File which defines method bodys of the LevelGoal class
Author: Richard Hayes
*/
#include "LevelGoal.h"
LevelGoal::LevelGoal(Level *level_pointer){
setIcon('>');
setColor(df::YELLOW);
setType("LevelGoal");
level = level_pointer;
//setSolidness(df::SOFT);
seen = false;
}
void LevelGoal::setIcon(char new_icon)... | true |
7aec26c253f7493f43d84da804033e24a11532eb | C++ | shuhari/WinTools | /src/KeyView/MsgRecord.cpp | UTF-8 | 2,079 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #include "stdafx.h"
#include "MsgRecord.h"
MsgRecord::MsgRecord() {
}
MsgRecord::MsgRecord(const MsgRecord& src) {
copyFrom(src);
}
MsgRecord& MsgRecord::operator=(const MsgRecord& src) {
copyFrom(src);
return *this;
}
void MsgRecord::copyFrom(const MsgRecord& src) {
type = src.type;
name = src.name;
fla... | true |
b66b1353b3c8e2d4fa3ffc1f31c99a66aa398d83 | C++ | nicomatex/taller_argentum | /ECS/position_component.cpp | UTF-8 | 558 | 3 | 3 | [] | no_license | #include "position_component.h"
#include <iostream>
PositionComponent::PositionComponent() : x(0), y(0) {}
PositionComponent::PositionComponent(int x, int y) : x(x), y(y) {}
PositionComponent::~PositionComponent() {}
void PositionComponent::init() {
}
void PositionComponent::update(int dt) {
std::cout << "x: " <<... | true |
194ab7ae0090fa919d16054a7002a96ec93b66d6 | C++ | abhinav1602/CTCI-Solutions-In-CPP | /Ch. 2 - Linked List/3.Delete Middle/O-N.cpp | UTF-8 | 1,281 | 3.640625 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *next;
};
struct Node *newNode(int data){
Node *n = new Node();
n->data = data;
n->next = NULL;
return n;
}
// returns middle element in linked list
void deleteMiddleElement(Node *head) {
int len = 0;
Node *curr... | true |
c852962b1e1cea8e99bd7f3910a1e8c8655282fb | C++ | ss23/DrawAttack | /src/States/PauseState.cpp | UTF-8 | 1,878 | 2.5625 | 3 | [
"MIT"
] | permissive | #include "PauseState.hpp"
#include <cpp3ds/Window/Window.hpp>
namespace DrawAttack {
PauseState::PauseState(StateStack& stack, Context& context)
: State(stack, context)
{
m_overlay.setSize(cpp3ds::Vector2f(400.f, 240.f));
m_overlay.setFillColor(cpp3ds::Color(0, 0, 0, 220));
m_texture.loadFromFile("images/button.... | true |
88fafd41d0ff815d0473ebf8d076956ba3cae527 | C++ | arnav127/C_plus_plus_Algos | /Collection_of_Algorithms/Sorts/SelectionSort.cpp | UTF-8 | 576 | 3.65625 | 4 | [] | no_license | // Selection sort --> n**2 time complexity
#include <bits/stdc++.h>
using namespace std;
void SelectionSort(int array[]){
int index_min=0, temp=0;
for(int i=0; i<6; i++){
cout << "A[" << i <<"] = " << array[i] << endl;
}
for(int i=0; i<5; i++){
i = index_min;
for(int j=1; j<6; j++){
if(array[index_min]>ar... | true |
cb0c957085ccdb85fb52fab1175b841251b1d1ba | C++ | pumpkin-code/dsba-wshp02 | /wshp2/src/ex1/main.cpp | UTF-8 | 722 | 3.34375 | 3 | [
"BSD-3-Clause"
] | permissive | /*******************************************************************************
* Workshop 2/Task 1
* Studying properties of some basic datatypes.
*
* Use operator sizeof to explore size of all important basic datatypes:
* char, short, int, long, long long, double, bool
*
* For storing results use named variab... | true |
3a548b461861445ce82909e55656a6bfcef8298b | C++ | sahle123/Personal-References | /C++ Codeblocks/SDL Projects/SDL Test/main.cpp | UTF-8 | 1,417 | 3.15625 | 3 | [] | no_license | /*
* Author: LazyFoo productions.
*
* Description: This will serve as a reference for how to start up SDL. I will post and add vital and rudimentary info of SDL
* on this program.
*
*/
#include "SDL/SDL.h"
#include <iostream>
int main(int argc, char* args[])
{
// The im... | true |
3baef312c8d565042905db7f754a27167d992cc3 | C++ | gursangat22/git-test | /letusc++/STL algorithm transform().cpp | UTF-8 | 1,076 | 3.5625 | 4 | [] | no_license | /*
#include <bits/stdc++.h>
using namespace std;
int increment(int x) { return (x+1); }
int main()
{
int arr[] = {1, 2, 3, 4, 5};
int n = sizeof(arr)/sizeof(arr[0]);
// Apply increment to all elements of
// arr[] and store the modified elements
// back in arr[]
transform(arr,... | true |
40346b59deb931276758cb4d93fdc6c4ba4bcdc8 | C++ | poojaaggarwal/Google-KickStart | /2017/Round G/Problem B/CardsGame.cpp | UTF-8 | 1,815 | 3.15625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> parent;
vector<ll> rank_vertex;
struct edge
{
ll v1;
ll v2;
ll cost;
edge(ll a,ll b, ll c):v1(a),v2(b),cost(c){};
};
bool compare(edge a , edge b){
return (a.cost < b.cost);
}
ll findParent(ll ... | true |
10493c5be930523d55023a444a90addf7a0ca754 | C++ | DaoLinZhou/CppCommonLibrary | /sort/ReverseOrder.h | UTF-8 | 1,321 | 3.09375 | 3 | [] | no_license | //
// Created by Daolin on 2019/6/14.
//
#ifndef ALGORITHM_REVERSEORDER_H
#define ALGORITHM_REVERSEORDER_H
#include <iostream>
#include "SortTestHelper.h"
using namespace std;
template <typename T>
long long __merge(T arr[], int l, int mid ,int r){
T* aux = new T[r-l+1];
for(int i=l; i<=r; i++)
aux... | true |
8c063ada28031b6cb06cf07ea79c3f0f8275b5e1 | C++ | SubashChandra/placements-Mtech | /3_map/6_lenOfLargestSubarrayWithContElem.cpp | UTF-8 | 654 | 2.96875 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
#include<set>
using namespace std;
void auxFunc(int arr[], int n)
{
set<int> s;
set<int>::iterator it;
int maxLen=0;
int minElem,maxElem;
int i,j;
for(i=0;i<n-1;i++)
{
s.insert(arr[i]);
minElem=arr[i];
maxElem=arr[i];
for(j=i+1;j<n;j++)
{
it=s.find(arr[j]);
... | true |
477afbba262a19f5270948182f2f2c80d1b5366c | C++ | Ro4z/DataStructure_Study | /Sequence/Sequence.h | UTF-8 | 550 | 3.09375 | 3 | [] | no_license | #pragma once
#ifndef SEQUENCE_H
#include<iostream>
class Node {
public:
int data;
Node* prev;
Node* next;
Node(int n) {
data = n;
prev = NULL;
next = NULL;
}
};
class Sequence {
public:
Node* head;
Node* tail;
int capacity;
Sequence() {
capacity = 0;
head = NULL;
tail = NULL;
}
int size();
bo... | true |
def29226cf09670d0810f63271c5925253bc2988 | C++ | sungiant/img2sky | /src/greedy.cpp | UTF-8 | 1,268 | 2.625 | 3 | [
"Unlicense"
] | permissive | #include "main.h"
#include <iostream>
void scripted_preinsertion(std::istream& script)
{
char op[4];
int x, y;
while(script.peek() != EOF)
{
script >> op >> x >> y;
switch(op[0]) {
case 's':
if(!mesh->is_used(x, y)) {
mesh->select(x, y);... | true |
7a6d6b34220313b42969f81f62bdc35519b05ee8 | C++ | zcnet4/putils | /QuadTree.hpp | UTF-8 | 3,606 | 3.015625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <stdexcept>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstddef>
#include "Point.hpp"
#include "fwd.hpp"
namespace putils {
template<typename Contained, typename Precision = int, std::size_t MaxChildren = 4>
class QuadTree {
public:
struct Obj {
... | true |
683bb3a624055e9bf1c2375a6c65141422e27667 | C++ | juciny/3D-database | /ConsoleApplication1/conn.cpp | GB18030 | 2,414 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <mysql.h>
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "libmysql.lib")
using namespace std;
class conndba
{
private:
MYSQL mydata;
public:
conndba()
{
//ʼݿ
if (0 == mysql_library_init(0, NULL, NULL))
{
cout << "mysql_library_init() succeed" << endl... | true |
ceff435d28acbc7355b17909cf84be41366b634d | C++ | mxxu/leetcodeOJ | /missingnum.cpp | UTF-8 | 488 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int missingNumber(vector<int>& nums) {
int res = 0;
for(size_t i = 0; i <= nums.size(); ++i)
{
res ^= i;
}
for(size_t i = 0; i < nums.size(); ++i)
{
res ^= nums[i];
}
return res;
}
};
int main (int... | true |
97d4e5113e2bbb192d29d9c694aa8765cc59a19c | C++ | oscpe262/TDDI14 | /Lab1.Listan/iterativ/test.cc | UTF-8 | 311 | 3.078125 | 3 | [] | no_license | #include "List.h"
#include <iostream>
#include <utility>
using namespace std;
int main() {
List lista_1;
List lista_2(lista_1);
// kopieringskonstruktorn används
List lista_3(std::move(lista_1)); // move-konstruktorn används (om den finns)
lista_1 = std::move(lista_2);
List lista{1,2,3,4,5};
}
| true |
6bea2df1b946dea491ddf6ce42b0db4b899a9846 | C++ | SamuelSS09/ENSEIRB_projet_cpp | /src/Vhs.cpp | UTF-8 | 1,041 | 3.21875 | 3 | [] | no_license | #include "Vhs.h"
// const string class_index = "3";
Vhs::Vhs():Media(){
length = 0;
producer = "";
this->class_index = 4;
}
Vhs::Vhs(string title,string author,int length,string producer)
: Media(title,author) {
this->set_length(length);
this->set_producer(producer);
this->class_index = 4;
}
Vhs::Vhs(vector<s... | true |
4e2c954cc4be6a364456195edbb60b0f2d9fa76f | C++ | PMRocha/Laig | /segunda entrega/LAIGvs10/src/SceneFlag.cpp | UTF-8 | 363 | 2.546875 | 3 | [] | no_license | #include "SceneFlag.h"
SceneFlag::SceneFlag() :
plane(100)
{
}
SceneFlag::SceneFlag(std::string texture) :
plane(100),
shader("flag.vert", "flag.frag", texture)
{
std::cout << "Shader intialized." << std::endl;
}
void SceneFlag::draw() {
glPushMatrix();
glScalef(10.0f, 1.0f, 10.0f);
shader.bind();
plane.dr... | true |
68596f831c01f1cc45a51949e84851c56cdaff42 | C++ | KarolinaIliash/TransportEmpire | /Model/City.h | UTF-8 | 1,112 | 2.765625 | 3 | [] | no_license | #pragma once
#include "Location.h"
#include "Database/Entity.h"
#include <QVector>
#include <QString>
#include <QJsonArray>
#include <QJsonObject>
#include <QDebug>
class City:public db::Entity
{
PERSISTENT
private:
QString placeID;
QString formatedAddress;
Location location;
pu... | true |
f3b1f73616c79eb232c7ab547988f6ec49062dfe | C++ | chouqiji/flawdetector_new | /flawdetector/inc/component/utility.h | UTF-8 | 567 | 2.828125 | 3 | [] | no_license | #ifndef UTILITY_H
#define UTILITY_H
#include <utility>
namespace Component {
template <typename T>
inline T subset(const T& in, int lower, int upper)
{
T ret;
for(int i = lower; i <= upper; ++i)
ret<<in[i];
return std::move(ret);
}
template <typename T>
inline T limitUp(const T& in, const T& up... | true |
93a3d8c792ebf205d745b8d1020815523e31c7bb | C++ | xlshn/BcdPower | /QtPowerBCD/DiskIo.cpp | UTF-8 | 539 | 2.65625 | 3 | [] | no_license | #include "DiskIo.h"
HANDLE DiskIO::OpenDisk(int diskIndex)
{
wchar_t pwszDiksPath[MAX_PATH] = { 0 };
wsprintf(pwszDiksPath, L"\\\\.\\PhysicalDrive%d", diskIndex);
return CreateFile(pwszDiksPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
... | true |
c42a3fb986a922c5dc8a11e5fa53076e399cb523 | C++ | duboisbarron/file_system2 | /locks.h | UTF-8 | 2,062 | 3.421875 | 3 | [] | no_license | #include <pthread.h>
class a4_rwlock {
private:
/* example of defining integers:
* int num_reader, num_writer;
* example of defining conditional variables:
* pthread_cond_t contitional_variable;
*/
/* Your Part II code goes here */
int waitingWriters;
int waitingReaders;
... | true |
b3e46658c71d1d109983450ca0d1b34764235008 | C++ | wes06/indicator | /Firmwares/Indicator-wifi-LXI-test/Indicator-wifi-LXI-test.ino | UTF-8 | 3,146 | 2.65625 | 3 | [] | no_license | /*
Based on Chat Server
*/
#include <SPI.h>
#include <WiFi101.h>
#include "credentials.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key ... | true |
a11d986b0de59e84acf65601767bafe57b3d0ec4 | C++ | blanerhodes/backUpFiles | /projects/docWebMap/main.cpp | UTF-8 | 1,431 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <sstream>
#include "Document.h"
int main() {
std::vector<std::string> someTags {"Character", "Main Story", "Good"};
std::string testTitle = "Blane";
std::string testContent = "Blane is a main story character on the good side.";
Document *testDoc = new Do... | true |
ba4df951486b873029ba4eabda5bf20ebc176f87 | C++ | lukaszgemborowski/cpptoolbox | /src/system/popen.cxx | UTF-8 | 702 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "toolbox/system/popen.hpp"
#include "toolbox/string/cat.hpp"
namespace toolbox
{
Popen::Popen(std::string_view command, std::initializer_list<std::string_view> arguments, Mode mode)
{
auto cmd = string::cat(command, arguments);
fd = popen(cmd.c_str(), mode == Mode::Read ? "r" : "w");
}
Popen::Popen(... | true |
1096654e201c2a52cc02d59693fa73531d46fde5 | C++ | pranphy/GraphSearch | /src/Base/Problem.cpp | UTF-8 | 1,953 | 3.375 | 3 | [] | no_license | #include "Base/Problem.h"
Problem::Problem()
{
//ctor
}
Problem::Problem(SlideCore Begin, SlideCore End):InitialState(Begin),GoalState(End){}
bool Problem::IsGoal(Node& TestNode)
{
SlideCore CurrentState = TestNode.GetState();
return GoalState == CurrentState;
}
void Problem::DisplayInfo()
{
cout<<" My initial... | true |
3c4ecc5f3969f433b7f60e9922d1d6a3ed00a03b | C++ | ravi-dafauti/DataStructures | /Heap/SortAtMostKSortedArray.cpp | UTF-8 | 672 | 3.546875 | 4 | [] | no_license | #include<iostream>
#include<queue>
#include<functional>
using namespace std;
void sortK(int arr[], int n, int k)
{
int i, j;
priority_queue<int, vector<int>, greater<int>> pq;
for (i = 0; i <= k&&i < n; i++)
{
pq.push(arr[i]);
}
for (i = 0, j = k + 1; i < n&&j<n; i++, j++)
{
arr[i] = pq.top()... | true |
e2bddbca8520dfcda43a888a7a6e17117c1ef620 | C++ | digitalmeltingculture/framework | /src/Transition.cpp | UTF-8 | 1,117 | 2.875 | 3 | [] | no_license | /*
* Transition.cpp
*
* Created on: Dec 1, 2014
* Author: prisca-davide
*/
using namespace std;
#include <iostream>
#include <string>
#include <list>
#include "../include/Content.h"
#include "../include/TmpTransition.h"
#include "../include/State.h"
#include "../include/Transition.h"
Transition::Transiti... | true |
6314d7796623f904d7d193361f12488c5a1cd950 | C++ | daria-grebneva/OOP | /LR_03/TVSet_tests/RemoteControl_tests.cpp | UTF-8 | 2,624 | 3.078125 | 3 | [] | no_license | #include "stdafx.h"
#include "../TVSet/CTVSet.h"
#include "../TVSet/RemoteControl.h"
using namespace std;
TEST_CASE(" ", "[Remote_Control]")
{
struct RemoteControlDependencies
{
CTVSet tv;
std::stringstream input;
std::stringstream output;
};
struct RemoteControlFixture : RemoteControlDepend... | true |
e06e68bcc6c7656458c0d1f4170ef4d6304e5419 | C++ | davidteket/cpp11 | /exercises/05_a_tour_of_c++_containers_and_algorithms/09/test/write_integers_to_file_unittest.cc | UTF-8 | 1,144 | 3.234375 | 3 | [] | no_license | #include <string>
#include <iostream>
#include <fstream>
#include "gtest/gtest.h"
#include "write_integers_to_file.h"
TEST(WriteIntegersToFile, IsValidFileContents)
{
// Arrange:
//
std::string expected = std::string();
for (int i = 0; i < 1000; ++i)
{
expected += std::to_string(i);
... | true |
ecf59c45fa0378592ec5868fb70d4d1a2174ade0 | C++ | sxpsxp12/FailureCheck | /Src/LogicalLayer/CustomInfoClass/delayinfoclass.h | UTF-8 | 1,567 | 2.59375 | 3 | [] | no_license | #ifndef DELAYINFOCLASS_H
#define DELAYINFOCLASS_H
#include <QString>
#include <QList>
class DelayInfoClass
{
public:
DelayInfoClass();
DelayInfoClass( const QString &delayId, const int &logicalRelationship, const int &delaySeconds,
const int &delayValue, const int &delayConditionNum, con... | true |
a9a8fb7af755594c17ee23c545e816d07fd13ee9 | C++ | Tohnmeister/TDD-training | /solutions/03 cruisecontrol/cpp/CruiseControl/CruiseControl/CruiseControl.cpp | UTF-8 | 484 | 2.640625 | 3 | [] | no_license | #include "CruiseControl.h"
#include "Hardware.h"
CruiseControl::CruiseControl(IHardware& hardware) :
_hardware(hardware)
{
}
CruiseControl::~CruiseControl()
{
}
void CruiseControl::tick()
{
if (_hardware.isBreakPressed() || _hardware.isClutchPressed())
{
_hardware.disableCruiseControl();
}
if (_hardware.isCr... | true |
fe3f06f3064511ad3bc380b699ddecb4c9a0c429 | C++ | Mononster/ChamberCrawler | /DLC/cc3kDLC/items/item.h | UTF-8 | 320 | 2.546875 | 3 | [] | no_license | #ifndef ITEM_H
#define ITEM_H
#include "../Game/toInclude.h"
#include "../Game/cell.h"
class Item
{
protected:
std::string name;
Cell* itemCell;
public:
Item(std::string name,Cell *update);
virtual Cell* getCell();
void setCell(Cell *);
virtual ~Item(){}
virtual std::string getName();
/* data */
};
#endif
| true |
577a97d134fad6aab32aea95431367b50e4e49cc | C++ | yonggwi-cho/IroIro | /lib/Measurements/FermionicM/source.hpp | UTF-8 | 489 | 2.75 | 3 | [] | no_license | /*! @file source.hpp
* @brief Definition of Source abstract base class
*/
#ifndef SOURCE_INCLUDED
#define SOURCE_INCLUDED
#include "include/field.h"
/*! @brief Virtual base class for sources */
class Source{
public:
virtual ~Source(){}
virtual const Field mksrc(int s,int c)const = 0;
virtual const Field mks... | true |
50d905578d27862fd4a52a59d73a586e57a7a4d1 | C++ | Shubham-tiwari123/palindrome | /palindrom.h | UTF-8 | 699 | 3.203125 | 3 | [] | no_license | #ifndef PALINDROM_H_INCLUDED
#define PALINDROM_H_INCLUDED
#include "linklist.h"
#include <stack>
class Palindrome:public Linklist{
public:
int palindrome(Palindrome);
};
int Palindrome::palindrome(Palindrome p1){
int flag =0;
stack <int> s;
temp = p1.start;
while(temp!=NULL){
s.push(temp->da... | true |
23f00e6642dd0a2c3687c48e1ef69f868a3f47b7 | C++ | koay9f/AMO-Tools-Suite | /include/calculator/pump/OptimalDeviationFactor.h | UTF-8 | 844 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* @brief Header file for OptimalDeviationFactor class
*
* This contains the prototypes of OptimalDeviationFactor calculator including getters and setters for the important fields.
*
* @author Subhankar Mishra (mishras)
* @author Gina Accawi (accawigk)
* @bug No known bugs.
*
*/
#ifndef AMO_LIBRARY_OPTIMAL... | true |
575a0157ddcb7a58616dd854ab4a06e7dede5803 | C++ | kotunde/SourceFileAnalyzer_featureSearch_and_classification | /Sapi_Dataset/Data/user8/labor5/feladat1/main.cpp | UTF-8 | 2,457 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include <list>
#include "list.h"
using namespace std;
bool compare( List& l1, list<int>& l2);
int main()
{
List list1;
list<int> list2;
list<int> list3;
list<int> list4;
list1.insertFirst(1);
list1.insertFirst(2);
list1.insertFirst(3);
list1.i... | true |
8d00af319c787db78d0e5f1a4fb8d033d3e9b49b | C++ | mfkiwl/lfortran | /src/lfortran/parser/parser.h | UTF-8 | 3,054 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef LFORTRAN_PARSER_PARSER_H
#define LFORTRAN_PARSER_PARSER_H
#include <fstream>
#include <algorithm>
#include <memory>
#include <lfortran/containers.h>
#include <lfortran/parser/tokenizer.h>
namespace LFortran
{
class Parser
{
public:
std::string inp;
public:
Allocator &m_a;
Tokenizer m_tokenizer;... | true |
e70b1f04dc9da08c3233ed6a5d50040136de0622 | C++ | sh2393/ECE4960 | /Assignment3/fullMatrix.hpp | UTF-8 | 692 | 2.96875 | 3 | [] | no_license | /*H**********************************************************************
* FILENAME : fullMatrix.hpp
*
* DESCRIPTION :
* Description the full matrix object.
* Expose the full matrix information to public.
*
* AUTHOR : Joyce Huang (sh2393:Cornell University) START DATE : 5 Apr 2019
*
* UPDAT... | true |
b73452a2ad5be902958f485a3847ed9891e28709 | C++ | moeenn/learning | /assignments/07_pointers/03.cpp | UTF-8 | 742 | 4.09375 | 4 | [] | no_license | #include <iostream>
using namespace std;
void swap(int* num1, int* num2) {
int tmp = *num1;
*num1 = *num2;
*num2 = tmp;
}
int main() {
int a,b,c,d,e;
int count = 5;
int* numbers[count] = { &a, &b, &c, &d, &e };
// take input from user
for(int i = 0; i < count; i++) {
cout << "Enter Number: ";
cin >> *nu... | true |
02853d8eaf69f667bbd17bcce61ea17c4ef6f57b | C++ | PKua007/obstructed_tracer | /src/simulation/random_walker/GPURandomWalker.h | UTF-8 | 5,032 | 3.015625 | 3 | [] | no_license | /*
* GPURandomWalker.h
*
* Created on: 26 sie 2019
* Author: pkua
*/
#ifndef GPURANDOMWALKER_H_
#define GPURANDOMWALKER_H_
#include <vector>
#include "simulation/RandomWalker.h"
#include "simulation/Trajectory.h"
#include "simulation/MoveGenerator.h"
#include "simulation/MoveFilter.h"
#include "simulation... | true |
b7dd58143322b3e472d039708d0aa73409fae766 | C++ | cs2b01/uniforminterface-macarenaoyague | /Documents/Cursos de carrera/POO 2/Clases Rivas 2019-1/c1/main.cpp | UTF-8 | 1,152 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "BMI.h"
using namespace std;
int main() {
string name;
int height;
double weight;
cout<<"Enter your name";
cin>>name;
cout<<"Enter your height";
cin>>height;
cout<<"Enter your weight";
cin>>weight;
BMI Student_1(name,height,weight);
//... | true |
7b8db10dfb0451c074898ee017a7823baedac6bb | C++ | Xelous/CommandLineCommandExample | /CommandExample/CommandBase.h | UTF-8 | 913 | 2.859375 | 3 | [] | no_license | #pragma once
#include <string_view>
#include <string>
// Whatever commands defined wherever, but we're using inheritance to let the compiler help
// affirm new commands are valid for use, even though this introduces a requirement to allocate
// rather than using a static function later (because the command class is e... | true |
bfbedd9faf882a2dcb4bae91e85f19c9d7d16090 | C++ | lebastr/pqsort | /src/main.cpp | UTF-8 | 1,600 | 3.3125 | 3 | [] | no_license | // First argument is a sort method
// Second argument is a array size
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include "quicksort.h"
#include "pquicksort.h"
int main (int argc, char* argv[]) {
std::string sort_method;
int M = std::atoi(argv[2]);
int NSiz... | true |
564759b7f55b4570e20d740aff4b4be1a69ca053 | C++ | ZodiacNumblzw/LZW-ACM-Template | /LZW_ACM_Template/Data Structure/树状数组.cpp | GB18030 | 2,248 | 3.03125 | 3 | [] | no_license | //״ ά
int a[maxn];
int c[maxn];
int lowbit(int x)
{
return x&(-x);
}
void update(int pos,int r,int val) // posλ+val O(logn)
{
for(int i=pos;i<=r;i+=lowbit(i))
{
c[i]+=val;
}
}
int getsum(int x) //ѯ1xǰO(logn)
{
int sum=0;
for(int i=x;i>=1;i-=low... | true |
329a6fe780f5e674e0b0dcb359d6d5bbef6a5009 | C++ | LauraSirbu/COB | /algorithms/container/vector/arrayvector.h | UTF-8 | 6,073 | 2.890625 | 3 | [] | no_license | #pragma once
#include <memorytracking.h>
#include "defaultvectorimplementation.h"
namespace kaos {
//-----------------------------------------------------------------------------------------------------------
template <
typename ObjectT,
typename HeapT = memory::legacy_heap_singleton_t
>
class ArrayVector
{
public... | true |
205636bd785d0b604b3f4536c13d46c1286532dd | C++ | MaxBushuev/nntu_hospital | /Patient.cpp | UTF-8 | 3,137 | 3.71875 | 4 | [] | no_license | #include "Patient.hpp"
#include <iostream>
#include <fstream>
using namespace std;
/**
* @brief Реализация класса Patient
*
* @param name ФИО пациента
* @param diagnosis Диагноз пациента
* @param departament Отделение, в котором лежит пациент
* @param days Дней госпитализации
* @param date Дата, когда пациент... | true |
6093576144ed2e4caa6b8be43a3b97fa5aa9c247 | C++ | JeongTaeLee/TwoKids | /TwoKids_Project/TeamProject_TwoKids/cCollisionManager.cpp | UTF-8 | 2,132 | 2.515625 | 3 | [] | no_license | #include "DXUT.h"
#include "cCollisionManager.h"
#include "cCollider2D.h"
cCollisionManager::cCollisionManager()
{
}
cCollisionManager::~cCollisionManager()
{
}
void cCollisionManager::AddCollider(shared_ptr<cCollider2D> collider)
{
for (auto Iter : liColliders)
{
if (Iter == collider)
return;
}
liCollid... | true |
a4a021b690188dc0cfce82d6be1623b8516984cf | C++ | keisuke-kanao/my-UVa-solutions | /Contest Volumes/Volume 114 (11400-11499)/UVa_11404_Palindromic_Subsequence.cpp | UTF-8 | 1,718 | 3.140625 | 3 | [] | no_license |
/*
UVa 11404 - Palindromic Subsequence
To build using Visual Studio 2012:
cl -EHsc -O2 UVa_11404_Palindromic_Subsequence.cpp
*/
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdio>
#include <cstring>
using namespace std;
const int nr_chars_max = 1000;
struct lcs { // longest common subse... | true |
081b44dec145a5e268292f7be587859d57f2801b | C++ | brock7/TianLong | /Common/Packets/CGAskMyBagList.h | UTF-8 | 1,755 | 2.859375 | 3 | [] | no_license | #ifndef _CG_ASKMYBAG_LIST_H_
#define _CG_ASKMYBAG_LIST_H_
#include "Type.h"
#include "Packet.h"
#include "PacketFactory.h"
namespace Packets
{
enum ASK_BAG_MODE
{
ASK_ALL,
ASK_SET
};
class CGAskMyBagList:public Packet
{
public:
CGAskMyBagList(){
m_AskCount = 0;
};
virtual ~CGAskMyBagList(){};
... | true |
2fa41ecda8ec9817ef04248390f72f5239fa7d5d | C++ | jjonah15/Midterm-Project | /Time.cpp | UTF-8 | 3,067 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
using namespace std;
#include "Time.h"
ostream& operator<<(ostream& output, const Time& arg)
{
output << ((arg.hour == 0 || arg.hour == 12) ? 12 : arg.hour % 12) << ":"
<< setfill('0') << setw(2) << arg.minute << (arg.hour < 1... | true |
966358ef0b14a3c8970842f39429b090e5ac495e | C++ | phzhou76/technical-problems | /TechnicalProblems/NumberOfOneBits.h | UTF-8 | 782 | 3.65625 | 4 | [] | no_license | #pragma once
#ifndef _NUMBER_OF_ONE_BITS_H_
#define _NUMBER_OF_ONE_BITS_H_
/**
* Write a method that takes in an unsigned integer and returns the number of
* '1' bits.
*
* Source: https://leetcode.com/problems/number-of-1-bits/description/
*/
class NumberOfOneBits
{
public:
int hammingWeight(int n)
{
int bitC... | true |
a33fd4a24f76730846728603c95556d53a95d4c4 | C++ | gottschalkbrigid89/netwars | /src/game/networking/connection.h | UTF-8 | 1,568 | 2.828125 | 3 | [] | no_license | #ifndef AW_NETWORK_CONNECTION_H
#define AW_NETWORK_CONNECTION_H
#include <ctime>
#include <iostream>
#include <string>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/asio.hpp>
#include <iostream>
#include <string>
#include <deque>
using boost::a... | true |
9bef63357fa2fe0225ade2cf0b6bb379aa83610a | C++ | welterde/reia | /attic/test/builtins/map.re | UTF-8 | 1,377 | 2.953125 | 3 | [
"MIT"
] | permissive | #
# MapTest: Tests for Reia's map type
# Copyright (C)2008 Jared Kuolt, Tony Arcieri
#
# Redistribution is permitted under the MIT license. See LICENSE for details.
#
module MapTest
def run
[
index_test(),
compare_test(),
remove_test(),
size_test(),
keys_test(),
has_tes... | true |
e5e0ac310865527aa5e935797448d715886147fc | C++ | mwilsnd/SkyrimSE-SmoothCam | /SmoothCam/include/render/line_graph.h | UTF-8 | 1,638 | 2.75 | 3 | [] | no_license | #pragma once
#ifdef WITH_D2D
#include "render/d3d_context.h"
#include "render/gradbox.h"
namespace Render {
class LineGraph : public GradBox {
public:
LineGraph(uint8_t numPlots, uint32_t maxPoints, uint32_t width, uint32_t height, D3DContext& ctx);
~LineGraph();
LineGraph(const LineGraph&) = delete;
Li... | true |
3e0443634fbdd50b3890fa62db21fdc5d25afe47 | C++ | zmukwa/CS106B-2 | /InverseGenetics.cpp | UTF-8 | 2,964 | 3.21875 | 3 | [] | no_license | /* File: InverseGenetics.cpp
*
* A program that, given a sequence of amino acids, returns all possible
* RNA strands that could encode that amino acid sequence.
*/
#include <iostream>
#include <string>
#include <fstream>
#include "set.h"
#include "map.h"
#include "simpio.h"
#include "console.h"
#include "foreach.h"... | true |
fbeb3d00e2112bfa8bc3d2c37d79cb743858576b | C++ | pedropalmeros/System_Monitor | /src/processor.cpp | UTF-8 | 1,378 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "processor.h"
#include "linux_parser.h"
#include <vector>
#include <string>
#include <iostream>
using std::vector;
using std::string;
using std::stoi;
// TODO: Return the aggregate CPU utilization
float Processor::Utilization() {
if(first_loop){
prevVals = {0,0,0,0,0,0,0,0,0,0};
first_loop = false... | true |
888685c3e53cec90f8338c21dd44d285939feaf4 | C++ | simonusher/zmpo-function-tree | /ZM3_Tree/Interface.cpp | UTF-8 | 4,684 | 3.203125 | 3 | [] | no_license | #include "Interface.h"
Interface::Interface() {
this->treeManager = new TreeManager();
this->finished = false;
}
Interface::~Interface() {
delete this->treeManager;
}
void Interface::run() {
std::cout << HELP_PROMPT;
while (!finished) {
printCommandPrompt();
readCommand();
splitCurrentCommand();
selectA... | true |
00ac7286f0d831b0d3b0a3bc5ffd9f2ab822ea62 | C++ | 1605919/MPScrabble | /0. C++ Code/Logic Game/Scrabble/Board.cpp | WINDOWS-1252 | 1,447 | 2.84375 | 3 | [] | no_license | //
// Board.cpp
// Scrabble
//
#include "Board.h"
#include <algorithm>
#include <iostream>
#include <fstream>
Board::~Board()
{
}
PositionResult Board::setTile(Tile& tile, const BoardPosition& boardPos)
{
return VALID_POSITION;
}
CurrentWordResult Board::checkCurrentWord(int& points)
/* ... | true |
12361f6eb3c2ea8ae764e65ce10414d0e6b903ad | C++ | saljashamy/CS2560 | /hw6/employee-production-exception/EmployeeException.h | UTF-8 | 338 | 2.890625 | 3 | [] | no_license | #ifndef EMPLOYEEEXCEPTION_H
#define EMPLOYEEEXCEPTION_H
#include <exception>
class EmployeeException : public std::exception {
const char * msg;
EmployeeException() {};
public:
explicit EmployeeException(const char * s) throw() : msg(s) { }
virtual const char * what() const throw() { return ... | true |
51b66524bf88291dec1312b9d5954bb56a739123 | C++ | fmi-lab/fmi-lab-sdp-2019-kn-group2-sem | /ex14/graph.cpp | UTF-8 | 5,274 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
class Person {
};
template <typename V, typename COST = int, COST DEFAULT_COST = 0>
class Graph {
public:
void addVertex(V vertex) {
vertexes.push_back(vertex);
// add default empty relations for the current vertex
... | true |
6d14afb25e4da3d5fb2879782b471953d176d87f | C++ | yaoxiaokui/linux_ever | /stlsrc/template_stl/ch11/search2.cpp | UTF-8 | 868 | 3.109375 | 3 | [] | no_license | /*************************************************************************
> File Name: search.cpp
> Author:
> Mail:
> Created Time: 2016年01月09日 星期六 11时31分13秒
************************************************************************/
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std... | true |
a11ea9ef58ffeb27d50518632e7df1cbc01eb265 | C++ | majecty/CapitalBreak | /CPlayer.cpp | UHC | 3,060 | 3.03125 | 3 | [] | no_license | #include "common.h"
#include "CPlayer.h"
#include "Configuration.h"
CPlayer::CPlayer()
{
Reset();
}
void CPlayer::Reset()
{
ZeroMemory(__mPlayerName, sizeof(__mPlayerName));
__mDept = 0;
__mCreditorCount = 0;
__mCurrentCard = (ECard)0;
__mCurrentRank = eFirstRank;
__mGrade = START_GRADE; /... | true |
eca822652897629671334388a641c7c76fee4268 | C++ | Mishkuh/wsu | /wsu/csci/labs/Lab_Inheritance_02/Source.cpp | UTF-8 | 447 | 3.09375 | 3 | [] | no_license | // main.cpp
#include "Header.h"
int main(void)
{
Base* ptr = new Base;
ptr -> testFunction (); // prints "Base class"
delete ptr;
ptr = new Derived;
ptr -> testFunction (); // prints "Base class" because the base class function is not virtual
delete ptr;
Mammal ... | true |
fc395afb244137e325837c514e086ba43be86097 | C++ | RichardRios/Generic-BST | /BST/main.cpp | UTF-8 | 312 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "BST.h"
using namespace std;
int main(int argc, char* argv[])
{
BinarySearchTree<int> bst;
for (int i = 0; i < 10; i++)
{
bst.insert(i);
}
bst.showInOrder();
bst.showInPreOrder();
bst.showInPostOrder();
bst.~BinarySearchTree();
getchar();
return 0;
} | true |
3932a4cb637a8477783ea78a52ee567fbdb04604 | C++ | whyisme/MahjongPanic | /server/polling.cc | UTF-8 | 2,607 | 2.59375 | 3 | [] | no_license | #include "polling.h"
#include "sockinit.h"
#include "threadpool.h"
DataManager *DataManager::dm(NULL);
DataManager *DataManager::getInstance()
{
if (dm == NULL)
dm = new DataManager();
return dm;
}
DataManager::DataManager() : receivepool(THREAD_INIT_AMOUNT, this, &DataManager::receiveData), handlepool(THREAD_IN... | true |
326354223ef175033d5fcb3d0290513b88f94d17 | C++ | clauskovacs/opengl-template | /include/graphicsRendering.hpp | UTF-8 | 1,581 | 2.71875 | 3 | [
"MIT"
] | permissive | /* This file contains the (header)functions used to render graphics on the screen.
*
* These are mainly glut- and OpenGL functions, responsible for drawing
* on the screen as well as handling the user input (mouse and keyboard).
*/
#ifndef GRAPHICSRENDERING_H
#define GRAPHICSRENDERING_H
/**************/
/** vari... | true |