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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
341cd45e42fad9beefd8346a755e6a9b33fc3647 | C++ | Maxence53/P2RV_Sujet1 | /src/main.cpp | UTF-8 | 2,302 | 2.546875 | 3 | [] | no_license | // inclusion des biblioth�ques, dont OpenCV
#include <string.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <vector>
// Inclusion des fichiers utiles à la reconnaissance de visage
#in... | true |
d938903f867885160e62e0bfee2a5fef41513e18 | C++ | urashima0429/keipro_practice | /arihon/3_2頻出テクニック/poj2785.cpp | UTF-8 | 774 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
const int MAX_N = 4000 + 10;
int N, A[MAX_N], B[MAX_N], C[MAX_N], D[MAX_N];
vector<int> v;
cin >> N;
for (int i = 0; i < N; ++i){
cin >> A[i] >> B[i] >> C[i] >> D[i];
}
for (int ... | true |
987e5b7e4d11fc3d13c34cf343088ef1404029ce | C++ | GonzaPM7/TPV_Practica6 | /SDLProject/InputHandler.h | UTF-8 | 1,342 | 2.984375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <vector>
#include "sdl_includes.h"
#include "Vector2D.h"
class InputHandler {
public:
enum mouse_buttons {
LEFT = 0, MIDDLE = 1, RIGHT = 2
};
static InputHandler* instance() {
if (instance_ == 0) {
instance_.reset( new InputHandler() );
}
return instance_.ge... | true |
d8c2677bbdf8d200b0988d573f96d3fca13ff66a | C++ | emiliev/IS-OOP-2018 | /Inheritance/SProgrammer.cpp | UTF-8 | 702 | 2.953125 | 3 | [
"MIT"
] | permissive | //
// SProgrammer.cpp
// inheritance
//
// Created by Emil Iliev on 29.04.18.
// Copyright © 2018 Emil Iliev. All rights reserved.
//
#include "SProgrammer.hpp"
SProgramer::SProgramer() {
numBooks = 0;
}
SProgramer::SProgramer(char* name, double salary, char* newLanguage,WorkingTime _wTime, int readBooks): JP... | true |
b5fe381df2b2cfb0495c03d75e25aeb1aadfcd9b | C++ | everitt257/CarND-Kidnapped-Vehicle-Project | /src/particle_filter.cpp | UTF-8 | 7,884 | 2.703125 | 3 | [] | no_license | /*
* particle_filter.cpp
*
* Created on: Dec 12, 2016
* Author: Tiffany Huang
*/
#include <random>
#include <algorithm>
#include <iostream>
#include <numeric>
#include "particle_filter.h"
void ParticleFilter::init(double x, double y, double theta, double std[]) {
// TODO: Set the number of particles. In... | true |
1ccb59beaf7fec092435ae22ebcb992ff631817c | C++ | mauscarelli/Comptetitive-Programming | /mazes.cpp | UTF-8 | 759 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
#define MAXV 10001
using namespace std;
vector<int> cor[MAXV];
bool find(int a,int b){
vector<int>::iterator it;
while(a!=b){
it = find(cor[a].begin(),cor[a].end(),a+1);
if(it != cor[a].end()) a++;
else return false;
}
return true;
}
int main(){
in... | true |
9dacd665a5859ffa27ceec8b4c91b7053fc70230 | C++ | liulanz/Study-Personal-Lab | /Programming Languae/Syracuse C++/554Lec/2019_01_22_Lecture_Linked_list_Reverse_RemoveOne.cpp | UTF-8 | 2,468 | 4.3125 | 4 | [] | no_license | #include <iostream>
using namespace std;
class ThreeD {
public:
int ht;
int wid;
int dep;
//constructor: the standard initializing methods
ThreeD(int i, int j, int k) {
ht = i * i; wid = j * j; dep = k * k;
}
ThreeD() { ht = wid = dep = 0; }
int vol() { return ht * wid*dep; }//return this->ht * this->wid * t... | true |
babdacca84f34f3795ff1d86440cb98cd29e77d8 | C++ | dgpark/Study | /AlgoStudy2020/p43165.cpp | UTF-8 | 1,220 | 3.578125 | 4 | [] | no_license | #include <string>
#include <vector>
using namespace std;
void plusNum(const vector<int>& numbers, int sum, const int& n_th, const int& target, int& answer);
void minusNum(const vector<int>& numbers, int sum, const int& n_th, const int& target, int& answer);
int solution(vector<int> numbers, int target) {
int ans... | true |
357f91fe51990d3a6b665d2c1ab7bfddab6cb312 | C++ | Jiltseb/Leetcode-Solutions | /solutions/1218.longest-arithmetic-subsequence-of-given-difference.323576884.ac.cpp | UTF-8 | 298 | 2.515625 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int longestSubsequence(vector<int> &arr, int difference) {
int mp[40001] = {};
int off = 20000;
int ans = 0;
for (int n : arr) {
n += off;
mp[n] = max(mp[n], 1 + mp[n - difference]);
ans = max(ans, mp[n]);
}
return ans;
}
};
| true |
22e60cced23f7a549c2bf3672a0a368c01ed80b1 | C++ | fuzzyhunter0608/game-physics | /Mass Aggregate/EGP300-proj1/Moveable.h | UTF-8 | 924 | 2.828125 | 3 | [] | no_license | #pragma once
#include <GLTools.h>
#include "PhysicsEngine/Vector3.h"
class Moveable
{
public:
Moveable();
~Moveable();
void setPosition(const Vector3 &position) { mPosition = position; };
void setPosition(float x, float y, float z);
void setRotation(const Vector3 &rotation) { mRotation = rotation; };
void set... | true |
964f2d59481ed36c0f225665b76947740f0e1c51 | C++ | ansungho22/algorithm-practice | /[프로그래머스]완주하지못한선수/소스.cpp | UHC | 658 | 3 | 3 | [] | no_license | //
#include <string>
#include <vector>
#include <map>
#include <iostream>
using namespace std;
string solution(vector<string> participant, vector<string> completion) {
string answer = "";
map<string, int> m;
map<string, int> ::iterator it;
for (auto i : participant) {
if (m.find(i) != m.end()... | true |
ef14c71d64f0870ea14b28bbb68030659a1383d5 | C++ | hophacker/algorithm_coding | /topcoder/programs/SixteenBricks.cpp | UTF-8 | 456 | 3.140625 | 3 | [] | no_license | #include <vector>
#include <algorithm>
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
class SixteenBricks
{
public:
int maximumSurface(vector <int> height)
{
sort(height.begin(), height.end());
int sum = 0;
F(i,8,16) sum += height[i] * 4;
... | true |
3252369f3d8bab2a91806c93d38d3469b354390a | C++ | JoelEarps/C-Essentials-Training-Course | /Ex_Files_CPlusPlus_EssT/Exercise Files/Chap04/typeid.cpp | UTF-8 | 472 | 2.953125 | 3 | [] | no_license | // typeid.cpp by Bill Weinman <http://bw.org/>
// version of 2018-10-28
#include <cstdio>
#include <typeinfo> //need to keep this
#include <string>
using namespace std;
struct A { int x; };
struct B { int x; };
A a1;
B b1;
int main() {
printf("type of %s\n", typeid(string).name());
if(typeid(a1) == typeid(A)... | true |
9409e58fa4b2e8cb2ed98ae858350573cc4b24d2 | C++ | amelco/lp1-2020.5 | /aula11/include/Diary.h | UTF-8 | 502 | 2.75 | 3 | [] | no_license | #ifndef DIARY_H
#define DIARY_H
#include "Message.h"
#include <string>
#include <vector>
struct Diary
{
Diary(const std::string& filename);
~Diary();
std::string filename;
std::vector<Message> messages;
bool add(const std::string& message); // adiciona string mensagem na lista de mensagens
bool write();... | true |
7a02d249486c38d9b0249436cc745caa777dee8f | C++ | Goto-Renato/yacre | /src/Materials/Diffuse.cc | UTF-8 | 451 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "Diffuse.hh"
#include<glm/gtc/constants.hpp>
bool yacre::Diffuse::Reflection(const glm::vec3& in, const glm::vec3& normal,
glm::vec3& out) const
{
float u = yacre::Material::GetRandomNumber();
float r = glm::sqrt(u);
float t = glm::two_pi<float>() * yacre::Material:... | true |
1661b7bbab321b1ed2fc84ce57858788ae196f29 | C++ | jnrdrgz/opengl_learning | /begginer/controls/listBox/listBox.h | UTF-8 | 496 | 2.921875 | 3 | [] | no_license | #ifndef LISTBOX_H
#define LISTBOX_H
#include "control.h"
#include <vector>
class ListBox : public Control
{
public:
ListBox(int posX, int posY, int w, int h);
void addItem(std::string item);
void removeItem(int index);
void setCurrent(int index);
int getIndex(void);
int getCount(void);
virtual bool updateC... | true |
cf6f6a527a65311867eb31cac8a86febaa8aa44f | C++ | ArnisLielturks/Urho3D-Project-Template | /app/src/main/cpp/Levels/Splash.h | UTF-8 | 959 | 2.546875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "../BaseLevel.h"
namespace Levels {
class Splash : public BaseLevel
{
URHO3D_OBJECT(Splash, BaseLevel);
public:
Splash(Context* context);
virtual ~Splash();
static void RegisterObject(Context* context);
void HandleUpdate(StringHash eventType,... | true |
b982245a6219f806c00c63b9f637aeaae4e7982f | C++ | BSU2016gr09/AsonovDmitriy | /1term/2.3.cpp | UTF-8 | 2,541 | 2.953125 | 3 | [] | no_license | //Ìàññèâ À ÷èñåë ðàçìåðà N ïðîèíèöèàëèçèðîâàòü ñëó÷àéíûìè ÷èñëàìè èç ïðîìåæóòêà îò -N äî N.
// Íå èñïîëüçóÿ ôóíêöèè èç çàäà÷è 2-2 Íàïèñàòü ôóíêöèè (áåç swap è àíàëîãîâ) öèêëè÷åñêîãî ñäâèãà
// ýëåìåíòîâ ìàññèâà âïðàâî íà k ýëåìåíòîâ (1-é ñòàíåò 1+k -ûì, 2-é ñòàíåò 2+k -ûì è ò.ä.)
// è âëåâî íà k ýëåìåíòîâ. Â main íàï... | true |
4b5c9f1f8f0eacee7b74681c53f4f453d2588e58 | C++ | namirinz/O-Com-TU-2563 | /Lab1_pointer/1.cpp | UTF-8 | 991 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
double x = 5.1231;
int y = 2;
char s = 'a';
double *px;
px = &x;
char *ps;
ps = &s;
int *py;
py = &y;
cout << "Value of int is " << y << endl;
cout << "Address of int is ... | true |
341ddf24b92698fe4a9c564b19a8f0c26c4001e6 | C++ | sureshmangs/Code | /competitive programming/codeforces/1527B1 - Palindrome Game (easy version).cpp | UTF-8 | 2,740 | 4.0625 | 4 | [
"MIT"
] | permissive | /*
The only difference between the easy and hard versions is that the given string s in the easy version is initially a palindrome, this condition is not always true for the hard version.
A palindrome is a string that reads the same left to right and right to left. For example, "101101" is a palindrome, while "0101" i... | true |
ea8f50cfcb259f425f68f481bdd78f419e9fb0a7 | C++ | 1160208849wfl/cpp-primer5e | /snippets/c++/template/chapter3/basics/varprint2.hpp | UTF-8 | 450 | 3.71875 | 4 | [] | no_license | #include <iostream>
// If two function templates only differ by a tailing parameter pack,
// the function template without the trailing parameter pack is preferred.
template <typename T>
void print(T arg)
{
std::cout << arg << '\n';
}
template <typename T, typename... Types>
void print(T firstArg, Types... args)
... | true |
e973ffa3e675f6aeb7f2742261300db2bc2a5ec7 | C++ | P14141609/CW1_GameEngine | /Projects/GameEngine/include/scene.h | UTF-8 | 2,065 | 3 | 3 | [] | no_license | #ifndef SCENE_H
#define SCENE_H
// Imports
#include "player.h"
#include "camera.h"
#include "gameobject.h"
#include "collectable.h"
#include "staticobject.h"
#include "light.h"
#include "xmlloader.h"
#include <memory>
#include <vector>
/////////////////////////////////////////////////
///
/// \brief Class for world ... | true |
d84cfc5bad342ff541234e8f687c6ede2db034cf | C++ | Timeligers/MoTa | /monsterlist_item.cpp | UTF-8 | 3,913 | 2.578125 | 3 | [] | no_license | #include "monsterlist_item.h"
#include <QWidget>
MonsterList_item::MonsterList_item(QWidget *parent): QWidget(parent)
{
}
//初始化item
void MonsterList_item::initItem()
{
head = new QLabel(this);
label_hp = new QLabel(this);
label_atk = new QLabel(this);
label_pdef = new ... | true |
9a70f2a6066168275abb5ba8cfb480026c0be72c | C++ | MrFrangipane/raytracer | /C++/node/sphere.cpp | UTF-8 | 1,417 | 3.03125 | 3 | [] | no_license | #include "sphere.h"
namespace frangiray {
// Pseudo Static Member
bool Sphere::traceable() const
{
return Sphere::_traceable;
}
// Set Radius
void Sphere::set_radius(f_real radius_)
{
radius = radius_;
_radius2 = radius_ * radius_;
}
// Intersection Distance
f_real Sphere::intersection_distance(const ... | true |
d4f1e1704336ceab703d513841d0ee508c390ab7 | C++ | zzJinux/cmpt-prog | /fbcup2018/qr1.cc | UTF-8 | 1,199 | 2.59375 | 3 | [] | no_license | /* Tourist */
#include <iostream>
#include <queue>
using namespace std;
struct Attr {
int idx, vcnt;
bool operator<(Attr const rhs) const {
return (vcnt > rhs.vcnt) or (vcnt == rhs.vcnt and idx > rhs.idx);
}
} attrs[50];
using PQ = priority_queue<Attr>;
using LL = long long;
int N, K;
LL V;
char titles[50]... | true |
20e960195ae6d5cf27b209fc532585072c78e9f4 | C++ | jandujar/multipong | /multipong/src/Bola.cpp | UTF-8 | 8,004 | 2.65625 | 3 | [
"MIT"
] | permissive | #include "Bola.h"
#include <stdlib.h>
#include <math.h>
#include "Constants.h"
#include <iostream>
Bola::Bola()
{
//ctor
}
Bola::~Bola()
{
//dtor
closeMedia();
}
//Initialization
void Bola::Init(SDL_Renderer *renderer){
rect.h = BOLA_SIZE;
rect.w = BOLA_SIZE;
rect.y = WIN_HEIGHT/2;
rect.... | true |
e6816a840ed075cd86453592c72a9bac67c4ffce | C++ | imsaiguy/TTGO-Projects | /TTGO_ADC_DAC.ino | UTF-8 | 1,572 | 2.6875 | 3 | [] | no_license | /*
12 bit ADC
full range 4095
8 bit DAC1 DAC2
full range 255
#########################################################################
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
#########################################################################
*/
#include <TF... | true |
0110c6453fd4466db75132592fe46795fa699263 | C++ | ishdutt/CP | /Gasoline.cpp | UTF-8 | 1,851 | 3.390625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Item
{
ll value, weight;
// Constructor
Item(ll value, ll weight)
: value(value)
, weight(weight)
{
}
};
// Comparison function to sort Item according to val/weight
// ratio
bool cmp(s... | true |
b6aa215b73df7bbd91d476afe9b1e78f7b089899 | C++ | dakeryas/CosmogenicAnalyser | /include/RootObjectExtractor.hpp | UTF-8 | 1,098 | 2.796875 | 3 | [] | no_license | #ifndef COSMOGENIC_ANALYSER_ROOT_OBJECT_EXTRACTOR_H
#define COSMOGENIC_ANALYSER_ROOT_OBJECT_EXTRACTOR_H
#include "TFile.h"
#include <stdexcept>
namespace CosmogenicAnalyser{
template <class T>
class RootObjectExtractor{
public:
static T extract(const std::string& keyName, TFile& file);
};
... | true |
108fa2660bf6cdd7964745436922bf70b9a62cc3 | C++ | ivanovdimitur00/programs | /Programs/zadachi praktikum 6/symmetrical_array.cpp | UTF-8 | 462 | 3.59375 | 4 | [] | no_license | #include <iostream>
int main()
{
int array[100];
int numbers_array;
std::cin>>numbers_array;
for (int i = 0; i < numbers_array ; i++) {
std::cin>>array[i];
}
int counter = 0;
for (int i = 0; i < numbers_array/2 ; i++) {
if (array[i] == array[numbers_array-1-i]) {
counter++;
... | true |
fd1ac0a124c7f50f4301e525d1df7155fd22deab | C++ | sundsx/RevBayes | /src/revlanguage/parser/SyntaxUnaryExpr.h | UTF-8 | 3,542 | 3.15625 | 3 | [] | no_license | /**
* @file
* This file contains the declaration of SyntaxUnaryExpr, which is
* used to hold unary expressions in the syntax tree.
*
* @brief Declaration of SyntaxUnaryExpr
*
* (c) Copyright 2009- under GPL version 3
* @date Last modified: $Date$
* @author The RevBayes Development Core Team
* @licen... | true |
63739bae7df005e7988770b81cf73bd7e1067afe | C++ | MFornander/kingjelly | /src/RainEffect.cpp | UTF-8 | 2,060 | 2.625 | 3 | [
"MIT"
] | permissive |
/*---------------------------------------------------------
* Includes
*--------------------------------------------------------*/
#include "KingJelly.h"
#include "RainEffect.h"
/*---------------------------------------------------------
* Macros
*--------------------------------------------------------*/
#de... | true |
505eb3a35b1c271f6e3190e8dee2661edbac7bfe | C++ | meedan/alegre | /threatexchange/tmk/cpp/bin/tmk-compare-two-tmks.cpp | UTF-8 | 3,387 | 2.671875 | 3 | [
"BSD-2-Clause",
"MIT"
] | permissive | // ================================================================
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
// ================================================================
// ================================================================
// Given a pair of `.tmk` files (see sectio... | true |
dffcc1806a2c8ea684d6cbaa9d679afc2131dbb2 | C++ | RobinMeyler/SpookyPirateShip | /SpookyPirateShip/YearProject/src/MovingDown.cpp | UTF-8 | 3,020 | 2.8125 | 3 | [] | no_license | #include "MovingDown.h"
MovingDown::MovingDown(int t_animationType)
{
// switch statement to see what texture to load
m_animationType = t_animationType;
switch (t_animationType)
{
case 0:
{
// Player Case
/*texture.loadFromFile("Assets\\playerSpriteSheet.png");
animatedSprite = new AnimatedSprite(texture)... | true |
bd83a669b251f7d7774e02d6da7db50d3b32d121 | C++ | gcoayla/Ciencia-de-la-Computaci-n-2 | /problem set 1/paso por valor y referencia.cpp | UTF-8 | 216 | 2.875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void imprir(int *numero){
cout<<*numero<<endl;
}
void impri(int numero){
cout<<numero<<endl;
}
int main(){
int numero=5;
impri(numero);
imprir(&numero);
}
| true |
7e489be3b5cb6ea2ab3da85fa82522d39115a5c0 | C++ | NicolasHo/openvkl | /testing/volume/dcm/write_visitor.cpp | UTF-8 | 3,181 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #include "./write_visitor.h"
#include "./data_element.h"
#include "./data_sequence.h"
#include "./data_set.h"
#include "./util.h"
#include "./writer.h"
namespace dcm {
WriteVisitor::WriteVisitor(Writer* writer) : writer_(writer) {
}
void WriteVisitor::VisitDataElement(const DataElement* data_element) {
tag_ = dat... | true |
0273bb6731e6fc4eedfc81ffeb1fa03c3645678f | C++ | Ventura-CS-V13-Spring2021/assignments-KarishaDel | /Quiz/Quiz1/Q5.cpp | UTF-8 | 550 | 3.53125 | 4 | [] | no_license | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int range1, range2 ;
bool done {false};
int i;
while (!done)
{
cout << "Type a range of integers to test for prime numbers: " << endl;
cin >> range1 >> range2;
for (int num = range1; num <= range2; num++)
{
for (i = 2; i < n... | true |
ca52b20f5b3fe61a7198ed3cabef7c7baf6b88f4 | C++ | kelby-amerson/binarytree | /Main.cpp | UTF-8 | 3,753 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <string.h>
#include "BinaryTree.h"
using namespace std;
int main(int argc, char *argv[]){
BinaryTree list;
ItemType item4;
int input;
fstream fs;//opens up file
i... | true |
3088a9559d1400180b1465e2572552acb243c2a7 | C++ | M4t3B4rriga/Team5-DataStructure-3688 | /II-PARCIAL/Homewrok02Polaca_Calculator/Poland_Calculator/Poland_Calculator/Operation.h | UTF-8 | 2,844 | 2.875 | 3 | [] | no_license | /** UNIVERSIDAD DE LAS FUERZAS ARMADAS "ESPE"
* INGENIERIA SOFTWARE
*
*
*@author THEO ROSERO
*@author YULLIANA ROMAN
*@author JUNIOR JURADO
*@author ALEX PAGUAY
*@author SANTIAGO SAÑAY
*TEMA: Calculadora Polaca inversa
*FECHA DE CREACION : 3 DE JULIO DE 2021
*FECHA DE MODIFICACION: 6 DE JUNIO 2021
*/
#pragma once
#i... | true |
9705d0211409d29f96482bc020970042ac881ee7 | C++ | Slackoth/Algoritmos | /SDA_Exam_04/ej_i.cpp | UTF-8 | 137 | 2.6875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void spaceArr(char* arr, int size) {
for(int i = 0; i < size; i++)
arr[i] = ' ';
} | true |
cfdb6ea9fa6a8bc92f6ccd6125ce2c8aa81947a9 | C++ | Daniel-del-Castillo/CC1 | /headers/transition.hpp | UTF-8 | 797 | 3.3125 | 3 | [
"Unlicense"
] | permissive | #pragma once
#include <string>
#include <vector>
#define EPSILON '.'
// Represents a transition. It also contains an id, so the transitions
// are easier to identify in the traces
class Transition {
int id;
std::string destination;
char tape_token;
char stack_token;
std::vector<char> new_stack_... | true |
fc093ada62cde1d1307350ff44e4c9351907ca7a | C++ | kai04/Programming | /Number System/sieveEratosthenes.cpp | UTF-8 | 1,299 | 2.84375 | 3 | [] | no_license | //
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<bool> Prime(ll n){
vector<bool> isPrime(n+1,true);
isPrime[0]=isPrime[1]=true;
for(ll i=2;i<=sqrt(n);i++){
if(isPrime[i]){
for(ll j=i*i;j<=n;j=j+i){
isPrime[j]=false;
}
}
}
return isPrime;
}
int main(){
ll n;
cin>>n;
ve... | true |
4afb602ae47df536884e5fbcc0a69ed09bfb780e | C++ | Yixuan-Lee/LeetCode | /algorithms/src/Ex_148/Sort_list.cpp | UTF-8 | 2,017 | 3.828125 | 4 | [] | no_license | // references:
// https://leetcode.com/problems/sort-list/discuss/46714/Java-merge-sort-solution
#include <iostream>
struct ListNode {
int val;
ListNode *next;
explicit ListNode(int x) : val(x), next(nullptr) {}
};
class Solution {
public:
ListNode *sortList(ListNode *head) {
if (head ... | true |
82a61b426bdff40a59433812ef612c6062a359ff | C++ | UmbrellaSampler/carnd-term2-4_pid_control | /src/PID.cpp | UTF-8 | 988 | 3.0625 | 3 | [
"MIT"
] | permissive | #include "PID.h"
PID::PID() {}
PID::~PID() {}
void PID::Init(double Kp_, double Ki_, double Kd_) {
Kp = Kp_;
Ki = Ki_;
Kd = Kd_;
p_error = 0.0;
d_error = 0.0;
i_error = 0.0;
prev_cte = 0.0;
}
void PID::UpdateError(double cte) {
// Proportional error: this term is proportional to t... | true |
ab301989d98482babf7d42b2c6b9e33e5d3a2d6a | C++ | spookyboo/Memorytracker | /MemoryTracker.h | UTF-8 | 6,558 | 3.5625 | 4 | [] | no_license | /*
* ----------------------------------------------- Memorytracker -----------------------------------------------
* This one-header file can be used to determine memoryleaks. Instead of overriding the 'new' and 'delete'
* operator, this tracker implements alternative functions. Usage:
*
* 1. Add this headerfile t... | true |
4dfa747783ada0163ecc6831cdb519f64bc0e2d8 | C++ | byznrdmrr/cs-sakaryauniversity | /BSM207 - VERİ YAPILARI/Ders Notları/Göstericiler/dizi_gostericisi.cpp | UTF-8 | 180 | 3.203125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int x[]={10,5,21};
int *p;
p=x;
cout<<*p<<endl; // 10
cout<<*(p+1)<<endl; // 5
cout<<*(p+2)<<endl; // 21
return 0;
} | true |
a2be1c4b2d817d31f494388e8af08e4fa7db449c | C++ | chrillomat/AstroEQ | /AstroEQ-Firmware/SerialLink.cpp | UTF-8 | 3,418 | 2.515625 | 3 | [
"LicenseRef-scancode-other-permissive"
] | permissive |
#include "SerialLink.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#ifndef USART0_TX_vect
#define USART0_TX_vect USART0_TXC_vect
#endif
#ifndef USART0_RX_vect
#define USART0_RX_vect USART0_RXC_vect
#endif
typedef struct {
unsigned char buffer[64];
volatile unsigned char head;
volatile unsigned char tail;
}... | true |
8b370c748ee699d42f26a9e48f1231b857fe78b2 | C++ | cgcollector/PatternLabel | /ImageViewer.cpp | UTF-8 | 4,321 | 2.5625 | 3 | [] | no_license | #include "ImageViewer.h"
#include <qevent.h>
#include <qpainter.h>
#include <set>
#include <stack>
#include "util.h"
#include "global_data_holder.h"
ImageViewer::ImageViewer(QWidget* parent)
:QWidget(parent)
{
setMouseTracking(true);
setBackgroundRole(QPalette::ColorRole::Dark);
setAutoFillBackground(t... | true |
89d3de4a040526500c1e56bbead5e792681bcab3 | C++ | dongryoung/Class_Examples | /10. Raspberry Pi/_15_Arduino_LED_PWM/_15_Arduino_LED_PWM.ino | UTF-8 | 301 | 2.65625 | 3 | [] | no_license | int led = 10; //~ mark port
int val = 0;
void setup() {
Serial.begin(9600);
Serial.println("input 0 ~ 255");
pinMode(led, OUTPUT);
} //setup()
void loop() {
if(Serial.available()) {
val = Serial.parseInt();
Serial.println(val);
analogWrite(led, val);
}
delay(50);
} //loop()
| true |
cf3093270c8225bf1396d1e35de1a4e4e2e97243 | C++ | alexisurvoy/Personal-Projects | /SuperPushBoy/Box.cpp | UTF-8 | 2,071 | 3.203125 | 3 | [] | no_license | /*
* Box.cpp
* sdlgame
*
* Created by Alexis Urvoy on 29/12/12.
* Copyright 2012 __MyCompanyName__. All rights reserved.
*
*/
#include "Box.h"
Box::Box(SDL_Surface* _screen): screen(_screen){
boxIm = IMG_Load("/Users/alex/Documents/sdlgame/images/box.png");
}
Box::~Box(){}
void Box::move(int direction){... | true |
0fc4ae26b8a1e8bc10e717c7a2cf56ac39f9bb04 | C++ | papan01/cvCrayon | /cvlib/imgproc/smoothing.cpp | UTF-8 | 3,216 | 2.984375 | 3 | [] | no_license | #include "smoothing.h"
namespace imgproc
{
GaussCache::GaussCache(const float& sigma, const int& gauss_window_factor)
{
kernel_window_factor = static_cast<int>(ceil(0.3 * (sigma / 2 - 1) + 0.8) * gauss_window_factor);
if (kernel_window_factor % 2 == 0) kernel_window_factor++;
kernel_horizontal_buf.reset(new f... | true |
7a6d8956ec4ab7b05613bba6fcfebff3b17ba26e | C++ | tigarto/whatsprogrammer | /data-structures-in-cpp/graph/MST/kruskal/ListUDG.cpp | UTF-8 | 15,347 | 3.578125 | 4 | [
"MIT"
] | permissive | /**
* C++: prim算法生成最小生成树(邻接表)
*
* @author skywang
* @date 2014/04/23
*/
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
// 示例类:边的结构体(用来演示)
class EData
{
public:
char start; // 边的起点
char end; // 边的终点
int weight; // 边的权重
public:
EData(){}
... | true |
41b56d510ec49e2e07c793433a5a611e5ba333ba | C++ | tiyunes/Lab_2sem_2 | /STACK.H | UTF-8 | 1,457 | 3.625 | 4 | [] | no_license | #ifndef STACK_H
#define STACK_H
#include "ArraySequence.h"
#include "LinkedListSequence.h"
template<class T>
class Stack
{
public:
Stack()
{
this->elements = (Sequence<T>*) new LinkedListSequence<T>();
//this->elements = (Sequence<T>*) new ArraySequence<T>();
}
Stack(T* items, int size... | true |
90d1093fe32cd8aa5d50590f37d41d250223aa9e | C++ | Cogitus/DCA1202---Projeto-1 | /tratamentoDePoligonos/ponto.cpp | UTF-8 | 1,055 | 3.453125 | 3 | [] | no_license | #include <cmath>
#include <iostream>
#include "ponto.h"
using namespace std;
Ponto::Ponto() { //construtor
}
void Ponto::setX(float _x) {
x = _x;
}
void Ponto::setY(float _y) {
y = _y;
}
void Ponto::setXY(float _x, float _y) {
x = _x;
y = _y;
}
float Ponto::getX(void) {
return x;
}
floa... | true |
7dfe33bb98baf0ce504f345f37fe55f9de6f313c | C++ | hljgirl/DesignPatterns | /Composite/Employee.h | UTF-8 | 334 | 3.296875 | 3 | [] | no_license | #pragma once
#include <string>
using namespace std;
class Employee
{
public:
Employee(string name, int age, int salary);
virtual ~Employee();
virtual void add(Employee* employee) = 0;
virtual void ShowInformation() = 0;
string GetName();
int GetAge();
int GetSalary();
private:
string _name;
int _age;
int... | true |
4861a8e06362a5fb981645aec2cdac899138eb1e | C++ | YadamD/HalProg | /Matrix/matr2D.h | UTF-8 | 10,966 | 3.375 | 3 | [] | no_license | #include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <numeric>
#include <initializer_list>
#include <cmath>
#include <ostream>
namespace detail
{
template<typename M1, typename M2, typename F>
void transform_matrix1(M1 const& m1, M2& m2, F f)
{
std::transform(m1... | true |
12e675bd2465c6db2edb9894b5b85fee9df00e30 | C++ | imanisaskia/Engis-Farm-Prototype | /Farm_Product/FarmProduct.hpp | UTF-8 | 319 | 2.5625 | 3 | [] | no_license | #ifndef FARMPRODUCT_HPP
#define FARMPRODUCT_HPP
class FarmProduct {
public:
/*virtual dtor*/
virtual ~FarmProduct(){};
/*virtual function to get FarmProduct type*/
virtual int getType()=0;
/*virtual function to get FarmProduct price*/
virtual int getPrice()=0;
};
#endif
| true |
259d145662d5e6989e1d45b8e58c4afe03bfcecd | C++ | etsaf/cpp-algorithms | /dijkstra.cpp | UTF-8 | 1,766 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <utility>
#include <set>
#include <climits>
#include <algorithm>
#include <tuple>
using namespace std;
struct edge {
public:
int to, l;
};
const int64_t inf = numeric_limits<int64_t>::max();
int main() {
int n, start, finish;
cin >> n >> start >> finish;
... | true |
00df11ba4f926ce7816731fda4a1ace883c004ac | C++ | Abdulrahman-Khalid/Algorithmic-Toolbox-Coursera-San-Diego | /week3_greedy_algorithms/4_maximum_advertisement_revenue/dot_product.cpp | UTF-8 | 520 | 2.75 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef long long ll;
void max_dot_product()
{
int n, x;
scanf("%d", &n);
VI a, c;
for (int i = 0; i < n; i++)
{
scanf("%d", &x);
a.push_back(x);
}
for (int i = 0; i < n; i++)
{
scanf("%d", &x);
c.push_back(x);
}
... | true |
294f957be26800814f37999b0a70de8f0c046834 | C++ | SohyunDev/ImageProcessing_EquationResolver | /Color.cpp | UTF-8 | 605 | 3.234375 | 3 | [] | no_license | #include "Color.h"
// Vec3s
Color::Color(Vec3s color)
{
this->blue = color[0];
this->green = color[1];
this->red = color[2];
}
Color::Color()
{
this->blue = 255;
this->green = 255;
this->red = 255;
}
Color::~Color()
{
}
short Color::getRedColor()
{
return this->red;
}
short Color... | true |
dd5fb9b34118d2d496bc922be7829dfa235e63b7 | C++ | xuehanshuo/ref-cpp-ood | /16 装饰模式/16 装饰模式.cpp | UTF-8 | 1,722 | 2.984375 | 3 | [] | no_license | //This is a C++ program
//Designed and supported by Hodor
//High cohesion & Low coupling
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
//替代继承 动态给一个类增加功能
//——————————————————————————————————————————————————————————————————————————————————————————
class AbsHero {
public:
virtual void ShowS... | true |
442117abd82480fecabdef46a07aa6dfb9667deb | C++ | SandeepMaithani/DS_and_Algo_practice | /DS/Graphs_DS/Topological Sort Algorithm with DFS.cpp | UTF-8 | 1,068 | 3.1875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define endl "\n"
typedef long long int ll;
void topologicalSortHelper(vector<vector<int>>& graph, vector<bool>& visited, stack<int>& st, int source) {
visited[source] = true;
for (auto neighbour : graph[source]) {
if (visited[neighbour] == fal... | true |
b02971dbf1cab9093bf6c42d56951fe11b0c2f3a | C++ | MichJadams/btr | /Assembly/SsePackedIntegerArithmatic/SsePackedIntegerArithmatic/SsePackedIntegerArithmatic.cpp | UTF-8 | 1,078 | 2.65625 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include "XmmVal.h"
#include <math.h>
extern "C" void SsePackedInt16_add(const XmmVal * a,const XmmVal *b, XmmVal c[2]);
extern "C" void SsePackedInt32_sub(const XmmVal * a, const XmmVal *b, XmmVal *c);
extern "C" void SsePackedInt32_mul(const XmmVal * a, const XmmVal *b, XmmVal c[... | true |
53a4c427163812ed7e89bafae5c9a7ceffb13248 | C++ | pavelkryukov/puzzles | /sudoku/source/main.cpp | UTF-8 | 997 | 3.03125 | 3 | [
"MIT"
] | permissive | /*
* main.cpp
*
* Sudoku solver main program
*
* Kryukov Pavel (C) 2011
*/
#include <ctime>
#include <iostream>
#include "sudoku.h"
int main(int argc, char* argv[]) {
if (argc != 2) {
std::cout << "Syntax error" << std::endl;
return -1;
}
std::ifstream inputfile;
inputfile.open... | true |
08bab62c15d687171249b45fd57f957346d76721 | C++ | lojpark/CodeForces | /Round #568 Div. 2/C2 - Exam in BerSU (hard version).cpp | UTF-8 | 972 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <queue>
#include <functional>
using namespace std;
int n, m;
int t[200010];
priority_queue<int, vector<int>, less<int>> pq_max;
priority_queue<int, vector<int>, greater<int>> pq_min;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m;
for (int i = 1; i <= n; i++)... | true |
dc1bd40da93efb48692c356c458560d9e1e869fe | C++ | dickynovanto1103/Sliding-Window-Protocol-Simulation | /src/recvfile.cpp | UTF-8 | 4,555 | 2.796875 | 3 | [] | no_license | #include "message.cpp"
#include "packet_validator.cpp"
#include "response.cpp"
#include "window.cpp"
#include <arpa/inet.h>
#include <fstream>
#include <iostream>
#include <netinet/in.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <unistd.h>
#define FILE_ENDING 0x26
#define SLEEP_TIME 100000
using namespace... | true |
e6aa05ba3e2a775d70ead3a0df8fd5a5c147a877 | C++ | haruka-mt/paiza | /Rank_C/C023.cpp | UTF-8 | 563 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <array>
#include <algorithm>
using namespace std;
int main(void)
{
int n;
array<int, 6> winNum;
int myNum;
int i, j;
for (j = 0; j < 6; ++j)
{
cin >> winNum[j];
}
cin >> n;
int sum;
for (i = 0; i < n; ++i)
{
sum = 0;
fo... | true |
2d496bcf4e3019d5271238e9e8efa9e6deaba897 | C++ | RhedensSpaceEngineering/RMGS | /Arduino/Core/SD_Card.ino | UTF-8 | 2,638 | 3.015625 | 3 | [] | no_license | /*
* SD_Card
*
* Connects the MicroSD to the arduino so it can be read out.
* Adds SD_Card, sdCardOpenFile, sdCardPrint, sdCardCloseFile\
*
* Pin layout:
* MicroSD --------- Arduino
* VCC ------------- 5V
* CS ------------- D10
* DI ------------- D11
* SCK ------------- D13
* D0 ------------- D... | true |
ec32653280a45b7dc5da1b8cfff8bf85dc5081b1 | C++ | hoangnamwar/data-structure | /first_test/list.h | UTF-8 | 561 | 3.28125 | 3 | [] | no_license | #ifndef LIST_H
#define LIST_H
#include "node.h"
class List
{
private:
Node* head;
public:
List()
{
head = 0;
}
void add(int value)
{
Node* newNode = new Node;
newNode->data = value;
newNode->next = 0;
if (head == 0)
{
head = newNode;
}
else
{
Node* shipper = head;
while (shipper->nex... | true |
a22d455426be4e750dd8e64a9fcd8f7468441a84 | C++ | gsmnit/coding_for_interview | /c/c++/str_property.cpp | UTF-8 | 296 | 2.578125 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{ string str1 = "praising";
string char1 = str1.substr(1);
cout << char1 << endl;
string substr1 = str1.substr(1,5);
cout << substr1 << endl;
cout << str1[0] << endl;
return 0;
}
| true |
33b5134ecfa304833c111699236cbae43b23222f | C++ | DoobleD/Air | /Air/src/OS/win32/Screen.cpp | UTF-8 | 3,161 | 2.671875 | 3 | [] | no_license | #include "OS/Screen.hpp"
using namespace air::os;
Screen::Screen(void)
{
m_threadRunning = false;
}
Screen::~Screen(void)
{
if (m_threadRunning)
{
m_threadRunning = false;
Wait();
}
}
int Screen::getResX(void)
{
RECT rc;
GetWindowRect(GetDesktopWindow(), &rc);
return rc.right;
}... | true |
c9d447f0e965fef222c050b98ccfa0943d8eb328 | C++ | vinitjindal/Data_Structure | /doubly linked list_4a.cpp | UTF-8 | 2,081 | 3.078125 | 3 | [] | no_license | #include<iostream>
using namespace std;
struct node{
struct node *pre;
int data;
struct node *next;
};
int main(){
struct node * n;
struct node *start3,*start4;
struct node *start2;
struct node *start1;
struct node *ptr1;
struct node *ptr;
char flag,flag1,flag2;
int num;
struct n... | true |
a7934db5c4c73571c8c6a8598de2570ea073c0cc | C++ | rajataneja101/leetcode_August_challenge | /Day_27(Right_insert_interval)/Solution.cpp | UTF-8 | 831 | 2.8125 | 3 | [] | no_license | class Solution {
public:
vector<int> findRightInterval(vector<vector<int>>& intervals) {
multimap<int, int> starttable;
multimap<int, int> endtable;
int len = intervals.size();
for (int i = 0; i < len; ++i)
{
starttable.insert(pair<int,int>(intervals[i][0], i));
endtable.insert(pair<int, int>(intervals[i]... | true |
b838b4418d948385887ee79ece0728740310f43a | C++ | ehnryx/acm | /wf2016/h.cpp | UTF-8 | 8,591 | 2.84375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef double ld;
//typedef complex<ld> pt;
struct pt {
ld x, y;
pt(const ld& _x=0, const ld& _y=0): x(_x), y(_y) {}
pt operator * (const pt& o) const { return pt(x*o.x - y*o.y, x*o.y + y*o.x); }
pt operator - () const { return pt(-x, -y... | true |
d32c28f292567bd887d39603dc2ebf5ea5cd9671 | C++ | webturing/ACM-1 | /按 OJ 分类/51Nod/f-51Nod-1552-白兰地定位系统/f-51Nod-1552-白兰地定位系统/main.cpp | UTF-8 | 1,574 | 2.546875 | 3 | [] | no_license | //
// main.cpp
// f-51Nod-1552-白兰地定位系统
//
// Created by ZYJ on 2017/7/31.
// Copyright ? 2017年 ZYJ. All rights reserved.
//
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 10;
const ll INF = 0x3f3f3f3f3f3f3f3f;
int n, m;
ll a[MAXN];
ll b[MAXN];
template ... | true |
23313aa6cf0e49dddcf7271b901db3162618e9b0 | C++ | dduynam/tutorial | /C++/study/algorithm/sort/src/quicksort.cpp | UTF-8 | 1,206 | 4.0625 | 4 | [] | no_license | #include "../lib/quicksort.h"
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
/* The partition function
1. Take the last element as pivot
2. Place the pivot to the correct position by comparing
3. Move the smaller value to the left
4. Move the greater value to the right
Note:... | true |
4949dc5261e80840641eda52083fa0f7d6e6cd51 | C++ | Mohammed-Shoaib/Coding-Problems | /HackerRank/Algorithms/Easy/E0090.cpp | UTF-8 | 785 | 3.15625 | 3 | [
"MIT"
] | permissive | /*
Problem Statement: https://www.hackerrank.com/challenges/largest-permutation/problem
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> largestPermutation(int n, int k, vector<int> arr) {
vector<int> sorted(arr);
sort(sorted.rbegin(), sorted.rend());
for (int j, i = ... | true |
266cbda3eb0959f3fc2ac843b0a8c593e349eea8 | C++ | pkc232/OperatingSystemLab | /Cpu_Scheduling/SJF.cpp | UTF-8 | 372 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,i,j;
cout<<"Enter the no of processes\n";
cin>>n;
vector<pair<int,int> >tim;
int x;
for(i=0;i<n;i++)
{
cin>>x;
tim.push_back(make_pair(x,i+1));
}
sort(tim.begin(),tim.end());
int t=0;
for(i=0;i<n;i++){
cout<<tim[i].second<<" :"<<t<... | true |
6c0250a7aca056b463f704aa2ecae864b3d635d8 | C++ | schafar92/antlr-cpp | /antlr.cpp | UTF-8 | 2,706 | 2.515625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "antlr4-runtime/antlr4-runtime.h"
#include "antlr4-runtime/CPP14Lexer.h"
#include "antlr4-runtime/CPP14Parser.h"
#include "ImageVisitor.h"
#include <experimental/filesystem>
#include "csv-writer/include/CSVWriter.h"
using namespace std;
using namespace antlr4;
namespace fs = std::experime... | true |
bc149b64c2d825b3fdc94d3d96353650bdc9915b | C++ | Wafiifaw55/Arduino-control-Servo-with-ultrasonic | /start_simulating1.ino | UTF-8 | 1,095 | 2.546875 | 3 | [] | no_license | #include<Servo.h>
int trig=8;
int echo=9;
int dt=10;
Servo servo1,servo2,servo3,servo4,servo5,servo6;
void setup() {
pinMode(trig,OUTPUT);
pinMode(echo,INPUT);
Serial.begin(9600);
servo1.attach(2);
servo2.attach(12);
servo3.attach(3);
servo4.attach(13);
servo5.attach(4);
servo6.attach(11);
}
int b=30,s... | true |
458a13cd35205327e6ed8b4fa1dd0022519de7b2 | C++ | cohenor1112/BlackJack-with-Cpp- | /BlackJack_ariel/Card.h | UTF-8 | 808 | 3.078125 | 3 | [] | no_license | #ifndef _CARD_H_
#define _CARD_H_
#include <string>
#include <iostream>
using namespace std;
class Card {
public:
//de/constractors:
Card(int card_serial);
~Card();
Card(Card& c);
//getters,setters:
char get_name() const;
char get_game_value() const;
static int toss_val();
static int get_max_cards();
static... | true |
6d07b53d303f0757ba6fbcf4113cd804599eb1c5 | C++ | tobiashienzsch/examples | /cxx_wdf/main.cpp | UTF-8 | 5,211 | 3.203125 | 3 | [
"MIT"
] | permissive | #include <array>
namespace mc
{
template<typename T>
struct State
{
T Rp {1}; // Port resistance
T a {0}; // incident wave (incoming wave)
T b {0}; // reflected wave (outgoing wave)
};
template<typename T>
struct ElectricalComponent
{
[[nodiscard]] auto voltage() noexcept
{
auto& stat... | true |
ecc8f3c7e81028dc6323f82e792597e8a014e9e1 | C++ | sergey-shambir/cocos2d-x-extensions-cpp2011 | /serialization-codegen/test_data/SampleGameData.h | UTF-8 | 1,175 | 2.6875 | 3 | [
"MIT"
] | permissive |
struct ISerializableRecord
{
virtual ~ISerializableRecord() {}
virtual void saveDataTo(CCDictionary *dict) const = 0;
virtual void loadDataFrom(CCDictionary *dict) = 0;
};
struct SoldierRecord : public ISerializableRecord
{
SoldierRecord();
void saveDataTo(CCDictionary *dict) const;
void loadD... | true |
46d0d51c7beb39508bafea07d2e1068526561444 | C++ | yashYRS/UndergraduateLabs | /OperatingSystems/Week_9/Deadlock/deadlock.cpp | UTF-8 | 2,860 | 3.265625 | 3 | [] | no_license | #include<iostream>
#include<stdlib.h>
using namespace std ;
int* take_input(int n, int m) {
int* a = (int*)malloc(sizeof(int)*n*m) ; // n*m
for(int i = 0 ; i < n ; i++) {
cout<<"\n Enter row -> " ;
for(int j = 0 ; j < m ; j++)
cin>>a[i*m + j];
}
return a ;
}
void copy(int *a , int * b, int n) {
for... | true |
3580ce73b36c3b3e2952adbc9384fe5c2c492e96 | C++ | johnmryan/TowerDefense | /Towers/Tower.h | UTF-8 | 2,001 | 3.1875 | 3 | [] | no_license | /* Jack Ryan
* CSE 20212
* Final Project
* Tower.h
* Tower interface for abstract base class
*/
#ifndef TOWER_H
#define TOWER_H
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <stdio.h>
#include <string>
#include <sys/time.h>
#include <iostream>
#include <cmath>
#include "../Enemies/Enemy.h"
using names... | true |
27705910cbee3dff5812a9e2620910a987af8048 | C++ | dlvguo/NoobOJCollection | /LeetCode/Normal/900-999/908.cpp | UTF-8 | 328 | 2.59375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int smallestRangeI(vector<int> &nums, int k)
{
int minNum = *min_element(nums.begin(), nums.end());
int maxNum = *max_element(nums.begin(), nums.end());
return maxNum - minNum <= 2 * k ? 0 : maxNum - minNum - 2 * k;
... | true |
ab7017e32b513d8069da16a3bc72ae6b786b3cfc | C++ | ztelur/sicp | /构造过程抽象/习题/1.11/f.cpp | UTF-8 | 290 | 3.03125 | 3 | [] | no_license |
/**
* c++的实现啊,先转换一下思想
*/
int a = 0;
int b = 1;
int c = 2
int f2(int n) {
int i = 0;
while(i!=n) {
inter_f2(i,n);
i++;
}
return c;
}
int inter_f2(int i,int n) {
if (i <3) return i;
int res = c+ 2*b + 3*a;
a = b;
b = c;
c = res;
return res;
}
| true |
cf776f88934f18cb7316879853b196a2bdc4ec70 | C++ | ejohns6/Simple-Operator-Overloading-Polymorphism | /Pair.h | UTF-8 | 849 | 2.953125 | 3 | [] | no_license | #ifndef PAIR_H_INCLUDED
#define PAIR_H_INCLUDED
#include <iostream>
#include <string>
using namespace std;
template <class T>
class Pair{
public:
Pair();
Pair(T first, T second);
T first();//return the first member of the pair
T second();//reutrn the second member of the pair
bool operator==(cons... | true |
26e18e060f6c8a8a2d770f526d183955c31ce857 | C++ | ZeroNerodaHero/USACO-Training-Gateway | /3.1/agrinet.cpp | UTF-8 | 1,430 | 2.90625 | 3 | [] | no_license | /*
ID: billyz43
PROG: agrinet
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <queue>
#include <cstring>
using namespace std;
std::ifstream in("agrinet.in");
std::ofstream out("agrinet.out");
struct node{
int cur, d;
node(int cur,int d): cur(cur),d(d) {}
bool operator <(const node &o) const{
... | true |
097cd3e2cd18b063867e21def85e63c4a1e64872 | C++ | mostriki/computer-science-161 | /in-class/wk08/practice-problem-03/main.cpp | UTF-8 | 2,128 | 4.1875 | 4 | [] | no_license | /**********************************************************************************************************************
* *
* * Author: Riki Montgomery
* * Date: March 17, 2019
* * Program Name: Number Swap
* * Filename: practice-problem-03
* * Description: Swaps the fi... | true |
fb65eb247b354644f01ceffafa196ee7d2409323 | C++ | katarina995/Monopoly | /Board.cpp | UTF-8 | 1,281 | 3.015625 | 3 | [] | no_license | //
// Created by rtrk on 9.10.19..
//
#include "Board.h"
#include <algorithm>
Board::Board(){
initializeFields();
}
Board::~Board(){
for(auto field: fields)
delete field;
}
void Board::initializeFields() {
vector<Street*> streets = readingFromFile();
for(auto street : streets){
Field *... | true |
356cbc83023a808fa02c900b8d023a34e200bfa7 | C++ | rpuntaie/c-examples | /cpp/container_unordered_map_equal_range.cpp | UTF-8 | 570 | 3.09375 | 3 | [
"MIT"
] | permissive | /*
g++ --std=c++20 -pthread -o ../_build/cpp/container_unordered_map_equal_range.exe ./cpp/container_unordered_map_equal_range.cpp && (cd ../_build/cpp/;./container_unordered_map_equal_range.exe)
https://en.cppreference.com/w/cpp/container/unordered_map/equal_range
*/
#include <iostream>
#include <unordered_map>
int ma... | true |
19191aa6dc440caa539b573fcd2be1c6b57df9d5 | C++ | OutOfTheVoid/Kernel | /include/hw/cpu/IO.h | UTF-8 | 1,287 | 2.671875 | 3 | [] | no_license | #ifndef HW_CPU_IO_H
#define HW_CPU_IO_H
#include <hw/HW.h>
#include <hw/cpu/CPU.h>
namespace HW
{
namespace CPU
{
class IO
{
public:
static inline void Out8 ( uint16_t Port, uint8_t Value )
{
__asm__ volatile ( "outb %1, %0" : : "a" ( Value ), "dN" ( Port ) );
};
static ... | true |
a01cc3853f0a0792c21c538571615291e67857ae | C++ | olasalem/MPS | /mps_parser/stack.cpp | UTF-8 | 1,281 | 3.28125 | 3 | [] | no_license | #include <QString>
#include <QDebug>
#include "stack.h"
using namespace std;
stack::stack(){
}
stack::stack(const stack & s){ //copy constructor
for(int i=0;i<maxSize;i++){
stackPointer[i] = s.at(i);
}
}
stack::~stack(){ //destructor
}
bool stack::isEmpty() con... | true |
33af5a723804ebddad6b5b473bfc3c16d29aba36 | C++ | pawanchoure2000/C-Language- | /recursion.cpp | UTF-8 | 777 | 3.953125 | 4 | [] | no_license | //direct recursive if it calls the same function
//called indirect recursive if it calls another function
// A C++ program to demonstrate working of
// recursion
#include<bits/stdc++.h>
using namespace std;
void printFun(int test)
{
if (test < 1)
{
printf("hi \n ");
return;
}
else
{ ... | true |
8616966308403b78a393db0c3c6768be617f8dac | C++ | egross91/Summer2013 | /Cards/Cards/Poker.h | UTF-8 | 617 | 2.546875 | 3 | [] | no_license | #ifndef POKER_H
#define POKER_H
#include "Dealer.h"
class Poker : public Dealer
{
private:
typedef Dealer super;
public:
Poker();
void play();
int printResult(std::vector<Card>);
int determineHand(std::vector<Card>);
bool royalFlush(std::vector<Card>);
bool flush(std::vector<Card>);
bool straight(std::vector<... | true |
1f684423a85f26e81576d8fa1054a82dfabd2bce | C++ | ganaganan/Reverse-Game | /反対/Source/Light.h | SHIFT_JIS | 1,476 | 2.765625 | 3 | [] | no_license | #pragma once
#include <DirectXMath.h>
struct PointLight {
float index;
float range;//͈̓͂
float type; //L
float dummy;
DirectX::XMFLOAT4 pos;
DirectX::XMFLOAT4 color;
};
class Light
{
public:
enum ConsumptionAmount
{
Small,
Midium,
Big,
};
static int amountState;
private:
static DirectX::XMFLOAT3 po... | true |
c4436041ae6b25fd53706a731e179622e3c4fb4f | C++ | JesusSerna/UberChat | /Project_Current_Test/Server/chat/chat_session.hpp | UTF-8 | 9,032 | 2.90625 | 3 | [] | no_license | /*
chat_session.hpp
*/
#pragma once
#include "chat_room.hpp"
class chat_server;
class chat_session
: public chat_participant,
public enable_shared_from_this<chat_session>
{
public:
chat_session(tcp::socket socket, vector<chat_room>& rooms)
: socket_(move(socket)),
rooms_(rooms)
{
}
void ... | true |
97dbc9c45363aea365ca1c32a369847f156e83a1 | C++ | megatelesync/ResourceManager | /MathUtil/h/!DEPRECATED/3DMath/MathUtil_3DMath_AngleDirectedPosition.h | UTF-8 | 3,192 | 2.875 | 3 | [] | no_license | #ifndef _MathUtil_3DMath_AngleDirectedPosition_h_
#define _MathUtil_3DMath_AngleDirectedPosition_h_
#include <DirectXMath.h>
#include "../Core/MathUtil_Core_AnglePair.h"
#include <boost/property_tree/ptree.hpp>
#include "MathUtil_3DMath_Utils.h"
namespace DvUtils
{
namespace Math
{
struct AngleDirectedPosition
... | true |
79a105c2db50160ddfa4eacc48e24b98ea726ed1 | C++ | nsarang/motif_bionet | /src/Graph.h | UTF-8 | 1,612 | 2.65625 | 3 | [] | no_license | //============================================================================
// Name : Graph.h
// Author : Nima Sarang
// Version :
// Copyright :
// Description :
//============================================================================
#ifndef __GRAPH_H
#define __GRAPH_H
#include <vector>
#... | true |