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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
64408a3e240f514b810cf69c54783c0dcd004f83 | C++ | Asmilex/CppUniversityProjects | /First_year/Triannual1/Classwork/Parte 4/410.cpp | UTF-8 | 422 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> v(1);
cout <<"Introduce una serie de valores: \n";
for (int i=0; i<v.size(); i++){
v.push_back(1);
cin >>v[i];
if (v[i]==0){
v.pop_back();
v.pop_back();
... | true |
b3b7b189f9033ce3b3f62d008a269e92f6d9d46d | C++ | marcellosautto/Red-Black-Tree | /RBT.h | UTF-8 | 1,004 | 2.78125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
#include <Windows.h>
using namespace std;
class rbt
{
public:
struct Node {
Node* left;
Node* right;
Node* parent;
Node* pnc;
int num;
bool black, isLC;
Node()
{
left = nullptr;
right = nullptr;
parent = ... | true |
858015648967eb4ac7316da437d36e60acb99952 | C++ | paquiro/Exams-2-Ing-Inform. | /Primer Cuatrimestre/POO/ExamenesResueltos/POOFebrero/ong.hpp | UTF-8 | 869 | 2.671875 | 3 | [] | no_license | #ifndef __ONG_H_
#define __ONG_H_
#include <string>
#include <vector>
#include "socio.hpp"
#include "persona.hpp"
using namespace std;
class Ong {
public:
Ong();
~Ong();
string getNombreOng() {return nombreOng_;}
void setNombreOng(string nombreOng) {nombreOng_ = nombreOng;}
void setVectorSocios... | true |
78990b4f66c88165c39e98ad7f780966594bc21c | C++ | aigerard/cplusplus-coursera | /examples/9 - template_functions/ExampleClass.h | UTF-8 | 850 | 3.375 | 3 | [] | no_license | #include <iostream>
#ifndef EXAMPLE_CLASS_H
#define EXAMPLE_CLASS_H
using namespace std;
namespace ExampleNamespace {
// only one declared
template<typename T> class ExampleClass {
public:
int num;
T flexibleVar;
// best to define these in the same class with template<typename T... | true |
477ce36c4537e85d522a71f574dcfbef7d1df147 | C++ | alvls/mp1-2020-1 | /troegubova_aa/task2/VectorClass.cpp | UTF-8 | 2,723 | 3 | 3 | [] | no_license | #include <iostream>
#include "Vector.h"
Vector::Vector()
{
count = 0;
memo = nullptr;
}
Vector::Vector(int _count) : count(_count)
{
memo = new int[count];
}
Vector::Vector(int _count, int d) : count(_count)
{
memo = new int[count];
for (int i = 0; i < count; ++i)
memo[i] = d;
}
Vector::Vector(int _count, int... | true |
87bcc2e524598c5cce5c3deed40049b580ff6a89 | C++ | sooreect/Harry-Potter-and-the-3-Socks | /space.hpp | UTF-8 | 785 | 2.90625 | 3 | [] | no_license | //Tida Sooreechine
//Final Project, 12/5/15
//space.hpp is the Space class specification file
#ifndef SPACE_HPP
#define SPACE_HPP
#include <iostream>
#include <string>
#include "die.hpp"
using std::cin;
using std::cout;
using std::endl;
using std::string;
//Space class declaration
class Space
{
protected:
int id... | true |
0d3aa669d42f8916fe575204ff884461fbbc0ce9 | C++ | ivanmmurciaua/P2 | /P1/PRACTICA1/autocorrectorP2p1/uncleOwen.cc | UTF-8 | 9,533 | 2.828125 | 3 | [] | no_license | //DNI 48729799K MAÑUS MURCIA,IVÁN
#include <iostream>
#include <climits>
#include <vector>
#include <string>
using namespace std;
// ---------------- android -------------------------
const int NUMDROIDMODELS=5;
const string droidModels[NUMDROIDMODELS] = {
"x-75",
"fx-7",
"JK9",
"XAR-25",
"HC-2"
};
... | true |
a93a1bad081393420cf45bde0800c2eaf8b3d62f | C++ | btcup/sb-admin | /exams/2558/02204111/1/final/4_1_715_5820502302.cpp | UTF-8 | 773 | 2.90625 | 3 | [
"MIT"
] | permissive | #include<iostream>
#include<cmath>
using namespace std;
/*int GetInVal(int z,int x,int y)
{ cout<<x<<"b10 is "<<z<<"b"<<y<<endl;
return 0;
}*/
int main()
{ int x,y;
float i,j;
float k,z=0;
do
{
cout<<"Enter decimal number: ";
cin>>x;
cout<<"Enter base(2-9)";
cin>>y;
if(x>0||x==0)
... | true |
6f55c5f6575f592ad334ad46549f7ee06b10090b | C++ | nexusstar/SoftUni | /Cplusplus/week_four/extra/DailyTask_Paint/paint.cpp | UTF-8 | 1,358 | 3.34375 | 3 | [
"MIT"
] | permissive | #include <iostream>
class Size
{
public:
float x;
float y;
};
class PaintObject
{
public:
char color[4];
Size size;
Size sheetSize;
};
class Whale
{
public:
Size size;
char sckinColor[4];
unsigned short mass;
};
class PaintWhale : public Whale, public PaintObject, public Size
... | true |
587dd5438cee69ebef4321ef0f5e19c8a8d5fea8 | C++ | CM4all/libcommon | /test/net/TestAnonymize.cxx | UTF-8 | 2,208 | 2.6875 | 3 | [] | no_license | // SPDX-License-Identifier: BSD-2-Clause
// Copyright CM4all GmbH
// author: Max Kellermann <mk@cm4all.com>
#include "net/Anonymize.hxx"
#include <gtest/gtest.h>
#include <string>
using std::string_view_literals::operator""sv;
void
PrintTo(std::string_view s, std::ostream* os)
{
*os << '"' << s << '"';
}
void
Pr... | true |
5a458daf20a15213a07b114f9e617b76fa80c85b | C++ | teamhimeh/simutrans | /script/api/api_simple.h | UTF-8 | 992 | 2.703125 | 3 | [
"Artistic-1.0"
] | permissive | /*
* This file is part of the Simutrans project under the Artistic License.
* (see LICENSE.txt)
*/
#ifndef SCRIPT_API_API_SIMPLE_H
#define SCRIPT_API_API_SIMPLE_H
#include "../../squirrel/squirrel.h"
#include "../../dataobj/ribi.h"
/** @file api_simple.h Helper functions to export simple datatypes: ribi & friend... | true |
9f0bc4e2ac511cfbba32ed2a54907327bf3b2460 | C++ | lex-96/ip_filter | /ip_filter_test.cpp | UTF-8 | 1,136 | 2.546875 | 3 | [] | no_license | #define BOOST_TEST_MODULE test_main
#include <boost/test/included/unit_test.hpp>
#include "ip_filter.h"
BOOST_AUTO_TEST_SUITE(test_suite_main)
BOOST_AUTO_TEST_CASE(test_split) {
BOOST_CHECK( split( "aaaa\taaa\taa\ta", '\t') == std::vector<std::string>({ "aaaa", "aaa", "aa", "a"}) );
BOOST_CHECK( split(".." ,... | true |
c51d1b05e9d78958877c80ac78a6d73f93060cf7 | C++ | markpudd/gate_opener | /arduino/GateOpener/GateOpener.ino | UTF-8 | 6,630 | 2.734375 | 3 | [
"MIT"
] | permissive | /*
Non replay request
This code is a simple 2 request secure request for Arduino
It works by having a shatred seceret between the client and the arduino (hmacKey).
The first request generated a random token which is passed back to the client.
The client then appends a command ("open") to the token and crea... | true |
ce9374660b7e5bbd314960a775a4ca290c947212 | C++ | brokenhalo420/Store-System | /Store.cpp | UTF-8 | 4,059 | 3.265625 | 3 | [] | no_license | #include "Store.h"
#include <iostream>
using namespace std;
Store::Store()
{
this->myProfile = Profile();
this->myData = Database();
this->myAccounts = AccountManager();
this->isLogged = false;
}
Store::Store(const Database& database, const AccountManager& myAccounts)
{
this->myProfile = Profile();
this->myData... | true |
b752b79c80414a8708efe6e38e74d0bfe068495b | C++ | kumbralyov/pservice | /add_forms/add_tickets_form.cpp | UTF-8 | 3,462 | 2.625 | 3 | [] | no_license | #include "add_tickets_form.h"
#include <QRegExpValidator>
add_tickets_form::add_tickets_form(QWidget *parent) : QMainWindow(parent)
{
form_show();
}
add_tickets_form::~add_tickets_form()
{
db.close();
}
int add_tickets_form::form_show()
{
QGridLayout *gl = new QGridLayout;
lb_series = new QLabel("С... | true |
e40477527f168f4478fa16df696efa673af72d9b | C++ | triicst/Reinforcement-Learning | /Node.h | UTF-8 | 969 | 2.671875 | 3 | [] | no_license | //
// Node.h
// CS440-HW4
//
// Created by Wenzhao Xu on 12/9/12.
// Copyright (c) 2012 Xu Wenzhao. All rights reserved.
//
#ifndef __CS440_HW4__Node__
#define __CS440_HW4__Node__
#include <iostream>
#include <vector>
using namespace std;
class node
{
public:
node * child[6]; //children node pointer: 0=... | true |
9a1400809258f281198c7e92d10a45d89114c8d0 | C++ | ShihabShafkat/c- | /prims.cpp | UTF-8 | 1,388 | 3.21875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct nodes{
int number;
int weight = INT_MAX;
int parent = -1;
bool operator < (const nodes &a)const{
return weight > a.weight;
}
};
int connection[100][100];
int main(){
int vertex, edge, cost = 0, x, y, z;
cout<<"Vertex: "... | true |
0aa60f466614a43760ba72d4a30918fab279c97f | C++ | ruitaocc/RcEngine | /RcEngine/RcEngine/Graphics/RenderQueue.h | UTF-8 | 3,047 | 2.859375 | 3 | [] | no_license | #ifndef RenderQueue_h__
#define RenderQueue_h__
#include <Core/Prerequisites.h>
namespace RcEngine {
struct _ApiExport RenderQueueItem
{
Renderable* Renderable;
float SortKey;
RenderQueueItem() {}
RenderQueueItem(class Renderable* rd, float key) : Renderable(rd), SortKey(key) { }
};
typedef std::vector<RenderQ... | true |
ba453e81791a14ab628332c16a8e012421944079 | C++ | wakeup5/Learning-Lesson | /04-10 Lesson - 1 게임 종합/NumberPuzzle.h | UTF-8 | 567 | 2.703125 | 3 | [] | no_license | #pragma once
#include "Gamble.h"
enum NP_GAME_INPUT_ARROW
{
NP_GAME_INPUT_ARROW_NONE, NP_GAME_INPUT_ARROW_UP, NP_GAME_INPUT_ARROW_DOWN, NP_GAME_INPUT_ARROW_LEFT, NP_GAME_INPUT_ARROW_RIGHT
};
class NumberPuzzle : public Gamble
{
private:
int _board[5][5];
int _x, _y;
NP_GAME_INPUT_ARROW getArrow();
... | true |
645a8b30df849d87b0a9f5eca2aad7cf50761741 | C++ | wrapdavid/Dungeon_Crawler | /engine/core/inc/timer.h | UTF-8 | 605 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*!
@file
timer.h
@brief
Functionality for timers in the game engine.
@detail
*/
#pragma once
//--------------------------------------------
// Includes
//--------------------------------------------
#include "gumshoe_typedefs.h"
namespace Gumshoe {
//--------------------------------------------
// Ti... | true |
d2995b4f5a976126271b9a57c3d2bae50617e0e7 | C++ | aro-ai-robots/FullyHeadlessNick | /MouthControll/MouthControll.ino | UTF-8 | 5,051 | 2.59375 | 3 | [] | no_license | //Summer 2017 intern ship by Sierra Dacey and Molly Nehring
//Orangutans are powered separate from the pi with a battery
//Use the power/ground wires with silver tape
//Orangutans must be powered to be programmed
//**THE MOUTH OPEN IS NOT CURRENTLY WORKING (MOTOR IS STUCK)**
#include <Wire.h>
#include <OrangutanLEDs.h... | true |
f00fa3d518fa1885fb2499072e53f7f8605aced8 | C++ | VitaliyOschepkov/Labs_PSTU2 | /8. Программаб управляемая событиями/Lab_08/Student.cpp | WINDOWS-1251 | 894 | 3.734375 | 4 | [] | no_license | #include "Student.h"
Student::Student() :Person()
{
rating = 0;
}
Student::Student(string n, int a, float r) : Person(n, a)
{
rating = r;
}
Student::Student(const Student& s)
{
name = s.name;
age = s.age;
rating = s.rating;
}
Student::~Student()
{
}
float Student::getRating()
{
return rati... | true |
5270bfbe122fcb1569eb8fa444b44f4f78bcd527 | C++ | AparnaChinya/100DaysOfCode | /42. Trapping Rain Water.cpp | UTF-8 | 989 | 3.625 | 4 | [] | no_license | /*
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
For example,
Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.
The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain w... | true |
ab51397530f850f78be823ae60b2aea46fe6a422 | C++ | fauzanbakri/Arduino_Folder | /sdtest/sdtest.ino | UTF-8 | 7,314 | 3.046875 | 3 | [] | no_license | #include <SPI.h>
#include <SD.h>
const int chipSelect = D8; // use D0 for Wemos D1 Mini
File root;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial.print("\r\nWaiting for SD card to initialise...");
if (!SD.begin(chipSelect)) { // CS is D8 in this example
... | true |
135374299f8b63d11a885ee91678e3f0081e2d94 | C++ | kwon-young/Millenium-Neural-Net | /src/Neural_Net.cpp | UTF-8 | 4,056 | 2.96875 | 3 | [
"MIT"
] | permissive |
#include "Neural_Net.hpp"
#include <cmath>
#include <iostream>
using namespace Eigen;
double Neural_Net_Functions::logistic(const double input) const
{
return 1.0 / (1.0 + exp(-input));
}
double Neural_Net_Functions::logisticPrime(const double input) const
{
return logistic(input)*(1-logistic(input));
}
void ... | true |
8996f5d9b112e610d83bf8808e26b27e1ab82a49 | C++ | mlowerysimpson/AMOS | /gps_odometer.cpp | UTF-8 | 3,246 | 2.9375 | 3 | [] | permissive | //gps_odometer.cpp -- program for parsing gps data from ship logs to determine total distance that boat has travelled
//program takes as input a folder name and parses all of the "shiplog_*.txt" files in that folder to determine the total distance that the boat has travelled.
//The total distance is tracked in a fil... | true |
bf57129e447d5fe5e273dd8f771847fa1ddd2633 | C++ | mark-smits/CSD2 | /csd2c/Aansturing/encoder.cpp | UTF-8 | 955 | 2.984375 | 3 | [] | no_license | #include "encoder.h"
#include <stdio.h>
#include <wiringPi.h>
#include <iostream>
Encoder::Encoder(int lPin, int rPin) : lPin(lPin), rPin(rPin) {
this->minVal = 0;
this->maxVal = 10;
this->val = 0;
this->lPinLastState = 0;
wiringPiSetup();
pinMode(lPin, INPUT);
pinMode(rPin, INPUT);
}
Encoder::~Encoder() {
}... | true |
eeb975a0dd8b45d09868df66709c333b951d1e64 | C++ | Veinard29/D31 | /VKSubject.cpp | UTF-8 | 552 | 2.796875 | 3 | [] | no_license | #include "VKSubject.h"
VKSubject::VKSubject()
{
SubjectName = "";
}
VKSubject::VKSubject(const string& _SubjectName)
{
SubjectName = _SubjectName;
}
string VKSubject::GetClassName()
{
return "VKSubject";
}
string VKSubject::Print()
{
return GetSubjectName();
}
bool VKSubject::operator==(const VKSubject& object)... | true |
06d632c116f37af105f4bc3e946c55ec60aef634 | C++ | Graphics-Physics-Libraries/SimpleRenderEngine-1 | /src/Core/HardwareBuffer/VertexElement.cpp | UTF-8 | 1,825 | 2.671875 | 3 | [] | no_license | #include "VertexElement.h"
namespace SRE {
VertexElement::VertexElement(unsigned short source, size_t offset, Vertex_Element_Type type,
Vertex_Element_Semantic semantic, unsigned short index)
: _source(source), _offset(offset), _type(type), _semantic(semantic), _index(index)
{
}
size_t VertexElement::getSi... | true |
0b80a6703fe23edf31e89480a3dec751a2c81fdd | C++ | GuilhermePontoAut/PCC103 | /PCC103_Intervalos_de_Confiança_3.cpp | ISO-8859-1 | 5,110 | 3.46875 | 3 | [] | no_license | // PCC103 - METODOLOGIA
// Nome do exerccio: Intervalos de Confiana - exerccio 3
# include <iostream>
# include <vector>
# include <ctime>
# include <math.h>
using namespace std;
void VetorAleatorio (vector <double> &x, int tam);
void MostraVetor (vector <double> vetor);
double Particao (vector<double>... | true |
c1a07b2e83f4038d2353c1df4e1dfbb346c41ce9 | C++ | JerryTheUser/Leetcode | /Maximum_Binary_Tree.cpp | UTF-8 | 1,340 | 3.78125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using std::vector;
using std::cout;
using std::max_element;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
TreeNode* constructMaximumBinaryTree(v... | true |
9f504fed2582a627ee2e14f22e7d186a99689d88 | C++ | chriniko13/simple_cpp_exercise | /behaviour_test.cpp | UTF-8 | 8,852 | 3.0625 | 3 | [] | no_license | //
// Created by nchristidis on 20/1/21.
//
#include "behaviour_test.h"
#include <iostream>
#include <thread>
#include <unordered_map>
#include <random>
//#include <climits> // Note: std::uniform_int_distribution<long> distribution(LONG_MIN,LONG_MAX);
#include "queue.cpp"
#include "publisher.cpp"
#include "... | true |
a99b4a4288dd3d0f5cee1aa386fe3e81d25bae13 | C++ | Fentom/cpp-Cars | /Lib/Voiture.cxx | UTF-8 | 5,515 | 3.46875 | 3 | [] | no_license | #include "Voiture.h"
#include <stdlib.h>
#include <iostream>
#include <cstring>
#include <sstream>
#include <fstream>
using namespace std;
int Voiture::Comparaison(const Voiture & V)
{
if(getPrix() < V.getPrix() )
return -1;
if(getPrix() > V.getPrix() )
return 1;
if(getPrix() == V.getPrix() )
return 0;
... | true |
91f7be1867bc65bacc565a305fd403a66c4f548f | C++ | kapz28/All-the-projects | /big_int/a1_doubly_linked_list.cpp | UTF-8 | 6,626 | 3.359375 | 3 | [] | no_license | //kapilan satkunanathan and yuanpei gao
#include <iostream>
#include "a1_doubly_linked_list.hpp"
using namespace std;
DoublyLinkedList::Node::Node(DataType data)
{
prev= NULL;
next= NULL;
value = data;
}
DoublyLinkedList::DoublyLinkedList()
{
head_ = NULL;
tail_ = NULL;
size_=0;
}
DoublyLinkedList::~DoublyLin... | true |
3989c8ed4bb53753b135a846bb89b6983fd00c70 | C++ | junseublim/Algorithm-study | /baekjoon/2630.cpp | UTF-8 | 895 | 2.9375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int paper[128][128];
int white = 0;
int blue = 0;
void divide(int ys, int ye, int xs, int xe) {
int num = paper[ys][xs];
int able = 1;
for (int i = ys; i<ye; i++) {
for (int j = xs; j<xe; j++) {
if (paper[i][j] != num) {
abl... | true |
aa1a74dd3deb05e075d8e00fc13b3029245ca8e8 | C++ | Oswal-Fuentes/Proyecto_Programacion3 | /Cuenta_normal.cpp | UTF-8 | 2,877 | 2.78125 | 3 | [] | no_license | #include "Cuenta_normal.h"
#include <cstdlib>
Cuenta_normal::Cuenta_normal(string nombre,string username,string password,vector<Cuenta*>* perteneceA){
this->nombre=nombre;
this->username=username;
this->password=password;
this->perteneceA=perteneceA;
}
Cuenta_normal::Cuenta_normal(){
}
void Cuenta_normal::agreg... | true |
e25904acbec772a4c844792a1adcb95f895d730a | C++ | NikitaNikson/xray-2_0 | /engine/xray/maya/sources/xray_shader_node_calculate.cpp | UTF-8 | 4,510 | 2.59375 | 3 | [] | no_license | ////////////////////////////////////////////////////////////////////////////
// Created : 18.05.2010
// Author : Andrew Kolomiets
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////
#include "pch.h"
#include "xray_shader_node.h"
// The compute() metho... | true |
9f99165f285f2a910f629317e11852abb08e18ed | C++ | hgeorge21/Physical_Animation | /A4/src/dphi_cloth_triangle_dX.cpp | UTF-8 | 637 | 2.671875 | 3 | [] | no_license | #include <dphi_cloth_triangle_dX.h>
#include <iostream>
//compute 3x3 deformation gradient
void dphi_cloth_triangle_dX(Eigen::Matrix3d &dphi, Eigen::Ref<const Eigen::MatrixXd> V, Eigen::Ref<const Eigen::RowVectorXi> element, Eigen::Ref<const Eigen::Vector3d> X) {
Eigen::MatrixXd T(3, 2);
T.block<3, 1>(0, 0) = ... | true |
a6d687fcf1344ecdb287723d5b3ba919a56b6bc7 | C++ | raquelmolinare/IG-UGR | /Codigo/src/camara.cc | UTF-8 | 10,125 | 3.03125 | 3 | [] | no_license | #include "auxiliar.h"
#include "camara.h"
#define PI 3.141592 //Definimos PI
Camara::Camara (Tupla3f eyeCam,Tupla3f atCam,Tupla3f upCam, int tipoCam,float leftCam, float rightCam, float bottomCam, float topCam,float nearCam ,float farCam) {
if( tipoCam > 2 || tipoCam < 1){
tipo = 1;
}
else
... | true |
29c2b488a74373141041aabda1cecb1144527118 | C++ | Happyxianyueveryday/wdpl | /第二章:线性表/2.3节习题/problem_17.cpp | GB18030 | 3,695 | 3.890625 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
// רµľϰ⣬leetcodeӼ: https://leetcode-cn.com/problems/palindrome-linked-list/
// A. ȸһʱ临ӶO(n)ռ临ӶO(n)дʹջʵ֣ٶ
// 㷨: һջʹڲм˫ָ뷨:
// (1) ָf... | true |
bb52c73d077a3bf310481813978c3277ca6e285f | C++ | ydlme/LeetCodeOj | /src/Sort_List.cpp | UTF-8 | 1,753 | 3.390625 | 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 *sortList(ListNode *head) {
/*
if (head == NULL || head->next == NULL) return head;
ListNode *fast = head;
... | true |
84cab1966f9f76c77f728216ab960a05849e84f4 | C++ | acc-cosc-1337-spring-2021/acc-cosc-1337-spring-2021-scott-gleason | /src/homework/04_iteration/main.cpp | UTF-8 | 1,174 | 3.78125 | 4 | [
"MIT"
] | permissive | //write include statements
#include "dna.h"
//write using statements
using std::cin;
using std::cout;
/*
Write code that prompts user to enter 1 for Get GC Content,
or 2 for Get DNA Complement. The program will prompt user for a
DNA string and call either get gc content or get dna complement
function and display... | true |
26c45ff1f45a4442d6e920d95244b59215048b9c | C++ | drkzrg/SynthControl | /usb.cpp | UTF-8 | 9,349 | 2.765625 | 3 | [] | no_license | #include <QPushButton>
#include "usb.h"
BOOL GetDeviceHandle(GUID guidDeviceInterface, PHANDLE hDeviceHandle)
{
BOOL bResult = TRUE;
HDEVINFO hDeviceInfo;
SP_DEVINFO_DATA DeviceInfoData;
SP_DEVICE_INTERFACE_DATA deviceInterfaceData;
PSP_DEVICE_INTERFACE_DETAIL_DATA pInterfaceDetailData = NULL;
... | true |
65bbf45780dddc2fa1a7750924ad9cfd46d425bb | C++ | xiweihuang/Primer | /chapter10/r_iter.cpp | UTF-8 | 1,517 | 3.375 | 3 | [] | no_license | // 反向迭代器
#include <stdio.h>
#include <vector>
#include <list>
#include <string>
using namespace std;
void r_iter() {
vector<int> vec = {0, 1, 2, 3, 4, 5};
for (auto iter = vec.crbegin(); iter != vec.crend(); ++iter) {
printf("%d\n", *iter);
}
}
void exercise_10_34();
void exercise_10_35();
void exercise_10_36()... | true |
6af2b69e4656e58bbf365d4a7997a7689980eec3 | C++ | leag37/RayTracer | /SuperTrace/SuperTrace/include/Ray.h | UTF-8 | 2,463 | 3.328125 | 3 | [] | no_license | //*************************************************************************************************
// Title: Ray.h
// Author: Gael Huber
// Description: This class defines a ray used for projecting light and intersection tests
//**************************************************************************************... | true |
6b612015391a16b295d7224d675c33cf87a6fe7d | C++ | stillwater-sc/hpr-blas | /applications/apf/cpp_apfloat.cpp | UTF-8 | 3,769 | 2.71875 | 3 | [
"MIT"
] | permissive |
#include <boost/multiprecision/cpp_bin_float.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include <iostream>
#include <universal/native/ieee754.hpp>
#include <universal/number/cfloat/cfloat.hpp>
const char* pistr = "3.141592653589793238462643383279";
constexpr float pi = 3.141592653589793238462643383279;
... | true |
0f01e621f1e89eea82950c84585d063eadfd3e5b | C++ | brujackie-zhang/Experiences | /data structure/countSort.cpp | UTF-8 | 451 | 3.328125 | 3 | [] | no_license | #include<stdio.h>
int countSort(int a[], int n)
{
int maxLen = n + 1;
int b[maxLen];
int index = 0;
for (int i = 0; i < n; i ++) {
if (!b[a[i]]) {
b[a[i]] = 0;
}
b[a[i]] ++;
}
for (int j = 0; j < maxLen; j ++) {
while (b[j] > 0) {
a[index ++] = j;
b[j] --;
}
}
return *a;
}
int main()
{
int... | true |
0a33b7bb9ea1bb06ebcfecf7c930907706ae93b2 | C++ | michlord/AngryJets | /Game/Ground.h | UTF-8 | 980 | 2.734375 | 3 | [] | no_license | #ifndef GROUND_H
#define GROUND_H
#include <SFML/Graphics.hpp>
#include "Collidable.h"
#include <vector>
namespace game{
class Ground : public sf::Drawable, public Collidable {
public:
Ground(const sf::Texture& background_,const sf::Texture& foreground_, const sf::Image& mask_);
void makeCircleHole(sf::Vector... | true |
12e94e37464b54d13d7c696a7527c88bcee0a64b | C++ | nastaranrezai/tamrin-2 | /سوال 4.cpp | UTF-8 | 459 | 2.671875 | 3 | [] | no_license |
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
int main()
{
int n, i, j, min= 21, max= 0, sum = 0;
cout <<"tedad daneshjo:";
cin >> n;
for(i = 0; i < a; i++)
{
cin >> j;
sum += j;
if(j <= min ) min = j;
if(j >= max) max = j;
}
... | true |
2e55ff07b79863c021350a9d5a102c14984657ba | C++ | Dwillnio/ConBox | /base/function_data.h | UTF-8 | 457 | 2.546875 | 3 | [] | no_license | #ifndef FUNCTION_DATA_H
#define FUNCTION_DATA_H
#include <vector>
#include "function.h"
class function_data : public function
{
public:
function_data(std::vector<vec>* data_points_, rnum dt_)
: function(1, (*data_points_)[0].dimension()), dt(dt_) {}
virtual vec value(const vec &x);
virtual vec v... | true |
d332efd82f6bfb502f1baf78b3d00b50ddc50f25 | C++ | gitliuyuhan/Algorithm | /min_edit_distance.cpp | UTF-8 | 1,548 | 3.640625 | 4 | [] | no_license | /*======================================================
> File Name: min_edit_distance.cpp
> Author: lyh
> E-mail:
> Other : 字符串的最短编辑距离
> Created Time: 2016年05月06日 星期五 08时55分36秒
=======================================================*/
#include<iostream>
#include<string.h>
int min(int a,int b,... | true |
e23f64f3b16c7270a5a571c969942bfad38e6095 | C++ | nowaits/base | /third/circularbuffer.cpp | UTF-8 | 3,271 | 2.796875 | 3 | [] | no_license | #include "circularbuffer.h"
#include <windows.h>
namespace vncjingle {
CircularBuffer::CircularBuffer(int size)
{
capacity_ = size;
store_ = new char[capacity_];
read_pos_ = 0;
write_pos_ = 0;
cached_length_ = 0;
done_ = false;
}
//------------------------------------------------------------------... | true |
cb4cbc4ea5f1ace9f05404580078747ba25917bb | C++ | LataSinha/Coding-Ninjas-Data-Structures-In-CPP | /OOPS-1/Student_class.cpp | UTF-8 | 345 | 3.453125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class Student{
public:
int age;
int rollnumber;
};
int main(){
Student s1;
s1.age = 20;
s1.rollnumber = 101;
cout << s1.age << " " << s1.rollnumber << endl;
Student* s2 = new Student;
s2->age = 25;
s2->rollnumber = 102;
cout << s2->age << " " << s2->rollnumb... | true |
7dad041a0516b189c7b788238f17c4c923149c51 | C++ | yuanjinsongquyi/ndktest | /app/src/main/cpp/VideoDecode.cpp | UTF-8 | 5,890 | 2.53125 | 3 | [] | no_license | //
// Created by 袁劲松 on 18/9/12.
//
extern "C" {
#include <libavutil/imgutils.h>
#include <libavutil/time.h>
}
#include "VedioDecode.h"
#include "macro.h"
void releaseAvPacket(AVPacket** packet) {
if (packet) {
av_packet_free(packet);
//为什么用指针的指针?
// 指针的指针能够修改传递进来的指针的指向
*packet =... | true |
ddd0d7156d5d9e31b9ea04fe716355a7d8fc8d2f | C++ | xamex/lab02 | /include/questao2/util.h | UTF-8 | 2,324 | 3.453125 | 3 | [] | no_license | /**
* @file util.h
* @brief Arquivo de cabeçalho contendo as definições de funções que realizam
* operações utilizadas em várias partes do programa.
* @author Gabriel Barbosa (gbsbarbosa.gb@gmail.com)
* @since 23/06/2017
* @date 25/06/2017
*/
#ifndef UTIL_H
#define UTIL_H
#include <iostream>... | true |
24d6b5db2a375ffed211211eb7fa874d2bb6b78f | C++ | CynicalHeart/clion_CV | /Demo_ch7/sources/Demo_ch7_3.cpp | GB18030 | 4,424 | 2.625 | 3 | [] | no_license | #include "../header/Demo_ch7_3.h"
Mat g_srcImage,g_dstImage;
Mat g_map_x,g_map_y;
void CVMap_Demo() {
ShowHelpText();
g_srcImage = imread("F:\\Ѷ\\ͼ\\chouyou.jpg");
if(!g_srcImage.data){
cout<<"ȡͼƬ"<<endl;
}
imshow("ԭʼͼ", g_srcImage);
g_dstImage.create(g_srcImage.size(),g_srcImage.ty... | true |
141aa58bbc429fab418d73f1b4ef5e9c181d18fa | C++ | ahans/hoerbert-clone | /wavreader/wavreader.h | UTF-8 | 1,489 | 2.578125 | 3 | [] | no_license | #include <fstream>
namespace de { namespace ahans {
class WavReader
{
public:
#pragma pack(push, 1)
struct WavHeader
{
unsigned char riff[4]; // RIFF string
unsigned int overall_size; // overall size of file in bytes
unsigned char wave[4]; // WAVE str... | true |
7bb8125af01d165dad7a726ffad836f8b42eb63f | C++ | triffon/oop-2014-15 | /player/superhero.cpp | UTF-8 | 1,547 | 2.96875 | 3 | [
"MIT"
] | permissive | /*
* superhero.cpp
*
* Created on: 7.05.2015 г.
* Author: trifon
*/
#include <cstring>
#include "superhero.h"
SuperHero::SuperHero(const char* _name, int _pts, int _level,
const char* _sp, int _linc)
: Hero(_name, _pts, _level),
Player(_name, _pts),
levelIncrease(_linc),
... | true |
83b31c95776abf89c14f5dd2af36bdb8c475548d | C++ | neutronest/goodgoodstudy | /gcj/2013/round_qulification_a.cc | UTF-8 | 2,872 | 3.265625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
void solve(vector<string> board, int t) {
int res = 0;
int flag = 0;
// check each row
std::string s = "";
for (int r=0; r<4; r++) {
s = board... | true |
3c5256cd30a66c78292ca3ebb406bd425890ae07 | C++ | katyhuff/cycamore | /src/Models/Market/StubMarket/StubMarketTests.cpp | UTF-8 | 2,494 | 2.53125 | 3 | [] | no_license | // StubMarketTests.cpp
#include <gtest/gtest.h>
#include "StubMarket.h"
#include "CycException.h"
#include "Message.h"
#include "MarketModelTests.h"
#include "ModelTests.h"
#include <string>
#include <queue>
using namespace std;
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class FakeS... | true |
075412f5b80e254d4bf5de195f79f0fdcf2b0375 | C++ | serek8/JSONDeserializer | /JSONDeserializer/Parser.hpp | UTF-8 | 5,643 | 2.609375 | 3 | [] | no_license | //
// Parser.hpp
// test
//
// Created by Jan Seredynski on 02/12/15.
// Copyright © 2015 Jan Seredynski. All rights reserved.
//
#ifndef Parser_hpp
#define Parser_hpp
#include <string>
#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include "ParserStringProxy.hpp"
#define WHITE_SPA... | true |
34f67bc98450cf1ed059aae7c669dd0d29ade885 | C++ | dmorse/util | /param/OptionalLabel.h | UTF-8 | 1,168 | 2.671875 | 3 | [] | no_license | #ifndef UTIL_OPTIONAL_LABEL_H
#define UTIL_OPTIONAL_LABEL_H
/*
* Util Package - C++ Utilities for Scientific Computation
*
* Copyright 2010 - 2017, The Regents of the University of Minnesota
* Distributed under the terms of the GNU General Public License.
*/
#include <util/param/Label.h>
namespace Util
{
/**
... | true |
2e5dd4a87c5317c1e036ab0b505e0e19a30ef5aa | C++ | mooniron/learn-cpp | /The cpp program language 4th/ch2/ex2-1-14.cpp | UTF-8 | 877 | 3.15625 | 3 | [] | no_license | /**************************************************************
* Name : ex2-1-14.cpp
* Author : Bronze Lee
* Version : 0.1
* Date : 2017年4月7日
**************************************************************/
/*
example 2.4.3.1 :
exceptions
*/
#include <iostream>
using namespace st... | true |
b3e6376c371b5c50d10e2bf09140e2afa71981f4 | C++ | Lukas1584/Accountant | /SRC/GUI/PasswordWidget.cpp | UTF-8 | 1,701 | 2.71875 | 3 | [] | no_license | #include "PasswordWidget.h"
PasswordWidget::PasswordWidget(){
drawWindow();
QObject::connect(pBtnOK,SIGNAL(clicked()),SLOT(slotClickedOk()));
setModal(true);
}
void PasswordWidget::drawWindow(){
resize(400,150);
pBtnOK=new QPushButton(tr("Ок"));
pLeName= new QLineEdit;
pLeP... | true |
d7a1aa8b11e9bb7842c32dc2f9521f0ef86c6db9 | C++ | Dragos123321/Chess3D-infoeducatie | /Chess/Chess/src/piece.cpp | UTF-8 | 1,187 | 3.265625 | 3 | [] | no_license | #include "piece.h"
#include <string>
Piece::Piece(int posX, int posY) :
m_posX(posX),
m_posY(posY)
{
}
void Piece::init(int posX, int posY)
{
m_posX = posX;
m_posY = posY;
}
Piece::~Piece()
{
// Empty
}
bool Piece::canMoveTo(int targetX, int targetY)
{
for (unsigned int i = 0 ; i < m_availableMov... | true |
456760bf5d3aa5e03ce2987f9514a90af3ac622c | C++ | AhatLi/AhatConfig | /ahatconfig/src/ahatconfig.cpp | UTF-8 | 3,232 | 2.8125 | 3 | [] | no_license | #include "ahatconfig.h"
/*
bool AhatConfig::readConfig(std::string path)
{
return readConfig(path.c_str());
}
*/
bool AhatConfig::readConfig(const char* path)
{
std::string configPath = "";
if(path == NULL)
{
#ifdef _WIN32
/*
LPSTR tmp;
int len = GetModuleFileName(NULL, tmp, MAX_PATH);
// std::wstring ws(tmp... | true |
ca2c919a028f9ff21335b694f0c8afc85556481b | C++ | khaledman6122/codeforces-A-B | /A. Triangular numbers.cpp | UTF-8 | 388 | 2.609375 | 3 | [] | no_license | // http://codeforces.com/contest/47/problem/A //
#include <iostream>
#include <algorithm>
#include <vector>
#define ll long long
#define endl "\n"
using namespace std ;
int main ()
{
std::ios::sync_with_stdio(false);
int n,t;
cin>>n;
for(int i=1;true;i++)
{
t=(i*(i+1))/2;
if(t==n) {cout<<"YES"<<endl; break;} ... | true |
9d583e74235d0a5e40305513faee79c9ef5ac7ca | C++ | FinancialEngineerLab/alillevangbech-cpp-xlsx | /CompFinance/Project1/Portfolio.h | UTF-8 | 365 | 2.71875 | 3 | [] | no_license | #include <vector>
#include "ClosedformOption.h"
class portfolio
{
public:
portfolio(size_t dim, std::vector<ClosedformOption* >& OptionValueVector, std::vector<double> weights);
~portfolio();
double getPrice();
private:
size_t dim;
std::vector<ClosedformOption* > OptionValueVector;
std::vector<double> weights;
... | true |
c794900546819d1187b60dfd49dc78322908308b | C++ | ruilin/RLMap | /platform/chunks_download_strategy.hpp | UTF-8 | 2,361 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include "std/string.hpp"
#include "std/vector.hpp"
#include "std/utility.hpp"
#include "std/cstdint.hpp"
namespace downloader
{
/// Single-threaded code
class ChunksDownloadStrategy
{
public:
enum ChunkStatusT { CHUNK_FREE = 0, CHUNK_DOWNLOADING = 1, CHUNK_COMPLETE = 2, CHUNK_AUX = -1 };
private:
#... | true |
1eb7ade4398bfd5db2b20c23d444018468229175 | C++ | ShinichiArakawa/Leika-STG | /github/Leika/Source/Utility/TaskManager.h | SHIFT_JIS | 1,284 | 3.15625 | 3 | [] | no_license | #pragma once
/**
* @file TaskManager.h
* @brief Task ̍XVƕ`
* @author Katsumi Takei
* @date 2016 / 06 / 29
* @date ŏIXV 2016 / 11 / 02
*/
#include "Task.h"
#include "../Function.h"
class TaskManager
{
private:
std::list<Task*> tasklist;
std::list<Task*> newlist;
DrawMode mode_;
TaskManager() {}
~TaskManag... | true |
c311c6964c5b85cc5b7d1cfaf56f632755a52f08 | C++ | BrillaintCB/Cpp | /cpp2020/06StorageClasses.cpp | UTF-8 | 598 | 3.59375 | 4 | [] | no_license | #include <iostream>
using namespace std;
/*
A storage class defines the scope(visibility) and life-time of variables and /or functions
whithin a C++ Program. These specifiers precede the type that they modify.
There are following storage classes, which can be used in a C++ program
-- auto
-- register
-- static
-- exte... | true |
9d91986b2dd4cf2f002450db97a7eeb4915a9646 | C++ | lugt/cprogram-oj | /test20180423/bankAccount.cpp | UTF-8 | 1,957 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by lugt on 2018/4/23.
//
#include<iostream>
#include<string>
using std::string;
using std::cin;
using std::cout;
using std::endl;
class Account {
public:
Account(string accno, string name, float banlance) {
_accno = accno;
_accname = name;
_banlance = banlan... | true |
a98c8df0fa7998fccdb63d2ad3aed4e55a6c17ac | C++ | wps13/logicaprog | /L2E5.cpp | UTF-8 | 372 | 3.296875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
float consumo, conta;
cout << "Digite o consumo de água(em metros cúbicos): ";
cin >> consumo;
if(consumo < 20){
conta = consumo * 8.50;
cout << "O valor da conta é:R$ " << conta;
}
else{
conta = consumo*11.0;
cout << "O va... | true |
f1b3808bfc972e980e6b53abb14e6aa8807659a2 | C++ | jasont7/cpp-projects | /linked_list/main_6.cpp | UTF-8 | 2,699 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <memory>
#include <iomanip>
#include <complex>
#include <vector>
#include <utility>
#include "list.hpp"
int main()
{
link_list<std::string> list;
std::string line;
// read one string at a time and insert at the end of the list
while ... | true |
3b97c877c35084a23c11f7de81090f90812fa04c | C++ | CrossNick/OOPLab3 | /OOPLab3/OOPLab2/OOPLab2/StaticArray.cpp | UTF-8 | 844 | 3.421875 | 3 | [] | no_license | #include "stdafx.h"
#include "StaticArray.h"
template<class T>
StaticArray<T>::StaticArray(int sz)
{
_size = sz;
arr = new T[_size];
}
template<class T>
int StaticArray<T>::size() const
{
return _size;
}
template<class T>
bool StaticArray<T>::isEmpty() const
{
return _size ==0;
}
template<class T>
std::string ... | true |
cc5cd823c46b56dd316ab4fe331bcec8d0acd0e9 | C++ | anuanu0-0/a2oj_ladders | /Div_2A/Chat_room.cpp | UTF-8 | 566 | 2.921875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define test \
int t; \
cin >> t; \
while (t--)
#define endl '\n'
#define vi vector<int>
#define pb push_back
int main()
{
string s, word = "hello";
cin >> s;
int idx = 0;
string ans = "";
for (int i =... | true |
076a245a7ccc4ce4566fccb1631b8dee02b06bee | C++ | Caffrey/CPipeline | /Raytracing/Intrucdtion/Realistic Ray Tracing/Shape.cpp | UTF-8 | 3,719 | 2.890625 | 3 | [] | no_license | #include "Shape.h"
Triangle::Triangle(const Vector3& _p0, const Vector3& _p1, const Vector3& _p2, const Color& _color) :
p0(_p0), p1(_p1), p2(_p2), color(_color) {}
bool Triangle::hit(const Ray& r, RFLOAT tmin, RFLOAT tmax, HitRecord& record) const
{
RFLOAT tval;
RFLOAT A = p0.x() - p1.x();
RFLOAT B = p0.y() - p... | true |
4ca010b6aa7d2da93308d02b85578882454f86ff | C++ | AnneMayor/algorithmstudy | /2071_평균값구하기_D1.cpp | UTF-8 | 708 | 2.59375 | 3 | [] | no_license | //
// 2071_평균값구하기_D1.cpp
// algorithmstudy
// codingtest4mycareer
//
// Created by DHL on 21/04/2019.
// Copyright © 2019 DHL. All rights reserved.
//
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int T;
cin.tie(0);
cin >> T;
for(int t = 1; t <= T; t++... | true |
3af77db6facffd84da3d4ac3969511d628b20686 | C++ | sgajaejung/Utility | /Graphic/collision/boundingbox.h | WINDOWS-1252 | 456 | 2.546875 | 3 | [
"MIT"
] | permissive | #pragma once
namespace graphic
{
// OBB 浹ڽ.
class cBoundingBox
{
public:
cBoundingBox();
cBoundingBox(const cCube &cube);
void SetBoundingBox(const Vector3 &vMin, const Vector3 &vMax );
void SetTransform( const Matrix44 &tm );
bool Collision( cBoundingBox &box );
bool Pick(const Vector3 &orig, const ... | true |
e9a465c4fe896bbd82ac27d73a075bc6d1ebfade | C++ | windgassen/Wreath-FastLED | /Wreath_Fast_LED_REV_A_Final.ino | UTF-8 | 7,835 | 2.9375 | 3 | [] | no_license | #include "FastLED.h"
FASTLED_USING_NAMESPACE
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
//
// This example also shows one easy way to define multiple
// animations patterns and have them automatically rot... | true |
44e835800a21d71c656329ff768dab5da4915273 | C++ | fpartl/libpe | /fft.cpp | UTF-8 | 3,287 | 2.734375 | 3 | [] | no_license | #include "fft.h"
FFT::FFT(int segmentSize, QObject *parent) : QObject(parent) {
if (segmentSize <= 0) {
emit error("FFT::FFT: Neplatná velikost vstupních segmentů.");
return;
}
// tento výpočet vyplívá z definice algoritmu FFT
for (m_maxSegmentSize = 1; m_maxSegmentSize < segmentSize; ... | true |
1390e54139dfa15a11c6559273704217a7f37ea8 | C++ | maxrchung/TetrisBuddies | /Gameplay/Header and Source for main/GameScreen.cpp | UTF-8 | 3,708 | 2.96875 | 3 | [] | no_license | #include "GameScreen.hpp"
// To be filled in at the gameplay people's discretion
GameScreen::GameScreen()
: pressed(false), pressed2(false)
{
bh = new BlockHandler(GraphicsManager::getInstance()->window.getSize().x, GraphicsManager::getInstance()->window.getSize().y);
ch = new CursorHandler(bh->SCREENWIDTH, bh->SCR... | true |
37596d82222f9487934831962ecb3010b577ab51 | C++ | gli-27/cpluscode | /chapter1/1.13/main.cpp | UTF-8 | 321 | 3.125 | 3 | [] | no_license | //
// main.cpp
// 1.13
//
// Created by LG on 2019/7/18.
// Copyright © 2019 LG. All rights reserved.
//
#include <iostream>
int main(){
int sum = 0;
for(int val = 1; val <= 10; ++val){
sum += val;
}
std::cout << "Sum of 1 to 10 inclusive is " << sum <<std::endl;
return 0;
}
| true |
20ad3dc50c415f4d12632e545492b8540eec0e17 | C++ | ererics41/Top-K-Approximation | /src/MaxHeap.cpp | UTF-8 | 3,561 | 3.59375 | 4 | [] | no_license | #include "MaxHeap.h"
#include <iostream>
using namespace std;
MaxHeap::MaxHeap(){
MAX_SIZE = 100;
this->size = 0;
heap = new HeapNode* [MAX_SIZE];
table = new HashTable(10000);
}
void MaxHeap::insert(string w){
//make word lowercase
if(w == ""){
return;
}
string word = "";
for(string::it... | true |
8a2fe19bce8b3a5a4a841d29da14ded61a627aee | C++ | MrBean1512/CS273-FinalProject | /Program-Files/Stats.cpp | UTF-8 | 1,526 | 3.375 | 3 | [] | no_license | #include "Stats.h"
Stats::Stats()
{
}
void Stats::update_report(Citizen * citizen) //updated with new stats every time a patient is done being treated
{
++num_patient;
num_total_time = num_total_time + (citizen->dismissal_time - citizen->arrival_time);
records.insert(std::pair<int, Citizen*>(citizen->it,... | true |
5561ee4162ceac99f5ae28c7f41c3db1e98fdddf | C++ | R4x7651/PAT_Answers | /PAT_LevelA/1006_Sign_In_and_Sign_Out.cpp | UTF-8 | 831 | 3.03125 | 3 | [
"MIT"
] | permissive | #include "cstdio"
struct Stu {
char id[16];
int hour;
int minute;
int second;
} in, out, temp;
bool earlier(Stu a, Stu b) {
int total_a = a.hour * 3600 + a.minute * 60 + a.second;
int total_b = b.hour * 3600 + b.minute * 60 + b.second;
if (total_a < total_b) return true;
else return fa... | true |
b1c4c9e11a6fc12515819a8bf9078efdcfac9986 | C++ | jeroennelis/Ray_Tracer | /Ray_Tracer/src/Ray_Tracer/GeometricObjects/GeometricObject.h | UTF-8 | 1,671 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
// this file contains the declaration of the class GeometricObject
#include "../Utilities/Constants.h"
#include "../Utilities/RGBColor.h"
#include "../Utilities/Point3D.h"
#include "../Utilities/Normal.h"
#include "../Utilities/Ray.h"
#include "../Utilities/ShadeRec.h"
#include "../Utilities/Constants.h... | true |
8d1cdff200f838b8495d3a34a0e04f70b3a90649 | C++ | hirotakaster/iot-workshop | /sketch_pwm/sketch_pwm.ino | UTF-8 | 331 | 2.875 | 3 | [] | no_license | void setup() {
// PWM PIN : 3,5,6,9,10,11
pinMode(6, OUTPUT);
}
void loop() {
// PWMは0-255まで
// ゆっくり明るくなる
for (int i = 0; i <= 255; i++) {
analogWrite(6, i);
delay(20);
}
// ゆっくり暗くなる
for (int i = 255; i >= 0; i--) {
analogWrite(6, i);
delay(20);
}
}
| true |
cd9c48c454ad8ed279f347385f8b981135c694c7 | C++ | tony-coder/PAT | /C++/Advanced Level/1137 Final Grading (25分).cpp | UTF-8 | 1,061 | 2.921875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct node
{
string id;
int Gp, mid_term, final, G;
node(): Gp(-1), mid_term(-1), final(-1), G(-1) {}
bool operator<(const node& n)const {
return G == n.G ? id < n.id : G > n.G;
}
};
int main(int argc, char const *argv[])
{
int P, M, N;
cin >> P >> M >> N;
uno... | true |
0a6bb7f7bc62f3cae00c197c066415dfc1ecf26e | C++ | Chickenbumps/BOJ | /#15989/main.cpp | UTF-8 | 449 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
int main(){
int t;
cin >> t;
int num[3] = {1,2,3};
while(t--){
int sum;
cin >> sum;
long long dist[sum+1];
memset(dist,0,sizeof(dist));
dist[0] = 1;
for (int j = 0; j < 3; j++) {
for (int i = 1; i <= sum; i++) {
if... | true |
5761f61dafbf0f82d5304c759fb285f71a1afcbc | C++ | thedavekwon/algo-projects | /uva/11450/11450.cpp | UTF-8 | 1,685 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int m, c;
int choices[21];
int prices[21][21];
int dp[201][21];
void pprint() {
for (int i = 0; i < m; ++i) {
for (int j = 0; j < c; ++j) {
cout << dp[i][j] << " ";
}
cout << endl;
}
}
int sol... | true |
5388c5bd5cfb675552b98bd208f2bdfa04561441 | C++ | emiliev/IS_OOP_2017 | /Week05/StringProject/String.h | UTF-8 | 1,017 | 2.8125 | 3 | [] | no_license | #pragma once
#include <cstring>
#include <iostream>
using namespace std;
class String
{
public:
String();
String(char* data, size_t size);
String(const String& other);
String& operator=(const String&);
~String();
void print();
char getAt(int index);
void setAt(int index... | true |
72492e223c56c142c080bd42607ccb4053396c72 | C++ | Kwakcena/algorithm | /baekjoon/1012_유기농배추/1012.cpp | UTF-8 | 1,051 | 2.875 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
using namespace std;
const int MAX = 51;
int N, M, K;
int dy[4] = {-1, +1, 0, 0};
int dx[4] = {0, 0, -1, +1};
int Table[MAX][MAX];
bool check[MAX][MAX];
void DFS(int s_row, int s_col, int value)
{
check[s_row][s_col] = true;
Table[s_row][s_col] = value;
for(int idx = 0; idx... | true |
47bc5d66224396d885090e9c91608cd0b5d5088d | C++ | mmaldacker/FluidRigidCoupling2D | /vector_math.h | UTF-8 | 839 | 2.859375 | 3 | [] | no_license | #ifndef VECTOR_MATH_H
#define VECTOR_MATH_H
#include <vector>
#include <algorithm>
#include "pcgsolver/blas_wrapper.h"
template<class T>
T sum(std::vector<T>& data) {
T result = 0;
for(unsigned int i = 0; i < data.size(); ++i)
result += data[i];
return result;
}
template<class T>
void copy(const std::... | true |
64a9f93b39eacdb1acd7f5050f531cf7f16f1c94 | C++ | jainabhi2001/Data_structure_-_Algo | /7_Evaluate_postfix.cpp | UTF-8 | 2,768 | 4.0625 | 4 | [] | no_license | // Program : Implement evaluation of postfix notation using stacks.
// ABC*D/+
// 5,6,2,+,*,12,4,/,-
// 5 6 2 + * 12 4 / -
#include <iostream>
#include <process.h>
#include <math.h> // For math related functions
#include <ctype.h> // For character related operations -isdigit
#include <stac... | true |
f64f710c022dbee07ce13668cb118199399b8f86 | C++ | austinholst/Recursion | /Node.h | UTF-8 | 357 | 3 | 3 | [] | no_license | //header guards
#ifndef NODE_H
#define NODE_H
//include libraries and h files
#include <iostream>
#include "Student.h"
using namespace std;
//node class
class Node {
public: //function declarations
Node(Student*);
~Node();
Node* getNext();
Student* getStudent();
void setNext(Node*);
protected: //variable... | true |
24cf871e4f8d67280118455bc0d70eec572f44b1 | C++ | Xlgd/learn-cpp | /cpp-primer-answers/Chapter_9/ex9-38.cpp | UTF-8 | 2,638 | 3.40625 | 3 | [] | no_license | // 练习9.38
/* 编写程序,探究在你的标准实现中,vector是如何增长的。*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
for (int i = 0; i < 100; i++)
{
cout << "capacity: " << v.capacity() << " size: " << v.size() << endl;
v.push_back(i);
}
return 0;
}
/*
capacity: 0 size: ... | true |
5ac172eb7b60381c821e44f84f9d1210197ec1b2 | C++ | joseluis-hd/EstructurasDeDatos | /Tarea04/include/queue.h | UTF-8 | 3,491 | 3.546875 | 4 | [] | no_license | #ifndef __QUEUE_H__
#define __QUEUE_H__
#include <iostream>
#include <exception>
#include <string>
using namespace std;
class QueueException : public std::exception {
private:
std::string msg;
public:
explicit QueueException(const char* message) : msg(message) { }
explicit QueueException(const std::string& m... | true |
354d678250b8e7c1d84a192647b7ae4dcd33c82d | C++ | kl456123/design_pattern | /decorator.cpp | UTF-8 | 1,240 | 3.0625 | 3 | [] | no_license |
class VisualComponent{
public:
VisualComponent();
virtual void Draw();
virtual void Resize();
};
class Decorator:public VisualComponent{
public:
Decorator(VisualComponent*);
virtual void Draw();
virtual void Resize();
private:
VisualComponent* compo... | true |
5cbc8baa8c05f2c761fae2192a591ca72bdf6ec5 | C++ | gepizar/CppND-System-Monitor | /src/processor.cpp | UTF-8 | 414 | 2.5625 | 3 | [
"MIT"
] | permissive | #include "processor.h"
#include "linux_parser.h"
#include <iostream>
// TODO: Return the aggregate CPU utilization
float Processor::Utilization() {
long total = LinuxParser::Jiffies();
long idle = LinuxParser::IdleJiffies();
long prevIdle = idle_;
long prevTotal = total_;
total_ = tota... | true |