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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b9fd13b80d3aa8f5e639affe27d6141a87c34524 | C++ | lepexys/projects | /home/home/home.cpp | UTF-8 | 6,535 | 2.96875 | 3 | [] | no_license | #include "pch.h"
#include <cstdio>
#include <iostream>
#include <fstream>
#include <clocale>
#include <iomanip>
using namespace std;
struct Shower
{
bool* u,*s,*ls;
int n;
Shower(unsigned v,int num)
{
n = num;
u = new bool[n];
for (int i = 0; i < n; i++)
{
u[i] = true;
if (i == v)
u[i] = false;... | true |
90f67249eda49be313682dbae142df0668f08715 | C++ | glw3d/_GLW3D | /glw/src/glw/RenderTarget.hpp | UTF-8 | 2,900 | 2.609375 | 3 | [] | no_license | /**
Author: Mario J. Martin <dominonurbs$gmail.com>
A frame buffer is basically used for off-screen rendering.
*******************************************************************************/
#ifndef _HGW_FRAMEBUFFER_H
#define _HGW_FRAMEBUFFER_H
#include "common/log.h"
#include "common/check_malloc.h"
#include "si... | true |
531243d2a3c6faf483a88ce4b52e60ab32ab2aa8 | C++ | duncalucian/Fundamental-algorithms | /AF/Lab3/main.cpp | UTF-8 | 3,525 | 2.921875 | 3 | [] | no_license | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "Profiler.h"
#define LEFT(i) 2*i
#define RIGHT(i) 2*i+1
#define PARENT(i) i/2
#define MAX_SIZE 10000
Profiler p("heaps");
/* Observatii
Se poate observa din grafic ca constructia Bottom Up este mai eficienta decat constructia Top Down. In im... | true |
6d8d301d92d0d5aae7776a5248eb001e5ceba4f1 | C++ | mmmaxou/imac-cpp | /TP8/Error.cpp | UTF-8 | 428 | 2.78125 | 3 | [] | no_license | #include "./Error.hpp"
#include <string>
#include <iostream>
Error::Error()
: _message("")
{};
Error::Error(const std::string &message)
: _message(message)
{};
Error::~Error() {};
const char* Error::what() const noexcept {
std::string message = std::string("Error::At " + std::string(__FILE__) + ":" + std::to_s... | true |
6ed96191d82ae1b6f499dce86f51f83a4aa93b33 | C++ | brandonalfred/ParallelProgramingExamples | /99s-openmp.cpp | UTF-8 | 2,932 | 3.34375 | 3 | [] | no_license | #include <omp.h>
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <stdio.h>
using namespace std;
int main()
{
int count = 0, i;
int parCount = 0;
int const size = 10000000; // 10,000,000
//int myArray [size];
int *myArray = new int[size];
double start_time, end_time;
double... | true |
f6cf2c338f14242861f5dfb085af5319c0908b80 | C++ | Jy411/CPPAssignmentTest | /FinalReport.cpp | UTF-8 | 2,471 | 2.796875 | 3 | [] | no_license | //
// Created by Jinyung Tan on 23/06/2018.
//
#include "FinalReport.h"
FinalReport::FinalReport() {}
FinalReport::FinalReport(int studentNo, const string &fullName, char gender, int classID, const string &className,
int yearForm, char yearGrade, int subjectID, const string &subjectName, cha... | true |
b422fbbaea18bcfac9b4602e65f3b61f8fc9aa66 | C++ | acc-cosc-1337-spring-2020/acc-cosc-1337-spring-2020-Naziaislam91 | /src/homework/tic_tac_toe/tic_tac_toe.cpp | UTF-8 | 2,520 | 3.359375 | 3 | [
"MIT"
] | permissive | #include "tic_tac_toe.h"
using std::string;
#include<iostream>
#include<string>
//cpp
bool TicTacToe::game_over()
{
if (check_column_win() == true || check_row_win() == true || check_diagonal_win() == true)
{
set_winner();
return true;
}
else if (check_board_full() == true)
{
winner = 'C';
return true;
... | true |
2863fbd3cd05c290fb0621f5bbdc573de2ab7818 | C++ | chadaustin/sphere | /sphere/source/particle_engine/ParticleSystemParent.cpp | UTF-8 | 13,557 | 2.765625 | 3 | [] | no_license | #include "ParticleSystemParent.hpp"
////////////////////////////////////////////////////////////////////////////////
/*
* - Calls the on_update callback and updates the descendants.
*/
void
ParticleSystemParent::Update()
{
if (IsExtinct() || IsHalted())
return;
if (IsDead() && m_Descendants.size()... | true |
217cfff2f4613d215c40d7a3d7c75d7a95532ff0 | C++ | FreshSJQ/RayTracer | /Rectangle.h | UTF-8 | 2,374 | 2.9375 | 3 | [] | no_license | #ifndef RAYTRACER_RECTANGLE_H
#define RAYTRACER_RECTANGLE_H
#include "Hitable.h"
class RECTXY : public Hitable {
public:
double x0, x1, y0, y1, k;
Material *mat_ptr;
RECTXY() {}
RECTXY(double x_0, double x_1, double y_0, double y_1, double kt, Material *mat) :
x0(x_0), x1(x_1), y0(y_0), ... | true |
69bde8991a8b5c67ac2647d9c9592c91b1b22e5e | C++ | nqnliu/CSE167-Final-Project | /Galaxy/Galaxy/Vector3.cpp | UTF-8 | 2,078 | 3.890625 | 4 | [] | no_license | #include "Vector3.h"
//construction
Vector3::Vector3()
{
for (int i = 0; i < 3; ++i)
{
v[i] = 0;
}
}
Vector3::Vector3(double x,double y,double z)
{
v[0] = x;
v[1] = y;
v[2] = z;
}
//overload operator '+' for addition
Vector3 Vector3::operator+(const Vector3& v2)
{
Vector3 res;
res.v[0... | true |
20c7e5eeb4316221a0203eac896c0e94bdc87eb2 | C++ | ChristopherCanfield/canfield_ant_simulator | /tests/Node_tests.cpp | UTF-8 | 3,191 | 2.90625 | 3 | [
"MIT"
] | permissive | #include "stdafx.h"
#include "CppUnitTest.h"
#include "../sim/nav/Node.hpp"
#include "../sim/nav/GridLocation.hpp"
#include "../sim/nav/Edge.hpp"
#include <memory>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace cdc;
using namespace std;
namespace tests
{
TEST_CLASS(Node_tests)
{
p... | true |
cad6f9f8341bf9f8f7139017b8da453630298786 | C++ | KeshavChaurasia/leetcode | /diameter-of-binary-tree/diameter-of-binary-tree.cpp | UTF-8 | 840 | 3.28125 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | true |
ab8d878a8a32836d35eec91f7411b4d0aa59590a | C++ | junamai2000/Emwd | /include/core/Request.h | UTF-8 | 2,944 | 2.828125 | 3 | [] | no_license | // vim:set noexpandtab sts=0 ts=4 sw=4 ft=cpp fenc=utf-8 ff=unix:
/*
* Request.h
*
* Created on: 2014/09/06
* Author: Junya Namai
*/
#ifndef EMWD_CORE_REQUEST_H_
#define EMWD_CORE_REQUEST_H_
// C++ headers
#include <map>
namespace Emwd { namespace core {
class Response;
/**
* Request class
*/
class Req... | true |
c2eee93c8ed0227ae6738588c493ef1f67d64e6b | C++ | anagorko/informatyka | /home/lukom/geny.cpp | UTF-8 | 3,063 | 3.03125 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<fstream>
#include<string>
using namespace std;
class genotyp {
public:
string s;
bool odporny_na_zmeczenie() const;
int ilosc_genow() const;
int jaki_najdluzszy_gen() const;
bool silnie_odporny() const;
bool odporny() const;
vector <string> geny(string s1) const;
}M[... | true |
95ec3fba096648ff7772213f8b04c4cfaab1b5f1 | C++ | debacoding/exercism-cpp | /triangle/triangle.cpp | UTF-8 | 597 | 3.25 | 3 | [] | no_license | #include "triangle.h"
#include <stdexcept>
#include <iostream>
using namespace std;
namespace triangle
{
triangles_t kind(double a, double b, double c)
{
triangles_t type;
if (a<=0 || b<=0 || c<=0)
{
throw domain_error("Error");
}
if ((a+b)<c || (a+c)<b ||... | true |
247dfd342cd8365de2fd1822e4ad1aef3c098f4c | C++ | msrLi/portingSources | /ACE/ACE_wrappers/tests/Object_Manager_Test.cpp | UTF-8 | 2,816 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive |
//=============================================================================
/**
* @file Object_Manager_Test.cpp
*
* Tests the basic functions of the ACE_Object_Manager.
*
* @author David L. Levine <levine@cs.wustl.edu>
*/
//=============================================================================
... | true |
3d20582e3424b9739ff9faee1c2a415c9829c5a2 | C++ | will-fawcett/exogaia | /exogaia.cpp | UTF-8 | 27,987 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <random>
#include <ctime>
#include <math.h>
#include <algorithm>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <string>
#include <ios>
using namespace std;
//********* MICROBES ****************
class microbe { // class for our ... | true |
f71a608afe3724f7ae481e564132ecf3a84799c9 | C++ | utkusenocak/CppEssentialTraining | /Essential/jump.cpp | UTF-8 | 1,131 | 3.421875 | 3 | [] | no_license | #include <iostream>
using namespace std;
const char* prompt();
int jump(const char*);
void fa() { printf("this is fa()\n"); };
void fb() { printf("this is fb()\n"); };
void fc() { printf("this is fc()\n"); };
void fd() { printf("this is fd()\n"); };
void fe() { printf("this is fe()\n"); };
void (*funcs[])() = { fa, f... | true |
4d0cc846279d41ef7e7e7a5133f58f2be823792a | C++ | ammarsalman94/Projects | /WindowsTextSearch/test/cpps/Entry.cpp | UTF-8 | 2,983 | 2.953125 | 3 | [] | no_license | /////////////////////////////////////////////////////////////////////
// Entry.cpp - Test stub for NoSqlDb package //
// Ver 1.0 //
// Application: Project #1 - No-SQL Database - CSE-687 //
// Platform: Dell Inspiron 5520, Win 10, Visual Studio 2015 //
// Author: ... | true |
affee8261cba838b3eda648bd6a349aff9001367 | C++ | AnastasiyaKuznetsova99/09_03 | /09_03/1.cpp | UTF-8 | 1,439 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <set>
#include <vector>
#include <chrono>
#include <random>
#include <iterator>
#include <array>
class Timer
{
using clock_t = std::chrono::steady_clock;
using timepoint_t = clock_t::time_point;
private:
timepoint_t begin;
public:
Timer() : begin(clock_t::now())
{}
~Timer() noexc... | true |
c98b349021a33e10ca98b34232be15690c2ae0b3 | C++ | Vincent-Renard/mpi-td-tutos | /TD6-Mandelbrot/Mandel/Mandelbrot.cpp | UTF-8 | 4,838 | 2.703125 | 3 | [] | no_license | //#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <ctime>
#include <cstring>
#include <omp.h>
using namespace std;
int i4_min ( int i1, int i2 ){
int value;
if ( i1 < i2 )
{
value = i1;
}
else
{
value = i2;
}
r... | true |
01528fb41c39c40e5d8fca4f56b598667ba1ff36 | C++ | FrodoAlves/AEDA | /aeda/Voo.h | UTF-8 | 1,201 | 2.796875 | 3 | [] | no_license | #ifndef VOO_H
#define VOO_H
#include <iostream>
#include <vector>
#include "Passageiro.h"
#include "Date.h"
#include "Aviao.h"
using namespace std;
class Voo
{
vector<Date> data;
Aviao* aviao; //aviao alocado //datas de partida e chegada
vector <Passageiro *> Passageiros;
int lugares_ocu... | true |
fc7d2bb6d7e6f000a239af006425db0f8fb21766 | C++ | velamen2009/HackerRank | /Algorithm/Implementation/P21-Non-Divisible-Subset.cpp | UTF-8 | 692 | 2.609375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n, k;
cin >> n >> k;
vector<int> num(n);
vector<int> mod(k);
for(int i = 0; i < n; ++i){... | true |
bb82301e6e5aa442dd184e50edd065672b0668b1 | C++ | IshaKawatra/HelloWorld | /modratewindow.cpp | UTF-8 | 1,134 | 2.53125 | 3 | [] | no_license | #include<iostream>
#include "modratewindow.h"
#include "ratewindow.h"
ModRateWindow::ModRateWindow(Movie* trytofind, Netflix *n){
this->n = n; //initialize netflix class
this->trytofind = trytofind;
QVBoxLayout *mainLayout = new QVBoxLayout; //the V means vertical
QHBoxLayout *buttonLayout = new QHBoxLayout;... | true |
e2da690bff264f71f3064d845eab5e5c2d88cf99 | C++ | Murzaza/WinterProject | /src/model.h | UTF-8 | 802 | 2.71875 | 3 | [] | no_license | #include<vector>
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
class Model
{
public:
Model();
//Setters
void setVerts(std::vector<std::vector<GLfloat> > set);
void setNorms(std::vector<std::vector<GLfloat> > set);
void setTex(std::vector<std::vector<GLfloat> > set);
void set... | true |
4f72e92dbd31b8ae49816ff88d74403f33c1200b | C++ | jinhyo/POCU | /Assignment2/Boatplane.cpp | UHC | 1,764 | 3.1875 | 3 | [
"MIT"
] | permissive | #include "Boatplane.h"
namespace assignment2
{
Boatplane::Boatplane(unsigned int maxPassengersCount)
: Vehicle(maxPassengersCount)
{
}
Boatplane::Boatplane(Boatplane&& other)
{
mMaxPassengerNumber = other.mMaxPassengerNumber;
mPassengerCount = other.mPassengerCount;
mPassengers = other.mPassengers;
//... | true |
e39eb4649c0d7b192744522afc116cb07e7c096f | C++ | templateaholic10/testrepo | /EM_algorithm/pdist.hpp | UTF-8 | 4,332 | 2.75 | 3 | [] | no_license | #ifndef PDIST
#define PDIST
#include <iostream>
#include <fstream>
#include <array>
#include <random>
#include <functional>
#include "statistic_util.hpp"
#include "../lab/util.hpp"
namespace statistic {
template <int dim>
using dvector = statistic_util::dvector <dim>;
template <int dim>
using dmatri... | true |
621f7fbcf82cfdca2d855f613217cacd94e4dc91 | C++ | majabedi/memilio | /cpp/models/abm/testing_scheme.h | UTF-8 | 1,540 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | #ifndef EPI_ABM_TESTING_SCHEME_H
#define EPI_ABM_TESTING_SCHEME_H
#include "abm/time.h"
#include "abm/parameters.h"
#include "abm/time.h"
#include <functional>
namespace mio
{
class Person;
/**
* Testing Scheme to regular test people
*/
class TestingScheme
{
public:
/**
* create a testing scheme.
*... | true |
79b70cc4f879804064b6c3d5d3f0a83749a1c852 | C++ | swati2917/C- | /sum.cpp/sum.cpp/Sum.cpp | UTF-8 | 214 | 3.25 | 3 | [] | no_license | // this is a sum program
#include <iostream>
using namespace std;
int a = 4;
int b = 5;
double c = 3.406678;
float d = 4.1;
double result;
int main()
{
c = c + d;
result = a - d;
cout << result << endl;
} | true |
e598b1df0887f1c2d8ff0606d18adbe00edae4c9 | C++ | futureshocked/ESP32-For-Busy-People-1 | /04-050_Analog_input_with_pot/04-050_Analog_input_with_pot.ino | UTF-8 | 1,493 | 2.859375 | 3 | [
"MIT"
] | permissive | /* 04.050 - ESP32 Analog input with potentiometer
This sketch shows you how to read the state of a potentiometer using an ESP32.
As you turn the potentiometer knob, see the measured value in the serial monitor.
This sketch was written by Peter Dalmaris using information from the
ESP32 datasheet and exa... | true |
880989c2ef1d112217617a79a03f18c5d1d0f90c | C++ | luismalta/analise_algoritmos_2 | /Algoritmos/Topological sorting for Directed Acyclic Graph/Kahn.cpp | UTF-8 | 2,762 | 3.59375 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class Graph
{
int V; //Número de vertices
// Ponteiro para uma vetor contendo listas de adjacências
list<int> *adj;
public:
Graph(int V); // Constructor
// Função que adiciona aresta ao grafo
void addEdge(int u, int v);
// Imprimi um... | true |
ba8d5bdd2d06fa1e70c54a6737daf36d964ae0f4 | C++ | pke456/POKEMON | /main/Player.cpp | UTF-8 | 1,517 | 2.734375 | 3 | [] | no_license | #include "stdafx.h"
#include "Player.h"
Player::Player(){}
Player::~Player(){}
HRESULT Player::init(void)
{
_playerRC = RectMakeCenter(WINSIZEX / 2, WINSIZEY / 2, 50, 50);
menu.init();
LEFT = RIGHT = UP = DOWN = menuToggle = false;
return E_NOTIMPL;
}
void Player::release(void)
{
}
void Player::update(void)
... | true |
6092e89d429797d48179634ef5fe436e87b81620 | C++ | katherine0504/Uva | /10107.cpp | UTF-8 | 446 | 2.734375 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <algorithm>
#define MAX 10010
using namespace std;
int arr[MAX];
int cnt = 0, input;
int main() {
while(scanf("%d", &input) != EOF) {
arr[cnt++] = input;
sort(arr, arr+cnt);
if (cnt == 1) {
printf("%d\n", input);
}
else if (cnt%2 == 0) {
... | true |
ecc0ae95422da1af63618eeba0380507c43a2a89 | C++ | LucasPauloOP/AED | /Trabalho_de_revisão_ex1.cpp | UTF-8 | 677 | 3.21875 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
#include<string.h>
#include<locale.h>
typedef struct {
char nome[30];
char sexo[2];
int idade;
float altura;
}Pessoa;
int main()
{
setlocale(LC_ALL,"portuguese");
Pessoa p;
printf("\nDigite um nome: ");
gets(p.nome);
printf("\nDigite F para sexo feminino e M para ... | true |
ac5195cbfcb7ddbe30e332ed21e95a956b67ec21 | C++ | xzqingzi/LeetCodeEx | /src/49_Group_Anagrams.cpp | UTF-8 | 705 | 3.125 | 3 | [] | no_license | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string,int> mymap;
vector<vector<string>> output;
string temp;
int i = 0;
for (string s : strs) {
temp = s;
sort(temp.begin(), temp.end()); // sort the... | true |
663f839cbddc139e6e18fab29c09b8736c96e122 | C++ | iPalash/allconnect | /c1.cpp | UTF-8 | 6,136 | 2.640625 | 3 | [] | no_license | #include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <cmath>
#include <vecto... | true |
32ae35abea5a5cc5f3f57f647002f2cf2bc72218 | C++ | newMember1/toyPBRT | /materials/basicbrdfmaterial.h | UTF-8 | 1,212 | 2.65625 | 3 | [] | no_license | #ifndef BASICBRDFMATERIAL_H
#define BASICBRDFMATERIAL_H
#include <vector>
#include "../core/materialBase.h"
using namespace glm;
class basicBRDFMaterial : public materialBase
{
public:
basicBRDFMaterial(std::shared_ptr<textureBase> textureBase);
basicBRDFMaterial(std::shared_ptr<textureBase> textureBase, float... | true |
16fb409390bc26d399b156e8f9ec57ba66ffd948 | C++ | Crasader/mygamelogic | /Classes/core/U2PoolingObjectManager.h | UTF-8 | 6,836 | 2.75 | 3 | [] | no_license | #ifndef __U2PoolingObjectManager_H__
#define __U2PoolingObjectManager_H__
#include "U2Prerequisites.h"
#include "U2IteratorWrapper.h"
#include "U2FactoryManager.h"
U2EG_NAMESPACE_BEGIN
class ObjectFactory;
template <class T>
class PoolingObjectManager
{
protected:
/// <guid, T*>
typedef std::map<String... | true |
cbd8b941f87a38c4e02a4c7511427dae20b2a17c | C++ | Padmina91/STLspielwiese | /Logger.cpp | UTF-8 | 1,103 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include "Logger.hpp"
#include "Date.hpp"
#include "Time.hpp"
void Logger::print_date() {
Date now = Date::get_current_date();
DateFormatNumeric df;
now.set_format(&df);
_f << now << " ";
}
void Logger::print_time() {
Time now = Time::get_current_time();
_f << now.to_string... | true |
641cffdcc9a1c54737c3b6acba8cdd6c2a9c8a48 | C++ | PLUkraine/c8 | /tests/test_c8_read.cc | UTF-8 | 1,548 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | #include "gtest/gtest.h"
#include <iostream>
#include <fstream>
#include <string>
#include "common.h"
#include "c8_read.h"
class c8_read : public ::testing::Test {
protected:
std::string sample_filepath;
const uint8_t data[15] = { 0x03, 0xFA, 0xAA, 0x98, 0x90, 0x32, 0x20, 0x34, 0xAB, 0xDE, 0xAD, 0xBE, 0xEF };... | true |
f7973575a8bcf5c543a164ab3c2e69664437944b | C++ | qcscine/kiwi | /src/Kiwi/Kiwi/KiwiOpt/Bisection.h | UTF-8 | 3,831 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* @file
* @copyright This code is licensed under the 3-clause BSD license.\n
* Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group.\n
* See LICENSE.txt for details.
*/
#ifndef KIWI_BISECTION_H
#define KIWI_BISECTION_H
#include "Kiwi/KiwiUtils/Data.h"
#include <iomanip>
... | true |
ca86fc1842821146863e283eaea8b614d2efafb5 | C++ | HarshitDhingra/Competitive-Programming | /Mo's algorithm/square root decomposition.cpp | UTF-8 | 954 | 2.96875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int query(int blocks[], int a[], int l, int r, int rn)
{
int ans = 0;
while (l < r && l % r != 0)
{
ans += a[l];
l++;
}
while (l + rn < r)
{
int index = l / rn;
ans += blocks[index];
l += rn... | true |
20e36be4459a6250cbf01e6566aef59108b8ae1f | C++ | kreczko/swatch | /core/include/swatch/core/ThreadPool.hxx | UTF-8 | 1,578 | 2.546875 | 3 | [] | no_license |
#ifndef __SWATCH_CORE_THREADPOOL_HXX__
#define __SWATCH_CORE_THREADPOOL_HXX__
#include <boost/function.hpp>
#include <boost/bind.hpp>
namespace swatch {
namespace core {
template<class OBJECT, class ResourceGuardType>
void ThreadPool::addTask(OBJECT* aCmd,
boost::function<void(OBJECT*, boost::shared_ptr<Resourc... | true |
bbf2710e5a340a20a1c24961a5240ddd6122e5d2 | C++ | Nuos/Elements-of-Programming-Interview | /5.16 Generate uniform Random Numbers/main.cpp | UTF-8 | 495 | 2.96875 | 3 | [] | no_license | /* */
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int randomOneZero(){
return rand()%2;
}
int generateRandom(int a, int b){
int total_num = b-a+1;
int result = total_num;
while(result >= total_num){
result = 0;
for(int i = 0; (1 << i) < total_num; i++){
result =... | true |
42f4210c9653f2c2a60cd3e9539927fdb9f1a4d3 | C++ | mvodya/bkv-labs | /software-engineering/lab5/calculator_v1/calc/functions/const.h | UTF-8 | 397 | 2.734375 | 3 | [] | no_license | #pragma once
#include "../symbol.h"
#include <cmath>
namespace calc {
class Const : public Symbol {
const double value;
public:
Const(double v) : value(v) {};
double call() { return value; }
double call(double a) { return value; }
double call(double a, double b) { return value; }
void set(double v) {}
... | true |
49b8401a807c905dbda1d8f14bb87a86b84ca54c | C++ | enjoy82/atcodersyozin | /c++学習用/ABC132c.cpp | UTF-8 | 272 | 2.765625 | 3 | [] | no_license | #include<iostream>
#include <algorithm>
#include<vector>
using namespace std;
int main(){
int n;cin>>n;
vector<int> a(n);
for(int i = 0; i<n; i++){
cin >> a[i];
}
sort(a.begin(), a.end());
int an = n/2;
cout << a[an]-a[an-1] << endl;
} | true |
25590934d3c79de78ce4b690467c8d3c9be617ba | C++ | redeff/cmp | /cf/1088/E/main.cpp | UTF-8 | 1,498 | 2.59375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll INF = 333333333;
struct Node {
ll parent;
vector<ll> children;
};
int main() {
ll n;
cin >> n;
vector<ll> weis(n);
for(ll i = 0; i < n; ++i) cin >> weis[i];
vector<vector<ll>> conns(n);
for(ll i = 0; i < n - 1; ++i) {
ll a, ... | true |
7799ce29606b9562ef61b6276029fa3ab4f69498 | C++ | Rocketng/Algorithm | /决赛第五题.cpp | UTF-8 | 855 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct edge{
int from,to,cost;
};
//edge es[1000];
int d[10001];
int V,E;
void shortest_path(int s,vector<edge>&es){
for(int i=0;i<V;i++){
d[i] = INT_MAX;
}
d[s] = 0;
while(true){
bool update =false;
for(int i=0;i<E;i++){
ed... | true |
8573368dce606b98412385fb722caf04b1af5948 | C++ | Mr-Poseidon/CFile | /AcWing/285没有上司的误舞会(树形DP).cpp | GB18030 | 1,517 | 3.109375 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N=6010;
int h[N],e[N],ne[N],idx;//άڽӱ
int happy[N];//άÿ˵Ŀֵ
int f[N][2];//f[i][0] ѡ i˵Ŀֵf[i][1] ѡ i˵Ŀֵ
bool has_father[N];//άijǷиڵ
int n;
void insert(int a,int b)//ڽӱ
{
e[idx]=b,ne[idx]=h[a],h[a]=idx++;
}
void... | true |
686b2e16bf4e9b80aa8cc070df543ef3f0f3c265 | C++ | jwvg0425/boj | /solutions/10815/10815.cpp11.cpp | UTF-8 | 470 | 2.546875 | 3 | [] | no_license | #include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <stack>
#include <math.h>
#include <memory.h>
#include <queue>
#include <set>
int main()
{
std::set<int> set;
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
int a;
scanf("%d", &a);
set.insert(a... | true |
2e2347fe28f82732afcf1ecf5c2189136ba948d8 | C++ | AlexHang/DSA | /HW4/Ex2/Queue.h | UTF-8 | 1,075 | 3.3125 | 3 | [] | no_license | #define NMAX 5
#include <stdio.h>
class Queue {
private:
Message queueArray[NMAX];
int head, tail, size;
public:
void enqueue(Message x) {
if (size == NMAX) {
fprintf(stderr, "Error 101 - The queue is full!\n");
return;
}
... | true |
0d90321549f46888f8107acd0c856ade3c8ac5df | C++ | borjafdezgauna/DSG | /2013/JuegoDSG/src/MaterialTexture.cpp | UTF-8 | 1,223 | 2.8125 | 3 | [] | no_license | #include "../inc/MaterialTexture.h"
MaterialTexture::MaterialTexture(void)
{
m_blendu= true;
m_blendv= true;
m_clamp= false;
m_cc= false;
m_mm[0]=0;
m_mm[1]=1;
m_offset[0]=0;
m_offset[1]=0;
m_offset[2]=0;
m_scale[0]=1;
m_scale[1]=1;
m_scale[2]=1;
m_turbulence[0]=0;
m_turbulence[1]=0;
m_turbulence[2]=0;
... | true |
9b75d4fafc3efc9718f2630c7b766ec707f0f136 | C++ | olokex/bachelors-thesis | /src/anf/formula.hpp | UTF-8 | 954 | 2.765625 | 3 | [] | no_license | /**
* Subject: Bachelor's thesis
* Author: Adam Sedlacek | xsedla1e@vutbr.cz
* Year: 2021
* Description:
* Formula's header file.
*
*/
#ifndef FORMULA_H
#define FORMULA_H
#include "../reference_bits.hpp"
#include "parameters.hpp"
#include "literal.hpp"
#include <vector>
class Formula {
public:
unsign... | true |
930dfbce401f6d327e0c4161ce24b873c297ef43 | C++ | SaricZarko/Data-Flow-Machine | /Token.h | UTF-8 | 1,299 | 3.078125 | 3 | [] | no_license | #ifndef _TOKEN_H
#define _TOKEN_H
#include<string>
#include<vector>
#include"Exception.h"
using namespace std;
class Operator;
class Token
{
public:
Token() :name_(""), operation_(nullptr), value_(0.0), timeDelay_(0), id_(""), function_(""), startTime_(0),
endTime_(0){}
string getName() { return this->name_; }
v... | true |
45a1b70b521c6db7563a408cfece5b2fcf707b7e | C++ | Asad51/Leetcode-Problem-Solving | /653. Two Sum IV - Input is a BST.cpp | UTF-8 | 871 | 3.15625 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution
{
bool isFound;
TreeNode *head;
map<int, int> mp;
public:
void findNum(TreeNode *root, int t... | true |
f153ec11433088266d20cf6229b95043028de804 | C++ | PSJ0724/C-Samples | /90.구조체와 함수/main.cpp | WINDOWS-1252 | 337 | 2.90625 | 3 | [] | no_license | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
typedef struct phone {
char n[20];
int p;
}PHONE;
int show(PHONE ph) {
printf("%s,", ph.n);
printf("%d", ph.p);
}
int main(int argc, char** argv) {
PHONE ph={"Ʈ", 2000};
show(ph);
return 0;
... | true |
50e5a68f8570533b68d4edba8405fdb67979b1d3 | C++ | gustiir/Degree-Project | /Asteroids/Asteroids/Asteroids/Engine.cpp | UTF-8 | 875 | 2.59375 | 3 | [] | no_license | #include "SDL2\SDL.h"
#include <cassert>
#include <iostream>
#include "Engine.h"
static SDL_Window* Window;
static SDL_Renderer* Renderer;
static bool IsOpen = false;
void engineInitialization()
{
SDL_Init(SDL_INIT_VIDEO);
Window = SDL_CreateWindow("Asteroids", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 6... | true |
dac46230f914e439346b36a22db461f1a4665059 | C++ | zhangsht/cplusplus | /C++程序练习/第八周/quick_sort.cpp | UTF-8 | 958 | 3.40625 | 3 | [] | no_license | #include <iostream>
using namespace std;
template <class Record>
void quick_sort(Record* startPointer, Record* endPointer) {
if (startPointer < endPointer) {
Record *bottom = startPointer, *top = endPointer - 1;
Record privot = *startPointer;
while (bottom < top) {
while (... | true |
5a6e4f248459e3286e39d14446e2083f3dcf8a0e | C++ | TzashiNorpu/Algorithm | /Clion/zero/1400_1600/maxArea_1465.cpp | UTF-8 | 1,015 | 2.828125 | 3 | [
"MIT"
] | permissive | //
// Created by TzashiNorpu on 2023/6/28.
//
#include "../header/header.h"
using namespace zero;
int Solution::maxArea(int h, int w, vector<int> &horizontalCuts, vector<int> &verticalCuts) {
//
vector<int> heights, widths;
int hCuts = horizontalCuts.size();
std::sort(horizontalCuts.begin(), horizontalCuts.e... | true |
7e2a98c96a474732a186576adebc6049c1b2270d | C++ | xingkungao/LeetCode_solutions | /n_queens_II.cpp | UTF-8 | 1,222 | 2.875 | 3 | [] | no_license | /*************************************************************************
> File Name: n_queens_II.cpp
> Author: lax
> Mail: xingkungao@gmail.com
> Created Time: Wed 10 Dec 2014 09:38:24 PM CST
************************************************************************/
#include <iostream>
#include <vector>
#in... | true |
5ddf8f1626b1c554b7f277e7ca31f960877e0ebf | C++ | Hiker-Xu/nowcoder_algorithm | /primary_class/practice/Code_03_StackAndQueueConvert.cpp | UTF-8 | 1,605 | 3.703125 | 4 | [] | no_license | // 如何仅用队列结构实现栈结构?
// 如何仅用栈结构实现队列结构?
# include <stdio.h>
# include <iostream>
# include <stack>
# include <queue>
using namespace std;
class twoStackQueue{
public:
void push(int num){
stackPush.push(num);
}
bool empty(){
return (stackPop.empty() && stackPush.empty())?true:false;
}
... | true |
0164ab9c40ade7ad0b0e61637447a61adc17d205 | C++ | asdlei99/Play-Advent-of-Code | /2019/Day-03- Crossed-Wires/cpp-2019-03/main_part_1.cpp | UTF-8 | 1,690 | 3.046875 | 3 | [] | no_license | /// Source : https://adventofcode.com/2019/day/3
/// Author : liuyubobobo
/// Time : 2020-12-03
#include <iostream>
#include <fstream>
#include <vector>
#include <cassert>
#include <set>
#include <unordered_map>
using namespace std;
class Solution{
public:
int solve(const string& s1, const string& s2){
... | true |
b59b95dc68556566344d88e03be71faa1f4dd165 | C++ | carljwmeisner/rc2016-machine-learning | /logisticRegression/include/data.h | UTF-8 | 1,113 | 3.078125 | 3 | [] | no_license | #ifndef data_hpp
#define data_hpp
#include <fstream>
#include <vector>
#include <string>
#include <iostream>
typedef std::vector <double> record_t;
typedef std::vector <record_t> data_t;
class Data
{
public:
std::vector<std::vector<double> > dataSet;
std::vector< std::vector<double> > getQuestions(); //this wi... | true |
b390b9a0fc5923bf854be3a15169e4a9e715c700 | C++ | fatimamujahid07/mywork | /q6.cpp | UTF-8 | 427 | 2.71875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int arr[]={1,2,4,6,3,7,8};
int i,k=0,n,j,n1,n2;
n=sizeof(arr)/sizeof(arr[0]);
cout<<endl;
//ORIGINAL ARRAY
for(i=0; i<n; i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
n1=arr[0];
n2=arr[i-1];
for(i=0;i<n;i++)
{
n1++;
for(j=i+1;j<n;j++)
{
if(n1==arr[j])... | true |
907dedecbe0efaa983dde75bc65cfbedd6aabf32 | C++ | KevinEsh/linear-algebra-api | /LinearAlgebra_def.h | UTF-8 | 38,427 | 3.078125 | 3 | [
"MIT"
] | permissive | using namespace std;
LinearAlgebra::LinearAlgebra(int n1, int n2)
{
N1 = n1, N2 = n2, N3 = n2;
Matrix = nullptr, inp_vector = nullptr, out_vector = nullptr;
//Alocacion de memoria.
try{
Matrix = new double[N1*N2];
inp_vector = new double[N3];
out_vector = (double*)malloc(N3*... | true |
fd3cc73097c69fe54d9e2b4d0c107038c68c92fe | C++ | ClericX/Projects | /Plat2D/Plat2D/PacketParser.cpp | UTF-8 | 1,405 | 2.703125 | 3 | [] | no_license | #include "PacketParser.h"
#include "Main.h"
void PacketParser(const char *Packet)
{
switch (Packet[0])
{
// Movement packet.
case PacketHeaders.MovementPacket:
{
MOVEMENTPACKET *mp = (MOVEMENTPACKET*)Packet;
if (mp->ID != Player.ID)
{
CPlayer *ply = Textures.GetPlayerByID(mp->ID);
if (ply == 0... | true |
1841aa2e37a74e02cc458433e9f1fdf814e0dd0d | C++ | FeiZhao0531/BasicAlgorithm | /Graph/ReadGraph.h | UTF-8 | 1,205 | 3.1875 | 3 | [
"MIT"
] | permissive | /// Template Class for Graph Algorithm to read a existing graph in .txt file
/// Author: Fei
/// Create: Aug-19-2019
#ifndef READGRAPH_H
#define READGRAPH_H
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cassert>
using std::string;
using std::ifstream;
using std::stringstream;
... | true |
bc186a432a8e16b70fe3bafb82fa7b569b6e5c1e | C++ | Yangmila/c_code | /乘法口诀.cpp | UTF-8 | 253 | 2.71875 | 3 | [] | no_license | #include<stdio.h>
void chengfa(int n)
{
int i,j,result;
for(i=1;i<=n;++i)
{
for(j=1;j<=i;++j)
{
result=i*j;
printf("%d*%d=%d\t",j,i,result);
}
printf("\n");
}
}
int main()
{
int n;
scanf("%d",&n);
chengfa(n);
return 0;
}
| true |
da9450b7cdfaceecee244b52d61517cf8b0f954f | C++ | ericosur/myqt | /sha3test/readthread.cpp | UTF-8 | 1,020 | 2.671875 | 3 | [
"MIT"
] | permissive | #include "readthread.h"
ReadThread::ReadThread()
{
qDebug() << Q_FUNC_INFO << "created...";
flag = true;
}
void ReadThread::run()
{
qDebug() << Q_FUNC_INFO << "run start...";
const int REPEAT_TIMES = 4000000;
qint64 current = QDateTime::currentMSecsSinceEpoch();
for (int i = 0 ; i < REPEAT_T... | true |
5e46fcce0f69ad7253ad3282951d6585bb1da547 | C++ | Ra1nWarden/Online-Judges | /UVa/12093.cpp | UTF-8 | 1,735 | 2.546875 | 3 | [] | no_license | #include <cstdio>
#include <vector>
#include <cstring>
#define MAXN 10005
#define INF 2000000000
using namespace std;
int n, c1, c2;
int a, b;
vector<int> adjList[MAXN];
int dp[MAXN][3][4];
// dp[u][i][j]
// at node u
// put i
// j=0 : parent edge not connected
// j=1 : parent edge connected
// j=2 : parent and child... | true |
d8385abf8f6686c740fed52ff925f4c4ca0dcf0a | C++ | sknjpn/Lonely-Creatures | /Lonely-Creatures/Field.h | SHIFT_JIS | 3,002 | 2.78125 | 3 | [
"MIT"
] | permissive | #pragma once
class Assets;
struct Field;
struct Chip;
struct Material;
enum struct MType {
Leaf,
Meat,
Iron,
Fertilizer,
};
enum struct CType {
Clematis,
Slug,
Cricket,
};
enum struct CState {
Egg,
Seed,
Child,
Adult,
};
//bIuWFNg
struct Object {
int age;
Chip* registeredChip;
bool enabled;
double ... | true |
0c1856edc19af15eb46ec88147b64b44fbc8a35f | C++ | OutOfTheVoid/FRC-2605-Robot-Code-2014 | /src/Behaviors/BehaviorController.cpp | UTF-8 | 2,255 | 3.015625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | #include "BehaviorController.h"
BehaviorController :: BehaviorController ()
{
Behaviors = new Vector <BehaviorControllerList_t> ();
};
BehaviorController :: ~BehaviorController ()
{
for ( uint32_t i = 0; i < Behaviors -> GetLength (); i ++ )
if ( ( * Behaviors ) [ i ].Active )
( * Behaviors ) [ i ].Item -> ... | true |
72ceb3e5502103c7c39963bb236c35b744b1de88 | C++ | nikoladimitroff/trinity | /src/FormulaParser.cpp | UTF-8 | 5,813 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <mutex>
#include <string>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <math.h>
#include "FormulaParser.h"
#include "TreeNode.h"
using namespace std;
static bool RequiresTwoArguments(const string& token)
{
return token=="+"||
token=="-" ||
token=="*" ||
token=="/" ... | true |
38ea035d1de9bbd3bdf2eb4caf33010e1118f5d0 | C++ | TahseenSust/Competitive-programming | /uva/10340.cpp | UTF-8 | 412 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
string s,t;
while(cin>>s>>t){
int cnt=0;
for(int i=0,j=0;i<t.size();i++){
if(s[j]==t[i]){
cnt++;
j++;
}
}
if(cnt==s.size()){
... | true |
791a45e13a7fc218f79fbab96653ade9ce9330a7 | C++ | wolfjagger/coopnet | /src/coopnet/sat/solving/solver.cpp | UTF-8 | 614 | 2.59375 | 3 | [
"MIT"
] | permissive | #include "solver.h"
using namespace coopnet;
Solver::~Solver() { }
auto CompleteSolver::solve() -> Solution {
auto solution = do_solve();
if (solution.status == SolutionStatus::Undetermined)
throw std::exception("Complete solver has undetermined solution.");
return solution;
}
auto IncompleteSolver:... | true |
9c7a08e01fd834976301d79fa81b70a354e97340 | C++ | vamsikrishna1417/Advanced_computer_architecture | /OpenCL/main.cpp | UTF-8 | 8,567 | 2.796875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <chrono>
#include <string>
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#include <CL/cl.h>
#define MAX_SOURCE_SIZE (0x100000)
// C version of matrix multiplcation. Use this function for result validation and execution time comaprison
void m... | true |
d6dcf89d48bc7259c58ee6de0b057c4bfbea4d38 | C++ | savageblossom/cpp | /abramyan.cpp | UTF-8 | 740 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
float RingS(int R1, int R2) {
float Pi = 3.14;
if(R1 > R2) return Pi*(pow(R1, 2)-pow(R2,2));
else return 666;
}
int main() {
// // while 3
// // 15 / 3 = 5
// // 15 12 9 6 3
// int N, K, acc = 0;
... | true |
066d1321e68f1132959cdeede06d3b0fb703a6d4 | C++ | Lozoute/Rtype | /API/API_Mutex/API_Mutex.hpp | UTF-8 | 827 | 2.59375 | 3 | [] | no_license | #ifndef API_MUTEX_HPP_
# define API_MUTEX_HPP_
# include <iostream>
# include <string>
# include "API_Error.hpp"
namespace API_Mutex
{
class IMutex
{
public:
virtual ~IMutex () {}
virtual bool lock() = 0;
virtual bool tryLock() = 0;
virtual bool try_lock() = 0;
virtual bool unLock... | true |
701281adc638aecfa39f89b283c7d560b8c66625 | C++ | EugeneH5837/Hackerrank | /Vector-sort.cpp | UTF-8 | 432 | 2.890625 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n;
cin >> n;
//n = size
vector<int> vec;
for (int i = 0; i < n; i++) {
int b;
cin >> b;
vec.push_bac... | true |
10860a000c232983081ae0299f6ebd541f6ede1d | C++ | zackkk/leetcode | /Word Ladder.cpp | UTF-8 | 1,427 | 3.078125 | 3 | [] | no_license | class Solution {
public:
// bfs, word queue + dist queue
int ladderLength(string start, string end, unordered_set<string> &dict) {
if(start == "") return 0;
queue<string> wordQueue;
queue<int> distQueue;
wordQueue.push(start);
distQueue.push(1);
... | true |
ac9458803ec38737fbc36eda244c17d6f9699fb6 | C++ | sandiya11/sandiya | /92.cpp | UTF-8 | 196 | 2.765625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int i, n, sum=0, num;
cout<<"enter the value"<<endl;
cin>>n;
for(i=0;i<n;i++)
{
cin>>num;
sum=sum+num;
}
cout<<sum;
return 0;
}
| true |
a07ba3f89efbd72fe68cc0eb655c2ac068625f00 | C++ | pradeep0995/competitive-codes | /arrat.cpp | UTF-8 | 1,576 | 2.65625 | 3 | [] | no_license | #include <cmath>
#include<stdio.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
bool search;
int test,R,C,r,c;
cin>>test;
while(test--)
{
int flag;
// input the first array
cin>>R>>C;
char a[R][C]... | true |
491b62bc568e1781dce5b097bf6924a6f08ed86d | C++ | niteshbhatia008/eeg-toolkit | /toolkit/toolkit/visgoth/collectd.cpp | UTF-8 | 1,977 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "collectd.hpp"
#include <errno.h>
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "../json11/json11.hpp"
#include "../helpers.hpp"
using namespace std... | true |
e58e3f89fe5b439900a67080339bbaa609c82998 | C++ | jal535c/FlappyB | /bird.cpp | UTF-8 | 1,330 | 3.1875 | 3 | [] | no_license | #include "bird.h"
#include <sstream>
Bird::Bird()
{
x = 96;
y = 240;
t.loadFromFile("assets/bird.png");
s.setTexture(t);
s.setOrigin(20, 15); //referencia en el centro del sprite
buffer.loadFromFile("assets/flap.wav");
flap.setBuffer(buffer);
}
void Bird::fly() {
if (alive == 1)
flap.pl... | true |
460af7b2923d3089dbd12a6850bd0fc312585d12 | C++ | tanertopal/CppND-Capstone-Route-Finder-Game | /src/player.h | UTF-8 | 450 | 2.625 | 3 | [] | no_license | #ifndef PLAYER_H
#define PLAYER_H
#include <tuple>
#include <vector>
#include "SDL.h"
#include "world.h"
class Player {
public:
enum class Direction { kUp, kDown, kLeft, kRight };
Player(World::Map &map);
void Walk(Direction direction);
std::tuple<size_t, size_t> GetPosition() const;
std::vector<std::t... | true |
6668372fffb59e1912d194b31e6f7b0d489f53fa | C++ | NesterovN/Homework | /26.12.18/5.cpp | UTF-8 | 528 | 2.9375 | 3 | [] | no_license |
#include <iostream>
using namespace std;
int main()
{
int M;
cin >> M;
int N;
int *m = new int[N];
int *c = new int[N];
double *w = new double[N];
for (int i = 0; i < N; i++)
{
cin >> m[i];
cin >> c[i];
w[i] = m[i] / c[i];
}
double max = w[0];
... | true |
7a206fe2e8a46a06275238b695b1579519dd501c | C++ | uLoyd/RPN_Calculator | /Linux/ONPCalculator/uts/InfixConverter.cpp | UTF-8 | 7,396 | 3.46875 | 3 | [] | no_license | //
// Created by dawpa on 02.10.2021.
//
#include <gtest/gtest.h>
#include <BasicElementCreator.hpp>
#include "InfixConverter.hpp"
#include "EquationParser.hpp"
class InfixConverterTest : public ::testing::Test {
protected:
static constexpr std::pair add{"+", Symbol::Add};
static constexpr std::pair... | true |
e9866093a6afc63300d0bedaa405abcd5cee49b6 | C++ | newenclave/bitchain-test | /varint.h | UTF-8 | 4,359 | 2.90625 | 3 | [] | no_license | #ifndef VARINT_H
#define VARINT_H
#include <string>
#include "byte_order.h"
#include "etool/details/byte_order.h"
namespace bchain {
struct varint {
typedef std::uint64_t size_type;
static const std::size_t min_length = sizeof(std::uint8_t);
static const std::size_t max_length = sizeof... | true |
d55c054170eab6d4fd5213b0f005c56ccd92223f | C++ | techtronics/blackhat | /src/mom_conf_inline.h | UTF-8 | 19,122 | 2.609375 | 3 | [] | no_license | #ifndef MOM_CONF_INLINE_H_
#define MOM_CONF_INLINE_H_
//! inserts a new momentum
/**
\param m complex momentum to be inserted
\return integer label of the inserted momentum
*/
int orderless_key2(int,int);
template <class T> inline const Cmom<T>& momentum_configuration<T>::p(size_t n) const {
if (n<=momentum_confi... | true |
7e0b755e5d2a1ea8a8dbee0d49d68c6c7663e7c6 | C++ | paullewallencom/cocos2d-978-1-7839-8526-5 | /_src/Chapter 8/Classes/Environment.cpp | UTF-8 | 4,140 | 2.796875 | 3 | [] | no_license | #include "Environment.h"
Environment::Environment()
{}
Environment::~Environment()
{}
Environment* Environment::create()
{
Environment* environment = new Environment();
if(environment && environment->init())
{
environment->autorelease();
return environment;
}
CC_SAFE_DELETE(environment);
r... | true |
31b1a37a715391faf83539d373263c5c6addc154 | C++ | iCoder0020/Competitive-Coding | /USACO/sprime.cpp | UTF-8 | 741 | 2.578125 | 3 | [] | no_license | /*
ID: ishansa2
PROG: sprime
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
ofstream fout("sprime.out");
ifstream fin("sprime.in");
#define int long long
#define INF 1LL<<32
vector<int>ans;
int N;
void solve(int x, int i)
{
bool push = true;
for(int j = 2; j*j<=x; j++)
{
i... | true |
a31a87a87cba3e10542703d4db86b4085ebdc3c2 | C++ | Sookmyung-Algos/2021algos | /algos_semina/4th_seminar/seminar_3/2nd_grade/정영주_yeongjujeong1021/3474.cpp | UTF-8 | 332 | 2.6875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t, n, a, b;
cin >> t;
while (t--) {
a = 0, b = 0;
cin >> n;
for (int i = 2; i <= n; i *= 2) a += n / i;
for (int i = 5; i <= n; i *= 5) b += n / i;
cout << min(a, b) << '\n';
}
... | true |
57f39418661538f6ea4175b95df8b7d61930c79e | C++ | 0general/practice-cpp | /cpp100/cpp17/string.cpp | UTF-8 | 319 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main() {
string my_country = "korea";
string my_jop = "developer";
cout << "Country : " << my_country << endl;
cout << "Job : " << my_jop << endl;
string my_info = my_country + ", " + my_jop;
cout << "My Info : " << my_info << endl;
return 0;
} | true |
0bd72bfaf62200bf33eec325c32e3338f13d3d8a | C++ | weigewansui/Hashtable | /satdata.h | UTF-8 | 1,083 | 2.765625 | 3 | [] | no_license | /**
* satdata.h
*
* AE552 HW2
* Wei Ding
* 03597803
*/
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
template <class KEY, class VALUE>
struct HASHTABLE {
KEY key;
VALUE value;
struct HASHTABLE* next;
};
struct Key {
string name;
string country;
string owner;
};
// ... | true |
337e2f823d6dd1e2c01cdf192c4a5113c728c0f4 | C++ | tanejamohit/CodepathIBit | /BinarySearchAndHeaps/DistinctNumbersInWindow.cpp | UTF-8 | 622 | 2.59375 | 3 | [] | no_license | vector<int> Solution::dNums(vector<int> &A, int B) {
vector<int> result;
std::unordered_map<int, int> seen;
int pos = 0;
while(pos<B) {
if (seen.find(A[pos]) == seen.end()) { seen[A[pos]] = 0; }
seen[A[pos]] += 1;
pos++;
}
while(pos<=A.size()) {
result.push_b... | true |
a0d6d8adf89ef1a478da898c9fe4bf330b337b75 | C++ | RDDiaz/Stock-Trading-Simulation | /blsh_strategy.h | UTF-8 | 569 | 2.640625 | 3 | [] | no_license | #ifndef _BLSH_STRATEGY_H
#define _BLSH_STRATEGY_H
#include "trading_strategy.h"
namespace csis3700{
class blsh_strategy : virtual public trading_strategy
{
private:
int red_bar_count;
int red_limit;
int buy_count;
public:
blsh_strategy();
virtual void process_bar(price_bar b);
... | true |
189e7ee8f65438a087ea9fc2b9273bd468861072 | C++ | AdrianNostromo/CodeSamples | /CPP_Joc_Windows_Android/SH_Client_Win_Cpp_Cmake/App/src/base/exceptions/NotImplementedException.h | UTF-8 | 291 | 2.578125 | 3 | [] | no_license | #pragma once
#include <exception>
#include "Exception.h"
struct NotImplementedException : public Exception {
public:
NotImplementedException()
: Exception()
{
//void
}
const char * what() const throw () {
return "NotImplementedException";
}
};
| true |
eaf875adcfecbdc8f766bf8c46ab5a230c1ac905 | C++ | Eugene851001/MovingSprite | /Player.cpp | UTF-8 | 2,032 | 3.03125 | 3 | [] | no_license | #include "Player.h"
#include <cmath>
Player::Player(int x, int y, int width, int height, float speed, HANDLE hndSprite, RECT window)
{
this->x= x;
this->y = y;
this->width = width;
this->height= height;
this->speed = speed;
this->window = window;
angle = 0;
scale = 1;
GetObject(hndSprite, sizeof(BITMAP), &Bm... | true |
0f03ab481a33d1be42b2c7fd9b219abd488f007d | C++ | tmdarwen/ArmCortexSynth | /Tests/AudioGeneration-UT/WaveFileWriter.cpp | UTF-8 | 7,327 | 2.984375 | 3 | [
"MIT"
] | permissive | #include <AudioGeneration-UT/WaveFileWriter.h>
#include <AudioGeneration-UT/Exception.h>
WaveFileWriter::WaveFileWriter(const std::string& filename, std::size_t sampleRate) :
filename_{filename}, sampleRate_{sampleRate}, sampleCount_{0}
{
fileStream_.open(filename_, std::ios::out | std::ios::binary);
if(!f... | true |
46fa5f88fff35885050231bb40a3f11982c56f54 | C++ | Stephen321/FYP | /include/Camera.h | UTF-8 | 307 | 2.609375 | 3 | [] | no_license | #pragma once
#include "SFML\Graphics.hpp"
class Camera
{
public:
Camera();
void init(float windowWidth, float windowHeight, int moveSpeed);
sf::View getView() const;
void update(float dt);
void pollEvents(sf::Event evt);
private:
sf::View m_view;
float m_zoom;
bool m_zooming;
int m_moveSpeed;
}; | true |