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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
905a072fc8f9ecbee0ada3d63061787b81d0c933 | C++ | Yura52/teaching | /2019_hse_cpp_seminars/01_input_output_variables_if_loops_switch/08_if_else_switch.cpp | UTF-8 | 599 | 3.40625 | 3 | [] | no_license | #include <cstdint>
#include <iostream>
using i32 = int32_t;
int main() {
i32 a = 0;
std::cout << "enter a:\n";
std::cin >> a;
if (a > 1) {
std::cout << "a is greater than 1\n";
} else {
std::cout << "a is less or equal than 1\n";
}
switch (a) {
case 0: {
... | true |
f881d8e2ef6c3b3f3cdfbc1240ffd12f85cc3308 | C++ | charles-pku-2013/CodeRes_Cpp | /Templates/Example_Code/examples/basics/stack5assign.hpp | UTF-8 | 1,037 | 3.15625 | 3 | [] | no_license | /* The following code example is taken from the book
* "C++ Templates - The Complete Guide"
* by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley, 2002
*
* (C) Copyright David Vandevoorde and Nicolai M. Josuttis 2002.
* Permission to copy, use, modify, sell and distribute this software
* is granted provi... | true |
d1a150208171eb5e505e13fd5b9666d3c6514b72 | C++ | hatigo/coleta-de-dados-HX711-e-armazenamento-em-SDcard | /coleta_de_dados_HX711_e_armazenamento_em_SDcard.ino | UTF-8 | 3,070 | 2.828125 | 3 | [] | no_license |
#include "FS.h"
#include "SD.h"
#include <SPI.h>
// --- Mapeamento de Hardware ---
#define ADDO 7 //Data Out
#define ADSK 6 //SCK
#define SD_CS 5
// --- Protótipo das Funções Auxiliares ---
unsigned long ReadCount();
// --- Variáveis Globais ---
unsigned long convert;
String... | true |
39314f74d4a8ae98a34402b7eeed99dfec59c7b9 | C++ | SebiH/ART | /tools/ImageProcessing/src/processors/UndistortProcessor.cpp | UTF-8 | 1,824 | 2.578125 | 3 | [] | no_license | #include "UndistortProcessor.h"
using namespace ImageProcessing;
using json = nlohmann::json;
UndistortProcessor::UndistortProcessor(const json & config)
{
cv::FileStorage fs_intrinsic_l(config["intrinsic_left"], cv::FileStorage::READ);
cv::FileStorage fs_distcoeffs_l(config["distcoeffs_left"], cv::FileStorage::REA... | true |
a2eeb59efe13424b4b04102e9eda8aafa5f67053 | C++ | Ashish-kumar7/geeks-for-geeks-solutions | /Greedy Algorithm/New Text Document.txt | UTF-8 | 1,294 | 2.625 | 3 | [] | no_license | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
int making(int pages[],int n,int capacity)
{
unordered_set<int>s;
unordered_map<int,int>map1;
int pagefault=0;
for(int i=0;i<n;i++)
{
if(s.size()<capacity)
{
if(s.find(pages[i])==s.end())
{... | true |
1b9f5e7cf58fee9744ab08736821b470427443df | C++ | miviwi/Hamil | /Hamil/src/gx/commandbuffer.cpp | UTF-8 | 13,683 | 2.609375 | 3 | [] | no_license | #include <gx/commandbuffer.h>
#include <gx/renderpass.h>
#include <gx/program.h>
#include <gx/vertex.h>
#include <cassert>
namespace gx {
CommandBuffer::CommandBuffer(size_t initial_alloc) :
m_pool(nullptr),
m_memory(nullptr),
m_program(nullptr),
m_renderpass(nullptr),
m_last_draw(NonIndexedDraw)
{
m_com... | true |
c7c57fe65670b4a62dfbf768eb79f9ce53384010 | C++ | DaeYoungKim/Recogbot | /src/utils/DB.cpp | UTF-8 | 2,552 | 2.59375 | 3 | [] | no_license | #include "utils/DB.h"
#include <cstdio>
#include <direct.h>
#include <assert.h>
namespace Recogbot {
DB::DB(char *folderName) {
_cnt=0;
_folderName=folderName;
}
void DB::createFolder(const char* name){
sprintf(_text,"../db/%s",name);
mkdir("../db");
mkdir(_text);
}
void DB::locateFolder(const char... | true |
bdf462ce8d16ba6e2f411bd608f90f8737ba6ac9 | C++ | marcinmajkowski/SPOJ | /TRN.cpp | UTF-8 | 728 | 3.0625 | 3 | [] | no_license | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <stdlib.h>
int main()
{
int m = 0, n = 0;
int *matrix;
scanf("%d %d", &m, &n);
matrix = (int*) calloc(m*n, sizeof(int));
for (int i=0; i<m*n; ++i)
{
scanf("%d", &matrix[i]);
}
for (int i=0; i<n; ++i)
{
for (int k=0; k<m... | true |
6ed11e36b8cd80f639ef73b140f658243ec9e08b | C++ | henrybzhang/usaco | /frac1.cpp | UTF-8 | 1,666 | 3.34375 | 3 | [] | no_license | /*
ID: LGD84711
LANG: C++
TASK: frac1
*/
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
ifstream fin ("frac1.in");
ofstream fout ("frac1.out");
int N, counter;
int gcd(int num, int den)
{
int common_factor = den % num;
if(num == 1) return num;
if(common_factor == 0) retu... | true |
52311849463d58bfb21fb63e9715138c3c3ec79c | C++ | yoanCesar78/qt | /controller.cpp | UTF-8 | 826 | 2.53125 | 3 | [] | no_license | #include "controller.hpp"
Controller::Controller(Client *c, MainWindow *w){ // connect différents listener
client = c;
main_window = w;
//connex entre vue et client
QObject::connect(main_window->getDisconnectBtn(), SIGNAL(clicked()), client,
SLOT(Disconnect()));
QObject::connect(main_window->getSen... | true |
5489b19eac496cec2085ca2bb9dadce70f6bb692 | C++ | devedu-AI/Competitive-Coding-for-Interviews | /Strings/LongestCommonPrefix.cpp | UTF-8 | 742 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
string longestCommonPrefix(string ar[], int n)
{
if (n == 0)
return "-1";
if (n == 1)
return ar[0];
sort(ar, ar + n);
int en = min(ar[0].size(), ar[n - 1].size());
string first = ar[0];
string last = ar[n -... | true |
dc46d9bf9980db097b7f81a38a3717452598ef84 | C++ | hrntsm/study-language | /CPP/HelloCpp2/chapter_1-2/ConsoleIO1.cpp | UTF-8 | 156 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main(){
cout << 10 << ":" << 1.15 << endl;
cout << "Kitty" << "on" << "your" << "lap";
return 0;
} | true |
f4a8fa23c249223df93b0cab6fbc1a49649c681e | C++ | HuxyUK/NetLibrary | /Headers/NetLib/LobbyMember.h | UTF-8 | 502 | 2.609375 | 3 | [] | no_license | #ifndef NETLIB_LOBBYMEMBER_H
#define NETLIB_LOBBYMEMBER_H
#include <string>
namespace netlib
{
struct LobbyMember
{
friend class ClientConnection;
float ping = 0;
bool ready = false;
std::string name = "";
unsigned int uid = 0;
unsigned int lobbySlot = 0;
p... | true |
8c020297e35d22563ea6711d23760cc934cbfccd | C++ | REDasmOrg/REDasm-Loaders | /dex/demangler.cpp | UTF-8 | 1,678 | 3 | 3 | [
"MIT"
] | permissive | #include "demangler.h"
#include <string>
#include <regex>
std::string Demangler::getPackageName(const std::string& s)
{
std::regex rgx("L(.+)\\/.+;");
std::smatch m;
if(!std::regex_match(s, m, rgx)) return s;
std::string sm = m[1];
std::replace(sm.begin(), sm.end(), '/', '.');
return sm;
}
s... | true |
0c9ee7cebc106cd229fab2880b6e3beeba8d63c2 | C++ | anshuman725/Ds-Algo-Practice | /spiral-order-matrix-traversal.cpp | UTF-8 | 3,564 | 3.796875 | 4 | [] | no_license | /*
Problem: We have to print the given 2D matrix in the spiral order.
Spiral Order means that firstly, first row is printed, then last column is printed,
then last row is printed and then first column is printed,
then we will come inwards in the similar way.
*/
/*
https://practice.geeksforgeeks.org/problems/spirall... | true |
d8f6089b32496b566576dc2acd489b717aa14d18 | C++ | amit1078-en/Data_Structure_And_Algorithms | /GRAPHS/BIPIRATE_GRAPH.cpp | UTF-8 | 3,005 | 3.734375 | 4 | [] | no_license | /*
BIPIRATE GRAPH
Given an adjacency list of a graph adj of V no. of vertices having 0 based index. Check whether the graph is bipartite or not.
Example 1:
Input:
Output: 1
Explanation: The given graph can be colored
in two colors so, it is a bipartite graph.
Example 2:
Input:
Output: 0
Explanation: The giv... | true |
2860214a698c8faa6bfdcfb79af25479055d9920 | C++ | StephenGaryKing/Math-For-Games | /2D vector Program/project2D/Vector2.cpp | UTF-8 | 1,097 | 3.265625 | 3 | [
"MIT"
] | permissive | #include "Vector2.h"
Vector2::Vector2()
{
}
Vector2::Vector2(float X, float Y)
{
x = X;
y = Y;
}
Vector2 Vector2::Translate(const Vector2& a_first, const Vector2& a_second)
{
return Add(a_first, a_second);
}
Vector2 Vector2::Add(const Vector2& a_first, const Vector2& a_second)
{
Vector2 newVector;
newVector.x... | true |
2b3e11b2bba46bacec17ff996f6be05199a10e02 | C++ | lwmcdona/CMPUT379 | /Unix-Multithreaded-System-Simulator-master/Unix-Multithreaded-System-Simulator-master/shared.cpp | UTF-8 | 1,568 | 3.125 | 3 | [] | no_license | // the shared.cpp file, this file handles contains shared methods
// used throughout the program, also defines the mutex struct
// which holds all mutexes
#include "includes.hpp"
#include "shared.hpp"
// get the current time in milliseconds
long int get_current_time(){
struct timeval t;
gettimeofday(&t, NULL);... | true |
0702b0d621134c063ce9b40f740763d78a37c9ea | C++ | eignatik/Lab3 | /Rearrange.h | UTF-8 | 315 | 2.578125 | 3 | [] | no_license | #include <list>
#include <iostream>
using namespace std;
#ifndef LAB3_REARRANGE_H
#define LAB3_REARRANGE_H
class Rearrange {
list<int> intList;
public:
Rearrange();
~Rearrange();
void fillList(int numberOfElements);
void printList();
void changeOrder();
};
#endif //LAB3_REARRANGE_H
| true |
0164a7b3d95938cf700e4b4c0155ca4b4a4c10f3 | C++ | JasonCreighton/snowy | /UCI.cpp | UTF-8 | 8,900 | 2.75 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2017 Jason Creighton
// Available under the MIT license, see included LICENSE file for details
#include "Common.hpp"
#include "UCI.hpp"
#include "Board.hpp"
#include "Search.hpp"
#include "IO.hpp"
#include "Constants.hpp"
#include "Util.hpp"
// In case someone wants to use a different build environme... | true |
0dfcbd09acfdc32d717965f15defc4283fab1539 | C++ | IgorBozhok/Repo_C | /Sasin/C-HW/13/hw13.cpp | UTF-8 | 12,160 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <ctime>
using namespace std;
class exepionMyArray
{
public:
enum exepionMyArrayType
{
UNKNOW_MY_ARR_EXEP = 0,
INC_SIZE__MY_ARR_EXEP,
INC_MEM__MY_ARR_EXEP,
DIVISION_BY_ZERO
};
private:
exepionMyArrayType exepType;
public:
exepionMyArray();
exepionMyArray(ex... | true |
10c7f0f654a94db85ca00668c369122d9469409c | C++ | R1tschY/liblightports | /lightports/core/memory.h | UTF-8 | 2,029 | 2.546875 | 3 | [
"MIT"
] | permissive | #ifndef WINSTRING_REF_H
#define WINSTRING_REF_H
#include <memory>
#include <type_traits>
#include <windows.h>
#include <cpp-utils/memory/unique_array.h>
namespace Windows {
//
// Local memory
namespace Detail {
struct LocalDeleter {
void operator()(void* ptr) {
::LocalFree(ptr);
}
};
} // namespace Detail
... | true |
b71605cee536d44d1dbdadd5e3b27226fd6eebcc | C++ | longuan/hctunnel | /src/acceptor.h | UTF-8 | 654 | 2.625 | 3 | [] | no_license | #ifndef __ACCEPTOT_H__
#define __ACCEPTOR_H__
#include "eventhandler.h"
#include <fcntl.h>
class Acceptor : public IOWatcher
{
private:
int _listenport;
int _idlefd;
public:
Acceptor() : IOWatcher(ACCEPTOR), _listenport(0), _idlefd(::open("/dev/null", O_RDONLY | O_CLOEXEC))
{
_fd = ::socket(PF... | true |
e0911c355355e3567a445d20804679c270108934 | C++ | umaatgithub/QlicProject | /src/product.cpp | UTF-8 | 957 | 3.0625 | 3 | [] | no_license | #include "product.h"
Product::Product(int a, QString b, QString c, int d, int e)
{
ID = a;
Name = b;
Description = c;
Category_ID = d;
Price = e;
}
bool Product::setID(const int &a)
{
ID = a;
return true;
}
int Product::getID() const
{
return ID;
}
bool Product:... | true |
e88ed2a60cfe65e311732ac4c6210472bc426833 | C++ | arnabsarker/LaundroMeter | /LaundryArduino.cc | UTF-8 | 4,936 | 3.140625 | 3 | [] | no_license | #include < SoftwareSerial.h >
SoftwareSerial BTSerial(2, 3);
//CONSTANTS
const int DRIER_TIME = 45*60; //seconds it takes to dry clothes, approx. 45 minutes
//Threshold values used to determine events for the dryer.
const int X_DOOR_THRESHOLD = 30;
const int Y_DOOR_THRESHOLD = 30;
const int Z_DOOR_THRESHOLD = 70;
con... | true |
e06699bbf0323e8df38e294f8816c14c775b4bc3 | C++ | djmgeneseo/Data-Structures | /Degree_Sequences_Linked_List/Degree_Sequences_Linked_List_v1.0.cpp | UTF-8 | 4,967 | 3.953125 | 4 | [] | no_license | // David Murphy
// 09/19/17
// Discrete Math Practice
// v1.0
/*
* A degree sequence is a sequence of integers that represents the degrees of each vertex
* in an undirected graph.
* To be a degree sequence, the following two cases must be true:
* 1) Handshaking Theorem: The sum of the degrees of all the vertic... | true |
dc8a5207f1a1fc350b367313953678ab334efcb3 | C++ | matbuster/cppframework | /Threading/Mutex.h | UTF-8 | 798 | 2.828125 | 3 | [] | no_license | /**
* \file Mutex.h
* \date 04/11/2015
* \author MAT
*/
#ifndef MUTEX_H
#define MUTEX_H
#ifdef _WINDOWS
#include <windows.h>
#endif
#ifdef LINUX
#include <pthread.h>
#include <errno.h>
#include <time.h>
#include "../Timing/Chrono.h"
#endif
namespace Threading
{
class Mutex
{
private:
#ifdef _WINDOWS
... | true |
eed7fc10111d0e7c766815d8ad97b40a839ae0a8 | C++ | arunksoman/MFRC522_ESP32 | /src/main.cpp | UTF-8 | 3,046 | 2.59375 | 3 | [] | no_license |
// Include Libraries
#include "Arduino.h"
#include "RFID.h"
#include <ArduinoJson.h>
#include <WiFi.h>
#include <HTTPClient.h>
// Pin Definitions
#define RFID_PIN_RST 22
#define RFID_PIN_SDA 21
const char * ssid = "anuja1";
const char * password = "ar3k57u4";
const char * host = "192.168.43.82";
String device_id = "... | true |
0675bf713ba203233b385029c5d8b1ff9d4ce0dd | C++ | ilario-pierbattista/hasp-tracker | /matlab/preprocess/floor_rebase.cxx | UTF-8 | 1,279 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
#include "mexutils.h"
/*
* Main function
*
* nlhs: Numero atteso di output
* plhs: Array di puntatori all'output
* nrhs: Numero di parametri in input
* prhs: Array di puntatori all'input
*/
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
Image *o... | true |
ca1b5773683914a2ad4d0627a68f3c5623ba1859 | C++ | fmi-lab/oop-2019-kn-group6-sem | /Exercise 5/row.cpp | UTF-8 | 2,352 | 3.6875 | 4 | [] | no_license | #include"row.h"
#include<iostream>
#include<cassert>
#include<cstring>
using namespace std;
row::row(const char* word, const char* meaning)
{
if(strlen(word) <= 100 && strlen(meaning) <= 500)
{
this->word = new char[strlen(word) + 1];
assert(this->word);
strcpy(this->word, word);
... | true |
d365d374c580266173ed92e5196f28ad65969794 | C++ | TejBirring8/PacketProcessingCpp | /packet_processing/packet_definitions/_packet.h | UTF-8 | 2,252 | 2.71875 | 3 | [] | no_license | //
// Created by tbirring on 10/10/2019.
//
#ifndef CODETEST_PACKET_PROCESSING_PACKET_DEFINITIONS_PACKET_H
#define CODETEST_PACKET_PROCESSING_PACKET_DEFINITIONS_PACKET_H
#include "_types.h"
#include "../types.h"
namespace packet_processing::packet_definitions
{
// packet type - the byte specifying which packet (s... | true |
1c8eb87c9335a905dab9e4b152350c7a965d4281 | C++ | mszkowalik/FilterBank | /Effect.cpp | UTF-8 | 1,053 | 2.828125 | 3 | [] | no_license | #include "Effect.h"
#include "Delay.h"
#include "FShift.h"
Effect::Effect(FilterSettings _settings, Effect* _child)
{
settings = _settings;
child = _child;
}
Effect::Effect(Effect * _effect)
{
}
Effect::~Effect()
{
if (child)
delete child;
}
ParameterList Effect::getParamsList()
{
return ParamsList;
}
Ef... | true |
91e13cbc618c99d9d4268ed0eb1dd7e793dbcd79 | C++ | trantrangntt/TINC | /thi/A/sg.cpp | UTF-8 | 576 | 2.625 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
int so(int n)
{
int a,m=1,so=1,i=1,s[10];
while(n>0)
{
s[i]=n%10;
n/=10;
i++;
}
for(int j=1;j<i-1;j++)
{
if(s[j]>=s[j+1]) return 0;
}
return 1;
... | true |
c2859f4ef870bbbe995f921feec927c3a783c335 | C++ | Annadd/cpp-example | /src/dtlib/DynamicArray.h | UTF-8 | 1,787 | 3.359375 | 3 | [] | no_license | #ifndef DYNAMICARRAY_H
#define DYNAMICARRAY_H
#include "Array.h"
namespace DTLib
{
template <typename T>
class DynamicArray : public Array<T>
{
protected:
int mLength;
T* copy(T* array, int len, int newLen)
{
T* ret = new T[newLen];
if(ret){
int size = (len < newLen) ? len :... | true |
205d856b6ef28d2a164bd90b04791d9b744dc89b | C++ | jalayonm/Programacion-clases | /2020-09-09.git/funcion3.cpp | UTF-8 | 357 | 3.328125 | 3 | [] | no_license |
#include<iostream>
#include<cstdlib>
double average(double x, double y);
int main( int argc, char *argv[])
{
double x = std::atof(argv[1]);
double y = std::atof(argv[2]);
double z=0;
z = average( x,y);
std::cout << z << std::endl;
return 0;
}
double average(double x, double y)
{
double result = 0;
r... | true |
2da8e2d7e96fa276d689f729f79245ced89ba1df | C++ | wentwrong/hashing-result | /src/argparser.cpp | UTF-8 | 775 | 2.578125 | 3 | [] | no_license | #include "argparser.hpp"
ArgParser::ArgParser(int argc, char *argv[])
{
if(argc < 3) {
std::cerr << "Incorrect number of parameters." << std::endl
<< "Usage: ./hashing-result-mt input output 1024" << std::endl;
exit(1);
}
this->input_fn = argv[1];
this->output_fn = arg... | true |
15c83669e195129df7deddfa07a33fc737346f8f | C++ | aravynn/QBWebPortal | /QBWebPortal/QBXMLSync.h | UTF-8 | 4,209 | 2.5625 | 3 | [] | no_license | #pragma once
/**
*
* QBXMLSync controls the actual processing functions required for the transfer of data from Quickbooks to the database.
* Additionally, this class will also manage any required inserts and updates to the file, as per the given data.
* This class is unlikely to store a great deal of held informat... | true |
99cec13e9bc3cc1bc42218b9f5cc0166f9db2703 | C++ | riera90/poo | /pr1/ej3-4-5/juego.cc | UTF-8 | 1,155 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | #include "dados.h"
#include <iostream>
int main(int argc, char const *argv[])
{
Dados d;
int v[4];
std::cout<<"dice 1: >'"<<d.getDado1()<<"'\n";
std::cout<<"dice 2: >'"<<d.getDado2()<<"'\n\n";
d.getUltimos1(v);
for (int i = 0; i < 5; ++i)
{
std::cout<<"v["<<i<<"]="<<v[i]<<"\n";
}
std::cout<<"\n";
d.getU... | true |
c748527eddfd6a99d24d3db246fce3ce6eea1d18 | C++ | duckhee/opencv_study | /chapter2/ex2-55/ex2_55.cpp | UTF-8 | 1,642 | 3 | 3 | [] | no_license | #include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
template <class T>
T* vec_to_arr(vector<T> v1) //1D array
{
T* v2 = new T[v1.size()];
for(int i = 0; i < v1.size(); i++)
{
v2[i] = v1[i];
}
return v2;
}
template<class T>
void delete_arr(T* arr)
{
delete[] arr;
}
... | true |
b01e4fba2551fbb8bcbda31d524d49129d0be283 | C++ | kslyre/optimizations | /functors.h | UTF-8 | 1,150 | 2.53125 | 3 | [] | no_license | #ifndef FUNCTORS_H
#define FUNCTORS_H
#include "derivable.h"
#include <QVector2D>
#include <QVector3D>
#include <structs.h>
class SimpleFunctor {
QVector<QVector2D> point1;
QVector<QVector2D> point2;
QVector2D center;
public:
SimpleFunctor();
SimpleFunctor(QVector<QVector2D> point1, QVector<QVect... | true |
fde8ac59589bcf36fbafda95bfeae0d572ec0092 | C++ | JohnHonkanen/NBody | /nbody/Body.cpp | WINDOWS-1252 | 4,072 | 2.921875 | 3 | [] | no_license | /*
Name: John Honkanen
Student ID: B00291253
I declare that the following code was produced by John Honkanen (B00291253), Adam Stanton (B00266256) and Kyle Pearce (B00287219) as a group assignment for the IPM module and that this is our own work.
I am aware of the penalties incurred by submitting in full or in part... | true |
28100ce34b93c299855bf278ab0378986f668708 | C++ | CISVVC/CIS202-GraphicsView | /mainwindow.cpp | UTF-8 | 3,074 | 2.578125 | 3 | [] | no_license | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include<cmath>
#include "axis.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->graphicsView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
... | true |
8810f8a1f9389925976a4b8771c42de4a5391932 | C++ | 0xA1MN/Problem_Solving | /URI Online Judge/1047 - Game Time with Minutes.cpp | UTF-8 | 689 | 2.921875 | 3 | [] | no_license | // https://www.urionlinejudge.com.br/judge/en/problems/view/1047
// handle 24 hour case
#include <bits/stdc++.h>
using namespace std;
int main() {
int start_h, end_h, start_m, end_m, duration_h, duration_m;
cin>>start_h>>start_m>>end_h>>end_m;
duration_h = end_h - start_h;
if (duration_h < 0) {
duration_h... | true |
cb7e5a6f5726027905d8b4d18bf4d3f16dc6933f | C++ | Kirthik13/LeetCode-1 | /generateTrees.cpp | UTF-8 | 1,127 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <vector>
struct TreeNode
{
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution
{
private:
std::vector<TreeNode*> generateTrees(int beg, int end)
{
std::vector<TreeNode*> res;
if (beg > end... | true |
ac19ad3958510a301fa3fbde29dea733d249eb2f | C++ | eliadra/Laba4 | /Лабораторная№3 (4)/Лабораторная№3/Tokar.cpp | WINDOWS-1251 | 489 | 2.71875 | 3 | [] | no_license | #include "StdAfx.h"
#include <iostream>
#include "Tokar.h"
using namespace std;
Tokar::Tokar(void)
{
cout << " " << endl;
}
void Tokar::setstaz(int x)
{
this->staz = x;
}
void Tokar::getstaz()
{
cout << " : " << this->staz << endl;
}
Tokar::~Tokar()
{
cout << " " << endl;
}
void Tokar::history()
{
cout << " ... | true |
ced2b63f8e2e4cc31ce081c90b2c1d4c40426abc | C++ | luchunabf/Cplusplus | /test_7_25_2/test_7_25_2/virtual.cpp | GB18030 | 1,186 | 3.109375 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
class Base1
{
public:
virtual void func1()
{
cout << "Base1:: func1()" << endl;
}
virtual void func2()
{
cout << "Base1:: func2()" << endl;
}
private:
int _b1;
char _b2;
double _b3;
};
class Base2
{
public:
virtual void func1()
{... | true |
64b80ccc193da24bbbeb807d43af7f4c284c2d8e | C++ | A-STAR0/hackerrank-solutions-1 | /DataStructures/LinkedLists/print-the-elements-of-a-linked-list.cpp | UTF-8 | 348 | 3.4375 | 3 | [
"MIT"
] | permissive | /*
Print elements of a linked list on console
head pointer input could be NULL as well for empty list
Node is defined as
struct Node
{
int data;
struct Node *next;
}
*/
void Print(Node *head)
{
Node* tracker = head;
while(tracker) {
cout << tracker->data << endl;
track... | true |
8026c66b176927852500b21ab6369a78d0d325b0 | C++ | bog2k3/boglfw | /src/OSD/ScaleDisplay.cpp | UTF-8 | 2,581 | 2.546875 | 3 | [
"MIT"
] | permissive |
#include <boglfw/OSD/ScaleDisplay.h>
#include <boglfw/renderOpenGL/Viewport.h>
#include <boglfw/renderOpenGL/Camera.h>
#include <boglfw/renderOpenGL/Shape2D.h>
#include <boglfw/renderOpenGL/GLText.h>
#include <boglfw/renderOpenGL/RenderContext.h>
#include <glm/vec3.hpp>
#include <math.h>
#include <stdio.h>
... | true |
9fee367c636358b64f4d1feeaab25483d4f6a6c4 | C++ | devrangel/LearnOpenGL | /src/camera.h | UTF-8 | 2,514 | 2.96875 | 3 | [] | no_license | #pragma once
#include "GLFW/glfw3.h"
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
const float YAW = -90.0f;
const float PITCH = 0.0f;
const float SPEED = 2.5f;
const float SENSITIVY = 0.000005f;
const float ZOOM = 45.0f;
class Camera
{
public:
glm::vec3 position;
glm::vec3 front;
glm::vec3 up;
... | true |
398aba5927d9b8e563f464e04d203a491b0f65e8 | C++ | migue27au/ESP32HTTP | /ESP32HTTP/examples/ESP32HTTP_example/ESP32HTTP_example.ino | UTF-8 | 1,966 | 2.859375 | 3 | [] | no_license | /*
* EXAMPLE OF ESP32HTTP library
* Author: migue27au --> https://github.com/migue27au
* Last Update: 18/02/2021
*/
#include "ESP32HTTP.h"
char* server = "www.arduino.cc";
String path = "/asciilogo.txt";
char* ssid = "SSID";
char* password = "SSID PASSWORD";
HTTP http(server, HTTP_PORT);
//HTTP h... | true |
1a01235b170e42ebfdfe34d0497d8a6ffd325aae | C++ | kunmukh/CS-475 | /CS-475/InClass-Assignment/CS215/Practical_Exam_1/practical1/problem1.cpp | UTF-8 | 1,129 | 3.421875 | 3 | [] | no_license | //Kunal Mukherjee
//Practical Exam
//Problem 1
//14th Feb, 2016
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int Ackermann(int m, int n);
int main (int argc, char *argv[])
{
if (argc != 3)
{
cout << "Usage: " << argv[0] << "Inputfile Outfile" << endl;
}
ifstream... | true |
6197b7d597d08ac593c13cf493f3b7a3e739971e | C++ | kloetzl/libdna | /test/Tdnax_revcomp.cxx | UTF-8 | 2,317 | 2.859375 | 3 | [
"MIT"
] | permissive | #include "Tcommon.h"
#include <assert.h>
#include <catch2/catch.hpp>
#include <dna.h>
#include <string.h>
#include <string>
TEST_CASE("Basic revcomp checks")
{
auto forward = repeat("ACGT", 10);
auto buffer = new char[forward.size() + 1];
memset(buffer, 0, forward.size() + 1);
auto end_ptr = dna4_revcomp(dna::b... | true |
a0253a4db4b5a86482d31f42311dad96436b803c | C++ | haxpor/cpp_st | /AliasNamespace2.cpp | UTF-8 | 553 | 3.90625 | 4 | [
"MIT"
] | permissive | /**
* Just a simple prove of concept of using `using` to alias struct inside namespace scope.
*/
#include <iostream>
namespace A
{
struct Util
{
static void foo()
{
std::cout << "foo()\n";
}
};
// style 2
// note: use this style to maintain the fully qualified namespace up to this point
using MyUtil ... | true |
6b6fb80bd90a7cfa4ecff4a0d791af22db755960 | C++ | AABHINAAV/InterviewPrep | /Hashing/Find_Itinerary.cpp | UTF-8 | 1,287 | 3.796875 | 4 | [
"MIT"
] | permissive | //given many routes in the following format:
//from place1 to place 2
//Find the itinerary i.e the complete route using the given data
#include<iostream>
#include<unordered_map>
using namespace std;
//prints the itinerary
/*
we just need to find the starting location.Now the starting location
can never be the destin... | true |
af9f26c0d949e6c9ce44c08f08f183ec5870d285 | C++ | wuli2496/OJ | /UVa/1316 Supermarket/Supermarket(贪心+并查集).cpp | UTF-8 | 2,395 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | /**
* @class AlgoPolicy
* @author wl
* @date 08/12/2019
* @file main.cpp
* @brief
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <memory>
#include <cstring>
using namespace std;
const int MAXN = 10001;
template<typename Result>
class AlgoPolicy
{
pub... | true |
a6d897768ee0fe67eeb0d8e3132f5bd0d9646052 | C++ | sgumhold/cgv | /libs/delaunay/delaunay_mesh_with_hierarchy.h | UTF-8 | 2,364 | 2.8125 | 3 | [] | permissive | #pragma once
#include "mesh_geometry_reference.h"
#include "delaunay_mesh.h"
#include "lib_begin.h"
/// simple triangle mesh data structure using the corner data structure to store neighbor relations
template <class ta_delaunay_mesh = delaunay_mesh<> >
class CGV_API delaunay_mesh_with_hierarchy : public ta_... | true |
531ee2eda7b68f09f3fc0cd6f947022f90933aa6 | C++ | iamnwi/papercraft-generator | /src/main.cpp | UTF-8 | 76,262 | 2.53125 | 3 | [] | no_license | // This example is heavily based on the tutorial at https://open.gl
#include <iostream>
#include <math.h>
#include <vector>
#include <list>
#include <algorithm>
#include <fstream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <iomanip>
// OpenGL Helpers to reduce the clu... | true |
eaefa575d6f039e422c861e12c148ebe07dbf881 | C++ | jasonjamet/CUDAisation | /CUDAisationCANSI/main.cpp | UTF-8 | 4,001 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <unistd.h>
#include "node.hpp"
#include "CodeGen.hpp"
#include "CodeString.hpp"
#include "set"
#include "algorithm"
extern FILE *yyin;
extern int yyparse();
extern TranslationUnit* root;
bool checkExtentionFile(char* fileName) {
if(fileName != NU... | true |
98480daa16cf98130ce32af8c80a70017656df80 | C++ | mnetoiu/SensorsMaps | /SensorsMaps/dht-light-co-blue.ino | UTF-8 | 1,451 | 2.6875 | 3 | [] | no_license | #include <SoftwareSerial.h>
#include <SimpleDHT.h>
SoftwareSerial MyBlue(2, 3); // RX | TX
int pinDHT11 = 7;
SimpleDHT11 dht11;
int sensorPin = 2; //define analog pin 2 for light sensor
int sensorCO = 0; // define analog pin 0 for CO sensor
int light = 0;
int valueCO;
void setup() {
Serial.begin(9600);
MyBlue.be... | true |
d6aa89dbfe2ff91e7a6395f67f2b8f88f84259eb | C++ | Pycorax/StateMachine | /Source/FiniteStateMachine.h | UTF-8 | 2,289 | 3.453125 | 3 | [] | no_license | /******************************************************************************/
/*!
\file NPC.h
\author Tng Kah Wei
\brief
NPC Finite State Machine interface class to turn any object into a Finite
State Machine.
*/
/******************************************************************************/
#ifndef FINITE_STATE_MA... | true |
8153bab6fe2e45cb937543d2e04565103a4542b2 | C++ | ing181/arduino.3 | /C++/2020-11-18/första_programmet.cpp | UTF-8 | 228 | 2.5625 | 3 | [] | no_license | // Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
// En kommentar, bara för programmeraren
// skärmen utmatningsoperatorn "Det som matas ut" ;
cout << "Hej pa dig";
}
| true |
086d83eb8ceb34277f0b2e4f5eeb8eb48ed014c1 | C++ | kodekill/Keyboard-Prank | /Keyboard_Mouse.ino | UTF-8 | 1,517 | 3.09375 | 3 | [] | no_license | #include <Mouse.h>
#include <Keyboard.h>
#define MIN 5000 //5 seconds
#define MAX 15000 //15 seconds
#define KEYL 33 //Lowest Ascii Dec
#define KEYH 126 //High Ascii Dec
#define DEL 8 //Delete key
int mouseState = 0;
int LED = 17;
int choice = 0;
void setup() {
Mouse.begin();
Keyboard.begin();
pinMode(LED, O... | true |
d1dd9541e246c805cca17c8f84d411b868f58b80 | C++ | abmodi/TC | /Div2/SRM650A/SRM650A/Source.cpp | UTF-8 | 445 | 3.25 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
using namespace std;
class TaroJiroDividing
{
public:
int getNumber(int A, int B)
{
int count = 0;
set<int> a;
while (A%2 == 0 && A != 0)
{
a.insert(A);
A = A / 2;
}
a.insert(A);
while (B % 2 == 0 && B != 0)
... | true |
9622011e07107793fb278ed9652a58ebab9ebdcb | C++ | qjagh95/MyData | /MyMap/MyMap.h | UHC | 8,028 | 3.28125 | 3 | [] | no_license | #pragma once
#include "stdafx.h"
#define TrueAssert(p) assert(!(p))
template<typename T1, typename T2>
class MyMap
{
private:
class Node
{
public:
Node() :Left(NULL), Right(NULL), Top(NULL)
{
memset(&Key, 0, sizeof(T1));
memset(&Data, 0, sizeof(T2));
}
Node(const T1& _Key, const T2& _Data) :Key(_Key),... | true |
aded32f40cdb04b74a5b173c362924f69997512c | C++ | keithalewis/enumerator | /sequence/counted_enumerator_.h | UTF-8 | 2,277 | 3.25 | 3 | [] | no_license | // counted_enumerator_.h - enumerators with a size_t count
#pragma once
#include "enumerator_.h"
namespace fms {
template<class I,
class C = typename std::iterator_traits<I>::iterator_category,
class T = typename std::iterator_traits<I>::value_type,
class D = typename std::iterator_traits<I>::difference_type,... | true |
cb82f971ea76dcc580104d40916c25087b30f95d | C++ | Mehwa/Algorithm_Study | /Algorithm_Study_KPark/BJ5022_ConnectLine/BJ5022_ConnectLine.cpp | UTF-8 | 3,256 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <queue>
using namespace std;
int N, M, a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y;
bool map[101][101];
bool visited[101][101];
int dist[101][101];
int dx[4] = { 1, -1, 0, 0 };
int dy[4] = { 0, 0, -1, 1 };
void input() {
cin >> N >> M;
cin >> a1x >> a1y;
cin >> a2x >> a... | true |
08e746ce4fa880884e0daa626f8fd5b7466359f2 | C++ | ryanyl/zombie-dash | /StudentWorld.cpp | UTF-8 | 14,197 | 2.921875 | 3 | [] | no_license | #include "StudentWorld.h"
#include "GameConstants.h"
#include "Level.h"
#include <string>
#include <iostream>
#include <sstream>
#include <iomanip> // defines the manipulator setw
using namespace std;
GameWorld* createStudentWorld(string assetPath)
{
return new StudentWorld(assetPath);
}
// Students: Add code to t... | true |
c629d8e91a6653483fe5cb42f63141699c66756e | C++ | hwiebers19/CS172HW4 | /HW4-CS172/HW4-CS172/Rectangle2D.cpp | UTF-8 | 2,564 | 3.734375 | 4 | [] | no_license | //
// Rectangle2D.cpp
// HW4-CS172
//
// Created by Heidi Wiebers on 10/19/16.
// Copyright © 2016 Heidi Wiebers. All rights reserved.
//
#include "Rectangle2D.hpp"
//argument constructor which uses pointers in it
Rectangle2D::Rectangle2D(int x, int y, int width, int height)
{
this->x=x;
this->y=y;
thi... | true |
d0860604c98ae0217d51c0253c9842a275b78e17 | C++ | samm007aqp/set_problems | /set_problem_4_5/geometry.cpp | UTF-8 | 3,923 | 2.953125 | 3 | [] | no_license | #include "geometry.h"
int Punto::getX()const{
return x;
}
int Punto::getY()const{
return y;
}
void Punto::setX(int new_x){
x= new_x;
}
void Punto::setY(int new_y){
y= new_y;
}
//----------------------------------------------
Arreglo_Puntos::Arreglo_Puntos(){
tamano = 0;
puntos = new Punto[tamano];
}... | true |
ca01d85043ebb614f20c64b6e423a9e8b111d519 | C++ | sandychn/LeetCode-Solutions | /Medium/0207-course-schedule.cpp | UTF-8 | 1,027 | 3.125 | 3 | [
"MIT"
] | permissive | class Solution {
public:
bool canFinish(int numCourses, vector<vector<int>>& prerequisites) {
vector<int> inDegree(numCourses);
vector<vector<int>> edges(numCourses);
for (const vector<int>& edge : prerequisites) {
int a = edge[0], b = edge[1];
edges[b].push_back(a);... | true |
cbaebc3e3dc4293f05ad97cbf796713c8f573cd1 | C++ | dyxcode/DataStructuresAndAlgorithms | /sort(排序)/MergeSort.cpp | GB18030 | 1,582 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
//void Merge(int * const first, int * const mid, int * const last) {
// vector<int> left(first, mid);
// vector<int> right(mid, last);
// left.push_back(INT_MAX); //ڱINT_MAXDZȽеĽϴ
// right.push_back(INT_MAX); //ֵINT_MAX... | true |
39858ad88c31195944c3545670730f3ad880bde9 | C++ | victor-istomin/CodeRacing | /cpp-cgdk/Vec2.h | UTF-8 | 2,569 | 3.640625 | 4 | [] | no_license | #pragma once
#include "Utils.h"
#include <cmath>
template <class T>
class Vec2 {
public:
T m_x, m_y;
Vec2() : m_x(0), m_y(0) {}
Vec2(T x, T y) : m_x(x), m_y(y) {}
Vec2(const Vec2& v) : m_x(v.m_x), m_y(v.m_y) {}
template <typename Point>
static Vec2 fromPoint(const Point& p) { return Vec2(p... | true |
f8363c2a540ebac191e95da88de378dc926ba452 | C++ | rongrong005/ap | /code/aggregation/ca_code/getsample.cc | UTF-8 | 805 | 2.625 | 3 | [
"MIT"
] | permissive | #include "Global.h"
#define MAX_LINE_SIZE 5000
int main(int argc, char*argv[])
{
int S = atoi(argv[1]);
int N,K;
cin >> N >> K ;
cerr << N << " " << K <<endl;
string line;
getline(cin, line); // clears the endl at the first line
string *LinesSampled = new string [S];
srand48(1973);
for (int ... | true |
2a21501103c2caa9bae03a3c6df21fba32d13698 | C++ | playbyte/Arduino | /LED_Ej2_circle.ino | UTF-8 | 6,817 | 2.671875 | 3 | [] | no_license |
/* ################## TiraLED_WS2812B ####################
* Filename: LED_Ej2_circle.ino
* Descripción: Circulo de Leds
* Autor: Jose Mª Morales
* Revisión: 02-03-2017
* Probado: ARDUINO UNO r3 - IDE 1.8.2 (Windows7)
* Web: www.playbyte.es/electronica/
* Licencia: Creative Commons... | true |
53b2402ee72c606397c082a9a1ff29ff0d2817b9 | C++ | jcschefer/icpc-practice | /2018-17-18/c.cpp | UTF-8 | 624 | 2.859375 | 3 | [] | no_license | #include <unordered_set>
#include<iostream>
using namespace std;
long calc(unordered_set<int> avoids, int targetsum, int sofar) {
if (sofar == targetsum) return 1;
int s = 0L;
for (int k = 1; k < targetsum; k++) {
if (avoids.find(k) == avoids.end()) {
//cout <<"adding"<<endl;
s += calc(avoids, targetsum - ... | true |
495694d2bc70b98e3be29c120fa8805f4292fc32 | C++ | vishwesh-mishra/SnakeAndLadder | /Services/Game.h | UTF-8 | 383 | 2.859375 | 3 | [] | no_license | #pragma once
#include<map>
#include<string>
using namespace std;
class Game {
public:
map<string, int> playerPosition;
map<int, int> snakeLadder;
Game();
void readInput();
void printOutput(string player, int diceRoll, int startPosition, int endPosition);
void addSnakeLadder(int headStart, int tailEnd);
void a... | true |
58fb0b9f126252508ca61492ac135d2898081f41 | C++ | manavsiddharthgupta/practice1 | /add.cpp | UTF-8 | 118 | 2.78125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int a=8;
int b=90;
cout<<"sum of a and b is- "<<endl<<a+b;
} | true |
f1664a10854996a7d1af5adf297fb9732eb55472 | C++ | rezanour/randomoldstuff | /Main/GDK/Runtime/Public/Common/FileSystem.h | UTF-8 | 797 | 2.671875 | 3 | [] | no_license | #pragma once
#include "Platform.h"
#include <string>
#include <memory>
namespace GDK
{
namespace FileSystem
{
// root - Path to ZIP file or directory for volume.
// logicalRoot - The logical root of the volume. For example you could pass in "Media\Textures" and
// then th... | true |
572934efdea7ac1f8936e713b5a5a3e70e33b3b9 | C++ | jaisong87/Stencil-Calc | /distributedMemoryParallelism/distributedMemStencil.cpp | UTF-8 | 12,881 | 3.015625 | 3 | [] | no_license | /******************************************
*
* distributedMemStencil.cpp - Calculates Stencil
* on distributed memory architecture using MPI
*
*****************************************/
#include<iostream>
#include<sstream>
#include<iomanip>
#include<mpi.h>
using namespace std;
bool enableDebug = false; /* detaile... | true |
d0c3ecdeba009aabe7fc43d8ac2719cf79e50618 | C++ | blizmax/XYZEngine-Public | /XYZEngine/src/XYZ/Renderer/Texture.cpp | UTF-8 | 2,362 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #include "stdafx.h"
#include "Texture.h"
#include "Renderer.h"
#include "XYZ/API/OpenGL/OpenGLTexture.h"
namespace XYZ {
Ref<Texture2D> Texture2D::Create(uint32_t width, uint32_t height, uint32_t channels, const TextureSpecs& specs)
{
switch (Renderer::GetAPI())
{
case RendererAPI::API::None: XYZ_ASSERT(fals... | true |
dc9fbe00d9ce8687e0a21d82db0962befe152817 | C++ | yku/Competition | /AOJ/0075/BMI.cc | UTF-8 | 424 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
bool solve(int id, double w, double h)
{
double bmi = (w / (h * h));
if(bmi >= 25.0) return true;
else return false;
}
int main()
{
int id;
char comma;
double w, h;
while(cin >> i... | true |
612a63754513af19b48e4beb9004d5c00cc3eab3 | C++ | dennn66/ArduRoomba | /Firmware/MotorTest/MotorTest.ino | UTF-8 | 2,431 | 2.6875 | 3 | [] | no_license |
#define PIEZOBUZZER
#define LEFT 0
#define RIGHT 1
#ifdef PIEZOBUZZER
#define BUZZER 44 //
#define BUZZER_GND 42 //
void alert(int _times, int _runTime, int _stopTime)
{
for(int _ct=0; _ct < _times; _ct++)
{
delay(_stopTime);
analog... | true |
3493a4bc3fade2f18388881b8a787cedc7d19544 | C++ | Egocentrix/CppPractice | /ObjectManager.cpp | UTF-8 | 1,960 | 3.8125 | 4 | [] | no_license | // To practice lifetime management and smart pointers
// See also https://rachelnertia.github.io/programming/2016/11/16/weak-ptr-fun-times/
#include <iostream>
#include <memory>
#include <unordered_map>
// Class to track objects and their existence. Objects will stay in memory as
// long as they are in use, and will ... | true |
e649ecb62839f892f5c9979ea49235e5065a7ea5 | C++ | zzm99/Algorithm-and-data-structure | /Datastructure/Sorting/Mergesort for Linked Lists.cpp | UTF-8 | 1,936 | 4.09375 | 4 | [] | no_license | // Merge sort is often preferred for sorting a linked list.
// The slow random-access performance of a linked list makes some other algorithms (such as quicksort) perform poorly,
// and others (such as heapsort) completely impossible.
// https://www.geeksforgeeks.org/merge-sort-for-linked-list/
#include <bits/stdc++.h... | true |
7852481617da870f7178fb17fcfca0d7fe7634d9 | C++ | syedTabish/Codes | /basic/counting_sort.cpp | UTF-8 | 685 | 3.046875 | 3 | [] | no_license | #include<iostream>
#define MAX 100
using namespace std;
int main(){
int n;
int *a,*b;
int c[MAX] = {0};
//read data
cin >> n;
a = new int[n];
b = new int[n];
for(int i = 0; i < n;i++){
cin >> a[i];
}
//algorithm
//ensure c is zero
for(int i = 0;i < n; i++){
... | true |
edb6346ef9f913a09d2d1bc01f4288098809146a | C++ | codenuri/TEMPLATE | /instantiation1.cpp | UTF-8 | 415 | 2.953125 | 3 | [] | no_license | /*
* HOME : ecourse.co.kr
* EMAIL : smkang @ codenuri.co.kr
* COURSENAME : C++ Template Programming
* MODULE : instantiation1.cpp
* Copyright (C) 2017 CODENURI Inc. All rights reserved.
*/
template<typename T> T square(T a)
{
T ret = a * a;
return ret;
}
int main()
{
// explicit inst... | true |
e7f42ab08c8cad515e20c33a66023f21738da700 | C++ | Shymae/androidpp | /Android/text/style/MetricAffectingSpan.h | UTF-8 | 2,534 | 2.765625 | 3 | [] | no_license | //
// MetricAffectingSpan.h
// Androidpp
//
// Created by Saul Howard on 1/22/14.
// Copyright (c) 2014 MoneyDesktop. All rights reserved.
//
#ifndef __Androidpp__MetricAffectingSpan__
#define __Androidpp__MetricAffectingSpan__
#include "AndroidMacros.h"
#include "Android/text/style/UpdateLayout.h"
#include "And... | true |
14e59d02fc812bfb6cea951442d44c12b5680f97 | C++ | teqno/f-framework | /f-library/src/activations.cpp | UTF-8 | 670 | 3 | 3 | [] | no_license | #include <math.h>
#include <iostream>
#include "activations.h"
Eigen::VectorXd sigmoid(const Eigen::VectorXd &z)
{
return z.array() / (1.0 + z.array().abs());
}
Eigen::VectorXd relu(const Eigen::VectorXd &z)
{
return z.cwiseMax(0);
}
Eigen::VectorXd sigmoid_prime(const Eigen::VectorXd &z)
{
return 1.0 /... | true |
b3aa0d6f6d9983c10df24127728ba7c3963b5bf2 | C++ | jucelinoss/Estruturas_de_dados | /Estruturas_dados/Semana_5_Aula_14_Arvore_binaria/ArvoreBinaria.cpp | UTF-8 | 3,511 | 3.453125 | 3 | [] | no_license | #include <cstddef>
#include <iostream>
#include "ArvoreBinaria.h"
#include "Aluno.h"
ArvoreBinaria::ArvoreBinaria() {
raiz = NULL;
}
ArvoreBinaria::~ArvoreBinaria() {
deletarArvore(raiz);
}
void ArvoreBinaria::deletarArvore(No* noAtual) {
if (noAtual != NULL) {
deletarArvore(noAtual->filhoEsquerda);
deletarArv... | true |
23f64128256e96a691db70d45acba2d8e18df1be | C++ | LuckyDmitry/devtools-course-practice | /modules/length_converter/src/length_converter.cpp | UTF-8 | 1,398 | 3.140625 | 3 | [
"CC-BY-4.0"
] | permissive | // Copyright 2020 Brazhnikov Eugene
#include "include/length_converter.h"
double LengthConverter::m_kmeter(const double& curr, bool side) {
if (curr >= 0 && side == false) // meter to kilometer
return curr / 1000;
if (curr >= 0 && side == true) // kilometer to meter
return curr * 1000;
... | true |
a322a2e46f7fa9d280019ec4348de86125211838 | C++ | Kawser-nerd/CLCDSA | /Source Codes/CodeJamData/13/01/15.cpp | UTF-8 | 1,762 | 3.21875 | 3 | [] | no_license | #include <cstdio>
using namespace std;
void doCase()
{
char board[4][4];
for (int i=0; i<4; i++)
{
for (int j=0; j<4; j++)
{
scanf(" %c", &board[i][j]);
}
}
// rows
for (int i=0; i<4; i++)
{
int nO = 0;
int nX = 0;
for (int j=0; j<4; j++)
{
if (board[i][j] == 'X')
nX++;
if (board... | true |
925433f75adfde022ce649d8463293849004ed1f | C++ | packetinspector/random | /temp-light.ino | UTF-8 | 3,432 | 2.71875 | 3 | [] | no_license | // Quick use of DHT and FastLED
// In production
//Includes
#include <dht.h>
#include "FastLED.h"
FASTLED_USING_NAMESPACE
//Make a DHT object
dht DHT;
//Setup Stuff
#define DHT22_PIN 5
#define NUM_LEDS 1
#define DATA_PIN 6
#define LED_TYPE WS2812
#define COLOR_ORDER RGB
CRGB leds[NUM_LEDS];
struct
{
uint32_... | true |
74f0d64b56952fe14c76bda10a9b244438a1df15 | C++ | johng/Rasteriser | /Source/Camera.h | UTF-8 | 518 | 2.71875 | 3 | [] | no_license | #ifndef COMPUTER_GRAPHICS_CAMERA_H
#define COMPUTER_GRAPHICS_CAMERA_H
#include <iostream>
#include <glm/glm.hpp>
using namespace std;
using glm::vec3;
using glm::mat3;
using glm::mat4;
using glm::vec4;
class Camera
{
private:
vec3 pos;
vec3 dir;
public:
Camera (vec3 pos,vec3 dir);
void setPos(vec3 pos);... | true |
54fc5b13c64154d7a9592d9e1fe3b2a88317129e | C++ | JS00000/acmCode | /hdu/1004.cpp | UTF-8 | 614 | 2.65625 | 3 | [] | no_license | #include "iostream"
#include "string"
using namespace std;
int main(int argc, char const *argv[])
{
int n;
cin >> n;
while(n!=0)
{
int j=0;
int k=0;
string str;
string in[1000];
int num[1000]={0};
while(k<n)
{
cin >> str;
bool p = false;
for (int i = 0; i < j; ++i)
{
if (str==in[i])
... | true |
3d1dadd9d0af03fa79a16d27eff17bd8387bdd48 | C++ | cooperyuan/attila | /src/trace/D3DStadistics/StatsUtils.h | UTF-8 | 26,959 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef STATS_UTILS_H
#define STATS_UTILS_H
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#ifndef WIN32
#include <function.h>
#endif
namespace workloadStats
{
/***************************************************************************************************... | true |
24e281f601c30dfb47bf3806790a53ba8a247104 | C++ | Newspaperman57/Particlesystem | /sources/DVector2.cpp | UTF-8 | 229 | 2.515625 | 3 | [] | no_license | #include "DVector2.h"
DVector2::DVector2() {
}
DVector2::DVector2(double X, double Y) {
this->X = X;
this->Y = Y;
}
DVector2::~DVector2() {
}
Vector2 DVector2::ToVector2() {
return Vector2((int)(X+0.5), (int)(Y+0.5));
}
| true |
f167802ff284d2c86babe99e49f6743ada93580a | C++ | ErnestSzczepaniak/rfs | /test/test_flash_bitmap.cpp | UTF-8 | 2,015 | 3.375 | 3 | [] | no_license | #include "test.h"
#include "flash_bitmap.h"
#include "string.h"
TEST_CASE("size assertion")
{
Flash_bitmap<8> bitmap_8;
Flash_bitmap<16> bitmap_16;
Flash_bitmap<24> bitmap_24;
Flash_bitmap<32> bitmap_32;
Flash_bitmap<64> bitmap_64;
REQUIRE(sizeof(bitmap_8) == 1);
REQUIRE(sizeof(bitmap_16) ... | true |
1a4f136f18ef2647adaf461fdcc2ed325de7be5c | C++ | AliShahrose/Circuit_Simulator | /Battery.cc | UTF-8 | 295 | 2.640625 | 3 | [] | no_license | #include "Component.h"
#include "Battery.h"
Battery::Battery(std::string nm, double v, Connection& p, Connection& n) : Component(nm, p, n), voltage{v} {}
void Battery::simulate(double& t)
{
positive.value = voltage;
negative.value = 0.0;
}
double Battery::current()
{
return 0;
} | true |
0c37a68261ed26c6c255a05235cfd9da4baea240 | C++ | vityok/code-snippets | /fuzzbizz/cxx/fuzzbizz.cpp | UTF-8 | 2,190 | 3.078125 | 3 | [] | no_license | // -*- c-default-style: "linux"; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
#include <iostream>
#include <sstream>
const int ITER = 100;
const int MAX_NUM = 10000;
void fuzzbizz_inc(std::ostream& os, const int lim)
{
os << "inc" << std::endl;
os << "1" << std::endl;
if (lim < 2) { return; ... | true |
2d33a5065c3dcd488f791bc3625f27b76dba474b | C++ | weiyy/ss | /json/ListNode.h | GB18030 | 3,095 | 3.734375 | 4 | [] | no_license | #pragma once
// ݽṹ
typedef struct tagNode
{
tagNode()
{
prev=0;
next=0;
value=0;
}
tagNode* prev;
tagNode* next;
void* value;
}Node, *PNode;
class ListNode
{
public:
ListNode()
{
head=0;
tail=0;
}
~ListNode(){}
// ȡͷڵ
PNode GetHead()
{
return head;
... | true |