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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27a23f98cf757a167fc720f123aca255c7c3a4bd | C++ | CuiZhiying/ACM | /COJ/coj1550(AC).cpp | GB18030 | 2,020 | 2.96875 | 3 | [] | no_license | // A[I]<N A[I]=N A[I]>N
//B[I]<N C[I]<=A+B C[I]<=A+B C[I]<=N+B
//B[I]=N C[I]<=A+B C[I]<=A+B C[I]<=B+N
//B[I]>N C[I]<=A+N C[I]<=A+N C[I]<=N+N
//⣬ǾͿг9жcеijַǷ
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
... | true |
fe5cb4a4d7cdf37cff2a2ea9422374f4d7b2bb00 | C++ | constantinevi6/SAD | /Sentinel_Auto_Downloader/include/txtfile.hpp | UTF-8 | 1,160 | 2.71875 | 3 | [] | no_license | //
// txtfile.hpp
// ASPS
//
// Created by Constantine VI on 2021/8/24.
// Copyright © 2021 CSRSR. All rights reserved.
//
#ifndef txtfile_h
#define txtfile_h
#include <vector>
#include <string>
#include <filesystem>
class txtFile
{
private:
std::filesystem::path pathFile;
std::vector<std::string> TXTCon... | true |
4cf081084a3097bdcc78d24e81376c439eec9425 | C++ | pzfok/MoonLib | /gtest/src/CppCurlTest.cpp | UTF-8 | 1,120 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <thread>
#include "gtest/gtest.h"
#include <CppCurl.h>
#include <CppLog.h>
static CppLog cppLog;
using namespace std;
TEST(CppCurl, GetUrlEncodeTest)
{
// EXPECT_EQ("123465asd", CppCurl::GetUrlEncode("123465asd"));
// EXPECT_EQ("%E9%97%AE", CppCurl::GetUrlEncode("问"));
... | true |
a3ed2b230848900c3e5be2e8bea6a7ee3e1325cc | C++ | h3nok/MLIntro | /Notebooks/viAI.Runtime/viAI.Runtime/Common.h | UTF-8 | 318 | 2.75 | 3 | [] | no_license | #pragma once
#include <filesystem>
#include <fstream>
#include <string>
namespace fs = std::filesystem;
bool file_exists(const std::string &path, fs::file_status s = fs::file_status{})
{
const fs::path p = fs::path(path);
if (fs::status_known(s) ? fs::exists(s) : fs::exists(p))
return true;
return false;
}
| true |
1f10e54b51ea3dafd3ce34df4f8301400f63195f | C++ | larous25/testC | /basico/structs.cpp | UTF-8 | 1,614 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
const int CERO = 0;
//la structura deportes es similar a un diccionario
//de datos o una columna en un db
//son similares a las clases (solo que todo es de tipo publico)
//tienen propiedades, constructores
struct deportes{
string nombre... | true |
ff2a34a22c93596ab66a4a611575f214f41f0688 | C++ | utsavmajhi/CP | /Algorithms/test.cpp | UTF-8 | 447 | 2.890625 | 3 | [] | no_license |
#include <iostream>
#include <algorithm>
using namespace std;
void solve(){
int n;
int a[n];
int b[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
cin>>b[i];
}
int monk=INT32_MIN;
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(b[j]>=a[i]){
monk=max(j-i,monk);
}
}
}
if(monk==... | true |
c5dc7446b1a9804acf91bf14c0e951ff43a1eda5 | C++ | gparkerc/ESP_Time_Date_Clock | /henry_date_clock_lcd_esp8266.ino | UTF-8 | 3,015 | 2.9375 | 3 | [
"MIT"
] | permissive |
/********************************/
// include the library code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ESP8266WiFi.h>
#include "TimeDateClient.h"
/**********************************************************/
//char array1[]=" SunFounder "; //the string to print on the LCD
//char array... | true |
eb587d8036b4a52f38384ef130cdf4e422faacd2 | C++ | trinitrotoluene/binary_master | /server/server/src/sreg.cpp | UTF-8 | 1,266 | 2.625 | 3 | [] | no_license | /*
* This implementation is re-used from my last arduino coursework submission.
* Patrick Michallet & Daniel Morris, 2019
* https://github.bath.ac.uk/cm10194-cw1-prm45-dm986/arduino-code/blob/master/game/src/sreg.cpp
*/
#include "sreg.hpp"
#include <Arduino.h>
SReg::SReg(int data_pin, int latch_pin, int ... | true |
be8bd10f97cb796f8bf37ec1564262486f6f2589 | C++ | FreeTax/exercise-C- | /ex1/main.cpp | UTF-8 | 216 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include "Contatore.h"
using N1::Contatore;
using namespace std;
int main() {
Contatore *c1= new Contatore();
for (int i=0; i<10; i++)
c1->adder();
cout<<c1->get_counter();
}
| true |
73406376b2e3be913800403cec8d821f5ba922bc | C++ | AaronGrissomCU/Homework7 | /HashTable::getTotalNumberNonStopWords.cpp | UTF-8 | 378 | 2.765625 | 3 | [] | no_license | int HashTable::getTotalNumberNonStopWords()
{
wordItem* scout = nullptr;
int numNonStopWords = 0;
for (int c = 0; c < STOPWORD_LIST_SIZE; c++)
{
scout = hashTable[c];
while (scout != nullptr)
{
numNonStopWords += scout->count;
scout = scout->... | true |
4e12072de2a51e85a10227308e66cb8932d283a1 | C++ | anuwu/Competitive-Programming | /InterviewBit/Math/Prime_Numbers.cpp | UTF-8 | 481 | 2.703125 | 3 | [] | no_license | vector<int> Solution::sieve(int N)
{
int i, p, st ;
vector<bool> arr(N , false) ;
vector<int> ans ;
p = 2 ;
st = p*p ;
while (st <= N)
{
while (st <= N)
{
arr[st - 1] = true ;
st += p ;
}
do p++ ; while (arr[p - 1]) ;
... | true |
28fee7b983b93eee1ef8c893de41aabdc468fdc7 | C++ | LucasPauloOP/AED | /revisao_de_prog2_ex4.cpp | UTF-8 | 738 | 3.3125 | 3 | [] | no_license | /*4)Ler a dist�ncia percorrida e o tempo gasto. Escrever LENTO, NORMAL e R�PIDO,
caso a velocidade m�dia est� abaixo de 60km/h, entre 60 e 100, ou acima de 100 km/h. Dica:
para calcular a velocidade deve-se fazer "dist�ncia/tempo". V=d/t.*/
#include<stdio.h>
#include<stdlib.h>
#include<locale.h>
int main()
{
setlo... | true |
a39880a87a5a9ad94a2425900f1020356c96bb99 | C++ | Invadoge/UP2019 | /exercises/07 - Pointers and References/algorithm.h | UTF-8 | 4,781 | 3.671875 | 4 | [] | no_license | #include <iostream>
#pragma once
void swap(int& a, int& b)
{
int c = a;
a = b;
b = c;
}
void iter_swap(int* a, int* b)
{
swap(*a, *b);
}
void print(const int* begin, const int* end)
{
for (; begin != end; ++begin)
{
std::cout << *begin << ' ';
}
std::cout << '\n';
}
void re... | true |
a05ff8b84951b7ed50f5211f3af2814c0d4f34c4 | C++ | 2myungho/algorithm_training | /Programmers/lv2/12985_binary/answer.cpp | UTF-8 | 610 | 3.515625 | 4 | [] | no_license | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int solution(int n, int a, int b) {
int answer = 0;
while (a != b) {
answer += 1;
a = (a + 1) / 2;
b = (b + 1) / 2;
}
return answer;
}
struct TestCase {
int N;
int A;
int B;
int answer;
};
... | true |
a7584b34dc5121cdb23c231a726aa83f52337e04 | C++ | thereisnoposible/Shared | /hh/hh/Event.cpp | UTF-8 | 1,258 | 2.609375 | 3 | [] | no_license | #include "Event.h"
namespace ZeroSpace
{
CEvent::~CEvent()
{
m_handlers.Clear();
}
void CEvent::AddHandler(EventHandlerPtr pHandler)
{
m_handlers.Insert(pHandler->GetEventID(), pHandler);
}
void CEvent::RemoveHandler(EventIDType id)
{
m_handlers.Erase(id);
}
CEventRetuirnBase& CEvent::Trigger(CEvent... | true |
98970241bbe24fab67e40b0e15e206adaf128027 | C++ | imran458/HunterCS | /CSCI335/Assignment5ImranSabur/FindPaths.cpp | UTF-8 | 1,301 | 3.625 | 4 | [] | no_license | /*
-Imran Sabur
- December 11, 2019
-
*/
#include <iostream>
using namespace std;
#include <string>
#include <sstream>
#include <fstream>
#include "Graph.h"
int main(int argc, char **argv){
if (argc != 3)
{
cout << "Usage: " << argv[0] <<" <GRAPH_FILE> <STARTING_VERTEX>" << endl;
return 0;
}
const ... | true |
194d6045a7c342ac3fe8901b0bc3eb1b931f6ea9 | C++ | KarolStola/DragonframeWithOpti | /DragonframeOptiWrapper.cpp | UTF-8 | 3,448 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <Opti.h>
#include <DragonframeMotionController.h>
#include <MemberBluetoothMessageHandler.h>
#include "DragonframeOptiWrapper.h"
DragonframeOptiWrapper::DragonframeOptiWrapper(Opti & opti)
: opti(opti)
{
jogSpeeds.resize(GetNumberOfAxes(), standardSpeed);
jogStatuses.resize(GetNumberOfAxes(), fals... | true |
b3d60a5e36b004f11261ebc8c558df309157c9f3 | C++ | conorbrown327/Iteration-1 | /project/tests/vector3d_test.cc | UTF-8 | 1,505 | 3 | 3 | [] | no_license | #include "gtest/gtest.h"
#include "vector3d.h"
#include <iostream>
namespace csci3081
{
class Vector3dTest : public ::testing::Test
{
public:
virtual void SetUp()
{
v = new Vector3d();
}
protected:
Vector3d *v;
};
/***********************************************************************... | true |
e195bfb8b449244d437f6da0e51faaf6b1b76515 | C++ | Naughty-Panda/CppPreprocessing | /mylib.h | UTF-8 | 2,010 | 2.828125 | 3 | [] | no_license | #pragma once
#include <array>
#include <string>
//////////////////////////////////////////////////////////
// Macro
//////////////////////////////////////////////////////////
#define TEST_INPUT(a, b) (((b) >= 0) ? ((a) >= 0 && (a) < (b) ? true : false) : ((a) <= 0 && (a) > (b) ? true : false))
#define BOOL_TO_STR(a)... | true |
8283fccde7eb904bf0cca3b78a5d0ce413e05f2d | C++ | wagnerdgarcia/Projetos-Gerais | /Projetos de Arduino/2_Sensor_de_Linha/sketch_april21a.ino | UTF-8 | 1,122 | 2.8125 | 3 | [] | no_license | #define LinhaDD 7
#define LinhaDE 8
#define LinhaAD A0
#define LinhaAE A1
void setup() {
// put your setup code here, to run once:
pinMode(LinhaAD, INPUT);
pinMode(LinhaAE, INPUT);
pinMode(LinhaDD, INPUT);
pinMode(LinhaDE, INPUT);
Serial.begin(9600);
Serial.println("Lendo dados do Sensor...");... | true |
0e267596bc5a7d83f3a952a368f10a1fae33cc75 | C++ | markbirss/everything-nrf52840-usb-dongles | /code/simple-ble-led/backups/wifi-ble-generic02.ino | UTF-8 | 12,284 | 2.578125 | 3 | [
"MIT"
] | permissive | /*
WiFi BLE Server
A simple web server that shows the value of the analog input pins
shuts down and loads BLE to identify knone LED BLE active devices
then restarts Wifi before the page refreshes.
expects several prenamed Simple LED devices to be nearby and fresh running
This example is written for a network us... | true |
bd93c9dd0f0862690d15e996d396db9188313bf4 | C++ | 2012ankitkmr/My-works | /Practice Codes/rangezer.cpp | UTF-8 | 1,309 | 2.859375 | 3 | [] | no_license | #include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
template<class T>
inline T fastIn() {
register char c=0;
register T a=0;
bool neg=false;
while ( c<33 ) c=getchar();
while ( c>33 ) {
if ( c=='-' ) {
neg=true;
} else {
a= ( a*10 ) + ... | true |
f9831f7929e65a36677e76fde85119a57d32726b | C++ | kakachen4129/Cracking_the_code_interview | /lc/172_FactorialTrailingZeros.cpp | UTF-8 | 206 | 2.8125 | 3 | [] | no_license | class Solution {
public:
int trailingZeroes(int n) {
int cnt = 0;
long t = 5;
while (n/t > 0){
cnt += n/t;
t = t*5;
}
return cnt;
}
}; | true |
d5dcd6ac6eba4c911d711958a3f44d155a106f9a | C++ | juliiiks/vector | /vector.h | UTF-8 | 5,531 | 3.984375 | 4 | [] | no_license | #pragma once
#include "iterator.h"
template <typename T>
class Vector {
private:
// Длина
int length;
// Вместительность
int capacity;
// Динамический массив
T* mass;
public:
// конструктор с длиной
Vector(int length) {
this->length = length;
this->capa... | true |
c8dd1d57587cf0a6530e4e48f386a93b05110d28 | C++ | JDCalvert/SpaceRTS | /Engine/Shader.cpp | UTF-8 | 3,645 | 2.90625 | 3 | [] | no_license | #include "Shader.h"
#include "OpenGLContext.h"
#include <fstream>
std::unordered_map<std::string, Shader*> Shader::shaders;
Shader* Shader::getShader(std::string shaderName)
{
return shaders[shaderName];
}
void Shader::initialiseForScreenSize()
{
}
void Shader::initialiseFrame()
{
}
void Shader::bindArrayBuff... | true |
fde83695fa0979ecaaf28cb1d233ad94096df49b | C++ | tojhe/FedTree | /src/FedTree/dataset.cpp | UTF-8 | 25,575 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by liqinbin on 10/14/20.
//
#include "omp.h"
#include "FedTree/dataset.h"
#include "thrust/scan.h"
#include "thrust/execution_policy.h"
#include "FedTree/objective/objective_function.h"
void DataSet::load_group_file(string file_name) {
LOG(INFO) << "loading group info from file \"" << file_name << "\... | true |
cfc814c2b67d34048ba274b1e7e66d1f1becb8d9 | C++ | Firas-al/1dv534-C-plusplus | /Step4/Plant.h | ISO-8859-1 | 2,219 | 3.09375 | 3 | [] | no_license | /******************************************************
* File: Plant.h
* Description: This is the header for the plant item.
*
* Version: 1.0 2020-08-16, Linnuniversitetet
* Author: Vilhelm Park, Linnuniversitetet
******************************************************
* Upda... | true |
8e818de06af44227fe972c958a4fba0f374a9019 | C++ | lasttruffulaseed/general-cs-fun | /MonopolySimulator-group/CardSpace.cpp | UTF-8 | 919 | 3.015625 | 3 | [] | no_license | /*
* CardSpace.cpp
*
* benjamin.dasari
* patrick.haren
* rebaz.maroof
*
* Implementation for the board spaces representing Cardspace
*
*/
#include "CardSpace.h"
#include "Space.h"
REGISTER_CLASS(Space, CardSpace);
CardSpace::CardSpace()
{
cardType = Card::chanceDeck;
}
CardSpace::~Car... | true |
cc1827f499e489b01dd653de208a2e0bb948a73c | C++ | 218502/PAMSI | /stosListaKolejka/stos.hh | UTF-8 | 363 | 2.75 | 3 | [] | no_license | #ifndef stos_hh
#define stos_hh
#include "lista.hh"
class InterfaceStos
{
public:
virtual void push(int element)=0;
virtual int pop()=0;
virtual int size()=0;
};
class Stos : public InterfaceStos
{
int Size;
List list;
int temp;//zmienna do przechowywania zdejmowanego elementu
public:
void push(int elem... | true |
119374f92e147187709a7a902836e97e152a13b3 | C++ | BellisL/CodingInterviews | /LeastSteps2One/main.cpp | UTF-8 | 1,651 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
int leastSteps2One_1(int vNum);
int leastSteps2One_2(int vNum);
void leastStepsCore(int vNum, int vTimes, int& vMin);
void test(const char* vpTestName, int vNum, int vExpect);
int main()
{
test("Test1", 0, 0);
test("Test2", 1, 1);
test("Test3", 2, 2);
tes... | true |
35cd586ae26e904c427adda8db6a4de0ebcf2d90 | C++ | rrao002c/pxCore | /examples/KeyboardAndMouse/KeyboardAndMouse.cpp | UTF-8 | 8,089 | 2.921875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-other-permissive"
] | permissive | // Keyboard and Mouse Example CopyRight 2007-2009 John Robinson
// Demonstrates how to handle keyboard and mouse events
#include "pxCore.h"
#include "pxEventLoop.h"
#include "pxWindow.h"
#include "pxOffscreen.h"
#include <stdio.h> // for printf
pxEventLoop eventLoop;
void drawBackground(pxBuffer& b)
... | true |
eb952a52f72d5eb6ae01a9e47d2e2bfc97a527e6 | C++ | harshraj22/problem_solving | /solution/binarysearch/Shipping and Receiving.cpp | UTF-8 | 969 | 2.921875 | 3 | [] | no_license | // https://binarysearch.com/problems/Shipping-and-Receiving
#define all(x) x.begin(), x.end()
int solve(vector<vector<int>>& ports, vector<vector<int>>& shipments) {
const int inf = 1e7;
int n = ports.size();
vector<vector<int>> dist(n, vector<int>(n, inf));
// initialize the dist
for (int i = 0... | true |
d8cf37f1e06343df2b7530564d818f4b5c0c7f9f | C++ | mmz-zmm/MyCppPrimer | /12_15.cpp | UTF-8 | 964 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <memory>
#include <string>
using namespace std;
struct destination
{
string ip;
string port;
destination(string ip_, string port_):ip(ip_),port(port_){}
};
struct connection
{
string ip;
string port;
connection(string ip_, string port_):ip(ip_),port(p... | true |
d8f89177a018e8b4a8ef42a408a7fe68ba69c4d1 | C++ | tanmaypanigrahi/tanmay | /stack Using queue.cpp | UTF-8 | 1,604 | 3.734375 | 4 | [] | no_license | #include<iostream>
using namespace std;
class node
{
public:
//data
int data;
//pointer to next node
node * next;
//constructor to make next pointer to null
Node(int value)
{
next=NULL;
value=data;
}
};
class queue
{
public:
node * front;
node * end;
queue()
{
front=NULL;
e... | true |
ab54719b09252e4b0ee1c63232ac50bfba53252c | C++ | azxca1731/nogada-algorithm | /0. 입출력/11718/main.cpp | UTF-8 | 169 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
using namespace std;
int main()
{
string buffer;
while (getline(cin, buffer))
{
cout << buffer << endl;
}
} | true |
d60b54c0e07b3975fc910f6a73ec74d7a0537f0d | C++ | smith1302/2D-Tank-Game | /Shot.h | UTF-8 | 228 | 2.5625 | 3 | [] | no_license | #pragma once
class Shot
{
public:
int x, y, velocity, angle, power, direction;
int getYForX(int x, double gravity);
int getDirection();
Shot(int x, int y, int velocity, int angle, int power);
Shot(void);
~Shot(void);
};
| true |
33b177a155dbf6b72fc7d917386a129141875434 | C++ | roq-trading/roq-api | /include/roq/cache/reference_data.hpp | UTF-8 | 4,948 | 2.59375 | 3 | [
"BSD-3-Clause",
"MIT",
"BSL-1.0",
"Apache-2.0"
] | permissive | /* Copyright (c) 2017-2023, Hans Erik Thrane */
#pragma once
#include <chrono>
#include "roq/api.hpp"
#include "roq/utils/update.hpp"
namespace roq {
namespace cache {
struct ReferenceData final {
ReferenceData() = default;
ReferenceData(ReferenceData const &) = delete;
ReferenceData(ReferenceData &&) = de... | true |
13e7155078b16c265ed18205ef2acda96777f794 | C++ | ihalton/CUED-Self-Balancing-Bike | /Big Bike/Arduino/BikeFirmware/IMU.h | UTF-8 | 2,416 | 2.640625 | 3 | [] | no_license | #ifndef IMU_H
#define IMU_H
#include <Wire.h>
#include <Arduino.h>
class IMU {
private:
void imuReadRaw(float *leanAcc, float *gx){
Wire.beginTransmission(MPU_addr);
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.endTransmission(false);
Wire.requestFrom(MP... | true |
24d2742836750ba4335fd1a984809525141a936e | C++ | dreamerweee/Algorithm | /LeetCode/MajorityElement.cpp | UTF-8 | 920 | 4.25 | 4 | [] | no_license | /*
** 给定一个大小为 n 的数组,找到其中的众数。众数是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。
*/
int MajorityElement(vector<int> &nums)
{
unordered_map<int, int> value_map;
for (auto e : nums) {
++value_map[e];
}
int cur_times = 0;
int ret_val = 0;
for (auto beg = value_map.cbegin(); beg != value_map.cend(); ++beg) {
if (beg->seco... | true |
e24ebb033e1f77294a91ebaebdbd6272a0b45f54 | C++ | missingXiong/leetcode | /Amazon/1167. Minimum Cost to Connect Sticks.cpp | UTF-8 | 275 | 2.953125 | 3 | [] | no_license |
int connectSticks(vector<int>& sticks)
{
int ans = 0;
priority_queue<int, vector<int>, greater<int>> pq(sticks.begin(), sticks.end());
while(pq.size() > 1)
{
int p = pq.top(); pq.pop();
int q = pq.top(); pq.pop();
pq.push(p + q);
ans += p + q;
}
return ans;
} | true |
388126e680695dd5c7e4653811738fda06703857 | C++ | jlopez2022/cpp_utils | /inversa1.cpp | MacCentralEurope | 2,624 | 3.4375 | 3 | [] | no_license | //Funciona fenmeno!!!
//Devuelve un valor < dimension si hay una fila que es
//multiplo de las otras. El valor devuelto es la fila correspondiente
#include <stdio.h>
#include <time.h>
class matrizc
{
public:
int inversa(double *x,double *y);
void imprimematriz(double *x,char s[256]="");
matrizc(int dim);
i... | true |
ea41a3687bdfad85ae99bdc07303511f8a1f2a38 | C++ | VaibhavSaraf/clean-strike-sahaj | /run.cpp | UTF-8 | 4,479 | 3.265625 | 3 | [] | no_license | // Clean Strike Game
#include <iostream>
#include <string> // include string library for string functions
#include "modules/play.cpp" // included manually created headers
#include "modules/carrom.cpp"
using namespace std;
// change the input.txt to input[1..3].txt for testing other testcases
#define OJ ... | true |
4d2302ccc209e3a838dc934958dab54e18df0d47 | C++ | shivangigoel1302/Interviewbit | /Sorted_Array_To_Balanced_BST.cpp | UTF-8 | 525 | 3.296875 | 3 | [] | no_license | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
TreeNode* helper(const vector<int>&A,int i,int j){
if(i > j){
return NULL;
}
int mid = (i+j)/2;
TreeNode* n ... | true |
c3c2c3d15b85bde91dbeff8151ba7100722b9034 | C++ | rambog/git | /study/c++_primer_V5/chapter9/resize.cpp | UTF-8 | 715 | 3.078125 | 3 | [] | no_license | /*======================================================================
* filename: resize.cpp
* author: rambogui
* data: 2018-12-27 10:50:33
======================================================================*/
#include <iostream>
#include <vector>
using std::vector;
using std::endl;
using s... | true |
8c1b7b7bd7c202ed9aa957484317c0b56dce5cfe | C++ | Kolbjoern/GameOfVirus | /LDCompo40/src/World.h | UTF-8 | 706 | 2.84375 | 3 | [] | no_license | #pragma once
#include <SFML\Graphics\RenderWindow.hpp>
#include <SFML\Graphics\VertexArray.hpp>
enum class TileType
{
EMPTY = 0,
GROUND = 1,
BORDER = 2,
GROUND_DESTROYED = 3,
VIRUS = 4,
VIRUS_UNIT = 5
};
class World
{
public:
World();
~World();
void init(int tileSize, int width, int height);
void draw(sf:... | true |
3ee87e87b51bd5c5fd18c767e709d98aeb16ec27 | C++ | 4less/bhm | /BHashMap.h | UTF-8 | 15,046 | 2.59375 | 3 | [] | no_license | //
// Created by joachim on 27/04/2020.
//
#ifndef BHM_BHASHMAP_H
#define BHM_BHASHMAP_H
#include <cmath>
#include "cstdint"
#include "DLList.h"
#include "KmerQueue.h"
#undef get16bits
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (... | true |
bbe0bc18535b1e9c156ddd0179e59853aa58cad8 | C++ | krylovgeorgii/threadpool | /ThreadPool/threadpool.h | UTF-8 | 1,417 | 2.890625 | 3 | [] | no_license | #pragma once
#include <queue>
#include <vector>
#include <memory>
#include <functional>
#include <thread>
#include <future>
#include <atomic>
#include <mutex>
#include <condition_variable>
namespace threadpool {
class ThreadPool {
public:
ThreadPool(size_t);
template<class Func, class... Args>
auto addTask... | true |
555f1fcca859c9b8bb4fe020426e0a88aa545e0c | C++ | qutter/080215 | /12장(인체 감지 센서)/practice_12/practice_12.ino | UTF-8 | 700 | 3.1875 | 3 | [] | no_license | #define PIR_PIN 7 //동작 감지 신호 처리 핀
void setup() {
// put your setup code here, to run once:
pinMode(PIR_PIN, INPUT); //7번 핀을 입력으로 설정
Serial.begin(9600); //시리얼 통신 초기화
}
void loop() {
// put your main code here, to run repeatedly:
int value = digitalRead(PIR_PIN); //동작 감지 신호를 value 변수에 저장
if(value == HIGH) /... | true |
0dffb349f33afc30677a964f20f494cf1f14ca86 | C++ | treque/cg | /TP3/TP3/TP3/Scene.h | UTF-8 | 4,496 | 2.75 | 3 | [] | no_license | #ifndef SCENE_H
#define SCENE_H
#include "Couleur.h"
#include "ISurface.h"
#include "Lumiere.h"
#include "MathUtils.h"
#include "Matrice4.h"
#include "Rayon.h"
#include "Singleton.h"
#include "Vecteur3.h"
#include <GL/glew.h>
#include <vector>
namespace Scene {
////////////////////////////////////////////////////////... | true |
c7505d85e544fb50c5f6d247ea5f5aab60de02ac | C++ | Minokis/self-education | /labs/part_1_Structured/4_two_dim_arrays/matrix_generator/matrix_generator.cpp | UTF-8 | 839 | 3.40625 | 3 | [] | no_license | #include "stdafx.h"
#include <fstream>
#include <iostream>
#include <string>
#include <ctime>
int main()
{
int ncol, nrow, val;
std::cout << "Welcome! Let's create a matrix.\n";
std::cout << "Values will be written to the file, separated by a whitespace (one row).\n";
std::cout << "Enter nrow (number of rows): \... | true |
4fb0fc54be3f3d2075bf931655c661f4312a17e3 | C++ | sarraff/HOTspital | /pass.cpp | UTF-8 | 901 | 2.96875 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <windows.h>
string getpass(const char *prompt, bool show_asterisk=true)
{
const char BACKSPACE=8;
const char RETURN=13;
string password;
unsigned char ch=0;
cout <<prompt<<endl;
DWORD con_mode;
DWORD dwRead;
HANDLE hIn=GetStdHandle(STD_INPUT_HANDLE);
GetConsole... | true |
3ecaad0a908b364bd46dec60d3987f80f14a5ac6 | C++ | dgquintas/libmpplas | /src/headers/Constants.h | ISO-8859-1 | 9,283 | 2.703125 | 3 | [] | no_license | /*
* $Id$
*/
#ifndef __CONSTANTS_H_
#define __CONSTANTS_H_
#include <limits>
#include <cstdlib>
#include "BasicTypedefs.h"
#include "Utils.h"
namespace mpplas{
/** Constants used throughout the library */
namespace Constants{
static const Digit DIGIT_ZERO = 0;
static const Digit DIGIT_ONE = 1;
... | true |
1e7be3d5d46bdc7f1dfc0bd1c9e9e3a12ffd6e1d | C++ | Galfurian/FixedPointNeuralNetwork | /include/fpnn/fixed_point_matrix.hpp | UTF-8 | 22,280 | 3.46875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vector>
#include <ostream>
#include <cassert>
template <typename T>
class QSMatrix
{
private:
std::vector<T> _data;
unsigned _rows;
unsigned _cols;
typedef std::initializer_list<std::initializer_list<T>> initializer_list_type_t;
public:
/// @brief Construct a new QSMatrix ... | true |
9770620a21f0b5aa693e99fcb951b27d05f9fe87 | C++ | KevinDurant77889/CPE | /guess.cpp | UTF-8 | 1,053 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int input;
string di;
vector <string> mv;
int ans[10];
memset(ans,1,10);
bool istrue = false;
while (true)
{
cin >> input;
if (input == 0)
{
break;
}
cin >> di;
if (di == "too high")
{
for (int i = 0; ... | true |
2dbc108545ab54f8af1478f96ffbce65cb5b8566 | C++ | Pangi790927/OS | /stage_3_sources/kthread/ksem.cpp | UTF-8 | 1,228 | 2.796875 | 3 | [] | no_license | #include "ksem.h"
#include "lock_guard.h"
#include "scheduler.h"
namespace kthread
{
void Sem::init (int initial) {
val = initial;
chain_head = NULL;
chain_tail = NULL;
lk.init();
}
void Sem::signal() {
std::lock_guard<Lock> guard(lk);
val++;
if (chain_tail) {
/* unblock val threads from the block... | true |
540bed7d00c84083eb16d4d5f5023f94209f35a3 | C++ | Raj-Bapat/usaco | /claust2/claust2.cpp | UTF-8 | 3,012 | 2.625 | 3 | [] | no_license | //
// main.cpp
// claust2
//
// Created by r on 10/1/17.
// Copyright © 2017 r. All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <vector>
#include <limits>
#include <cmath>
using namespace std;
struct podouble {
double x, y, idx;
};
double N;
double idx1 = -1,idx2 = -1;
double least... | true |
f8126c7504d578c50dddf52b92458d0c996cf24e | C++ | DerThorsten/orthos | /orthos_cpp/include/orthos_cpp/axis/plane.hxx | UTF-8 | 1,958 | 2.890625 | 3 | [] | no_license | #ifndef ORHTOS_CPP_PLANE_HXX
#define ORHTOS_CPP_PLANE_HXX
#include <string>
#include <vector>
#include <vigra/tinyvector.hxx>
namespace orthos{
class Plane{
public:
Plane(const std::string & name,
const int xAxis,
const int yAxis,
const int zAxis=-1,
... | true |
e3565515015c066ac22ebaec84f922d7bec118cd | C++ | angelsware/aw-plugin-barcode-scanner | /src/ios/aw_camera_ios.cpp | UTF-8 | 1,076 | 2.578125 | 3 | [
"MIT"
] | permissive | #include "aw_camera_ios.h"
extern "C" {
void* BarcodeScanner_create();
void BarcodeScanner_destroy(void* ptr);
void BarcodeScanner_addListener(void* ptr, long long listener);
void BarcodeScanner_removeListener(void* ptr, long long listener);
void BarcodeScanner_clearAllListeners(void* ptr);
void BarcodeScanner_s... | true |
e358b52d2b7559e23d730a0d6fd1057280fb96fd | C++ | gregzb/gfx_03_line | /src/Utils.cpp | UTF-8 | 1,735 | 3.15625 | 3 | [] | no_license | #include "Utils.hpp"
#include "Vec3.hpp"
#include <cmath>
#include <vector>
#include <algorithm>
Color::Color(){};
Color::Color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) : r(r), g(g), b(b), a(a){};
Color::Color(int r, int g, int b, int a)
{
this->r = (unsigned char)r;
this->g = (unsig... | true |
7108c910547e2f1f90d36295208ad51763a01e4d | C++ | sshockwave/Online-Judge-Solutions | /EZOJ/Contests/1320/C.cpp | UTF-8 | 1,685 | 2.671875 | 3 | [
"MIT"
] | permissive | #include <cstring>
#include <string>
using namespace std;
typedef long long lint;
class Entropy{
private:
bool odd;
int n,half;
char s[65];
inline lint rev(lint x){
lint ans=0;
for(int i=0;i<n;i++){
ans<<=1,ans|=(x&1)^1,x>>=1;
}
return ans;
}
public:
lint getM(int N){
n=N;
odd=n&1;
... | true |
1929ca92a2f1f1548e617f73826b34757b953b56 | C++ | lxj434368832/Framework | /projects/ServiceManage/CService.cpp | GB18030 | 1,121 | 2.65625 | 3 | [] | no_license | #include "CService.h"
#include "../../include/ServiceManage/IService.h"
//CServiceʵ
class ConcreteService : public IService
{
bool Start() { printf("ʼ"); return true; }
void Stop() { printf("ֹͣ"); }
};
//ʱõĽӿڣ˽ӿڲһֱʾУ
void CService::OnStart(DWORD argc, TCHAR* argv[])
{
argc; argv;
OutputDebugString(_T("CService:A... | true |
c65f3ea842dee03bb8a09a8f9ce5397f5d9c1508 | C++ | kaos8192/Nachos | /userprog/ipt.cc | UTF-8 | 1,287 | 2.71875 | 3 | [] | no_license | #include "ipt.h"
#include "machine.h"
extern int hand;
HashTable::HashTable(){
for (int i = 0; i < NumPhysPages; ++i){
// set valid flag to false
hashes[i].valid = FALSE;
}
//init the clock hand
//hand = 0;//MAYBE set init to zero?
}
void HashTable::Update(int frame, int vpn, int pid)... | true |
9cb8b6964e4e322f04b52ecc319c4cfc0e7494db | C++ | chokevin/Schedule-of-Classes | /container.cc | UTF-8 | 16,856 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "datime.h"
#include "time.h"
#include "container.h"
#include <vector>
using namespace std;
Appt :: Appt(string namae, DaTime prd){
this->appt_setName(name);
this->appt_setPeriod(period);
}
void Appt :: appt_setName(string namae){
name.assign(namae);
}
void ... | true |
d2070ed488b2745b8c65b01b6d973df8b3ca2279 | C++ | inzamamtoha/ProblemSolving_Algorithms | /Data structure/linked list/doubly linked list.cpp | UTF-8 | 3,276 | 3.875 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int Value;
struct Node *Next;
struct Node *Prev;
};
struct Node *Head=NULL, *LL, *Temp,*Tail=NULL,*pot,*pot_n,*love;
void Create_A_Node(int V)
{
Temp = (struct Node *)malloc(sizeof(struct Node));//Dynamic memory allocation
if(!Temp)
{
pr... | true |
3b03f2f6275e86ac5950e68a9abfc199d7093ff1 | C++ | Sysreqx/Cpp | /acmp.ru/acmp0633.cpp | UTF-8 | 512 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
int main()
{
std::string team, name;
std::vector<std::string> names;
std::getline(std::cin, team);
for (int i = 0; i < 3; i++)
{
std::getline(std::cin, name);
names.push_back(name);
}
std::sort(names.begin(), names.end());
std::... | true |
1f79ef40b2f4f93afe4206a040b004ef86054a1f | C++ | robertinant/emt | /src/ti/runtime/wiring/msp432e/tests/sanity/blink.cpp | UTF-8 | 484 | 2.65625 | 3 | [] | no_license | #include <Energia.h> // Energia Wiring API
int period = 1;
extern "C" void switchToRTCTimer(void);
__extern void blinkSetup(void)
{
pinMode(RED_LED, OUTPUT); // set ledPin pin as output
//switchToRTCTimer();
}
__extern void blinkLoop(void)
{
digitalWrite(RED_LED, HIGH); // set the LED on
delay(pe... | true |
5c8fba8a616e6e2da0c1e1fc7a8629815777a846 | C++ | Stason1o/2-2-SDMP-lab1- | /SDMP lab1/Source.cpp | WINDOWS-1251 | 15,393 | 2.96875 | 3 | [] | no_license |
#include <iostream>
#include <fstream>
#include <utility>
#include <string>
#include <map>
#include <cmath>
using namespace std::rel_ops;
typedef std::string string_t;
typedef std::ifstream ifstream_t;
const string_t unsorted_txt = "D:\\unsorted.txt";
const string_t sorted_txt = "D:\\sorted.txt";
const string_t... | true |
25992c1554c9079e89cc98af56ec0e8e22e65f34 | C++ | ymivanov/Interpeter | /src/Lexer.cpp | UTF-8 | 9,157 | 3.03125 | 3 | [] | no_license | #include "Lexer.h"
struct Keyword
{
TokenType type;
TFString content;
};
enum State
{
Success,
Fail,
Error
};
using FuncIdentifier = Keyword;
bool isEnd(char c)
{
return c == '\0';
}
bool isNewLine(char c)
{
return c == '\n';
}
bool isDigit(char c)
{
return c >= '0' && c <= '9';
}... | true |
a80d2a8afa5ac143cec1376c284206dfdf5a5306 | C++ | tetat/Codeforces-Problems-Sol | /Difficulty1300/1220C.cpp | UTF-8 | 766 | 2.578125 | 3 | [] | no_license | /// Problem Name: Substring Game in the Lesson
/// Problem Link: https://codeforces.com/problemset/problem/1220/C
/**
* winners never quit
**/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long Long;
const int N = 2e5;
int main()
{
ios:... | true |
9d3b36837a6dc19f2a29024043f1d6e227d6d6d9 | C++ | 6293/idocp | /src/robot/contact_status.cpp | UTF-8 | 635 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | #include "idocp/robot/contact_status.hpp"
#include <iostream>
namespace idocp {
void ContactStatus::showInfo() const {
std::cout << "----- The contact status -----" << std::endl;
std::cout << "active contacts: [";
for (int i=0; i<maxPointContacts(); ++i) {
if (isContactActive(i)) {
std::cout << i << ... | true |
9997693134eed4b41f6fc907d413bbd1d7beb127 | C++ | SSutherlandDeeBristol/computer-graphics-cw | /submission/raytracer/Source/TestModel.h | UTF-8 | 17,199 | 3.15625 | 3 | [] | no_license | #ifndef TEST_MODEL_CORNEL_BOX_H
#define TEST_MODEL_CORNEL_BOX_H
// Defines a simple test model: The Cornel Box
#include <glm/glm.hpp>
#include <vector>
#include <fstream>
#include <sstream>
using glm::vec3;
using glm::mat3;
using glm::vec4;
using glm::mat4;
using glm::distance;
using namespace std;
// Used to descr... | true |
1249b0ee724a69a21448ffe0e684ca3e2fd8b10c | C++ | arupa-loka/lrep | /datastructures/RnBTree.hpp | UTF-8 | 8,997 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | /*
1 - root is everytime black
2 - leaves are everytime black
3 - from the root each path toward the leaves includes exactly the same
number of black nodes
4 - a red node can have only black children
*/
#ifndef __RED_AND_BLACK_TREE_HPP
#define __RED_AND_BLACK_TREE_HPP
#include <cstdio>
#include <cstdlib... | true |
3b54a3012b3d056158f41d8125bab5ae7edbb674 | C++ | roxla/learningC- | /20201214/homework/homework1.cpp | UTF-8 | 1,258 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <list>
using namespace std;
class Person
{
public:
string name;
int age;
float height;
Person(string name, int age, float height)
{
this->name = name;
this->age = age;
this->height = height;
}
~Person() {}
};
void addPerson(list<Person>... | true |
4c3edc8d340c5d645eef40fb8a1c65e7b353a6e5 | C++ | NarutoVPS/CompetitiveProgramming | /CPP/[1108]Defanging_An_IP_Address[LeetCode].cpp | UTF-8 | 458 | 2.9375 | 3 | [] | no_license | // #include <bits/stdc++.h>
// using namespace std;
class Solution {
public:
string defangIPaddr(string address) {
string from {"."};
string to {"[.]"};
int pos{};
while((pos = address.find(from, pos)) != string::npos){
address.replace(pos, 1, to);
pos += to... | true |
c414c4f28a444b450b343c5546109c19ccf38f35 | C++ | Lesssnik/Labs | /3 semester/C++/2 lab/Plant.cpp | WINDOWS-1251 | 1,405 | 3.3125 | 3 | [] | no_license | #include "Plant.h"
#include "main.h"
void Plant::Show(void) // ,
{
cout << "Life time: " << Get_life_time() << '\n'; //
cout << "Stem length: " << Get_stem_length() << '\n'; //
}
// ,
void Plant::Set_life_time(double lt){_life_time = lt;}
double Plant::Get_life_time(void){return _life_time;}
vo... | true |
43d991b36fa798ae2f4f7dbfab051be0c164ee1e | C++ | sergey-s-null/LAB-03-03-Curves | /curve.cpp | UTF-8 | 16,070 | 2.828125 | 3 | [] | no_license | #include "curve.h"
#include <algorithm>
#include <QTextStream>
#include <cmath>
#include <sstream>
#include <QDebug>
//-------------|
// private |
//-------------|
using std::remove_if; using std::stringstream;
struct monom {
int deg_x, deg_y;
double coef;
};
monom readMonom(stri... | true |
be00744bc390417ffe7c3d7cf0b9ace0f63ecf30 | C++ | BBBBchan/C_CPP_ACM | /Vjudge/POJ_1004.cpp | UTF-8 | 194 | 2.578125 | 3 | [] | no_license | #include <stdio.h>
int main(int argc, char const *argv[])
{
float sum = 0.0, mon;
for(int i = 0; i < 12; i++){
scanf("%f",&mon);
sum = sum+ mon/12.0;
}
printf("$%.2f", sum);
return 0;
} | true |
cf986876264e0479face00795e516b088f7d41ee | C++ | SirBob01/Dynamo-Engine | /src/Math/Fourier.hpp | UTF-8 | 1,710 | 2.9375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <array>
#include <vector>
#include "../Log/Log.hpp"
#include "../Types.hpp"
#include "../Utils/Bits.hpp"
#include "./Complex.hpp"
namespace Dynamo::Fourier {
/**
* @brief Pre-compute the twiddle factor tables.
*
* @param inverse Forward or inverse transform table.
* @re... | true |
fb07fbf7d4100f18ce305e84fa3451c7943bface | C++ | TankOs/SFGUI | /include/SFGUI/Window.hpp | UTF-8 | 2,284 | 2.671875 | 3 | [
"Zlib",
"LicenseRef-scancode-public-domain",
"Bitstream-Vera"
] | permissive | #pragma once
#include <SFGUI/Bin.hpp>
#include <SFML/Graphics/Rect.hpp>
#include <SFML/Window/Mouse.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Vector2.hpp>
#include <memory>
namespace sfg {
/** Window.
*/
class SFGUI_API Window : public Bin {
public:
typedef std::shared_ptr<Window> Ptr; //!< S... | true |
2c595041b4fb0db5f460be2b4a6ee1ee00054303 | C++ | edhaker13/team-indecisive | /TI_Engine/ComponentFactory.cpp | UTF-8 | 2,671 | 2.578125 | 3 | [
"CC-BY-3.0",
"MIT"
] | permissive | #include "ComponentFactory.h"
#include "GameObject.h"
#include "OBJLoader.h"
#include "IResourceManager.h"
#include "Structures.h"
namespace Indecisive
{
IGameObject* ComponentFactory::MakeTestObject()
{
Vertex vertices[] =
{
{ Vector3(-1.0f, 1.0f, 0.0f), Vector3(0.333333f, 0.666667f, -0.666667f), Vector2(-1.... | true |
0a38d468260ba20d707149f315a7f8aec763eff1 | C++ | JuantAldea/clever | /src/clever/benchmark/clever_benchmarks.h | UTF-8 | 856 | 2.53125 | 3 | [] | no_license | //
// Copyright Thomas Hauth, Danilo Piparo 2012
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include <gtest/gtest.h>
#include "../clever.hpp"
TEST( clever_benchmarks, benchmark_floa... | true |
4e9be3835a231e5de52d9692ba1b62e15f3a6e2f | C++ | ssliuyi/ACMCode | /LeetCode/Set Matrix Zeroes.cpp | UTF-8 | 2,216 | 3.078125 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: Set Matrix Zeroes.cpp
*
* Description: LeetCode
*
* Version: 1.0
* Created: 03/31/2014 01:54:30 PM
* Revision: none
* Compiler: gcc
*
* Author: LiuYi (),... | true |
cf81c1f749df8dd6362a67e92ee567b466b2262e | C++ | Allexin/TrackYourTimeSimpleServer | /TrackYourTimeSimpleServer/main.cpp | UTF-8 | 997 | 2.71875 | 3 | [] | no_license | #include <QCoreApplication>
#include <QDebug>
#include "cudptofileserver.h"
int main(int argc, char *argv[])
{
QString outputFileName;
QString stateFileName;
qDebug() << "available arguments: ";
qDebug() << "-output <fileName> - CSV table output";
qDebug() << "-state <fileName> - current state of ... | true |
15a52f2930ae206e17b9686588e074861a895526 | C++ | jawwadmateen/OOP-concepts | /diamond problem.cpp | UTF-8 | 1,054 | 3.328125 | 3 | [] | no_license | #include <iostream>
using namespace std;
class book
{
private:
string name;
public:
book(string a)
{
name=a;
}
void display()
{
cout<<"Name of book is "<<name<<endl;
}
};
class genre:virtual public book
{
private:
int nop;
public:
genre(string a,int b):book(a)
{
... | true |
107dcbef4429a88ae261c66a1c137079d661a34c | C++ | Jakelyny/Algoritmos_I-II_ | /Algoritmos I/038.cpp | ISO-8859-1 | 918 | 3.65625 | 4 | [] | no_license | #include <iostream>
using namespace std;
/* Um banco conceder um crdito especial aos seus clientes, varivel com o saldo mdio no ltimo ano.
Faa um algoritmo que leia o saldo mdio de um cliente e calcule o valor do crdito de acordo com a tabela
abaixo. Mostre uma mensagem informando o saldo mdio e o valor do crdito.*/
... | true |
e3d37ac36f86182bcc20f4d99683849788eeed9b | C++ | umar-07/Competitive-Programming-questions-with-solutions | /oops_2/main.cpp | UTF-8 | 321 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Human
{
public:
int age;
Human(int age)
{
this->age=age;
}
void display()
{
cout << age << endl;
cout << "1";
cout << this->age << endl;
}
};
int main()
{
Human anil(27);
anil.display();
return 0;
}... | true |
182d88639c84e2b96f925a49b1e4dfe32a4b9b6f | C++ | yuzele/Bsortrank | /Bsortrank/源.cpp | GB18030 | 2,203 | 2.53125 | 3 | [] | no_license | #include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include<iostream>
#pragma comment(lib,"ws2_32.lib")
using namespace std;
BOOL GetIpByDomainName(char *szHost, char* szIp)
{
WSADATA wsaData;
HOSTENT *pHostEnt;
int nAdapter = 0;
struct sockaddr_in sAddr;
if (... | true |
d5c55bf85df1fb9eac966ddc40bae0ba8a5c7ea2 | C++ | Marcel129/Uklad_rownan_liniowych | /zad3-zalazek/inc/Wektor.hh | UTF-8 | 1,819 | 3.359375 | 3 | [] | no_license |
#ifndef WEKTOR_HH
#define WEKTOR_HH
#include "rozmiar.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
class Wektor
{
double tablica[ROZMIAR];
public:
Wektor(){};
Wektor(double moja_tab[])
{
for (int i = 0; i < ROZMIAR; i++)
tablica[i] = moja_tab[i];
}
const doubl... | true |
82b955174e1db691cad80d904675da9fbf9dd725 | C++ | ajmd17/apex-engine | /ApexEngineV2/math/vector4.h | UTF-8 | 2,514 | 3.015625 | 3 | [
"MIT"
] | permissive | #ifndef VECTOR4_H
#define VECTOR4_H
#include <cmath>
#include <iostream>
#include "matrix4.h"
namespace apex {
class Vector3;
class Vector4 {
friend std::ostream &operator<<(std::ostream &out, const Vector4 &vec);
public:
float x, y, z, w;
Vector4();
Vector4(float x, float y, float z, float w);
... | true |
da9c6bb8254c1436960fed85427143aef1731e80 | C++ | mattdude2489/Time-Warrior | /Team BMP/SDL_SplashScreen.h | UTF-8 | 1,498 | 2.734375 | 3 | [] | no_license | #ifndef _SDL_SPLASHSCREEN_H_
#define _SDL_SPLASHSCREEN_H_
#include "Global.h"
#include "SDL_Resource.h"
#include "SDL_Sprite.h"
#include "sdl\SDL.h"
#include <assert.h>
class SDL_SplashScreen : public SDL_Resource {
protected:
/** x coordinate to draw the splash screen to, centered for screen surface ... | true |
e63a7ff5a1ab978a183cd25e1589ccc481c5a339 | C++ | kamil-s-kaczor/Group_of_Figures | /Group_of_Figures/Circle.cpp | UTF-8 | 574 | 2.984375 | 3 | [] | no_license | #include "pch.h"
#include <cmath>
#include "Circle.h"
#include "Figure.h"
const double pi = std::acos(-1);
Circle::Circle(Point const& a, double const& radius)
{
this->set_Figure_type(0);
this->center = a;
this->radius = radius;
}
bool Circle::operator==(Circle const& a) const noexcept
{
if (this... | true |
659ea1e139ce0c1daa73886a387cb7cddec33054 | C++ | NortonGitHub/Creation_of_dungeon | /CreationOfDungeon_master/cd_666s/TilebaseAI/ParameterEffecter.h | SHIFT_JIS | 778 | 2.640625 | 3 | [] | no_license | #pragma once
#include "../../Vector2D.h"
class BattleParameter;
class ParameterEffecter
{
public:
ParameterEffecter(int continuousTime, bool isPositive);
~ParameterEffecter();
//Ԍo
void UpdateCounter();
//ljʂLǂ
bool IsEnable() const { return _time < _affectionTime; }
bool IsPositive() co... | true |
751bb19ca11e3112887160dccfa010eca6f9f62c | C++ | kubamaruszczyk1604/HFRPlayer | /HFRPlayer/ExperimentSocketManager.cpp | UTF-8 | 536 | 2.640625 | 3 | [] | no_license | #include "ExperimentSocketManager.h"
using namespace Networking;
// initialsie static fields
SocketConnection* ExperimentSocketManager::s_serverSocket = nullptr;
std::vector<ExperimentSocketStream*> ExperimentSocketManager::s_activeSockets = {};
std::thread* ExperimentSocketManager::s_acceptThread = nullptr;
void Ex... | true |
128837ec2a8885f87901d7a458fecabd83bb63a3 | C++ | yongjianmu/leetcode | /second/145_Binary_Tree_Postorder_Traversal/sol.cpp | UTF-8 | 813 | 3.09375 | 3 | [] | no_license | #include "../include/header.h"
class Solution {
public:
vector<int> postorderTraversal(TreeNode* root) {
vector<int> ret;
if(NULL == root)
{
return ret;
}
stack<TreeNode*> st1, st2;
st1.push(root);
while(!st1.empty())
{
TreeN... | true |
d463fcff23c797bdb9732c53e76e97beeacb4f34 | C++ | hpointu/e3e | /src/e3e/Matrix4fStack.cpp | UTF-8 | 709 | 3 | 3 | [] | no_license | #include "Matrix4fStack.hpp"
e3e::Matrix4fStack::Matrix4fStack()
{
push();
}
void e3e::Matrix4fStack::push()
{
e3e::Matrix4f *toPush = isEmpty() ? new e3e::Matrix4f() : new e3e::Matrix4f(*top());
data.push_back(toPush);
}
void e3e::Matrix4fStack::pop()
{
if(!isEmpty())
{
e3e::Matrix4f *b = data.back();
data... | true |
faac9ea4437d9a236f2631634a6ec588ea4616bb | C++ | Tduderocks/PracticeProblems | /Ch_8/Ch8_Rev9and10.cpp | UTF-8 | 1,147 | 4.03125 | 4 | [] | no_license | //chapter 8 review 9 and 10 works and works :) done:)
#include <iostream>
#include <string>
#include <vector>
using namespace std;
string Reverse (string phrase)
//reverses a string using arrays
{
string word;
for(int Letter = phrase.length()-1; Letter>=0; Letter --){
word+=phrase[Letter];
}
re... | true |
05bcba98c30cee71c0e32f6f0fbff4e069306a0a | C++ | ernestchu/cse391-object-oriented-programming | /Assignments/hw4/src/lib/Lexer.cpp | UTF-8 | 3,011 | 3.171875 | 3 | [] | no_license | //
// Lexer.cpp
// hw4
//
// Created by Ernest Chu on 2020/11/18.
//
#include "Lexer.h"
int Lexer::line = 1;
void Lexer::reserve(const Word& w) {
words.insert({w.lexeme, w});
}
Lexer::Lexer(std::string target) : target(target) {
target_stream.open(target, std::ifstream::in);
reserve(*new Word("if", ... | true |
90bdac4a0146513a6e8410aee2f7dac9895d167e | C++ | chiku/cmatrix | /src/impl/matrix/populators.cpp | UTF-8 | 370 | 2.71875 | 3 | [
"MIT"
] | permissive | // Written by : Chirantan Mitra
namespace cmatrix
{
template <class Type>
void Matrix<Type>::fillWith(Type value)
{
for (long int i = 0; i < rows(); i++) {
for (long int j = 0; j < columns(); j++) {
access(i, j) = value;
}
}
}
template <class Type>
inline void Matrix<Type>::fi... | true |
bb8c6dba1322d200256078bbcda311fd80526f37 | C++ | Floating-light/datastruct | /leetcode/Array/MaxSubarray/maxSubarray.cpp | UTF-8 | 2,147 | 3.71875 | 4 | [] | no_license | // 53. Maximum Subarray
// tags: Array, Divide and Conquer
#include <vector>
#include <limits>
#include <iostream>
using namespace std;
class Solution {
void findMax(const vector<int>& nums, int head, int& realMax)
{
if(head > nums.size()) return ;
int currentSum = 0;
for(int ... | true |
af0269281eb6dee353adb06912ba730727d71281 | C++ | 7princekumar/competitive_coding | /coding_ninjas/prerequisites/evenAndOddIndexes.cpp | UTF-8 | 557 | 3.125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define N 100005
int get_esum(int* a, int n){
int esum = 0;
for(int i=0; i<n; i++){
if(i%2 == 0 && a[i]%2 == 0) esum += a[i];
}
return esum;
}
int get_osum(int* a, int n){
int osum = 0;
for(int i=0; i<n; i++){
if(i%2 != 0 && a[i]%2 ... | true |