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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0cbfb02002df1b5f37da71e5a42841cae2f36426 | C++ | NathanBruce/nathanbruce-CSCI20-Fall2017 | /lab32/lab32.cpp | UTF-8 | 7,200 | 3.84375 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
/*
Nathan Bruce
10/12/2017
This program calculates how much a user owes for taxes (or refunds they are entitled to).
It does this by reducing the tax rate by personal exemption and marital status, and then running the remainder through the appropriate tax bra... | true |
a27efb00d663c2c9f89bce07c6c46724271c2cb6 | C++ | In2ne1/Mine | /C++/模拟实现string类函数/main.cpp | UTF-8 | 598 | 2.9375 | 3 | [] | no_license | int main()
{
String s1("aaaaa");
cout << s1 << endl;
cout << s1.append(4, 'n') << endl;
cout << s1.append("bbb") << endl;
cout << s1.find('n') << endl;
String s2("Thanks for your help!");
cout << s2 << endl;
s2.insert("useful ", 15); //const char* str, pos
s2.insert("useful ", 7, 15); //const char... | true |
1cb34626d2e1568119ce8d1495c0de435270b1ef | C++ | TissueFluid/Algorithm | /LintCode/Route Between Two Nodes in Graph.cc | UTF-8 | 1,229 | 3.609375 | 4 | [] | no_license | // Route Between Two Nodes in Graph
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
using namespace std;
struct DirectedGraphNode {
int label;
vector<DirectedGraphNode *> neighbors;
DirectedGraphNode(int x) : label(x) {};
};
class Solution {
public:
/**
* @param g... | true |
e520995844e4aa1a10749e8807d2e74ed5e01618 | C++ | sc-0571/cppPoc | /cppPoc/PartitionEqualSubset.cpp | UTF-8 | 1,924 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string.h>
using namespace std;
bool canPartition(vector<int>& nums) {
int half = 0;
for (int i=0; i< nums.size(); i++) half += nums[i];
if (half %2 != 0) return false;
half /=2;
int n = nums.size();
int MAX = n * 100;
int ... | true |
2936d494367cdc24684a4e12aa8f8e51aca19b5b | C++ | tcagame/Attraction2016 | /Solution/Client/BulletImpact.cpp | UTF-8 | 1,125 | 2.890625 | 3 | [] | no_license | #include "BulletImpact.h"
#include "Effect.h"
const int POWER = 100;
const int WAIT_TIME = 8;
const int ANIMATION_TIME = 10;
const double RANGE = 3 * Bullet::BULLET_SCALE;
const double EFFECT_SCALE = 0.5 * Bullet::BULLET_SCALE;
BulletImpact::BulletImpact( const Vector& pos, const Vector& dir, int power )
: Bullet( Bu... | true |
034a1af27eb9774430fd36628d0a014037dae7e2 | C++ | Asif-Al-Rafi/Project1 | /main.cpp | UTF-8 | 742 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include "SelectionSortUsArray.h"
#include "InsertionSortUsArray.h"
#include "MergeSortUsArray.h"
#include "BubbleSortUsArray.h"
using namespace std;
int main()
{
SelectionSort asif;
int arr[] = {10,33,27,14,35,19,48,44};
int size = 8;
asif.SelectionSorter(arr,size);
Inser... | true |
280a26b1c4093c9bc1b415fc2386ccc208430451 | C++ | naknaknak/3D_Game_Portfolio | /Old_Version/map_8.3.0(피격추가)/Base_3D/Quest.h | UTF-8 | 603 | 2.609375 | 3 | [] | no_license | #pragma once
#include "image.h"
#include "TextDraw.h"
#include "Button.h"
enum QuestType
{
QUEST_START = 0,
QUEST_MIDDLE,
QUEST_END,
QUEST_NUM
};
class Quest
{
public:
private:
QuestType type = QUEST_START;
image* imageBack = nullptr;
TextDraw text_title;
TextDraw text_body;
Button buttonOk;
TextDraw te... | true |
b170cf59d028f4c3466feae1b79505383251071f | C++ | wayfinder/Wayfinder-Server | /Server/Modules/RouteModule/include/RedBlackNode.h | UTF-8 | 3,278 | 2.640625 | 3 | [] | no_license | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of condit... | true |
c4f44ff2b1c407226c8ca088211184df7a3ed4fe | C++ | Stephen1993/ACM-code | /hdu1333之求素因子.cpp | GB18030 | 1,092 | 3 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<iomanip>
#define INF 99999999
using namespace std;
const int MAX=20;
int prime_factor[MAX],factor_num[MAX];
bool flag=true;
int digit(int n){
int num=0;... | true |
3e9753592eeb746a410e5140168b64b28a2bd571 | C++ | Borysiakk/BatGUI | /Theme.cpp | UTF-8 | 2,200 | 2.59375 | 3 | [] | no_license | //
// Created by Borysiak on 28.07.2019.
//
#include "Theme.hpp"
#include "Widget.hpp"
#include <iostream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
namespace pt = boost::property_tree;
std::vector<std::string> Theme::WidgetNames =
{
{"Button"},
};
std::map<st... | true |
a4f30ea5bddc54564541a892d8b32cb29cb44639 | C++ | ivannatadash/Lab_OOP_01 | /Lab_OOP_iterator/Lab_OOP_iterator/Student.cpp | UTF-8 | 341 | 3.28125 | 3 | [] | no_license | #include "Student.h"
Student::Student(string l, string i)
{
lastname_name = l;
institute = i;
}
string Student::getLastname_name()
{
return lastname_name;
}
ostream& operator<< (ostream& ostr, const Student& st)
{
ostr << "Student: " + st.lastname_name + "\nInstitute: " + st.institute;... | true |
da7b81c5d4f0b0dadb0f9323a2625b5b61c438d0 | C++ | coolguycoolstory/RaveTowers | /RaveTowerMaster_ESP8266_10APR2019.ino | UTF-8 | 14,215 | 2.515625 | 3 | [] | no_license | /*
This code and the overall design drew heavy inspiration from Hans's "MUSIC VISUALIZING Floor Lamps".
His code can be found here: https://github.com/hansjny/Natural-Nerd/tree/master/SoundReactive2.
Other inspiration came from haag991's code, found here: https://github.com/haag991/Spectrum_Visualizer
This is th... | true |
8c322e3e103726d53c064ea21d5383a78dca457f | C++ | netvipec/AoC2018 | /C++/Day17/day17p1.cpp | UTF-8 | 9,233 | 3.1875 | 3 | [] | no_license | #include <bits/stdc++.h>
enum class Direction { Down, Up };
struct pos {
int x;
int y;
Direction d;
pos(int xx, int yy, Direction dd) : x(xx), y(yy), d(dd) {}
bool operator==(pos const& other) const { return std::tie(y, x, d) == std::tie(other.y, other.x, other.d); }
bool operator<(pos const... | true |
165329ee9ecfa5b0e0cffd2eb637f50fd469dd49 | C++ | floriansimon1/xboy | /src/gameboy/cpu/instructions/dereference-combined-into-single-increment.cpp | UTF-8 | 1,095 | 2.59375 | 3 | [] | no_license | #include <sstream>
#include "dereference-combined-into-single-increment.hpp"
#include "../../../debug/register-string.hpp"
#include "../../gameboy.hpp"
DereferenceCombinedIntoSingleIncrement::DereferenceCombinedIntoSingleIncrement(
CpuRegisterPointer pointerRegister,
CpuRegisterPointer targetRegister,
const sho... | true |
51d39d37398e1b06458c0c3487965e2910130c4a | C++ | WitoldSobczak/PAMSI-lab | /Kolejka/Kolejka.cpp | WINDOWS-1250 | 1,575 | 3.671875 | 4 | [] | no_license | /** Funkcja glowna programu opartego na bibliotece STL Standard Template Library w programie uzywamy adapteras kolejki
* std::queue. okreslany mianem FIFO First In First Out.Adapter ten zawiera nastepujace funkcje ,ktore uzylem w programie:
*
* back Zwraca referencj na ostatni element w kolejce;
* empty Spra... | true |
876f86490d2f47822633c8a302b6f7f4a2c7ef0c | C++ | touyou/CompetitiveProgramming | /aoj/0125.cpp | UTF-8 | 1,284 | 2.578125 | 3 | [] | no_license | #include <cstdio>
int y1, m1, d1, y2, m2, d2;
int day[2][12]={
{31,28,31,30,31,30,31,31,30,31,30,31},
{31,29,31,30,31,30,31,31,30,31,30,31}
};
bool uruu(int year) {
if (year%400==0) return true;
else if (year%100==0) return false;
else if (year%4==0) return true;
else return false;
}
int main() {
wh... | true |
0414747946b0075a859f0f614cfb2ca5f9de2152 | C++ | Lzyuuu/Cpp-Program | /Chapter 5/Interest/Interest/main.cpp | UTF-8 | 848 | 3.46875 | 3 | [] | no_license | //
// main.cpp
// Interest
//
// Created by Zhaoyu Lai on 2019/2/23.
// Copyright © 2019 Zhaoyu Lai. All rights reserved.
//
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
// initialization
double principle{1000.00}; // initial amount
double rate{0.05}; // i... | true |
464887f77b1a30969156a29bf25ac16d744e46b9 | C++ | awnonbhowmik/TicTacToe-in-CPP | /TicTacToe.cpp | UTF-8 | 3,638 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include "TicTacToe.h"
using namespace std;
void TicTacToe::ClearBoard()
{
system("CLS");
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
Board[i][j] = ' ';
}
}
TicTacToe::TicTacToe()
{
ClearBoard();
}
void TicTacToe::PrintBoard(char Board[3][3])
{
cout ... | true |
a5f4c97f99161f5fcaec41ece9e25e6879a5c964 | C++ | mke01/BasicC- | /Day 11/02 The this pointer/Source03.cpp | UTF-8 | 552 | 3.4375 | 3 | [] | no_license | struct Integer
{
int n;
void SetN(Integer *const This, int value)
{
Integer t;
// This = &t; // such assignment is prohibited
This->n = value;
}
};
void SetN(Integer *const This, int value);
int main()
{
Integer u;
u.SetN(&u, 5);
Integer v;
v.SetN(&v, 15);
return 0;
}
/*
When we executed above prog... | true |
99382322ee45b17dbc91165201ce1b3360995cd5 | C++ | XPRIZE/GLEXP-Team-KitkitSchool | /mainapp/Classes/Games/StarFall/StarFall.cpp | UTF-8 | 1,283 | 2.703125 | 3 | [
"Apache-2.0",
"CC-BY-3.0",
"CC-BY-4.0",
"MIT"
] | permissive | //
// StarFall.cpp -- Bubble-falling typing game with a keyboard
// TodoSchool on Jul 22, 2016
//
// Copyright (c) 2016 Enuma, Inc. All rights reserved.
// See LICENSE.md for more details.
//
#include "StarFall.h"
#include "Models/StarFallWorksheet.h"
#include "Core/StarFallScene.h"
#include <numeric>
using todo... | true |
eda2ada2e44aac1bdc252b0db695313bbfbc3ed9 | C++ | preyta/leetcode_oj | /addtwonumber.cpp | UTF-8 | 592 | 3.21875 | 3 | [] | no_license | /**
* * Definition for singly-linked list.
* * struct ListNode {
* * int val;
* * ListNode *next;
* * ListNode(int x) : val(x), next(NULL) {}
* * };
* */
class Solution {
public:
ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) {
int carry=0;
ListNo... | true |
a9c45b7808725147d0f7e2dfedbac62deeecda7d | C++ | wyxTrustYs/Snake | /snake/snake/main.cpp | GB18030 | 2,838 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include "MyGame.h"
#include "MyMap.h"
#include "Print.h"
#include "Snake.h"
#include "SaveAndRead.h"
using namespace std;
int main() {
int option;
char name[10];
int num;
int flat;
Snake snake;
FullScreen();
while (true) {
system("cls");
WriteChar(35, 5, "̰Ϸ");
WriteChar(20, 10, "1ʼϷ"... | true |
373bf84155492c45e5864cd63794ed3fed0b0d66 | C++ | r2kberlin/Ardunio | /Lichtsensor/Lichtsensor.ino | UTF-8 | 531 | 2.921875 | 3 | [] | no_license | int eingang= A7;
int LED = 5;
int sensorWert = 0;
void setup()//Hier beginnt das Setup.
{
Serial.begin(9600);
pinMode (LED, OUTPUT);
//Der analoge Pin muss nicht definiert werden.
}
void loop()
{
sensorWert=analogRead(eingang);
Serial.print("Sensorwert = " ); Serial.println(sensorWert);
if (se... | true |
13cdc1ac983c182e7531789b2bfde04c11820593 | C++ | morphixelf/delegate | /delegate_test.cpp | UTF-8 | 1,450 | 2.8125 | 3 | [
"MIT"
] | permissive | //---------------------------------------------------------------------------
// Created by Morphixelf
// https://github.com/morphixelf/
// The MIT License
//---------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
//---------------------------------------------... | true |
6d71bedec53263b33fdef03f1264c57cd4c98d2d | C++ | Delmurat/C | /2-1.cpp | UTF-8 | 167 | 2.75 | 3 | [] | no_license | #include<stdio.h>
int main()
{
int nArray[10]={1,2,3,4,5,6,7,8,9};
for(int i=0;i<10;i++)
{
printf("%d\n",nArray[i]*2);
}
return 0;
}
| true |
1180d61bee7d0d8055933c438a2fc20526ceff0b | C++ | BJas/InterviewBit | /backtracking/palindrome_partintioning.cpp | UTF-8 | 1,134 | 3.34375 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
bool isPalindrome(string s) {
int i=0, j=s.size()-1;
while(i<j) {
if(s[i]!=s[j])
return false;
i++;
j--;
}
return true;
}
void getPalindrome(string s, vector<string> &subset, vector<vector<string> > &res... | true |
b5c2876073d2292e1433a37d21c6df89373424e5 | C++ | novo1985/Leetcode | /Pairs and Intervals/435. Non-overlapping Intervals.cpp | UTF-8 | 1,019 | 3.734375 | 4 | [] | no_license | /* Given a collection of intervals, find the minimum number of intervals you need to remove
* to make the rest of the intervals non-overlapping.*/
/**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s),... | true |
8aed6a0f050a67719913bcc541915d701cc2acdc | C++ | dreamspot4everyone/No-Exam | /Greedy/Job_Schduling.cpp | UTF-8 | 1,377 | 3.375 | 3 | [] | no_license | #include<iostream>
using namespace std;
struct job
{
int dead;
int profit;
};
void merge(job a[],int l,int mid,int r,int n)
{
int i=l,j=mid+1,k=l;
job z[r+1];
while(i<=mid && j<=r)
{
if(a[i].profit>=a[j].profit)
z[k++]=a[i++];
else
z[k++]=a[j++];
}
while(i<=mid)
z[k+... | true |
f1efcc7fed1565ace532aafb6c7d1fd9586d0da2 | C++ | truong225/Image-editor | /src/Filter.hpp | UTF-8 | 801 | 2.515625 | 3 | [] | no_license | #ifndef FILTER_HPP
#define FILTER_HPP
#include <QVector>
class Filter {
QVector <QVector <qreal> > kernel;
public:
Filter();
Filter(int width, int height);
Filter(const Filter &filter);
static Filter single(int width, int height);
static Filter single(const Filter &filter);
const qrea... | true |
8cb381b5f7969d431fcc3b77d36bb196e5fde309 | C++ | kohei-us/ray-tracing-practice | /constant_medium.cpp | UTF-8 | 1,598 | 2.578125 | 3 | [
"Unlicense"
] | permissive |
#include "constant_medium.h"
#include "material.h"
constant_medium::constant_medium(
const std::shared_ptr<hittable>& b, double density, const std::shared_ptr<texture>& t) :
boundary(b), phase_function(std::make_shared<isotropic>(t)), neg_inv_density(-1/density)
{}
constant_medium::constant_medium(
const... | true |
bbffb2d18383ddcc81d9915e1be3bc3412f97094 | C++ | oneapi-src/oneAPI-samples | /Publications/GPU-Opt-Guide/implicit-scaling/05_stream_cross_stack/stream_cross_stack.cpp | UTF-8 | 2,467 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //==============================================================
// Copyright © 2022 Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================
// clang-format off
// Code for cross stack stream
#include <iostream>
#include <omp.h>
// compile via:
// icpx -O2 ... | true |
23977a8472d29f383a7582618c0b3bdd76b6a124 | C++ | NellyNi/top-k | /table.h | UTF-8 | 667 | 2.78125 | 3 | [] | no_license | #ifndef table_h
#define table_h
#include<vector>
#include<iostream>
#include<string>
#include<sstream>
#include "entry.h"
using namespace std;
class Table {
public:
//constructor
//Table(unsigned int max_entries);
//Table(unsigned int entries, std::istream& input);
Table();
//functions
void put(string key, ... | true |
55ee44a6e0debb7c14b6f51a2818d80cb8bc48fd | C++ | kesslp/CSS343 | /HW4/HW4/ClassicalCD.h | UTF-8 | 473 | 2.640625 | 3 | [] | no_license | #include "Item.h"
#pragma once
class ClassicalCD : public Item
{
friend ostream& operator<<(ostream&, const ClassicalCD&);
friend istream& operator>>(istream&, ClassicalCD&);
public:
ClassicalCD();
ClassicalCD(string, string, string, int);
bool operator<(const Item&);
bool operator>(const Item... | true |
a7c0a71ec6da2008f60bab2be992b78669b194f5 | C++ | SeanWuLearner/leetcode | /src/q0560.h | UTF-8 | 1,078 | 3.40625 | 3 | [
"MIT"
] | permissive | #include <unordered_set>
/*Solution1: hashset the acc*/
class Solution1 {
public:
int subarraySum(vector<int>& nums, int k) {
unordered_multiset<int> memo;
memo.insert(0);
int acc = 0, ans = 0;
for(auto i : nums){
acc += i;
ans += memo.count(acc - k);
... | true |
81de1e7ecc2c1f656a450188b2f2127263ebf698 | C++ | frc5024/PowerUP | /2017_11_27/SetCursorPos/cRobot.cpp | UTF-8 | 1,971 | 2.8125 | 3 | [] | no_license | #include "cRobot.h"
cRobot::cRobot()
{
this->m_pSPThingy = new cSecretPhysics();
this->mass = cRobot::DEFAULTROBOTMASSKG; // 50.0kg
this->m_pXMotor = new cMotor();
this->m_pYMotor = new cMotor();
this->m_physState.position.x = 0.0f;
this->m_physState.position.y = 20.0f;
// this->m_physState.velocity.x = 1.0;
... | true |
e0882771cc73461f6e8d0462d89f328d4a4d6aaa | C++ | nguardadov/EstructurasDinamicas | /grupo2-proyecto/pro/VentanaPrincipal.cpp | UTF-8 | 4,208 | 2.765625 | 3 | [] | no_license | #include "VentanaPrincipal.h"
#include "ClasePuntaje.h"
#include "ClaseJuego.h"
#include <SDL2/SDL_image.h>
#include <iostream>
#include <cstdlib>
VentanaPrincipal::VentanaPrincipal()
{
this -> windows=nullptr;
this ->windowSurface=nullptr;
this ->isRunning=true;
this->player1="";
this->player2="... | true |
ec9e218cdf5deeca712b3ec98d8d69f603866613 | C++ | maeda-lab/Scaledown | /確認用/hirayama_IK_Serial/Serial_Binary_Communication/main.cpp | UTF-8 | 2,418 | 2.6875 | 3 | [] | no_license | // Aug 25, 2020
// Masahiro Furukawa
//
// Serial Binary Communication
#include <math.h>
#include <string>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <Windows.h>
#include "QueryPerformanceTimer.h"
#include "mbed_Serial_binary.h"
// Target Angle in deg
struct TargetAngle {
float J1_deg;
... | true |
a516447ef4afceec2380cd54b122957d2bdc1c0b | C++ | Xavier-Baudry/Battleship_AI | /Battleship_CORE/Battleship_Core.h | ISO-8859-1 | 3,749 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <windows.h>
using namespace std;
#ifndef Battleship_Core_H
#define Battleship_Core_H
#define NUM_OF_GAMES 10
//#define HUMAN_MODE
//#define DELAY
#define FAIL 0
#define MISS 1
#define HIT 2
#define HITNSUNK 3
#define CARRIER '... | true |
6b5f159fbb299a351d0f315254e69f2f5a726436 | C++ | MijaelTola/icpc | /atcoder/abc151F.cpp | UTF-8 | 635 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int,int> > v;
int main() {
cin >> n;
double cx = 0, cy = 0;
for (int i = 0; i < n; ++i) {
int x,y;
cin >> x >> y;
cx += x;
cy += y;
v.emplace_back(x,y);
}
cx /= n;
cy /= n;
... | true |
a51d91096e4081136c0680fce7ff5da750342877 | C++ | jumbuna/data-structures-algorithms | /algs/searching/ExponentialSearch.h | UTF-8 | 532 | 2.75 | 3 | [
"MIT"
] | permissive | #pragma once
#include "BinarySearch.h"
//works on sorted data
//out performs binary search when value may appear toward the beginning
//logarithmic time complexity
//constant space complexity
namespace jumbuna {
template<class T>
int exponentialSearch(T *array, T value, size_t arraySize, int begin = 0) {
if(array[b... | true |
391071a77272bd26916a3f8670dd57702350f589 | C++ | jesusramirez95/Lab-Robotica | /ProyectoFinal/codigos/sensores.ino | UTF-8 | 3,033 | 2.875 | 3 | [] | no_license | #include <Servo.h>
char sensores[50] = {0};
const int trigPin = 8;
const int echoPin = 7;
long duration;
long distance;
int inByte = '0';
int SV1 = 0, SV2 = 0, US = 0;
Servo base; //Definir objetos servos
Servo shoulder;
Servo elbow;
Servo hand;
int hands = 0;
int elbows = 145;
int shoulders = 1;
int base... | true |
a4a39d912a07ec19dec65e30ec6f5849326a52d1 | C++ | qinhx/algorithm | /DP/triangle/dp1.cpp | UTF-8 | 787 | 3.03125 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include <vector>
#include <cstring>
class Solution{
public:
int MaxSum(vector<vector<int> > t,int n){
vector<vector<int> > dp(n,vector<int>(n,0));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i==0){
dp[i][j] = t[i][j];
}else {
if(j==0){
... | true |
50a82fd62569c11ee1ab4928b23b89e3ad56b374 | C++ | ClementAbadie/Eggstia | /HTU21D_Humidity_Temperature.ino | UTF-8 | 654 | 2.6875 | 3 | [] | no_license |
#include "HTU21D_Humidity_Temperature.h"
void setup_HTU21D()
{
#ifdef DEBUG
Serial.println("HTU21D_setup");
#endif
myHumidity.begin();
}
void loop_HTU21D()
{
value_humidity = myHumidity.readHumidity() * HTU21D_HUMIDITY_CORRECTION_RAMP + HTU21D_HUMIDITY_CORRECTION_OFFSET;
value_temperature = myHumidity.readTe... | true |
d942168a00d0945997ca3ef66124007092d79694 | C++ | ajmarin/CTris | /Piece.h | UTF-8 | 458 | 2.546875 | 3 | [] | no_license | /**
* Piece
*/
#include "Block.h"
#include "Config.h"
#include "Defines.h"
#ifndef PIECE_CLASS
#define PIECE_CLASS
class Piece {
Block* parts[4];
Block* projection[4];
int row, col, type, rot;
static Piece* instance;
Piece(int r, int c, int type, int rotation);
void UpdateProjection();
public:
static Piece* Cr... | true |
df99c14beb719db25a7a0c393977bcdd25b487c6 | C++ | samiksha2325/pattern3 | /PATTERN3.CPP | UTF-8 | 409 | 2.515625 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,k,m;
for(i=1;i<=5;i++)
{
for(m=1;m<=i;m++)
{
printf("*");
}
for(j=9;j>=2*i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("*");
}
printf("\n");
}
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("*");
}
for(k=2;k<2*i;k++)
{... | true |
e38c0ab3b32c7f1be1eede9fe757b04cf813b618 | C++ | Ray-SunR/leetcode | /107. Binary Tree Level Order Traversal II/levelOrderBottom.cpp | UTF-8 | 1,416 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct TreeNode
{
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int val, TreeNode* left = NULL, TreeNode* right = NULL)
: val(val)
, left(left)
, right(right){}
~TreeNode() { if (left) delete left; if (right) delete right; }
};... | true |
fb480188ea36325c7d74f9213eb6954b51b4b137 | C++ | mCRL2org/mCRL2 | /libraries/data/include/mcrl2/data/exists.h | UTF-8 | 2,380 | 2.78125 | 3 | [
"BSL-1.0"
] | permissive | // Author(s): Jeroen Keiren
// Copyright: see the accompanying file COPYING or copy at
// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
/// \file mcrl... | true |
3446680f0cb52887b787bde4814748f18216979f | C++ | mirshahzad/C-basic | /Hello World My first program/Hello World My first program/Hello World My first program.cpp | UTF-8 | 438 | 3.125 | 3 | [] | no_license | // Hello World My first program.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
using namespace std;
int main()
{
int var1, var2, result;
cout<<"Please enter the first variable:";
cin>>var1;
cout<<endl<<"Please enter the second value";
cin>>var2;
result=var1+... | true |
849a70e4f49bb0c31b44d0ed8dbc917494664a73 | C++ | WenjingWangCarrie/CST8219-CPP | /Assignment 1/Animation.cpp | UTF-8 | 4,849 | 3.5 | 4 | [] | no_license | /***************************************************************
Filename: Animation.cpp
Version: 1.0
Student Name: Wenjing Wang
Student Number: 040812907
Course Name/Number: C++ Programming CST8219
Lab Section: 303
Assignment # : Assignment 1
Assignment Name: Animation Project in C++
Due Date: November 25, 20... | true |
e3a6344cacc9a6bec31ce6d2131ca3031d95fdc3 | C++ | artallo/problem-solving-in-cpp | /recursive-programming/recursion-dec-to-bin/main.cpp | UTF-8 | 2,196 | 3.5625 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include <windows.h>
#include <cstdlib>
#include <string>
#include <algorithm>
// Переход на кириллицу:
void cyrillic() {
// Эти строки нужны для правильного отображения кириллицы:
SetConsoleOutputCP(1251);
SetConsoleCP(1251);
// Также надо изменить шрифт в консоли на Lucida Conso... | true |
1af5b0a16efad6f5e132ed172ceed1b0e8a32a18 | C++ | gagan86nagpal/Interview-prep | /Array Rotation Inplace/main.cpp | UTF-8 | 872 | 3.390625 | 3 | [] | no_license | #include <iostream>
using namespace std;
// We are doing a[i] = a[i+d] , and incrementing i by d
// Here , we can get stuck in cycles
// THere are total g = gcd(n,d) cycles , hence repeating this procedure for (g-1) values of length each cycle gives
// us rotated array
// We are making this so much complex because o... | true |
904d783a4d0520f9e3ebfe76b368500ffc7a7560 | C++ | scottlafetra/AlephEngine | /AlephEngine/Source/Rendering/MeshRenderer.inl | UTF-8 | 1,259 | 2.53125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "gmtl/Generate.h"
#include "../Core/Utility.h"
using namespace AlephEngine;
template <class T>
MeshRenderer<T>::MeshRenderer( AlephEngine::Entity* entity )
: Renderer( entity ), hasTexture( false )
{
shaderProgram = Shaders::GetGLProgram<T>();
}
template <class T>
void MeshRenderer<T>::SetVert... | true |
95c9b2d6b06c2665b501bc738e90be05d7b7cfc5 | C++ | kurogen/learning | /iguania/07_iguania/07_iguania/07_iguania.cpp | WINDOWS-1251 | 959 | 3.640625 | 4 | [] | no_license | // 07_iguania.cpp : Defines the entry point for the console application.
// if - else if
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int value;
cout << "Enter number: " << endl;
cin >> value;
if (value > 0)
{
cout << "Number positive" << endl;
cout << "You have entered num... | true |
23b02f81e9b3555a820e63dffd665601ce6aeb23 | C++ | Juank23/DC-motor-positional-control | /Working_PID_Posi.ino | UTF-8 | 3,518 | 2.515625 | 3 | [
"Beerware"
] | permissive | #include <PID_v1.h>
int val;
int encoder0PinA = 2; //interrupt pin 0
int encoder0PinB = 3; //interrrupt pin 1
int encoder0Pos = 0; //initial encoder count on reset
int encoder0PinALast = LOW; //assume leading signal is low
int n = LOW;
int Trgt = 512; //Setpoint range
int STBY = 10; //standby
int AIN1 = 5; /... | true |
5f157563960c92c877c4e3e0b984458ecf295c34 | C++ | 116dariya/10 | /d.cpp | UTF-8 | 499 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <set>
using namespace std;
int main(){
set<char> s;
for(int i = 0; i < 8; ++i){
char c = char(i + 48);
s.insert(c);
}
string line;
cin >> line;
bool ok = true;
if(line[0] == '0'){
ok= false;
}
else{
for(int i = 0; i < line.length(); ++i){
... | true |
ff46236c416c3dada4df65747ab5dd96cbe78974 | C++ | CrazyCodersCollective/EcoSim | /EcoSimGame/Source/StateNode.cpp | UTF-8 | 960 | 2.84375 | 3 | [] | no_license | #include "StateNode.h"
StateNode::StateNode()
{
}
StateNode::StateNode(PointerBag* pointerbag)
{
this->pointerBag = pointerbag;
this->master = this;
this->renderer = pointerbag->renderer;
}
StateNode::~StateNode()
{
}
void StateNode::render() {
for (int i = 0; i < children.size(); i++) {
states[i]->rende... | true |
af57d6e79c0bdfd41a73ca45069774066c057161 | C++ | chadaustin/renaissance | /ren2/ren/Global.h | UTF-8 | 662 | 2.75 | 3 | [
"MIT"
] | permissive | #pragma once
#include <memory>
#include <stdexcept>
#define REN_PTR(C) typedef std::shared_ptr<class C> C##Ptr
namespace ren {
inline void verify(bool condition) {
if (!condition) {
int* p = 0;
*p = 0;
fprintf(stderr, "verify failed\n");
throw ... | true |
0d88ad45f6f55023f6474fd2ceadb20bf1cb2551 | C++ | alex-peng/AnimVis | /object.h | UTF-8 | 846 | 2.578125 | 3 | [] | no_license | #ifndef _OBJECT_H_
#define _OBJECT_H_
namespace AMT
{
typedef enum {
WIREFRAME = 0,
GOURAUD,
TEXTURED
} TRenderMode;
class CBoundingBox
{
public:
float center[3];
float size;
CBoundingBox() : size(0.0f) {};
};
class CRenderObject
{
public:
bool m_visiable;
bool m_VisiableTest;
bool m_ShaderReady;
float al... | true |
84c4e023b24d2a28d97a21110d1bf49f75588b05 | C++ | GazRobinson/SFML_Gaz | /GityGenerator/GityGenerator/GSprite.h | UTF-8 | 1,409 | 2.75 | 3 | [] | no_license | #pragma once
#include <SFML\Graphics.hpp>
#include "Input.h"
#include "structs.h"
class GSprite : public sf::RectangleShape
{
public:
GSprite();
~GSprite();
virtual void Update(float dt);
sf::Vector2f GetLastPosition() { return lastPosition; };
void SetVelocity(sf::Vector2f vel);
void SetVelocity(float vx, f... | true |
6a8c139706a7e27b605c88ec129e4f074eb4f0da | C++ | kristenlau8/IoT-Light | /led/src/led.ino | UTF-8 | 5,081 | 2.921875 | 3 | [] | no_license | /*
* Project led
* Description:
* Author:
* Date:
*/
//citation: I followed some of the code from here: https://www.hackster.io/brandonsatrom/using-nativescript-to-build-particle-powered-mobile-apps-ea6e99
LEDStatus blinkLED;
int red = 255;
int green = 255;
int blue = 255;
int fadered = 0;
int fadegreen = 0;
int... | true |
c3b6f3fc35d47cca0e8460eeec64ed6309c79bb2 | C++ | mistervunguyen/starting-out-with-c-plus-plus-early-objects-solutions | /Programming Challenges/Chapter18/18_13.cpp | UTF-8 | 1,273 | 4.3125 | 4 | [] | no_license | // Chapter 18, Assignment 13, Stack-Based Fibonacci Function
#include <cstdlib>
#include <stack>
#include <iostream>
using namespace std;
// Prototype
int fibonacci(int n);
int main ( )
{
cout << "Enter a positive integer: ";
int number;
cin >> number;
cout << "The first " << number << " terms ... | true |
b34164908f21417eea66ea07b6e919359bd75b52 | C++ | samkimuel/problem-solving | /BaekjoonOJ/10869.cpp | UTF-8 | 381 | 3.09375 | 3 | [] | no_license | /**
* @file 10869.cpp
* @brief 사칙연산
* @author Sam Kim (samkim2626@gmail.com)
*/
#include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int a, b;
cin >> a >> b;
cout << a + b << '\n';
cout << a - b << '\n';
cout << a * b << '\n';
... | true |
f836ae9c64d4698563b77ce97ee2c9838240800a | C++ | Seiseigy/taller-2-paralela | /src/producto.cpp | UTF-8 | 253 | 2.703125 | 3 | [] | no_license | #include "../include/producto.h"
Producto::Producto(long _barCode, std::string _name, int _volume){
barCode = _barCode;
name = _name;
volume = _volume;
}
void Producto::addQuantity(int quantity){
this->count = this->count + quantity;
} | true |
15d32d904d03bab2d79fefb69a2d0e2a44f6f603 | C++ | neortls007idev/guildhall | /LD45/Code/Game/Tile.hpp | UTF-8 | 524 | 2.546875 | 3 | [] | no_license | #pragma once
#include "Engine/Math/IntVec2.hpp"
#include "Engine/Primitives/AABB2.hpp"
enum Tiletype
{
TILE_TYPE_INVALID = -1,
TILE_TYPE_GRASS = 0,
TILE_TYPE_WATER = 2,
TILE_TYPE_LAVA = 3,
NUM_TILE_TYPES = 4
};
struct Tile
{
public:
Tile( IntVec2 tileCoordinates, Tiletype type );
~Tile() {};
void Upda... | true |
cb7e5249c414bef1d7cdcb71cb634122f125a944 | C++ | thomasdelmoro21/laboratorio_di_programmazione | /test/UnreadMessageNotifierTest.cpp | UTF-8 | 779 | 2.609375 | 3 | [] | no_license | //
// Created by thomas on 18/09/20.
//
#include "gtest/gtest.h"
#include "../UnreadMessageNotifier.h"
#include "../Chat.h"
TEST(UnreadMessageNotifier, draw) {
User emma("Emma");
User chiara("Chiara");
User carlo("Carlo");
Chat b(emma, carlo);
Chat c(emma, chiara);
std::shared_ptr<Chat> ptrB =... | true |
a931c95d455c52676a6c801b43d159c09f6354e1 | C++ | avrdan/CyborgBattle | /CyborgBattle/Animation.h | UTF-8 | 445 | 2.65625 | 3 | [] | no_license | #pragma once
#include "Frame.h"
class Animation
{
public:
Animation(const std::string& name = "");
~Animation() {}
int getNextFrameNumber(int frameNumber) const;
Frame* getNextFrame(Frame* frame);
int getEndFrameNumber() const;
Frame* getFrame(int frameNumber);
const std::string& getName() const;
void loadAni... | true |
08a71a0c6dce7df4b53b6167316089b5734ee1b5 | C++ | vanvule/ImageProcessing | /src/Lab3/Convolution.cpp | UTF-8 | 2,125 | 3.015625 | 3 | [] | no_license | #include "stdafx.h"
#include "Convolution.h"
Convolution::Convolution()
{
this->_kernel;
this->_kernelHeight = 0;
this->_kernelWidth = 0;
}
Convolution::~Convolution()
{
this->_kernel.clear();
this->_kernelHeight = 0;
this->_kernelWidth = 0;
}
vector<Kernel> Convolution::GetKernel()
{
return t... | true |
05c6288e8c5a35e22760f24df64b948d2a1191b2 | C++ | ku3i/flatcat | /src/common/basic.cpp | UTF-8 | 2,797 | 2.921875 | 3 | [] | no_license | /* basic.cpp */
#include "basic.h"
#include <algorithm>
FILE*
open_file(const char* mode, const char* format, ...)
{
char filename[1024];
va_list args;
va_start(args, format);
vsnprintf(filename, 1024, format, args);
va_end(args);
FILE * fd = fopen(filename, mode);
if (NULL == fd)
{
... | true |
21665136293201cc042be335ff049afa56c7ad6f | C++ | uvbs/GameProject | /libEngine/SList.h | UTF-8 | 2,540 | 3.453125 | 3 | [] | no_license | #ifndef SList_h__
#define SList_h__
#include <cassert>
template <class T>
class SList
{
struct Node;
public:
SList();
~SList();
int size() const { return mNum; }
bool empty() const { return mFirst != 0; }
void push_front( T const& val );
void push_back( T const& val );
T const& front() cons... | true |
2465ba7fa4316f61b8d55a4190292a264fe1927e | C++ | alexandraback/datacollection | /solutions_1482494_1/C++/ckebabo/b.cc | UTF-8 | 1,332 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <set>
using namespace std;
int foo(vector<pair<int,int> > &v) {
int star = 0;
int cnt;
int a[1003] = {0,};
int aa = 0;
bool f;
sort(v.begin(), v.end(), greater<pair<int,int> >());
for(cnt=0;;cnt++) {
... | true |
cfdd1569e224c7334ab04876a2b18b005c537290 | C++ | ecubillanleon/Simulacion | /Simulador.cpp | UTF-8 | 6,667 | 3.015625 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
typedef struct
{
char nombre[20];
char apellido[20];
int cedula;
int activo;
int edad;
}registro;
#define TAMANO_REGISTRO sizeof(registro)
#define NOMBRE_ARCHIVO "archi.txt"
void v_inicializar(FILE *f... | true |
5af8d7713f6b85e1c56b63db0e94f09900c55c8b | C++ | wfhendrix11/Software-Construction | /Lab4/RegularCash.hpp | UTF-8 | 540 | 2.78125 | 3 | [] | no_license | // Lab 4: Simple Cash Register Application with
// Inheritance and Vitual Functions
// File: RegularCash.hpp
// Description: RegularCash class abstraction.
#ifndef RegularCash_hpp
#define RegularCash_hpp
#include "RegularSale.hpp"
using namespace std;
// Name: RegularCash
// Description: ... | true |
226695636705b90e5fa47555ef24b87e74e93ef8 | C++ | ar43/NES_Emulator | /src/machine/ppu/ppuaddr.h | UTF-8 | 328 | 2.609375 | 3 | [] | no_license | #pragma once
#include <array>
class PpuAddr
{
public:
PpuAddr()
{
addr[0] = 0;
addr[1] = 0;
scroll_offset = 0;
w = nullptr;
}
int GetAddr();
void Write(uint8_t value, int *t, int *v);
void Add(uint8_t val);
void Clear();
int* w;
int* x;
int scroll_offset;
uint8_t* scrolladdr;
private:
uint8_t addr[... | true |
4cc0533be3989f2e6bb8731950b3c0d0f0f1f6d1 | C++ | sergiiGitHub/Demo | /Algorithm/e-olymp/0066.cpp | UTF-8 | 2,318 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
using namespace std;
struct Schedule{
int start;
int end;
static const int hToM = 60;
private:
int getMinutes( string str ){
int h, m;
string toInt;
std::stringstream stream(str);
getline... | true |
ed1f4e09e36b8253c37c7e7b2ce2b55a7a6b4fa6 | C++ | SRatna/Parallel-computing-lab | /Lab 3/Exercise1/bfsqueue.cpp | UTF-8 | 5,808 | 2.984375 | 3 | [] | no_license | #include <stdlib.h>
#include <unistd.h>
#include <string>
#include <iostream>
#include <fstream>
#include "bfsqueue.h"
using namespace std;
/**
* Data structure for supporting the breadth first search. The data structure primarily implements
* a queue for configurations, connected with a set (bit set) storing the... | true |
be74a8b5f37073500767e2baaa6557960732a5e7 | C++ | zhanglei/tikv-cpp | /test/pd_client_test.cc | UTF-8 | 771 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #include <string>
#include "pd_client.h"
#include "logging.h"
#define CATCH_CONFIG_MAIN
#include "3rd_party/catch/catch.hpp"
TEST_CASE("get region by key") {
tikv::pd_client pd("pd://localhost:2379");
tikv::region_info region;
tikv::resp r = pd.get_region("hello", ®ion);
REQUIRE(r.ok());
}
TEST_CA... | true |
5d77bacca4ac5152833ed10af6cf77fa8152bb45 | C++ | wangzilong2019/text | /蓝桥杯算法练习/采药.cpp | GB18030 | 582 | 2.53125 | 3 | [] | no_license | #include<stdio.h>
#define max(a, b) a>b ? a:b
#define MAX 1000
int v[MAX], t[MAX];
int main () {
int i, j, T, M;
int c[MAX][MAX] = {0};
//ҩʱɽҩĿ
scanf("%d %d", &T, &M);
//ÿҩĵIJժʱͼֵ
for (i = 1; i <= M; i++) {
scanf("%d %d", &t[i], &v[i]);
}
for (i = 1; i <= M; i++) {
for (j = 1; j <= T; j++) {
//жϵiҩǷԲժ
... | true |
fe501319ac0ad0cded05c9c8e370d8cc90303cf3 | C++ | LDlornd/OI-Memory | /洛谷/P1000~P1999/P1000~P1099/P1012 拼数/P1012 拼数.cpp | UTF-8 | 416 | 2.703125 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct num
{
string s;
int len;
};
num k[20];
int CMP(const num &a,const num &b)
{
string i=a.s+b.s,j=b.s+a.s;
if(i<=j) return 0;
else return 1;
}
int main()
{
int n;
cin>>n;
for(int i=0;i<n;++i)
{
cin>>k[i].s;
k[... | true |
9fbd613bb8ed7bf5aff9189df9698d6b9b93665b | C++ | tarawa/cntt2016-hw1 | /TC-SRM-554-div1-250/bx2k.cpp | UTF-8 | 391 | 3.25 | 3 | [] | no_license | #include<bits/stdc++.h>
class TheBrickTowerEasyDivOne
{
public:
int find(int rc, int rh, int bc, int bh)
{
if(rc==bc)
{
if(rh==bh)return rc*2;//去除二式等于三式的情况
else return rc*3;
}
else//a!=b的情况会多出一种
{
if(rh==bh)return std::min(rc,bc)*2+1;//去除二式等于三式的情况
else return std::min(rc,bc)*3+1;
... | true |
cc07c08b3ae8ede2cc3980594faa7b06709ff679 | C++ | hongh815/C_code_collection | /C++_project/c++9차_namespace_std/std10-3.cpp | UTF-8 | 830 | 3.890625 | 4 | [] | no_license |
#include <cstdio>
#include <iostream>
//다음과 같은 int 배열을 오름차순으로 정렬한 후 화면에 결과를 출력하는 프로그램을 작성하세요.
//단, 화면에 배열 내용을 출력할 때는 반드시 ‘범위 기반 For 문’을 사용합니다.
// Int aList[5] = { 10, 20, 30, 40, 50};
void arrDesc(int*);
int main() {
int number[5] {69,793,25,498,245};
int* pnum;
pnum = &number[0];
arrDesc(pnum);
std::cout... | true |
1fe0e70aa0ef760986b3e06269b96fdf6955dba3 | C++ | thiagosantos346/URI-OJ | /Volume 15 (1500 - 1599)/1503/1503.cpp | UTF-8 | 2,692 | 2.59375 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
#define endl '\n'
bool comp(const string &a, const string &b) {
return (a.length() > b.length());
}
class PalindromicTree {
class no {
public:
int inicio, fim, length, suffixEdge;
vector<int> insertEdge = vector<int>(26, 0);
no() { }
no (int... | true |
dc0acc47ece4dca0b10d824009cd10ef828f01d6 | C++ | caiafrazao/SoccerRobot | /Delta.cpp | UTF-8 | 336 | 2.828125 | 3 | [] | no_license | #include "Delta.h"
Delta::Delta(float alpha, float beta)
{
this->alpha = alpha;
this->beta = beta;
this->spike = alpha;
}
float Delta::pertinencia(float u)
{
float mi = 0.0;
if (u < alpha) mi = 1.0;
if ((u >= alpha) && (u <= beta)) mi = (beta - u)/(beta - alpha);
if (u > beta) mi = 0.0;
... | true |
87fa8264110885c98cb6b3f506642d618acdb614 | C++ | rainlong/learning_DP | /example/STRUCTURAL/Proxy/subject.h | UTF-8 | 622 | 2.921875 | 3 | [] | no_license | #pragma once
#include <iostream>
// 真实的需求
// 抽象出方法, 没有成员变量(就好像没有特定的目的) - “我知道该怎么做, 但我做是为了什么是不知道”
// 对需求的实现而言, 需要实现方法,并且明确对象
// 对代理而言, 需要知道实际的实现, 然后调用它, 所以真正执行的是具体主题的行为, 而实际暴露给外界的是代理对象
class Subject
{
public:
virtual ~Subject() {}
virtual void request() = 0;
// { std::cout << "我只知道该怎么做" << std::endl; }... | true |
373dd8490fb4a56d43904a7a192cf8a6d4d8d6a9 | C++ | miketsop/Udemy_DesignPatternsInModernCpp | /Builder/HtmlBuilder.cpp | UTF-8 | 503 | 2.96875 | 3 | [] | no_license | #include "HtmlBuilder.h"
using namespace std;
HtmlBuilder::HtmlBuilder(string root_name)
{
root = new HtmlElement(root_name, "");
}
HtmlBuilder &HtmlBuilder::addChild(string child_name, string child_text)
{
HtmlElement e{child_name, child_text};
root->elements.emplace_back(e);
return *this;
}
HtmlEl... | true |
68af4a7c84c2cd358106d93cd825b19e960c9e99 | C++ | joseph-isaacs/CppSocket | /CppSocket.Test/Source/CountedParserTest.cpp | UTF-8 | 4,346 | 2.984375 | 3 | [] | no_license | #ifndef CATCH_CONFIG_MAIN
#define CATCH_CONFIG_MAIN
#endif
#include "CountedDataParser.hpp"
#include "catch.hpp"
std::string packIntToString(size_t number)
{
std::string str_in;
str_in.resize(4);
str_in[0] = (number >> 24) & 0xFF;
str_in[1] = (number >> 16) & 0xFF;
str_in[2] = (number >> 8) & 0xFF;
str_in[3]... | true |
6ce9e32b091c7ee518a5f591ec072e7a5cae436c | C++ | gregormilligan/GregorMilliganProgrammingExamples | /Genetic ALgorithm/CarAI/CarAI/AItargetwall.h | UTF-8 | 597 | 3 | 3 | [] | no_license | #pragma once
#include <iostream>
const int wallPop = 15; // this is the number of walls spawned
class AItargetwall
{
public:
float x = 10;
float y = 10;
float width = 10;
float height = 10;
AItargetwall();
AItargetwall(float wx, float wy, float wwidth, float wheight);
};
AItargetwall::AItarget... | true |
acdd527acb139a1204d92c1f59f3bc684e688ca0 | C++ | hal2069/Faasm | /tests/test/knative/test_knative_handler.cpp | UTF-8 | 5,436 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #include <catch/catch.hpp>
#include "utils.h"
#include <knative/KnativeHandler.h>
#include <scheduler/GlobalMessageBus.h>
#include <util/json.h>
using namespace Pistache;
namespace tests {
TEST_CASE("Test valid knative invocations", "[knative]") {
cleanSystem();
// Note - must be async to avoid... | true |
61b7cc2e5a5b30319640c6daf2bc641002298ab7 | C++ | shuaipeng123/SatSolver | /Proposition.h | UTF-8 | 301 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Proposition
{
// Access specifier
public:
int index_i;
int index_k;
// Data Members
int position;
// Member Functions()
int getPosition()
{
cout << "position is: " << position;
return position;
}
};
| true |
2672118a248568385dee2d69e15bd81653054297 | C++ | pranjalg8/Competitive-Code | /Trees/iterativePostorder.cpp | UTF-8 | 697 | 3.078125 | 3 | [] | no_license | void iterativePostorder(Node* root)
{
stack<pair<Node*, int> > st;
st.push(make_pair(root, 0));
while (!st.empty()) {
struct Node* temp = st.top().first;
int b = st.top().second;
st.pop();
if (temp == NULL)
continue;
if (b == 0) {
... | true |
72c64969738d14cfa2c6c809448f231a20f8ab61 | C++ | wangjing99/ve280 | /proj 4/p4/game.cpp | UTF-8 | 6,765 | 3.09375 | 3 | [] | no_license | //
// Created by DELL on 2019/7/6.
//
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cassert>
#include "player.h"
using namespace std;
int main(int argc, char *argv[]){
try{
Pool pool=Pool();
Pool *pool... | true |
9c37492b7f3dd82bef83aef177d261def022a022 | C++ | amolr/MusicPlayer | /MusicPlayerTest/PlayTrackUnitTest.cpp | UTF-8 | 1,926 | 3.03125 | 3 | [] | no_license | #include "stdafx.h"
#include "CppUnitTest.h"
#include "MusicPlayer.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace MusicPlayerTest
{
//Unit test for all Play track operations
TEST_CLASS(PlayTrackUnitTest)
{
public:
// play a song when ordinal is less than 0
TEST_METHOD(PlayTrack... | true |
3053a9bff2a15e63a5ee2f7b46337d90f5b75759 | C++ | pawel02/SpareTime | /SpareTime/Builder/Builder2.cpp | UTF-8 | 2,263 | 3.4375 | 3 | [] | no_license | //#include <iostream>
//#include <string>
//#include <vector>
//#include <sstream>
//#include <memory>
//
//struct HtmlBuilder;
//
//struct HtmlElement
//{
// std::string name;
// std::string text;
// std::vector<HtmlElement> elements;
// const size_t indent_size = 2;
//
// HtmlElement() {}
//
// HtmlElement(const std:... | true |
37a054e6b115902e183bdc4b53d608fd9d663b80 | C++ | Soulliom/anoroguelike | /src/InputManager.cpp | UTF-8 | 26,130 | 2.734375 | 3 | [
"MIT"
] | permissive | #include "../include/InputManager.h"
#include "../include/GameManager.h"
#include "../include/Player.h"
#include "../include/SceneManager.h"
/* Setters / Getters */
int InputManager::getSelectStateX() {
return selectState.x;
}
int InputManager::getSelectStateY() {
return selectState.y;
}
InputManager::SelectState ... | true |
189b58bb6a78f3327266f14e7b86654ee7919c6a | C++ | ChrisTwaitees/ChromaEngine | /Chroma/Chroma/source/models/StaticMesh.cpp | UTF-8 | 6,972 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "StaticMesh.h"
void StaticMesh::setupMesh()
{
// Generate buffers
// Vertex Array Object Buffer
glGenVertexArrays(1, &VAO);
// Vertex Buffer and Element Buffer
glGenBuffers(1, &VBO);
glGenBuffers(1, &EBO);
// Bind buffers
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_... | true |
7e58d922cc4e4255a72d31e715b60ead8a70a7dd | C++ | Lisoleg555/OOP | /lab6/tree.cpp | UTF-8 | 1,365 | 2.828125 | 3 | [] | no_license | #include "tree.h"
template <class F> TTree<F>::TTree() : seed(nullptr){
}
template <class F> std::ostream& operator<<(std::ostream& os, const TTree<F>& tree)
{
std::shared_ptr<TTreeItem<F>> item = tree.seed;
if(item == nullptr)
{
return os;
}
item->Show();
return os;
}
template <class F> void TTree<F>::push(... | true |
cd332ca29b9c82e6ef40e24a41eaff3a6e4a2820 | C++ | openvkl/openvkl | /openvkl/devices/cpu/common/Allocator.h | UTF-8 | 1,518 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <atomic>
#include "../common/ManagedObject.h"
#include "rkcommon/memory/malloc.h"
namespace openvkl {
namespace cpu_device {
/*
* Allocate and deallocate aligned blocks of
* memory safely, and keep some ... | true |
88c72d92afc953e340d0236767bcd3e0dc40388c | C++ | apoorvKautilya21/Data-Structures-And-Algorithm-in-C- | /12. Recursion Questions/13_stringGenerationAcode.cpp | UTF-8 | 926 | 3.53125 | 4 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
int string2Int(char *c, int n) {
if(n == 0) {
return 0;
}
// Assumed that it will find 123
int num = string2Int(c, n - 1);
// when i have 123 i will multiply it with 10 and (c[n - 1] - '0') that's last element
num = num * 10 + (c[n - 1] - '0');
ret... | true |
9a5bfc416fd6c6a678d723fe562ce667dabd3f90 | C++ | alexandraback/datacollection | /solutions_2453486_0/C++/totoroXD/main.cpp | UTF-8 | 1,932 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<string>
using namespace std;
char brd[5][5];
int cnt;
bool check_row(int i, char p)
{
int cntp=0,cntt=0;
for(int j=0; j<4; j++){
if(brd[i][j]==p){
cntp++;
}
else if(brd[i][j]... | true |
f7a31f50a3ff9ae5c0a2e1f4d9799f14feaa19cf | C++ | prakhartp/codingNinjasProj | /L16/LinkedList.cpp | UTF-8 | 4,476 | 3.515625 | 4 | [] | no_license | #include<iostream>
using namespace std;
#include "Node.h"
Node* createList(){
Node* n1 = new Node(10);
Node* n2 = new Node(20);
Node* n3 = new Node(30);
Node* n4 = new Node(40);
n1->next = n2;
n2->next = n3;
n3->next = n4;
return n1;
/* Node n1(10);
Node n2(20);
Node n3(30);
n1.next = &n2;
n2.next = &n3... | true |
b916a45835da7bb1758dc782c116bfe8a09cb899 | C++ | kumar-kunal/Algorithm | /DP/Bellman_Ford_Algorithm.cpp | UTF-8 | 1,718 | 3.1875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
const int m=100;
struct edges
{
int s,d,w;
};
struct edges edge[m];
int e=0;
//Make edge list so that we can travel ....
void collect_edge(int graph[m][m],int v)
{
for(int i=0;i<v;i++)
{
for(int j=0;j<v;j++)
{
if(graph[i][j]!=0)
{
edge[e].s=i;
edge... | true |