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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12f9c50368f3acf2ec9f0e23d4b3ec14afeef3cf | C++ | aleruirod/hpc | /Solution.h | UTF-8 | 2,307 | 3.4375 | 3 | [] | no_license | #ifndef SOLUTION_H
#define SOLUTION_H
#include <vector> // we will use the standard vector library provided by the C++ language.
#include <iostream>
/**
* The Solution class is the base for
* \n all other methods used as they all share
* \n some common characteristics.
*
*/
class Solution {
public:
// CONSTRUC... | true |
6a8e54c3c775c4ac812347bb89e9f5e9d687e77f | C++ | mchoi0320/CSCE121H_IntroToProgram | /histogram.cpp | UTF-8 | 2,625 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
int main(int argc, char** argv)
{
ifstream input;
input.open(argv[1]);
int numBins = atoi(argv[2]);
while (numBins <= 0) {
cout << "Please re-enter a positive value for the number ... | true |
95961d2103739ca45b02fc983187337c31c6f85a | C++ | Kartikay123/Competitive-Programming-Question | /friend2.cpp | UTF-8 | 865 | 3.578125 | 4 | [] | no_license | #include"Kartikay.h"
class c2;
class c1{
int val1;
friend void exchange(c1 &,c2 &);
public:
void indata(int a){
val1 = a;
}
void display(){
cout<<val1<<endl;
}
};
class c2{
int val2;
friend void exchange(c1 &,c2 &);
public:
void indata(int a){
val2 =a;
}
void display(){
... | true |
366d1c3b96bb9519036d8d3b9a67d189a96a8206 | C++ | haileykim1/Algorithm-Problem | /백준/C++/2580_스도쿠.cpp | UTF-8 | 1,012 | 2.765625 | 3 | [] | no_license | #include<iostream>
#include<memory.h>
#include<queue>
using namespace std;
int map[9][9];
bool row[9][10];
bool col[9][10];
bool sqr[9][10];
void DFS(int cnt) {
int x = cnt / 9;
int y = cnt % 9;
if (cnt == 81) {
for (int i = 0; i < 9; ++i) {
for (int j = 0; j < 9; ++j) {
cout << map[i][j] << " ";
}
... | true |
4cc3070ce6e8f042c04dd7273bebe553b0a997c7 | C++ | lovesunmoonlight/leetcode-solutions | /leetcode2/leetcode2.cpp | GB18030 | 1,736 | 3.625 | 4 | [] | no_license | // leetcode2.cpp : ̨Ӧóڵ㡣
// ģ
#include "stdafx.h"
#include <iostream>
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode... | true |
5594b1d9c8033555dc23bb4c2f06007ee7763068 | C++ | anr6921/ggp-game-engine | /ggp-engine/LightManager.cpp | UTF-8 | 5,475 | 2.921875 | 3 | [] | no_license | #include "stdafx.h"
#include "LightManager.h"
using namespace DirectX;
LightManager* LightManager::instance = nullptr;
LightManager* LightManager::GetInstance() {
if (instance == nullptr) {
instance = new LightManager();
}
return instance;
}
void LightManager::ReleaseInstance() {
if (instance != nullptr) {
... | true |
b5a45e089b7d3c92028910aac08dfbe7d27c646d | C++ | HossamAshraf10/Battle | /CIE205Project_Code_S2021/Castle/SuperSoliders.cpp | UTF-8 | 4,859 | 2.765625 | 3 | [] | no_license | #include "SuperSoliders.h"
#include <iostream>
using namespace std;
//Constructor
superSoliders::superSoliders()
{
this->distance = 0; this->power = 0; this->arrTime = 0; this->reloadTime = 0; this->speed = 0; this->health = maxHealth; this->ID = 0;
}
superSoliders::superSoliders(int ID, int power, int arrTime, int ... | true |
ad90ba5d4919c72babc9b9d86fa7c9fbbac9bff8 | C++ | yellowzunzhi/PAT | /Advance/1011.cpp | UTF-8 | 456 | 2.84375 | 3 | [] | no_license | #include<stdio.h>
int main (void)
{
float MAX[5]={0.0},temp[5];
char SELECT[5],SELECTS[4] = {' ','W','T','L'};
float total;
for (int i = 1;i <= 3 ;i++)
{
scanf("%f%f%f",&temp[1],&temp[2],&temp[3]);
for (int j = 1;j <= 3 ;j++)
{
if (MAX[i] < temp[j])
{
MAX[i] = temp[j];
SELECT[i] = SELECTS[j];
... | true |
3ae16646b85e32f2fce6653acd08d7e3283915bf | C++ | RaoKarter/microbenches | /threads.cpp | UTF-8 | 2,898 | 2.640625 | 3 | [] | no_license | #include "threads.h"
using namespace std;
int main(int argc, char * argv[])
{
int NUM_THREADS;
if(argc < 2)
{
cout << "Usage: threads NUM_THREADS " << endl;
exit(0);
}
NUM_THREADS = atoi(argv[1]);
int i, j, k;
vector<int> iter;
s_var **p_str;
p_str = new s_var* [NUM_THREADS];
iter.resize(NUM_THREADS)... | true |
d39826aff76e9578028285768d05ba97c7d94857 | C++ | jasonCarruthers/De-Casteljau-Algorithm-And-Bezier-Curves | /Curves.cpp | UTF-8 | 29,333 | 2.53125 | 3 | [] | no_license | #include <vector>
#include "Main.h"
#include "MyMath.h"
#include "Line.h"
#include "Curves.h"
#include "GUI.h"
#include "Graph.h"
#include "Tree.h"
/*
*Global variables
*/
int curveIndex;
std::vector<Curve*> curveVec;
unsigned int curveResolution;
float splitT;
bool isUsingBernstein;
bool controlPoi... | true |
3a2d70e784351204fa17624129010d44781204ac | C++ | Muneebdw/DSproject | /Keystree.h | UTF-8 | 4,706 | 3.0625 | 3 | [] | no_license | #include<iostream>
#include<cmath>
#include<cstdio>
#include <string>
#include<cstdlib>
#include <sys/stat.h>
#include <iomanip>
#include <fstream>
#include <time.h>
using namespace std;
string char_arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
short int system_bits=4;
short int number_of_Ports=1;
short int number_of_Hubs=1;
s... | true |
3d34242ad92983ffd9bc68a9f5be0bdb6abebf1f | C++ | PTReturns/Source | /Server/FieldTable.cpp | UTF-8 | 2,091 | 2.53125 | 3 | [] | no_license | #include "stdafx.h"
#include "FieldTable.h"
#include "SQLApi.h"
void CFieldTable::BuildFields( )
{
int nMaps = 0;
SQLBuffer Maps;
SecureZeroMemory( ( void* )0x0075B038, 0x3AA00 );
if( SQL->Select( Maps, "SELECT * FROM ServerDB.dbo.Maps" ) )
{
nMaps = Maps.size( ) - 1;
if( nMaps > MAX_TOTAL_FIELD )
nMaps = ... | true |
0674e1e035814f5809639ab0602a8d46f429de4b | C++ | ngangwar962/C_and_Cpp_Programs | /june_27_string_dp/delete_consecutive_vowels.cpp | UTF-8 | 606 | 2.5625 | 3 | [] | no_license | #include<iostream>
#include<bits/stdc++.h>
#include<unordered_set>
using namespace std;
int main()
{
unordered_set<char> s;
s.insert('a');
s.insert('e');
s.insert('i');
s.insert('o');
s.insert('u');
int i,j,k,l;
string str;
getline(cin,str);
//cout<<str<<"\n";
int len=str.length();
//cout<<len<<"\n";
if(le... | true |
b13df053ee7144cee7b3370b212399f98086b788 | C++ | fabiohsm2008/3er-Semestre | /Algebra Abstracta/RSA/main.cpp | UTF-8 | 1,769 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include "RSA.h"
using namespace std;
int rdtsc() ///rand de ciclos utilizados por procesador desde el inicio
{
__asm__ __volatile__("rdtsc");
}
int main()
{
srand(rdtsc());
cout << "RSA Cifrado y Descifrado" << endl;
cout << "1: Imprimir claves" ... | true |
fb39e5bd2834e8149bb39aa4ce9bf1e03a2d9ece | C++ | KamalAfiqMN/MCTE4342-Embedded-System-Design | /Week 4 GPIO/Example 8/Exercise_8.ino | UTF-8 | 550 | 2.703125 | 3 | [] | no_license | #include <ezButton.h>
int total_A, total_B;
ezButton A(7);
ezButton B(8);
void setup()
{
Serial.begin(9600);
A.setDebounceTime(100);
B.setDebounceTime(100);
}
void loop()
{
A.loop();
B.loop();
if (A.isPressed())
{
total_A++;
print();
}
else if (B.isPress... | true |
47a61250d353b701972d8d4805a6893eaa405528 | C++ | intelfx/pulse-dispatcher | /sources/soundfile.cpp | UTF-8 | 2,026 | 2.5625 | 3 | [] | no_license | #include "soundfile.h"
#include <common.h>
#include <limits>
namespace {
const double DEFAULT_THRESHOLD_LOW = 0.4,
DEFAULT_THRESHOLD_HIGH = 1;
const long DEFAULT_PULSE_MSEC = 30;
} // anonymous namespace
SoundFileSource::SoundFileSource (const options_map_t& options)
: FrequencySource (options)
, fi... | true |
222f0a572346f258819eef48a64811a22d728cce | C++ | hyfung/Arduino_Libaries | /HS420391/HS420391.h | UTF-8 | 1,143 | 3 | 3 | [] | no_license | #ifndef HS422391_h
#define HS422391_h
#include "Arduino.h"
/*
Library used to drive 4-digit seven segment
Common Anode
HS420391 sevenSeg;
*/
class HS420391{
public:
void setDigit(int x[]);
void setSegment(int x[]);
void writeNumber(int Number);
private:
unsigned char _Segment[7];
unsign... | true |
bded901694cfc25f85bd3dd58172e727805bc451 | C++ | jacekzema/Sterownik | /src/Sypialnia.cpp | UTF-8 | 681 | 2.828125 | 3 | [] | no_license | #include "Sypialnia.h"
Sypialnia::Sypialnia(string n, float t, float c, float w)
{
cout << "Podaj nazwe sypialni: " << endl;
cin >> n;
name = n;
temperatura = t;
cisnienie = c;
wilgotnosc = w;
cout << "Stworzono sypialnie: " << name << endl;
obiekty.push_back(new Czujnik(name,temperatura,cisnienie,wilg... | true |
205999cf271d5244872739b4458e4ab1447bbac4 | C++ | RogueProfile/RogueProject | /src/gl/BoundBufferObject.h | UTF-8 | 4,037 | 2.921875 | 3 | [] | no_license | #ifndef GL_BOUNDBUFFEROBJECT_H__
#define GL_BOUNDBUFFEROBJECT_H__
#include <vector>
#include <array>
#include <cstdint>
#include "Flags.h"
#include "TargetLock.h"
#include "BufferObject.h"
#include "MappedBufferObject.h"
#include "Enums.h"
namespace gl
{
class GlContext;
class BoundBufferObject
{
public:
Bound... | true |
e90428431243d18a5714d0da9e8e462ba0c1ebc8 | C++ | ljianhui/TaskManager | /core/systeminfo.h | UTF-8 | 1,387 | 2.765625 | 3 | [] | no_license | #ifndef _SYSTEMINFO_H
#define _SYSTEMINFO_H
#include <string>
#include <vector>
class SystemInfo
{
public:
virtual void update() = 0;
virtual std::string toString()const = 0;
virtual std::string toString(const std::vector<char> &filter)const = 0;
virtual ~SystemInfo();
protected: // data
const static std:... | true |
74bcb230ed991a7eecb24c6bdf0b7a5c5840d6df | C++ | TheWorldOfCode/Introduction-to-robotics-exercise-1 | /src/position.cpp | UTF-8 | 602 | 3.1875 | 3 | [] | no_license | #include "../includes/position.hpp"
position::position(int position_x, int position_y, cv::Vec3b Color)
{
x = position_x;
y = position_y;
color = Color;
}
bool position::at_position(int x_r, int y_r)
{
return x == x_r && y == y_r;
}
void position::draw_position_on_map(map2D & map)
{
map.draw_circle(... | true |
9ad07c94f695a48349f8b50d03eb161562f734f7 | C++ | TheMarsupialMole/Laboration3 | /Laboration3/fiterator.cpp | UTF-8 | 1,241 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include "String.h"
//constructor that takes a char pointer
fiterator::fiterator(char* string) {
currentposition = string;
}
//constructor that takes an iterator
fiterator::fiterator(const fiterator& ptrin) {
*this = ptrin;
}
fiterator::~fiterator(){
}
//increase pointer by onePOST
fiterator ... | true |
6f3c43cedf5f5c08ef59dd60ac5631f5b62b1e40 | C++ | samcragg/Autocrat | /src/Autocrat.Bootstrap/include/locks.h | UTF-8 | 1,405 | 3.5625 | 4 | [
"MIT"
] | permissive | #ifndef LOCKS_H
#define LOCKS_H
#include <atomic>
#include <cstdint>
namespace autocrat
{
/**
* Represents a light-weight lock over a resource.
* @remarks This class provides mutual exclusion facility and can be locked
* recursively by the same thread.
*/
class exclusive_lock
{
public:
/**
* In... | true |
3c7039d34dabb1fa4755baa61bc2f37c700220f4 | C++ | eglide/bdlib | /src/Array.h | UTF-8 | 10,545 | 2.6875 | 3 | [
"BSD-2-Clause"
] | permissive | /*
* Copyright (c) 2006-2014, Bryan Drewery <bryan@shatow.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* noti... | true |
c659a2f1635c2383db1eb69dcbec5043b7a79407 | C++ | kursatyurt/HS_Panel_Solver | /src/Point.cpp | UTF-8 | 280 | 3.0625 | 3 | [] | no_license | #include "Point.hpp"
Point::Point() : x(0.0), y(0.0) {}
Point::Point(double a, double b) : x(a), y(b) {}
void Point::changeDelta(double dx, double dy)
{
this->x += dx;
this->y += dy;
}
void Point::setValues(double xn, double yn)
{
this->x = xn;
this->y = yn;
}
| true |
7900e11c1bb99a0d3f9428edea760068dc41e1bf | C++ | Gustice/ESP32Tutorial | /SimpleTemplate/components/CppModule/include/cppModule.h | UTF-8 | 156 | 2.609375 | 3 | [
"MIT"
] | permissive |
#pragma once
class Module
{
public:
Module(int init = 0);
~Module(){};
void AddValue(int v);
int GetValue();
private:
int value;
};
| true |
9cf2d144daa84e02d96086e7ea27026065dcd247 | C++ | denniskb/merge_fusion | /KinectFission/kifi/cuda/device_allocator.h | UTF-8 | 980 | 2.65625 | 3 | [] | no_license | #pragma once
#include <cstddef>
#include <memory>
namespace kifi {
namespace cuda {
template< typename T >
class device_allocator : public std::allocator< T >
{
public:
pointer allocate( std::size_t n, const_pointer hint = 0 );
void deallocate( pointer p, std::size_t n );
};
}} // namespace
... | true |
f5a8e12c305a7768e9d5e93b52f50df9b80ec672 | C++ | anvv5/httpServ | /core/FileRead.cpp | UTF-8 | 979 | 2.5625 | 3 | [] | no_license | //
// Created by Talla Chicken on 5/21/21.
//
#include "FileRead.h"
#include "SendFile.h"
FileRead::FileRead(int fd, char *buf, size_t buf_capacity, const ClientSocket &clientSocket)
:
_fd(fd),
buf(buf),
buf_size(0),
buf_capacity(buf_capacity),
_isDeleted(false),
_clientSocket(clientSocket)
{}... | true |
3c372018c8e2a3522b7b8c8501b8c1fb04a1d28d | C++ | lkrizan/ECF_deep_learning | /DeepModelTraining/ConfigParser.h | UTF-8 | 2,046 | 2.578125 | 3 | [
"MIT"
] | permissive | #include <vector>
#include <fstream>
#include <boost/tokenizer.hpp>
#include <common/Shape.h>
class ConfigParser
{
private:
std::vector<std::pair<std::string, std::vector<std::vector<int>>>> m_LayerConfiguration;
std::vector<unsigned int> m_InputShape;
std::vector<unsigned int> m_OutputShape;
std::vector<std... | true |
765052ed10b6d62b9cb8c62fc3554e9949150bc3 | C++ | fishybell/ATIatm | /open_embedded_stable_ati/oe_at91sam/recipes/ati/files/modules/fasit/process.h | UTF-8 | 1,239 | 3.03125 | 3 | [
"MIT"
] | permissive | #ifndef _PROCESS_H_
#define _PROCESS_H_
#include <stdio.h>
#include "connection.h"
using namespace std;
// a minimal wrapper around Connection to allow for handling a process pipe rather than a socket
class Process : public Connection {
public:
Process(FILE *pipe); // a new process always starts with a file stre... | true |
60bb47b9a99dfa50dcb727f9f7233b554c430ec5 | C++ | fassad1001/triples- | /Ontology.h | UTF-8 | 1,934 | 2.546875 | 3 | [] | no_license | #ifndef ONTOLOGY_H
#define ONTOLOGY_H
#include <QtCore>
#include "TripleStorage.h"
#include "Class.h"
class MyHash : public QHash< QString, QString >
{
public:
MyHash& insertInc(const QString key, const QString value)
{
insert(key, value);
return *this;
}
MyHash& insertIncMulti(const QStr... | true |
8e3bd9f87876e6bdeb156f58d5a2c2c643a36018 | C++ | jrubix/Pub-ProjectsCPP131 | /EPP-Practice/Header2.h | UTF-8 | 1,695 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
class Booking {
private:
string firstname;
string lastname;
string pclass;
vector<Booking> myvec;
vector<Booking> boardingorder;
public:
void checkin(string _firstname, string _lastname, string _pclass);
void printorder();
Bookin... | true |
dab0cc746ef6773019c41ed746f4350c14880b91 | C++ | madcato/StreamLib | /include/ProtectedFIFO.h | UTF-8 | 2,696 | 3.046875 | 3 | [] | no_license | // ProtectedFIFO.h: interface for the ProtectedFIFO class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_PROTECTEDFIFO_H__52F473E7_EBAD_4612_AFF2_853A8F55CAA9__INCLUDED_)
#define AFX_PROTECTEDFIFO_H__52F473E7_EBAD_4612_AFF2_853A8F55CAA9__INCLUDED_
#if _MSC_VER > 100... | true |
3fe6dc7f06cbaa5788a4dd72b29750394f99af1a | C++ | en30/online-judge | /atcoder/past201912_k.cpp | UTF-8 | 584 | 2.71875 | 3 | [] | no_license | #include <bits/stdc++.h>
#include "../include/template"
#include "../include/lca.hpp"
int N, Q;
vector<int> p;
vector<vector<int>> G;
int main() {
cin >> N;
p.resize(N);
G.resize(N);
int root;
rep(i, N) {
cin >> p[i];
if (p[i] == -1) {
root = i;
continue;
}
--p[i];
G[i].push... | true |
28499a844f8704694f3ae15fd4c4005e8e7babe8 | C++ | y-shindoh/coding_interview | /c_02/q_02.03.cpp | UTF-8 | 1,617 | 3.4375 | 3 | [] | no_license | /* -*- coding: utf-8; tab-width: 4 -*- */
/**
* @file q_02.03.cpp
* @brief 「世界で闘うプログラミング力を鍛える150問」の問題2.3の回答
* @author Yasutaka SHINDOH / 新堂 安孝
* @note see http://www.amazon.co.jp/dp/4839942390 .
*/
/*
問題:
単方向連結リストにおいて、中央の要素のみアクセス可能であるとします。
その要素を削除するアルゴリズムを実装してください。
*/
#include <cstddef>
#include <cassert>... | true |
595fd564436d5d1df0683e0478915d6d0c3cb0dd | C++ | Hearen/AlgorithmHackers | /SheYi/2015-12-11-week2/Longest-Substring-Without-Repeating-Characters.cpp | UTF-8 | 1,055 | 3.390625 | 3 | [] | no_license | #include<iostream>
#include<set>
using namespace std;
class Solution {
public:
int lengthOfLongestSubstring(string s) {
if(s.length()==0) return 0;
int head=0; //count start point
int maxLength=1; //the current max lenght of substring
int count=1; //cout for a certain substring
set<char> charSet; //se... | true |
f698c788ada9831a85116899593e1008f5941466 | C++ | carrardt/Fleye | /plugins/PanTiltFollowerAdHoc.cc | UTF-8 | 3,671 | 2.5625 | 3 | [] | no_license | #include "fleye/plugin.h"
#include "fleye/FleyeContext.h"
#include "fleye/vec2f.h"
#include "services/PanTiltService.h"
#include "services/TrackingService.h"
#include "services/TextService.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <assert.h>
#define _USE_MATH_DEFINES
#... | true |
55fc6ad102f7e779ba730908d633f05ef4c0af85 | C++ | ChaeLinYeo/BAEKJOON | /11441.cpp | UTF-8 | 814 | 3.015625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main (){
cin.tie(NULL);
int N; //첫째 줄에 수의 개수 N이 주어진다. (1 ≤ N ≤ 100,000)
int A[100000]; //둘째 줄에는 A1, A2, ..., AN이 주어진다. (-1,000 ≤ Ai ≤ 1,000)
int M; //셋째 줄에는 구간의 개수 M이 주어진다. (1 ≤ M ≤ 100,000)
int i, j; //넷째 줄부터 M개의 줄에는 각 구간을 나타내는 i와 j가 주어진다. (1 ≤ i ≤... | true |
12a446ce654f72b9b4405545f2a07456fea75cd2 | C++ | LukeLookS/All-sortings-algorithm | /Sorting/Counting.h | UTF-8 | 1,133 | 3.0625 | 3 | [] | no_license | /////////////////////////////////////////////////////////////////////
// Counting.h //
// //
// Mengjie Shi, CSE674 //
// SUID: 457056896 ... | true |
9d54f9ae6d6756fbc6dc74b8a7f7425d3af623ce | C++ | WheretIB/nullc | /NULLC/includes/error.cpp | UTF-8 | 1,657 | 2.6875 | 3 | [
"MIT"
] | permissive | #include "error.h"
#include "../../NULLC/nullc.h"
#include "../../NULLC/nullbind.h"
#include "../../NULLC/nullc_debug.h"
namespace NULLCError
{
void throw_0(NULLCArray message)
{
nullcThrowError("%.*s", message.len, message.ptr);
}
void throw_1(NULLCRef exception)
{
nullcThrowErrorObject(exception);
}
bo... | true |
f41be52407f918af653f3066ed0e4a9f5a37537f | C++ | vodelerk/locha-mesh-app | /Turpial/general_utils.cpp | UTF-8 | 9,225 | 3.296875 | 3 | [
"MIT"
] | permissive | /**
* @file general_utils.cpp
* @author locha.io project developers (dev@locha.io)
* @brief
* @version 0.1
* @date 2019-04-24
*
* @copyright Copyright (c) 2019 locha.io project developers
* @license MIT license, see LICENSE file for details
*
*/
#include <Arduino.h>
#include "general_utils.h"
// compare... | true |
d19d14ec06a088bca2bf162477f8def038ef5a0d | C++ | ldiez/GWNSyM | /modules/utilities/Distance.cpp | UTF-8 | 449 | 2.640625 | 3 | [] | no_license | #include "Distance.h"
Distance::Distance(units::m d) : m_km(units::To<units::km>::Do(d))
{
}
Distance::Distance(units::km d) : m_km(d)
{
}
double
Distance::GetM(void) const
{
return units::To<units::m>::Do(m_km).RawVal();
}
double
Distance::GetKm(void) const
{
return m_km.RawVal();
}
units::m
Distance::Get... | true |
215f0a5499ca2bed5e2becff90f2a5c373e0ef62 | C++ | Ckins/c-sicily | /07cs_2015-12-18/6.cpp | UTF-8 | 1,982 | 2.734375 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
int n, m, ans;
int g[7][7];
int MAX(int a, int b)
{
if(a > b)
return a;
return b;
}
void dfs(int x, int y, int cnt)
{
if(x >= n)//表示已经搜索完毕
{
ans = MAX(ans,cnt);
return;
}
if(y >= m)//列出界,表示当前行已经搜索完毕
{
dfs(x+1,0,cnt);//重新从下一... | true |
7db144807a28d4c7abc47b87958a85ca005ef066 | C++ | RoiTanGene/mrustc | /tools/backend_c/codegen.cpp | UTF-8 | 8,274 | 2.6875 | 3 | [
"MIT"
] | permissive | /*
*/
#include "codegen.hpp"
Codegen_C::Codegen_C(const char* outfile):
m_of(outfile)
{
}
Codegen_C::~Codegen_C()
{
}
void Codegen_C::emit_type_proto(const HIR::TypeRef& ty)
{
TRACE_FUNCTION_R(ty, ty);
}
void Codegen_C::emit_static_proto(const RcString& name, const Static& s)
{
TRACE_FUNCTION_R(name, na... | true |
67a955c78d626021a57cb7a7a38756dcc5676ec2 | C++ | ShareTheWorld/algorithms | /LeetCode/letter_combinations_phone_number.cpp | UTF-8 | 1,860 | 3.5 | 4 | [] | no_license | /*
* author: luo feng
* date: 2013/11/20
* source: LeetCode OJ
* title: Letter Combinations of a Phone Number
* language: C++
*/
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iterator>
using namespace std;
class Solution {
public:
vector<string> letterCombinations(string d... | true |
82d67504fda1fa8a8ba2b18d114926c2764111ea | C++ | gdmsl/bwsl | /templates/template.test.cpp | UTF-8 | 2,467 | 3.09375 | 3 | [] | no_license | //===-- FooTest.cpp --------------------------------------------*- C++ -*-===//
//
// BeagleWarlord's Support Library
//
// Copyright 2016-2022 Guido Masella. All Rights Reserved.
// See LICENSE file for details
//
//===---------------------------------------------------------------------===//
///... | true |
0323f01d2dbe3e04def78944d0bd278eff5ba313 | C++ | ewodac/PortaDrop | /include/StatusLed.h | UTF-8 | 2,318 | 3.078125 | 3 | [] | no_license | #pragma once
/**
* @file StatusLed.h
*
* @class StatusLed
* @author Nils Bosbach
* @date 04.08.2019
* @brief used to control the status LED, which are connected to a shift register via the atmega32
*/
#include "Uc_Connection.h"
#include <memory>
#include <chrono>
#include <bitset>
class StatusLed{
public:
... | true |
43be623f47bf6888b5fdb56b0d421ad5972736d8 | C++ | ferconde87/Programming-contests | /guide-to-competitive-programming/02 programming-techniques/bit-manipulation/representing-sets.cpp | UTF-8 | 3,807 | 3.71875 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define cn(x) cout << #x << " = " << x << endl;
#define xn(x) cout << #x << " = ";
//prints 10 less significative bits
void printBits(int num){
for(int i = 6; i >= 0; i--){
cout << ((num & (1 << i))!=0);
}
cout << endl;
}
int set_union(int x, int y){
retur... | true |
8c854a5d6c9e361ceaf6e05cff4cd0936d499974 | C++ | yoongoing/Algorithm | /~2019/1247_c++.cpp | UTF-8 | 636 | 2.75 | 3 | [] | no_license | #include <stdio.h>
#include <algorithm>
using namespace std;
int main(){
for(int i=0; i<3; i++){
long long int data[1000000] = {0};
int a;
scanf("%d",&a);
long long int sum = 0;
for(int j=0; j<a; j++){
scanf("%lld",&data[j]);
}
sort(data,data+a);
if(data[0] > 0){
printf("+\n");
continue;
... | true |
31cd4daf0bf10d457dcddbf6faa5f290a5a1a2f2 | C++ | comradesurendra/cpp-ds-algo | /tree/BFStrav.cpp | UTF-8 | 711 | 3.40625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int data){
this->data = data;
left=right=NULL;
}
};
//Levelorder
void Levelorder(Node *root){
if(root==NULL){
return;
}
queue<Node *> q;
q.push(root);
whil... | true |
65dc73dfca54f0a0bb6cbf785c12acc36e5b25da | C++ | k-a-z-u/KLib | /math/filter/particles/estimation/ParticleFilterEstimationRegionalWeightedAverage.h | UTF-8 | 1,914 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | #ifndef K_MATH_FILTER_PARTICLES_PARTICLEFILTERESTIMATIONREGIONALWEIGHTEDAVERAGE_H
#define K_MATH_FILTER_PARTICLES_PARTICLEFILTERESTIMATIONREGIONALWEIGHTEDAVERAGE_H
#include "ParticleFilterEstimation.h"
#include "../Particle.h"
#include "../ParticleAssertions.h"
#include <algorithm>
namespace K {
/**
* this imple... | true |
909e476cd17c4543b9ace0342dac399feaf92d77 | C++ | paercebal/Kizuko | /paercebal/KizukoLib/clusters/AltitudeLine.cpp | UTF-8 | 5,346 | 2.828125 | 3 | [
"MIT"
] | permissive | #include <paercebal/KizukoLib/clusters/AltitudeLine.hpp>
#include <paercebal/KizukoLib/utilities.hpp>
#include <SFML/Graphics.hpp>
#include <memory>
#include <string>
#include <cmath>
namespace paercebal::KizukoLib::clusters
{
namespace {
const sf::Color PositiveAltitudeColor{ 0, 128, 0, 255 };
const sf::Color Neg... | true |
fc40cc68227ce8f1ced8433aec0b4de61ffaeb72 | C++ | HenriqueIII/learning-cpp | /Capitulo 2/exercicios/ex2714.cpp | UTF-8 | 553 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int main(){
float x1, x2;
int a, b, c;
cout << "Insira os coeficientes da equacao de 2 grau(a b c): " << endl;
cin >> a >> b >> c;
x1 = (-b+(sqrt((b*b)-4*a*c)))/(2*a);
x2 = (-b-(sqrt((b*b)-4*a*c)))/(2*a);
if (x2>x1){
floa... | true |
a0e2aae2064519aef621e4b00395a852d668a4ac | C++ | famo7/music_program | /include/Queue.h | UTF-8 | 997 | 3.21875 | 3 | [] | no_license | // Filename: Queue.h
// Written by: Farhan Mohamed
// Created date: 03/01/2020
// Last modified: 03/08/2020
/* Description: Header file containing the class definition for Queue class
* class that handles queue of songs.
*/
#include "Song.h"
#include <cstddef>
#include <iostream>
#include <iomanip>
using std::co... | true |
0ca42e5bec543ddb8f9b0284a0f5c7968764b6f8 | C++ | zhangweiooy/C-Language-learning | /FF的肉饼.cpp | UTF-8 | 833 | 2.71875 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define PI 3.14159265
long long r[10005];
long long s[10005];
long long ans=0;
int m,n;
int judge(long long k)
{
int count=0;
for (int i=0;i<n;i++)
count+=s[i]/k;
if (count>=m) return 1;
return 0;
}
void binsearch(long long left,long long right)
{
l... | true |
9f13f1488854455283dbe0a19659408f120b4fc0 | C++ | Hi10086/CR22-2 | /MFC/20160405课堂代码和作业/ChatClient2/ChatServer/SSocket.cpp | GB18030 | 2,817 | 2.953125 | 3 | [] | no_license | #include "stdafx.h"
#include "SSocket.h"
int TEMPSIZE = 255;
CSSocket::CSSocket(void)
{
m_socket = -1;
m_sock_type = 0;
}
CSSocket::~CSSocket(void)
{
if (m_socket != -1)
{
closesocket(m_socket);
}
}
int CSSocket::TcpSocket(sockaddr addr)
{
//
m_socket = ::socket(AF_INET, SOCK... | true |
2e5eeb2adf7102d01d3e3fc02ac9a947d24d582e | C++ | MicekP/Biblioteka | /Biblioteka/Aktorzy.h | UTF-8 | 1,374 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include "Karta.h"
#ifndef Aktorzyh
#define Aktorzyh
using namespace std;
class Osoba
{
private:
public:
string Imie;
string Nazwisko;
string GetImie()
{
return Imie;
}
string GetNazwisko()
{
return Nazwisko;
}
};
class Czytelnik : public Osoba
{... | true |
a75b832bd0185f9fe9fa7a6064ffee7185b9f6b8 | C++ | nackata/ss_ecs | /entity.h | UTF-8 | 680 | 2.609375 | 3 | [] | no_license | #ifndef ENTITY_H
#define ENTITY_H
#include "component.h"
#include "componentmanager.h"
#include "TypeCounter.h"
#include <array>
template<class T, size_t type_count>
class Entity
{
protected:
// replace method to entityManager
bool validateEntity() const
{
for (const auto & a : types)
{
... | true |
9c06c87512d0e9ac56d8e18b96b0b0d2b477dd67 | C++ | kunalpratapsingh13/C-CPP-Programs---2 | /ch-1(5).cpp | UTF-8 | 548 | 2.984375 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
//clrscr();
int main()
{
int l,b,rad,ar,pr;
float pi=3.14,ac,cc;
printf("\nENTER THE LENGTH OF RECTANGLE:");
scanf("%d",&l);
printf("\nENTER THE BREADTH OF RECTANGLE:");
scanf("%d",&b);
printf("\nENTER RADIUS OF CIRCLE:");
scanf("%d",&rad);
ar=l*b;
pr=2*(l+b);... | true |
1f34fa1e94efcd83b79d008b9d19be15d388c2ff | C++ | Scoder15/CS-note | /code/75. Sort Colors.cpp | UTF-8 | 413 | 2.546875 | 3 | [] | no_license | class Solution {
public:
void sortColors(vector<int>& nums) {
int n = nums.size();
int a[3] = {0};
for(int i = 0; i < n ; i++)
{
a[nums[i]]++;
}
int j;
for(j = 0; j < a[0]; j++)
nums[j] = 0;
for(j = a[0]; j < a[1] + a[0]; j++)
... | true |
38a38a5d08ded37fde6e9bdeb67bb442bda8d9c1 | C++ | ZigorSK/Technology_of_prog2 | /Stack.cpp | WINDOWS-1251 | 4,158 | 3.734375 | 4 | [] | no_license | #include "Stack.h"
Stack::Stack()
{
hight_stack_ptr = nullptr;
}
Stack::Stack(int d = 0)
{
float dat;
hight_stack_ptr = nullptr;
for (int i = 0; i < d; i++)
{
cout << " , " << endl;
cin >> dat;
this->push(dat);
}
}
Stack::Stack(const Stack &obg)
{
hight_stack_ptr = nullptr... | true |
7f231492f83a8c33399a2ece6e76a797ed3271ec | C++ | goku321/code | /cc/shknum.cpp | UTF-8 | 1,272 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef unsigned long ul;
typedef long long ll;
int countSetBits(ul num) {
int count = 0;
while(num) {
count += num & 1;
num >>= 1;
}
return count;
}
int main() {
int t;
cin >> t;
... | true |
69fa60ce663924d7b42664c897f7e4e3c142d703 | C++ | AnikDas-Stack/Codeforces-Problem-Solution | /519B. A and B and Compilation Errors.cpp | UTF-8 | 532 | 2.671875 | 3 | [] | no_license | #include <stdio.h>
int main()
{
long long int n, sum1=0, sum2=0, sum3=0;
scanf("%lld", &n);
long long int ara1[n], ara2[n-1], ara3[n-2];
for(int i=0; i<n; i++)
{
scanf("%lld", &ara1[i]);
sum1+=ara1[i];
}
for(int i=0; i<n-1; i++)
{
scanf("%lld", &ara... | true |
f0efa8cc6a049351853791baabcb560dd53ddd0c | C++ | SheSnake/code-jamp-solution | /code-jam-2018/round_a/edgy_baking.cpp | UTF-8 | 2,467 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
// view analysis: try each interval and for each new interval cut off the invalid
struct Interval
{
double l;
double r;
Interval(double l = 0, double r = 0): l(l), r(r) {}
};
int compare... | true |
7c57ef882eabe791869b3495c1c7547f97c7e6cb | C++ | mwthinker/CppSdl2 | /src/sdl/texture.h | UTF-8 | 2,328 | 2.640625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #ifndef CPPSDL2_SDL_TEXTURE_H
#define CPPSDL2_SDL_TEXTURE_H
#include "opengl.h"
#include "rect.h"
#include "surface.h"
#include <spdlog/spdlog.h>
#include <type_traits>
namespace sdl {
class Texture {
public:
friend class TextureAtlas;
Texture() = default;
~Texture();
Texture(const Texture& texture) = ... | true |
5ed00ee37e6dc0a87a6bdb9f7a9565fca1b7c518 | C++ | ankushgarg1998/Competitive_Coding | /college-labs/Information Security Lab/caesar_cipher.cpp | UTF-8 | 609 | 3.359375 | 3 | [] | no_license | #include<bits/stdc++.h>
#define loop(i, a, b) for(int i=a; i<b; i++)
using namespace std;
string caesar_cipher(string text, int shift) {
string cipher = "";
loop(i, 0, text.size()) {
int ch = text[i] - 'A';
ch = (ch + shift) % 26;
if(ch < 0)
ch += 26;
cipher += char(... | true |
01961f05c300eb6c7fdaed08a942a0e1e5abdb3f | C++ | LuhMoonShy/Lista-07-Algoritmos-e-programacao | /Lista 07/Exercicio 09 Lista 10.cpp | ISO-8859-1 | 917 | 3.234375 | 3 | [] | no_license | //Faa um algoritmo que leia a idade de at 100 pessoas e apresente a mdia entre todas, alm de
//identificar a mais velha e a posio em que ela se encontra no vetor. A idade mais velha pode aparecer em
//mais de uma posio.
#include <stdio.h>
#include <locale.h>
int main(){
setlocale(LC_ALL, "Portuguese");
int i, ... | true |
d21e62ddbabda38e90dd00b209bf432279738123 | C++ | HDarko/CPP-Projects | /BlackJack/Headers/Card.h | UTF-8 | 1,091 | 3.640625 | 4 | [] | no_license | #pragma once
#include <iostream>
//Declaration of the Card class
enum class Suit
//Hearts, Clubs, Spades, Diamonds in that order
{
HEARTS,
CLUBS,
SPADES,
DIAMONDS
};
enum class Rank
{
//Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten
//| Jack | Queen | King | Ace
//We treat A... | true |
1e8c5c44bf8584c7bd40f6536d30807dfc81247c | C++ | 15831944/Fdo_SuperMap | /源代码/Thirdparty/UGC/inc/Geometry/UGGeoRect.h | GB18030 | 12,664 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #ifndef INCLUDE_GEOMETRY_UGGEORECT_H_HEADER_INCLUDED_BE220BE3
#define INCLUDE_GEOMETRY_UGGEORECT_H_HEADER_INCLUDED_BE220BE3
#include "UGGeoRect.h"
#include "UGGeometry.h"
namespace UGC {
//! \brief (б)
//! \remarks ڲݽṹĵ/θ߶/ο/תǶȹ
//! ·ʽε״: һηŵʵλ(ĵ/߶/),
//! ȻʱתεĽǶ, õ״
class GEOMETRY_API UGGeoRect : public UGGeometry
{... | true |
a3ebdba5318147b4b929fec3d8dfa22295d79a25 | C++ | 9hack/net-sandbox | /trash/game_server.cpp | UTF-8 | 3,754 | 2.953125 | 3 | [] | no_license | #include "threadsafe_queue.h"
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/bimap.hpp>
#include <boost/thread.hpp>
#include <string>
#include <array>
#define PORT 9000
using boost::asio::ip::tcp;
typedef boost::bimap<int, tcp::endpoint> ClientList;
typedef ClientList::value_type Client;
type... | true |
0cf24a9e49774b553af398a3a02e5bb2c40aa448 | C++ | apatank2/Algorithms | /Algorithms in C++/OBST/obst.cpp | UTF-8 | 3,910 | 2.890625 | 3 | [] | no_license | // Name of program obst.cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
float mat[100][100];
int index2[100][100];
int v[100];
int count = 0;
int t,tmax = -1;
//creates an array of obst tr... | true |
3215db48c932cee849daba636acc9e396c11f50a | C++ | DMHACYJ/work1 | /gcd,lcm.cpp | UTF-8 | 566 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include<cstring>
using namespace std;
const int maxn=100;
long long int gcd(int a,int b)
{
return b==0?a:gcd(b,a%b);
}
long long int lcm(int a,int b)
{
return (a/gcd(a,b))*b;
}
int a[maxn];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
memset(a,0,siz... | true |
acd568af31292d0e09f6e676980f4bc93f329506 | C++ | jihoonn/Alt | /JMH/숙제1.cpp | UHC | 472 | 3.359375 | 3 | [] | no_license | #include <stdio.h>
int main(void)
{
int num;
printf("90 ̻ 40 ̸ Է: ");
scanf("%d", &num);
switch(num)
{
case (80.0<90.0):
printf("A \n");
break;
case 80:
printf("B \n");
break;
case 70:
printf("C \n");
break;
case 60:
printf("D \n");
break;
case 5:
printf("E \... | true |
360138c8bc017fa91ed822cf8591ddf576840324 | C++ | mohansella/simple-kvstore | /source/lib/src/mohansella/kvstore/StoreValue.cpp | UTF-8 | 3,220 | 3.21875 | 3 | [
"MIT"
] | permissive | #include <mohansella/kvstore/StoreValue.hpp>
#include <memory>
namespace mohansella::kvstore
{
StoreValue::StoreValue()
{
this->valueType = StoreValue::Type::Unknown;
}
StoreValue::StoreValue(std::int64_t value)
{
this->valueType = StoreValue::Type::Integer;
this->sizeVa... | true |
2aa9490eb7f3be725f1c07257e1f3fc8ee09e12c | C++ | rock4on/Atm | /Atm.h | UTF-8 | 663 | 2.9375 | 3 | [] | no_license | #pragma once
#include <map>
#include "Bill.h"
using std::map;
class Atm
{
public:
Atm() = default;
Atm(map<Bill::bill, int> bills) : num_of_Bills(bills) { recalculate_ballance(); };
int recalculate_ballance();
Atm* add_Bill(Bill::bill b, int quantity);
float get_balance();
float extract(float sum);
... | true |
91b6b38d5dd4a0f7e70c793843b8050ba8a210db | C++ | bfMendonca/SFND_Lidar_Obstacle_Detection | /src/quiz/cluster/kdtree.h | UTF-8 | 2,740 | 3.71875 | 4 | [] | no_license | /* \author Aaron Brown */
// Quiz on implementing kd tree
#include "../../render/render.h"
// Structure to represent node of kd tree
struct Node
{
std::vector<float> point;
int id;
Node* left;
Node* right;
int depth;
Node(std::vector<float> arr, int setId, int _depth = 0 )
: point(arr), id(setId), left(NULL... | true |
417226351baceefb1e36e7dd10b5d3af9a61b7de | C++ | bin3/balgo | /src/balgo/container/min_queue.h | UTF-8 | 1,710 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright (c) 2013 Binson Zhang.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache Licens... | true |
3aeffc1506dcaf2bef48f62c8c815e488f3c7940 | C++ | diantaowang/cocoding | /963_min_area_free_rect.cc | UTF-8 | 1,867 | 2.78125 | 3 | [] | no_license | #include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <tuple>
#include <queue>
#include <stack>
#include <unordered_map>
using namespace::std;
class Solution {
public:
double minAreaFreeRect(vector<vector<int>>& points) {
int n... | true |
7d4000ed4d7ac7f2b385c99851891c7b6c201353 | C++ | iflei/Data_Structure | /Hash _Bucket/HashTable.h | GB18030 | 6,381 | 3.40625 | 3 | [] | no_license | #include <vector>
using namespace std;
//
template <typename K>
struct HashFunc
{
size_t operator()(const K& key)
{
return key;
}
};
//ػstring
template <>
struct HashFunc<string>
{
static size_t BKDRHash(const char* str)
{
unsigned int seed = 131;
unsigned int hash = 0;
while (*str)
{
hash = hash * ... | true |
d9996637eab48c016a804402db286959a12026fd | C++ | wzj1988tv/code-imitator | /data/dataset_2017/dataset_2017_8_formatted/OKuang/3264486_5654742835396608_OKuang.cpp | UTF-8 | 1,615 | 2.609375 | 3 | [] | no_license | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
const int maxn = 1010;
class CNode {
public:
int len, l, r;
CNode() {}
CNode(int _len, int _l, int _r) : len(_len), l(_l), r(_r) {}
bool operator<(const CNode &b) const {
if (len != b.len)
retu... | true |
0471fc202e9acddeee0f9923ad2d1c206ae79e13 | C++ | Ediolot/IA-Coche | /include/scene.hpp | UTF-8 | 1,849 | 2.625 | 3 | [
"MIT"
] | permissive | #ifndef SCENE_HPP
#define SCENE_HPP
#include <allegro5/allegro.h>
#include "common.hpp"
#include "map.hpp"
#include "button.hpp"
#include "scrollbar.hpp"
#include "selector.hpp"
#include "numericSelector.hpp"
class scene {
const double default_animation_time_ = 0.2;
public: // Thread sync
ALLEGRO_MU... | true |
701e42d9b9a24f30f8471f7d67d10b8f22ceb6f3 | C++ | claudiahwong/cs184-an-eh-sp10 | /rayTracer/Color.h | UTF-8 | 2,218 | 3.609375 | 4 | [] | no_license | #pragma once
class Color
{
public:
/* Members */
float r, g, b;
/* Constructors */
Color(void);
Color(float red, float green, float blue);
~Color(void);
/* Methods */
void setEqual(Color dest);
/* Operators */
const Color operator+(const Color &c1) {
Color result = Color(c1.r + this-... | true |
4c72187afc742b35908c9125013b7c42da0f5161 | C++ | rayjan0114/python_call_c_cxx_demo2 | /cxxFunc.cpp | UTF-8 | 899 | 2.859375 | 3 | [] | no_license | /*========================================================
這是關於 python ctypes call C/C++ opencv 的範例
會先從 python BGR uint8 numpy (H,W,3) <----> C++ cv::Mat
======================================*/
#include <cstdlib>
#include <iostream>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc/types_c.h>
#includ... | true |
2b467c1bd32c4ba65ea16de42fb6e2ec53be4433 | C++ | Bdegraaf1234/AdventOfCode-019 | /AdventOfCodeLib/Tile.h | UTF-8 | 678 | 2.6875 | 3 | [] | no_license | #pragma once
#ifdef ADVENTOFCODELIB_EXPORTS
#define ADVENTOFCODELIB_API __declspec(dllexport)
#else
#define ADVENTOFCODELIB_API __declspec(dllimport)
#endif
using namespace::std;
#include <string>
#include <vector>
#include <map>
class ADVENTOFCODELIB_API Tile
{
public:
int X;
int Y;
char Id;
Tile(int tileInstru... | true |
5f7c9b5b9575b8a1389e0f936be492a086348413 | C++ | Hwanghoseon/algorithm_test | /1032.cpp | UTF-8 | 512 | 2.828125 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
const int MAX = 50;
int n;
string st[MAX];
void input() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> st[i];
}
void compare() {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < st[0].size(); j++) {
if (st[i][j] != st[i + 1][j])
st[i + 1]... | true |
52c3e8aded4aeba9137191707931f265c2d81a0c | C++ | SweepFlaw/demo | /demodata/wrongCode1.cpp | UTF-8 | 608 | 2.546875 | 3 | [
"MIT"
] | permissive | // codeforces 1204B - 59154860
// human solve time: 582s
#include <bits/stdc++.h>
using namespace std;
const int N = 1234;
int a[N], b[N];
int n, l, r;
int main() {
scanf("%d %d %d", &n, &l, &r);
for (int i = 0; i < n; i++)
a[i] = b[i] = 1;
int mt = 2;
for (int i = 0; i < l - 1; i++) {
a[i] = mt;... | true |
9f49f219639abbc50fb62eda31ffd4c9d72d027b | C++ | SamiKhan-cse19/borgo-sample | /PingPong/PingPong.cpp | UTF-8 | 14,088 | 2.75 | 3 | [] | no_license | #include "PingPong.h"
void PingPong::handlePlayerCollision(bool isPlayerLeft)
{
std::pair<int, int> pb = ball.getTopLeftPos();
if (isPlayerLeft) {
std::pair<int, int> pl = playerL.getTopLeftPos();
switch (pb.second - pl.second) {
case -2:
case -1:
case 0:
bal... | true |
b94dc82b1aa9acb312cbd3afe6f7a4d65e60040b | C++ | ThePhysicsGuys/Physics3D | /application/picker/selection.cpp | UTF-8 | 6,791 | 2.640625 | 3 | [
"MIT"
] | permissive | #include "core.h"
#include "selection.h"
#include "application.h"
#include "view/screen.h"
#include "ecs/components.h"
namespace P3D::Application {
void Selection::recalculateSelection() {
this->boundingBox = std::nullopt;
for (auto entity : this->selection)
expandSelection(entity);
}
void Selection::expa... | true |
729f8365fe3f323a422cde4bff11c7a71199a99a | C++ | KROIA/Projekte | /Intervalometer/Versionen/1.3.0/Intervalometer.h | ISO-8859-1 | 2,440 | 2.53125 | 3 | [] | no_license | #ifndef INTERVALOMETER_H
#define INTERVALOMETER_H
#include "Arduino.h"
#include "button.h"
#include "led.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
enum modes
{
IntervallSetzen = 0,
HelligkeitSetzen = 1,
AufnahmezeitSetzen = 2,
Kontrolle1 = 3,
Running1 = 4,
Abschlussinfo1 = 5,
Haup... | true |
359b571dd30f1682825338bbaf143f9e12ccc30d | C++ | SHS-GROUP/NEO-DFT | /libcchem/src/cc/symmetrize.hpp | UTF-8 | 4,181 | 2.546875 | 3 | [] | no_license | #ifndef CC_SYMMETRIZE_HPP
#define CC_SYMMETRIZE_HPP
#include <boost/multi_array/multi_array_ref.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/mpl/vector_c.hpp>
#include "cc/tensor.hpp"
namespace cchem {
namespace cc {
namespace detail {
template<typename S>
... | true |
49bc084fb040e5e1c39ec5046888d93b4fb40c64 | C++ | Vinc33/CoursJeux | /Projet1/Hero.cpp | UTF-8 | 305 | 2.546875 | 3 | [] | no_license | #include "Hero.h"
#include "InputManager.h"
Hero::Hero(string unitName, short playerID, short baseDamage, short maxHP) : Character (unitName, baseDamage, maxHP)
{
this->playerID = playerID;
}
Hero::~Hero()
{
}
bool Hero::getKeyState(INPUT key)
{
return InputManager::getKeyState(playerID, key);
}
| true |
1b2ce9b214105c21883c210acafcab569156ff8d | C++ | isaacroberts/BroodwarAI | /Ref.cpp | UTF-8 | 2,496 | 2.515625 | 3 | [] | no_license | #include "Ref.h"
#include "Util.h"
int Ref::updateAmt =0;
bool Ref::hasSoldiers=true;
std::vector<Class*> Ref::clas=std::vector<Class*>();
Ref::Ref()
{
}
void Ref::onStart()
{
std::set<Player*> player=Broodwar->getPlayers();
bool terran=false,zerg=false;
for (std::set<Player*>::iterator ply=playe... | true |
f1c192ca3747908adf6e1972606fd1aaa5674b2a | C++ | LiBingtao/prictice-for-pat | /prictice/1016. 部分A+B.cpp | UTF-8 | 433 | 2.59375 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main()
{
string a, b;
char da, db;
int at = 0, bt = 0;
cin >> a >> da >> b >> db;
for (int i = 0; i < (int)a.length(); i++) {
if (a[i] == da) {
at = at * 10 + (int)(da-'0');
}
}
for (int i = 0; i < (int)b.length(); i++) {
if (b[i] == db) {
... | true |
dc767421c47060db9a060ab95f224f16fd371f90 | C++ | Senryoku/NESen | /src/tools/log.hpp | UTF-8 | 2,828 | 2.9375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <array>
#include <chrono>
#include <deque>
#include <functional>
#include <iostream>
#include <sstream>
namespace Log {
using Color = const char*;
const Color Black = "\033[0;30m";
const Color Red = "\033[0;31m";
const Color Green = "\033[0;32m";
const Color Brown = "\033[0;33m";
const Color Blu... | true |
2f9cb6490587aa16b4c2e72370ebe30ee205f218 | C++ | aleafall/DS-A | /offer/verifySquenceOfBST.cpp | UTF-8 | 733 | 3.1875 | 3 | [] | no_license | //
// Created by aleafall on 17-2-17.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool judge(const vector<int> &vi,int left,int right){
if (left >= right) {
return 1;
}
int middle = left;
while (middle < right && vi[middle] < vi[right]) {
++middle;
}
for ... | true |
9379fdb1aa0f039d6c4e8897bccf6079094c7317 | C++ | MohitMotiani99/Leetcode | /1344.cpp | UTF-8 | 293 | 2.828125 | 3 | [] | no_license | class Solution {
public:
double angleClock(int hour, int minutes) {
double h=hour;
double m=minutes;
if(h==12)
h=0;
double total=h*60+m;
double ha=total*0.5;
double ma=m*6;
return min(abs(ha-ma),360-abs(ha-ma));
}
};
| true |
3973bf7d8dbe3b7e04cff2a9c9094b52a24bc0a6 | C++ | ruitaocc/RcEngine | /RcEngine/RcEngine/Core/Timer.h | UTF-8 | 912 | 2.578125 | 3 | [] | no_license | #ifndef Timer_h__
#define Timer_h__
#include <Core/Prerequisites.h>
namespace RcEngine {
class _ApiExport SystemClock
{
public:
static void InitClock();
static void ShutClock();
static uint64_t Now();
static inline double ToSeconds(uint64_t timeCounts) { return timeCounts * SecondsPerCount; }
private:
static ... | true |
3bb08bc52b50524137fc4a8dba0cc97026878202 | C++ | neu-velocity/code-camp-debut | /codes/Garnetwzy/46.cpp | UTF-8 | 749 | 3.015625 | 3 | [] | no_license | class Solution {
public:
vector<vector<int>> permute(vector<int>& nums) {
vector<vector<int>> ret;
vector<bool> visit(nums.size(), false);
vector<int> cur = {};
dfs(ret, visit, cur, nums);
return ret;
}
void dfs(vector<vector<int>>& ret, vector<bool>& visit, vect... | true |
2b583960b6540aca902dd2eccd3e8ad9c4647248 | C++ | luispadron/Decaf-Lang | /code-gen/tac.cc | UTF-8 | 6,229 | 2.765625 | 3 | [
"MIT"
] | permissive | /* File: tac.cc
* ------------
* Implementation of Location class and Instruction class/subclasses.
*/
#include "tac.h"
#include "mips.h"
#include <string.h>
#include <deque>
Location::Location(Segment s, int o, const char *name) :
variableName(strdup(name)), segment(s), offset(o){}
void Instruction::Pri... | true |
eb665216b0c2dd5f8f72bf88bb14bd5784d7b452 | C++ | ArjunAranetaCodes/MoreCodes-CPlusPlus | /Loops/problem10.cpp | UTF-8 | 432 | 3.84375 | 4 | [] | no_license | //Problem 10: Write a program to check whether a given
//number is an armstrong number or not.
#include<iostream>
using namespace std;
int main(){
int num = 371;
int sum = 0;
int temp = 0;
int rmdr = 0;
temp = num;
while (temp != 0){
rmdr = temp % 10;
sum = sum + (rmdr * rmdr * rmdr);
temp = temp / 10;
... | true |