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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8fb299b5a028899f3907c32a0f74106018f3f823 | C++ | elf11/client_server_application | /MessageArchive.cpp | UTF-8 | 3,640 | 2.765625 | 3 | [] | no_license | #include <arpa/inet.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <utility>
#include "MessageArchive.h"
#include "commons.h"
using namespace std;
bool MessageArchive::addMessage(const struct user_info &info, const char* message) {
FILE *f;
char buffer[256];
char port_str... | true |
915b9e2c6d5d4d82c97b352f4499b5205f048f4e | C++ | NicholasFan235/Codewars | /SymbolicDifferentiationOfPrefixEquations.cpp | UTF-8 | 12,119 | 3.546875 | 4 | [] | no_license | #include <bits/stdc++.h>
class term{
public:
std::string value;
term *t1 = nullptr, *t2 = nullptr;
public:
term(){
t1 = nullptr;
t2 = nullptr;
};
term(const term& t) = default;
term(std::string v){
value = v;
t1 = nullptr;
t2 = nullptr;
}
~term(){... | true |
81df7c7e225932302bbf61a36f810c06d39a44cb | C++ | pasbi/Splines | /Tools/tangenttool.cpp | UTF-8 | 1,743 | 2.625 | 3 | [] | no_license | #include "tangenttool.h"
#include "Objects/spline.h"
#include <QDebug>
#include "Dialogs/pointeditdialog.h"
REGISTER_DEFN_TYPE(Tool, TangentTool);
Point* TangentTool::_currentPoint = 0;
TangentTool::TangentTool()
{
}
bool TangentTool::canPerform(const Object *o) const
{
if (!o->inherits(CLASSNAME(Spline))) retu... | true |
a0602450288b4a21846986649ece0ed39afcd783 | C++ | Ipiano/Maze-Runners | /Maze/Interfaces/mazepartitioner.h | UTF-8 | 1,106 | 3 | 3 | [] | no_license | #ifndef _MAZEPARTITIONER_H
#define _MAZEPARTITIONER_H
#include "../types.h"
#include "backend_types.h"
template<class PlayerDataType, class Tile>
class MazePartitioner
{
public:
virtual ~MazePartitioner(){}
/*
* Returns an array which contains a subsection of a maze
*
* width, height - Dime... | true |
a77f2b457636dd6bc2997fe840f378f5a2584ed5 | C++ | aswingler1/TopTenList | /TopTenList.cpp | UTF-8 | 599 | 3.1875 | 3 | [] | no_license | //Manages a list of top ten hyperlinks
#include <string>
#include <iostream>
#include "TopTenList.h"
#include "Hyperlink.h"
#include "IDirectionable.h"
using namespace std;
TopTenList::TopTenList()
{
_list.resize(10);
}
void TopTenList::set_at(int index, Hyperlink link)
{
_list[index-1] = link;
}
Hyperlink TopTe... | true |
8263f7af1f9599f6c4b1dd53dea799bcac41450d | C++ | iamarjun45/leetcode | /Dynamic Programming/Unique Paths II.cpp | UTF-8 | 839 | 2.625 | 3 | [] | no_license | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
int rows=obstacleGrid.size();
if(rows==0)
return 0;
int cols=obstacleGrid[0].size();
long long dp[rows][cols];
memset(dp,0,sizeof(dp));
for(int i=rows-1;i>=... | true |
f8bb4d76b26aade0938f97ae6bc8e7e890c932e8 | C++ | manso-pedro/2021-1-exercicio-revisao-refatoracao | /Imovel.cpp | UTF-8 | 926 | 2.90625 | 3 | [] | no_license | #include "Imovel.hpp"
Imovel::Imovel(double area, int quartos, int banheiros, int vagas, double valorm2, Cliente *vendedor, string corretor){
this->area = area;
this->quartos = quartos;
this->banheiros = banheiros;
this->vagas = vagas;
this->valorm2 = valorm2;
this->vendedor = vendedor;
this->corretor ... | true |
1d9db7743853bef26377bad831080f1d284894f9 | C++ | RafaelFabris/Intepretador-E-Tradutor-MiniPascal | /BasicIntAST/teste.cpp | UTF-8 | 240 | 2.65625 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main(){
int x[5-0];
int y;
x[1]=3;
if(x[1]>2){x[1]=4;
while(x[1]>3){
cout<<"curry"<<endl;
x[1]=x[1]-1;
cout<<x[1]<<endl;
}for(;x[1]<3;x[1]=x[1]+1){cout<<"OLA"<<endl;
}}return 0;}
| true |
2f2b7d125be0c8d6a7cc944f6c8ac5cd79f15bb6 | C++ | LauZyHou/Algorithm-To-Practice | /LintCode/101.cpp | UTF-8 | 598 | 3.171875 | 3 | [
"MIT"
] | permissive | class Solution {
public:
/**
* @param A: a list of integers
* @return : return an integer
*/
int removeDuplicates(vector<int> &v) {
const int lx = 2;//连续的个数
int len = v.size();
if(len<lx)
return 0;
int r = lx;//新插入的位置
//判断前面的有几个连续,连续的是谁
int cnt = 1;
int t = v[r-1];
for(in... | true |
452a0653afc49b06f5350b1b3f9116bcffa43846 | C++ | Voley/Algorithmic-Problems | /Strings/IsPermutation/main.cpp | UTF-8 | 889 | 3.8125 | 4 | [
"MIT"
] | permissive |
// main.cpp
// IsUnique
#include <iostream>
#include <map>
#include <string>
bool isPermutation(const std::string& first, const std::string& second);
int main() {
std::cout << isPermutation("hello", "ehlol") << std::endl;
std::cout << isPermutation("First", "striF") << std::endl;
std::cout << isP... | true |
a1c56fa96b52917003530e74d49c0df4497bd996 | C++ | radtek/PDV | /labs/2/benchmark.cpp | UTF-8 | 2,935 | 2.90625 | 3 | [
"MIT"
] | permissive | //
// Created by karel on 12.2.18.
//
#include <chrono>
#include <iostream>
#include <thread>
#include "PDVCrypt.h"
#include "decryption.h"
using namespace std;
using namespace std::chrono;
typedef vector<pair<string, enc_params>> messages_t;
int main(int argc, char **argv) {
// Inicializace pomoci nahodneho t... | true |
5eee4d239ee1fb7e3df281cfc241eaa274e94215 | C++ | prakaashghimire/C_C- | /Programming/recursive.cpp | UTF-8 | 283 | 3.09375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
int add(int,int);
int main(){
int a,b,c;
printf("enter any two no.");
scanf("%d%d",&a,&b);
c=add(a,b);
printf("sum=%d",c);
return 0;
}
int add(int x,int y)
{
if(x==0&&y==0){
return 0;
}else{
return x%10+y%10+add (x/10, y/10);
}
}
| true |
9c9544a2cd806bb0573d6ffa0c25028745f42b84 | C++ | Asganafer/Arduino | /INVIO_RICEV_INFRAROSSI/invio_infra/Infrarossi.ino | UTF-8 | 2,337 | 2.609375 | 3 | [] | no_license | #define I2 3
#define I1 2
#define A 13
#define B 12
#define C 11
#define D 10
#define time 500
void setup() {
Serial.begin(9600);
pinMode(A, INPUT);
digitalWrite(A, LOW);
pinMode(B, INPUT);
digitalWrite(B, LOW);
pinMode(C, INPUT);
digitalWrite(C, LOW);
pinMode(D, INPUT);
digitalWri... | true |
9dc437ac6496d30040fc56ed52d21e67c75bf313 | C++ | inouetmhr/FitbikeConnector | /arduino/cadence-counter.ino | UTF-8 | 991 | 2.9375 | 3 | [] | no_license | #include <avr/sleep.h>
int PIN = 3;
int rpm_max = 150;
int wait = 60 * 1000.0 / rpm_max ;
void setup()
{
Serial.begin(9600);
pinMode(PIN, INPUT_PULLUP); // default High
//Serial.print(wait);
set_sleep_mode(SLEEP_MODE_PWR_DOWN); //スリープモードの設定
//attachInterrupt(1, wakeUpNow, FALLING); // use interrupt 1 (pin... | true |
18c151e28e7d6b6d3a89ab2d22002dbf6115eb8a | C++ | Lugswo/PokeMMO | /PokeMMO/Camera.cpp | UTF-8 | 1,141 | 2.515625 | 3 | [] | no_license | #include "Camera.h"
#include <gtc/matrix_transform.hpp>
#include "GameObjectFactory.h"
#include "Transform.h"
#include "Editor.h"
#include "InputManager.h"
Camera* Camera::instance;
void Camera::Init()
{
position = glm::vec3(0.f, 0, 3);
jumbo = glm::vec3(0.f, 0, -2);
}
Camera* Camera::GetInstance()
{
if (!i... | true |
97e53d01ff317346fa9a0a4432ca4495e183b119 | C++ | RAHULSHARMA63/Basic-salary | /Basic salary.cpp | UTF-8 | 586 | 3.171875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
float s,b,n=0;
cout<<"enter your salary";
cin>>s;
if(s>=15000)
{
b=(s*10)/100;
n=s+b;
cout<<"your salary is:"<<s;
cout<<"\nyour bonus is:"<<b;
cout<<"\nyour net salary is:"<<n;
}
if(s>=10000&&s<15000)
{
b=(s*b)/100;
n=s+b;
c... | true |
c49b758a722badd1dd1192825c065a8926276a10 | C++ | kanhaiyatripathi/cplusplusKP2 | /Mathematics/multiplicative_inverse.cpp | UTF-8 | 351 | 3.6875 | 4 | [] | no_license | #include<iostream>
using namespace std;
int modInverse(int a, int m)
{
a = a%m;
for (int x=1; x<m; x++)
if ((a*x) % m == 1)
return x;
}
int main()
{
int a,m;
cout<<"Enter the value of a : ";
cin>>a;
cout<<"Enter the value of m : ";
cin>>m;
cout << modInverse(... | true |
b804881d86f89ba44ccc864410d10ac6db8fd32d | C++ | Ankit152/my_codes | /codes/c++_codes/self_practice/linked_lists/queue_ll.cpp | UTF-8 | 1,587 | 3.859375 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
node *next;
node(int data){
this->data=data;
next=NULL;
}
};
void insert_end(node *&head,int data){
if(head==NULL){
head=new node(data);
return;
}
node *temp... | true |
4bf1f090cf6799e019220fc198e4f62ff731628c | C++ | Trietptm-on-Coding-Algorithms/leetcode-4 | /src/Implement strStr()/Implement strStr().cpp | UTF-8 | 555 | 3.171875 | 3 | [] | no_license | class Solution {
public:
int strStr(char *haystack, char *needle) {
if(!needle || !haystack ) return -1;
char *p1 = haystack;
while(1)
{
char *now = p1, *p2 = needle;
while(1)
{
// reach the end of needle, has substring, return index
if(!(*p2)) return (int)(p1-haystack);
//... | true |
b80f6492255c3578f6d110f1a96d080e28a6386d | C++ | grork/MixpanelClient | /MixpanelCppCX/PayloadEncoder.cpp | UTF-8 | 2,323 | 2.90625 | 3 | [
"MIT"
] | permissive | #include "pch.h"
#include "payloadencoder.h"
using namespace Platform;
using namespace Windows::Security::Cryptography;
using namespace Windows::Data::Json;
using namespace Windows::Foundation;
using namespace Windows::Globalization::DateTimeFormatting;
using namespace Codevoid::Utilities::Mixpanel;
String^ Codevoid... | true |
9bb5d1e8384937bb923791056901aff48bcf80a3 | C++ | Pimed23/Practica | /Practica 2/1_AdditionalMaterial/1_4_GlobalScope/1_4_1_GlobalVariable.cpp | UTF-8 | 156 | 2.609375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int A = 15;
void sumar() {
cout << A + 1 << endl;
}
int main() {
cout << A << endl;
sumar();
} | true |
32773249c6ff78585709fdd0ad9bf9a97c827c8f | C++ | NPgreatest/Lost-In-World-War-II | /Lost In World War II beta version 1.2.0/Lib/Sql.h | UTF-8 | 1,559 | 3.03125 | 3 | [] | no_license | #ifndef SQL_H
#define SQL_H
#include "All.h"
#include <QRect>
#include<QImage>
#include <QList>
class Sql
{
private:
Player_Sql P1,P2;
//QList<Player> Player_List;
QList<Object_Sql> Object_List;
QList<Object_Sql> Partical_List;
QList<Enemy_Sql> Enemy_List;
public:
Sql();
~Sql... | true |
ee535214be19aca310ad98e92dc224a8102cad15 | C++ | Murilo-ZC/FATEC-MECATRONICA-MURILO | /Microcontroladores-2020-2/Pratica11/prog03.ino | UTF-8 | 3,047 | 2.578125 | 3 | [] | no_license | /*
Programa para trabalhar com a comunicação serial
*/
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const int LED_LIGADO = LOW;
const int LED_DESLIGADO = HIGH;
const int ENTRADA_ACIONADA = LOW;
const int ENTRADA_DESACIONADA = HIGH;
const int LED1 = D5;
const int LED2 = D6;
const int LED3 = D7;
const int EN... | true |
a5379a2ca79db8847733cfeea23f02f5358490b3 | C++ | NENCAO/TANK | /NewTank/EnmeyTank.cpp | GB18030 | 5,792 | 2.90625 | 3 | [] | no_license | #include "stdafx.h"
#include "EnmeyTank.h"
#include "Bullet.h"
#define MAX_STEP 12 //ת䲽
CEnmeyTank::CEnmeyTank()
{
int x = (rand() % (CGraphic::GetBattleGround().GetWidth() - 50)) + 50;
if (x % 25 > 13)
{
x = x + 25 - x % 25;
}
else
{
x = x - x % 25;
}
m_Pos.SetX(x);
... | true |
23796d601a45ce42b9f1bcd931fb5dcc57173c3c | C++ | jiadaizhao/LeetCode | /1101-1200/1189-Maximum Number of Balloons/1189-Maximum Number of Balloons.cpp | UTF-8 | 361 | 2.734375 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int maxNumberOfBalloons(string text) {
vector<int> table(26);
for (char c : text) {
++table[c - 'a'];
}
table['l' - 'a'] /= 2;
table['o' - 'a'] /= 2;
return min({table['b' - 'a'], table['a' - 'a'], table['l' - 'a'], table[... | true |
031c586011e3780a3b40d4407019191a740656b1 | C++ | aburifat/ProblemSolving | /Solve-By-Topic/Algebra/Number Theoretic Functions/Euler's Totient Function/Farey Sequence-UVA-12995.cpp | UTF-8 | 725 | 2.75 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MX=1000000;
vector<ll>phi;
vector<ll>sumPhi;
void phiAll(ll n)
{
phi.resize(n+1);
phi[0]=0;
phi[1]=1;
for(ll i=2; i<=n; i++)
phi[i]=i;
for(ll i=2; i<=n; i++){
if(phi[i]==i){
f... | true |
bcff37a5a8b0a97e5eb4571e1f444363936c2eff | C++ | AlekseiMaide/HackerRankCPP | /algorithms/sorting/quicksort_1_partition.cpp | UTF-8 | 715 | 3.265625 | 3 | [] | no_license | //
// Quicksort 1 Partition.
//
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n{};
int p{};
int x{};
cin >> n >> p;
vector<int> left{};
vector<int> right{};
vector<int> equal{};
equal.push_back(p)... | true |
af2df182f4164ba5338bb4d92424b3469a177d9a | C++ | TimTargaryen/GoldenMiner | /re Golden Miner/gold.h | GB18030 | 1,045 | 2.96875 | 3 | [] | no_license |
#include"object.h"
class gold: public object
{
public:
int gender;//
bool being;//Ƿץ
gold() {
switch (rand() % 6) {
case 0:
display = all + 3; length = 60; width = 60; gender = 0;
backup = all + 32; break;//ɴ
case 1:
display = all + 8; length = 40; width = 40; gender = 1;
backu... | true |
72c81d8f2e3285b4004f92a0ced097536fde5842 | C++ | parkhaeseon/boj | /10451.cpp | UTF-8 | 917 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <math.h>
#include <algorithm>
#include <map>
using namespace std;
vector<int> v[1001];
bool visit[1001] = { false, };
int connect = 0;
void DFS(int start)
{
... | true |
315534b37e0a214c41a36818492a3b27f4a0433b | C++ | ciknowles/CircularFlashWriter | /CircularFlashWriter.cpp | UTF-8 | 3,530 | 3.3125 | 3 | [] | no_license | #include "Arduino.h"
#include "CircularFlashWriter.h"
CircularFlashWriter::CircularFlashWriter() {
}
void CircularFlashWriter::begin(uint8_t csPin) {
flash = new SPIFlash(csPin);
flash->begin();
capacity = flash->getCapacity();
next = getNextAddress();
first = getFirstAddress();
#ifdef CFW_DEBUG
... | true |
351a5b65d90f8195574652d855251f865eb70f69 | C++ | JanneRemes/janityengine | /JanneRemesEngine/Engine/jni/Mesh.cpp | UTF-8 | 5,800 | 2.703125 | 3 | [] | no_license | #include <Mesh.h>
#include <cmath>
#include <Debug.h>
#include <Camera.h>
using namespace JanityEngine;
Mesh::Mesh(int X, int Y, int Z, float scale, const char* objPath)
{
x = X;
y = Y;
z = Z;
LoadObj(objPath);
Debug::CheckGlError("load obj: ");
HandleData();
GenBuffer();
Move(x, y, z);
Resize(scale, scale,... | true |
fa19ad519213167ad84c90dcab48d0b2764b00c7 | C++ | katerina632/Constructor_destructor | /Student.h | UTF-8 | 543 | 2.90625 | 3 | [] | no_license | #pragma once
class Student
{
private:
char* name;
int age;
float avgMark;
int* marksArr;
int countMarks;
bool IsValidAge(int age) const
{
return age >= 0 && age <= 100;
}
void CalcAverageMark();
void DelMemory() const;
public:
Student();
Student(const char* _name, int _age);
~Student()
{
... | true |
d5a77d73359a99578d15c69a257dbc6e6a404991 | C++ | quartuxz/Cryoscom-src | /serializationUtils.cpp | UTF-8 | 4,509 | 2.953125 | 3 | [] | no_license | #include "serializationUtils.h"
std::vector<std::pair<size_t, size_t>> getOutermostBlocks(std::string data){
std::vector<std::pair<size_t, size_t>> retVal;
if(data.find("}") != std::string::npos && data.find("{") != std::string::npos){
}else{
return retVal;
}
std::string cutData = dat... | true |
511dd96aedf1de5d62a820c9af56939eafb6840f | C++ | j3camero/checkers | /bit-string.cc | UTF-8 | 5,085 | 3.390625 | 3 | [] | no_license | #include "bit-string.h"
#include "std.h"
Bitstring::Bitstring() : size(0) {
// Do nothing.
}
Bitstring::Bitstring(bool b) : size(0) {
Append(b);
}
Bitstring::Bitstring(uint64 length) : size(0) {
Resize(length);
}
Bitstring::Bitstring(const Bitstring& b) : size(0) {
Append(b);
}
Bitstring::Bitstring(const s... | true |
594edf9f90701d511983e778981b53a4b2644d23 | C++ | sujiwo/VMML | /vmml/vision_core/src/FeatureTrack.cpp | UTF-8 | 3,130 | 2.671875 | 3 | [] | no_license | /*
* FeatureTrack.cpp
*
* Created on: Mar 10, 2020
* Author: sujiwo
*/
#include <exception>
#include <opencv2/imgproc.hpp>
#include "vmml/FeatureTrack.h"
using namespace std;
namespace Vmml {
void
FeatureTrack::add(const uint& frameNum, const cv::Point2f &pt)
{
frameNumbers.insert(frameNum);
mPoints[... | true |
a0b355cd9f177888b8daeb5928762f315981bc17 | C++ | rlj1202/problemsolving | /baekjoon/1620/main.cpp | UTF-8 | 635 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <unordered_map>
#include <string>
#include <sstream>
using namespace std;
unordered_map<string, string> mapping;
int main() {
ios::ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int N, M;
cin >> N >> M;
for (int n = 1; n <= N; n++) {
string st... | true |
a598ef6ee147f9bfc9e35585ffbc4a1cd4cabe71 | C++ | mahendra-ramajayam/MultiPhaseField | /Grain_Growth/2D/indexed/sorting/sortp.cpp | UTF-8 | 740 | 2.78125 | 3 | [] | no_license |
// find 6 largest eta from the claculation list and assign them back to eta and inds matrix
int sortp(double* maxetas,int* maxinds,double* eta2, int* inds2,int size2, int p,int i, int jn)
{
int ni,ii,maxi;
double maxeta;
for (ni=0;ni<p;ni++)
{
maxeta=maxetas[0];
maxi=0;
for (ii=0;ii<10;ii++)
... | true |
a09e114f0e22264665100b1bdfb5997eccad7bab | C++ | DavesCodeMusings/b64 | /example.ino | UTF-8 | 850 | 2.8125 | 3 | [
"Unlicense"
] | permissive | /*
* Sample Arduino sketch to encode and decode messages.
*/
#include <b64.h>
void setup() {
Serial.begin(115200);
delay(1000);
// Encoding example.
char msg[] = "Hello Cleveland!";
char enc_result[b64enclen(sizeof msg)];
b64enc(msg, enc_result, sizeof msg);
Serial.println(msg);
Serial.println("...... | true |
991a701391a7a80169f1bcf99ef05c051d295f45 | C++ | djanuskaite/Cplus_darbai | /Vector/prekes-cekis/prekes1.cpp | UTF-8 | 1,694 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
struct preke{
string pav;
int kiek;
double kaina;
double suma;
};
ifstream in("prekes.txt");
ofstream out("cekis.txt");
void skaitom (preke P[], int kiekis);
void rasom (preke P[], int kiekis);
... | true |
a68f0cc4673f04da68fe64794025516531be2830 | C++ | amplab/zipg | /core/src/GraphLogStore.cpp | UTF-8 | 5,058 | 2.671875 | 3 | [] | no_license | #include "GraphLogStore.h"
#include "GraphFormatter.hpp"
void GraphLogStore::construct() {
node_table_ = std::make_shared<KVLogStore>(4294967296ULL);
LOG_E("GraphLogStore: Constructing Edge table\n");
edge_table_.construct();
LOG_E("GraphLogStore: Edge table constructed\n");
}
void GraphLogStore::load() {
... | true |
efa4bf9e6489efa9c97c842f8f0b030eaab70a39 | C++ | janfranco27/spoj | /basics/12205.cpp | UTF-8 | 1,515 | 3.5625 | 4 | [] | no_license | /**
* HS12MBR
* Minimum Bounding Rectangle
**/
#include <iostream>
#include <vector>
#include <utility>
typedef std::pair<int, int> point;
typedef std::vector<point> vectorPoints;
void printBoundingRect(vectorPoints& points) {
int min_x = 1001, min_y = 1001, max_x = -1001, max_y = -1001;
vectorPoints::iterato... | true |
b4192dbeaba8fc51e779c92b2a962140138b02bf | C++ | batsnap/eduacation | /programming/c++/labs/lab5/pampampam.cpp | UTF-8 | 3,097 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <clocale>
#include <ctime>
#include <cmath>
#include <fstream>
using namespace std;
const int n = 4, m = 8;
ofstream fout("file.txt");
void FullfillMatrix(float** a) {
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) a[i][j] = -10 + rand() % (10 - ... | true |
c62492f166e5481eb980644a480b4857ed03114c | C++ | santosh500/Cplusplus_Projects | /Maze_Game/main.cpp | UTF-8 | 3,490 | 3.125 | 3 | [] | no_license | /**
File Name: main.cpp
Author: Paul Charles
Date: 11.18.2015
Purpose: File that contains the main.cpp
**/
#include <iostream>
#include <cstdlib>
#include <string>
#include <stdexcept>
#include "MazeReader.h"
#include "MazeWalker.h"
#include "Test.h"
#include "MazeCreationException.h"
#include "Position.h"
using nam... | true |
b77de6ce643236b409373fdd87a49d7a2bceb0cd | C++ | alen0216056/Image_search_by_sketch | /grid.h | UTF-8 | 6,117 | 3.265625 | 3 | [] | no_license | #ifndef __GRID_H__
#define __GRID_H__
#include <queue>
#include <cmath>
#include <vector>
using namespace std;
template<class T>
class grid
{
private:
int w,h,size;
vector<T> map;
public:
grid(int); //given size(default square)
grid(int,int); //given width & height
grid(const vector<T>&); //given vector
int w... | true |
fe67f7ad9796c8fb0aed96477f2f69999a5eff56 | C++ | mirnasumopawiro/Challenges-chapter-3 | /8.cpp | UTF-8 | 1,075 | 3.640625 | 4 | [] | no_license | //
// 8.cpp
// Chapter 3 Programming Challenges
//
// Created by Mirna Sumopawiro on 10/12/16.
// Copyright © 2016 Mirna Sumopawiro. All rights reserved.
// The Yukon Widget Company manufactures widgets that weigh 12.5 pounds each. Write a program that calculates how many widgets are stacked on a pallet, based on ... | true |
a4077ef684c5043d811cf680376a2322ada749df | C++ | pokutan/eng_train | /EnglishTraining/gen_random.h | UTF-8 | 1,348 | 3.140625 | 3 | [] | no_license | #pragma once
#include <random>
#ifndef CLASS_NO_COPY_NO_MOVE
#define CLASS_NO_COPY_NO_MOVE(__class_name__) \
__class_name__(const __class_name__&) = delete; \
__class_name__& operator =(const __class_name__&) = delete; \
__class_name__& operator =(__class_name__&&) = delete; ... | true |
cb3e72948547e1e85376334b35eab4912049148d | C++ | hariganesan/zombie-roll | /src/Battle.hpp | UTF-8 | 1,334 | 2.8125 | 3 | [] | no_license | // Hari Ganesan 3/20/13
// zombie-roll: Battle library file
#include "Actor.hpp"
#include <vector>
#include <list>
using std::vector;
using std::list;
class Game;
class View {
string id;
};
class Area {
public:
double averageEnemyLevel;
double battlePercent;
Area(double b) {
battlePercent = b;
}
unsigned... | true |
ede62bcecdb82e3f599fbaf31e3aeca732b98128 | C++ | ag2888/C-- | /code-4/pair.cc | UTF-8 | 1,893 | 3.375 | 3 | [] | no_license | /*
* Object-Oriented Programming
* Copyright (C) 2013 Thomas Wies
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be ... | true |
3b7471f240ec5e3f81e4006eb6d612b45d527c97 | C++ | magdyali7/gosu | /Gosu/Image.hpp | UTF-8 | 6,076 | 2.875 | 3 | [
"MIT"
] | permissive | //! \file Image.hpp
//! Interface of the Image class and helper functions.
#ifndef GOSU_IMAGE_HPP
#define GOSU_IMAGE_HPP
#include <Gosu/Fwd.hpp>
#include <Gosu/Color.hpp>
#include <Gosu/GraphicsBase.hpp>
#include <Gosu/TR1.hpp>
#include <memory>
#include <vector>
namespace Gosu
{
//! Provides functionality for d... | true |
87602c044dc73b7f52cf16018f3a1b616fd2f7ac | C++ | aaniket/CNS | /playfair.cpp | UTF-8 | 1,389 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
char grid[5][5];
int marked[26];
void fill(string key){
for(int f=0;f<26;f++){
marked[f]=0;
}
for(int i=0;i<5;i++){for(int j=0;j<5;j++){grid[i][j]='`';}}
int i=0,j=0;
int l=key.length();
for(int k=0;k<l;k++){
if(marked[key[k]-'a']==0){
marked[key[k]-'a']=1;
... | true |
bb5e11cd56d7162c06373a0bb263002574e2011b | C++ | masdevas/algostruct-old | /algostruct/tests/unit/sort/k_merge_sort.cpp | UTF-8 | 1,172 | 2.984375 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <algorithm>
#include "sort/k_merge_sort.h"
#include "data_generation.h"
TEST(TEST_K_MERGE_SORT, RANDOM_TEST) {
size_t size = 1000;
size_t count_parts = 100;
using DataType = double;
double lower_bound = 0, upper_bound = 10000;
auto data = GenerateRandomVectorReal(s... | true |
40b89d2605bc8e42257723297102a000dd2848f7 | C++ | James3039/OhMyCodes | /Others/Mssctf2020/PPC3.cpp | UTF-8 | 642 | 2.578125 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <iostream>
using namespace std;
string s, subs[100005];
int t, n, len, les;
int main(){
scanf("%d", &t);
for(int i=0; i<t; i++){
scanf("%d", &n);
cin >> s;
len=s.length();
les=len-((len/n)*n);
for(int i=0; i<les; i++){
subs[i]=s.substr(i*(len/n+1), len/n+1);
}
for(int i=l... | true |
c0e4c4b670ff0a90cc33db3de1a5cbb3fb564757 | C++ | Xerewulf/Summerize-your-money-with-file | /Summerize your money/lab8filesneredeydimbenböyle/Source.cpp | ISO-8859-9 | 1,008 | 3.015625 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
// banlnot sayc
void divade(int num,int *num1, int *num2, int *num3, int *num4, int *num5) {
*num1 = num/100;
*num2 = num % 100 / 50;
*num3 = num % 50 / 20;
*num4 = num % 20 / 10;
*num5 = num % 10 / 5;
}
int main() {
int stat,num,num1... | true |
e99c3d3e9e334bc0bf220bf57c28493986304200 | C++ | goofi0211/datastructure | /ncku oj/探望麻衣.cpp | UTF-8 | 1,261 | 2.703125 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
const int maxn=500000;
using namespace std;
int main(){
vector<vector<int>> adj;
int city,edge;
cin>>city>>edge;
vector<pair<int,int>>dis;
for(int i=0;i<=city;i++){
vector<int> temp;
for (int j=0;j<=city;j++){
... | true |
6cf8ded26d9131658b6f713874bd9caee4792578 | C++ | Stukeley/spoj-csharp | /SUMAN.cpp | WINDOWS-1252 | 226 | 2.6875 | 3 | [] | no_license | // Obviously this isn't C# either, but that wasn't my choice \_(?)_/
//131 points
#include <iostream>
using namespace std;
int main()
{
int n;
while (cin>>n)
cout<<((1+n)/(float)2)*n<<endl;
return 0;
}
| true |
0e7b9d1fd1e57df61e47863e87b087b445db0be4 | C++ | menanagy/Algorithms | /C++/Linear_Search/main.cpp | UTF-8 | 723 | 4.03125 | 4 | [] | no_license | #include <iostream>
using namespace std;
int search(int arr[], int sizeArray, int element)
{
int index;
for (index = 0; index < sizeArray; index++)
if (arr[index] == element)
return index;
return -1;
}
// Driver code
int main(void)
{
int arr[] = { 2, 3, 4, 10, 40 };
int element... | true |
5a07cd5ea94d96ca2427f51fd2d493a8a57fccd7 | C++ | HardPlant/DataStructure | /ConsoleApplication3/1.cpp | UHC | 881 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Coffee {
public:
Coffee()
{
cout << "<Ŀ>" << endl;
}
};
class Latte : public Coffee {
public:
Latte()
{
print("");
}
void print(string n) // κ̹Ƿ Coffee ű .
{
cout << n << " Դϴ." << endl;
}
};
class Mocha : public Coffee {
public:
Mo... | true |
9138a8595da164a216e57b67a72cfea492a947d4 | C++ | aphill70/ckWC1984 | /inc/StopWords.h | UTF-8 | 914 | 2.890625 | 3 | [] | no_license |
#ifndef STOPWORDS_H
#define STOPWORDS_H
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
/*
*
*
*
*
*
*/
class StopWords{
private:
int containerSize;
string* stopwords;
int lineCount;
public:
// default constructor
StopWords();
// defa... | true |
b9724acc8d40b7dd54b1696d4ed571a7748c0ea0 | C++ | sopyer/Shadowgrounds | /game/UnitInventory.h | UTF-8 | 1,595 | 3.109375 | 3 | [] | no_license |
#ifndef UNITINVENTORY_H
#define UNITINVENTORY_H
namespace game
{
class Game;
class Unit;
class Item;
class UnitInventory
{
public:
// returns true on success, if an item was added
static bool giveUnitItem(Game *game, Unit *unit, const char *itemName);
// returns true on success, if an item was remo... | true |
2032e1580ad35d13bafcc80d6e86519ae641ec77 | C++ | wuolayuju/BluetoothArduinoShowcase | /arduino/BT_Android_Control_LEDS/BT_Android_Control_LEDS.ino | UTF-8 | 989 | 3.15625 | 3 | [] | no_license | String readString;
char c;
int redLED = 10;
int yellowLED = 11;
int greenLED = 12;
void setup() {
pinMode(redLED,OUTPUT);
pinMode(yellowLED,OUTPUT);
pinMode(greenLED,OUTPUT);
Serial.begin(115200);
Serial.println("Ready for connection");
Serial.println("Go on, type something");
}
void loop() {
while(Ser... | true |
01bd994833f2d8661aafde602b0c6be655b97536 | C++ | meniossin/src | /third_party/angle/src/tests/gl_tests/AttributeLayoutTest.cpp | UTF-8 | 12,889 | 2.8125 | 3 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// AttributeLayoutTest:
// Test various layouts of vertex attribute data:
// - in memory, in buffer object, or combination of both
// - fl... | true |
eb7a9f02f3360bc038e63ee51d728d57e8151b46 | C++ | Han-songyang/cpp | /c++.3.20/c++.3.20/c++.3.20.cpp | GB18030 | 678 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
void test1()
{
string str = "12345";
//ʼλõĵ
string::iterator it = str.begin();
for (; it != str.end(); it++)
{
//Ľ
cout << *it << " " ;
}
}
void test2()
{
string str="12345";
string::reverse_iterator it = str.rbegin();
while (it != str.rend())
... | true |
c5c87c4998e600dbf285618aa123fd2e76c548e1 | C++ | manishmotwani2002/30dayschallenge | /day 13 (DP)/knapsack 0 1 recursive.cpp | UTF-8 | 1,080 | 3.328125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Returns the maximum value that
// can be put in a knapsack of capacity W
int max(int a,int b)
{
return a>b ? a : b;
}
int knapSack(int W, int wt[], int val[], int n)
{
if(n==0 || W==0)
return 0;
if(wt[n-1]<=W)
... | true |
3015a3b1403a9b9934bda86e37404ebaa5ad64d9 | C++ | RainforZurich/CCpp2017 | /practices/cpp/level1/p01_Queue/main.cpp | UTF-8 | 453 | 3 | 3 | [] | no_license | #include "queue.h"
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
Queue queue;
int data[100];
int i=0;
while(1)
{
queue.isEmpty();
cout <<"please input the numbers";
cin >> data... | true |
ce976ddb2ff731fff1e7f4dfa0701bbb0bde9378 | C++ | gowtham1197/ncrwork | /Data Structures/cqueue.cpp | UTF-8 | 2,003 | 3.796875 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class queuee
{
int *arr,size,rear,front;
public:
queuee()
{
rear=front=-1;
size=0;
arr=NULL;
}
void getsize(int n)
{
arr=new int[n];
size=n;
}
bool underflow()
{
if(rear==front&&front==-1)
return true;
else
return false;
}
bool overfl... | true |
6e6370412cc4d93c55531f62f8e793afd8d1acf9 | C++ | kennykyliu/sudoku-solver | /unitest-SudokuValidator.cpp | UTF-8 | 1,205 | 3.53125 | 4 | [] | no_license | #include "util.h"
#include "sudoku-validator.h"
int main() {
ifstream dataFile;
dataFile.open("sudoku-data.txt");
vector<vector<int> > board(9, vector<int>(9, 0));
int row = 0;
int col = 0;
int num = 0;
if (!dataFile.good()) {
cout << "Fail to open file [sudoku-data.txt]." << endl;... | true |
ce8e9328fdce48493573fca816e2f8268132ed58 | C++ | tvdinh1008/Thuat_toan_ung_dung | /Duong_Di_NN_Priovity_Queue.cpp | UTF-8 | 3,546 | 2.984375 | 3 | [] | no_license | #include<iostream>
#include<vector>
#define MAX 100001
using namespace std;
vector<int> A[MAX];//ds kề
vector<int> C[MAX]; //trọng số của cạnh
int N, M;
int s, t;//tìm đường đi ngắn nhất từ s->t
int result;
//mỗi 1 node trên cây sẽ chứa đỉnh v và d[v]
int node[MAX];//chứa đỉnh v
int idx[MAX];//là chỉ số của... | true |
981021df51092d5e4580c70d83cfab9b268727e5 | C++ | alirezafour/practice | /cpp/Practice/Seasen 1/Section 1/MojsazanPractice/18-count function.cpp | UTF-8 | 254 | 3 | 3 | [] | no_license | #include <cstdio>
int main(int argc, char const *argv[])
{
int x,y;
printf("insert X: ");
scanf("%d", &x);
if(x < 0)
{
y = 1 - (2 * x);
}
else if(x = 0)
{
y = 0;
}
else
{
y = 1 + (2 * x);
}
printf("\ny = %d\n", y);
return 0;
} | true |
4d4415eab1bcb1c45319fae6a29c1cb97663bc44 | C++ | MagicSen/C_Plus_Plus_Primer | /test_11_2_3_1.cpp | UTF-8 | 657 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <string>
#include <utility>
using namespace std;
int main()
{
vector<pair<string, int>> string_sequence;
string temp_str;
int temp_int;
while(cin >> temp_str >>... | true |
423c15a48714584aa36d08df57b42c843413c90c | C++ | oasiskharkov/Blackjack | /person.cpp | UTF-8 | 821 | 3.453125 | 3 | [] | no_license | #include "person.h"
Person::Person(std::string&& name) :
m_name{std::move(name)}
{
}
Hand& Person::hand()
{
return m_hand;
}
const Hand& Person::hand() const
{
return m_hand;
}
const std::string Person::name() const
{
return m_name;
}
bool Person::isBusted() const
{
return m_hand.total() > GamePara... | true |
06c2f79833b94468c7dfcf774b2bb5509e01acfb | C++ | E-BAO/SimpleGL | /simpleGL/SimpleMath.cpp | UTF-8 | 669 | 3.03125 | 3 | [] | no_license | //
// SimpleMath.cpp
// simpleGL
//
// Created by EBAO on 2017/5/27.
// Copyright © 2017年 EBAO. All rights reserved.
//
#include "SimpleMath.h"
void swap(int &a,int &b){
int c = a;
a = b;
b = c;
}
void swap(float &a,float &b){
float c = a;
a = b;
b = c;
}
void swap(color_s &a,color_s &b)... | true |
5313f5d4c85a986ae6c141d7b860dbac79d2689b | C++ | luongpd2000/Data-structures-and-algorithms | /ConTest1(Demo)/B15.cpp | UTF-8 | 459 | 2.84375 | 3 | [] | no_license | #include<iostream>
#include<math.h>
using namespace std;
void xuly(int a[100000],int n){
int ktra=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n-1;j++){
if(a[i]==a[j]){
cout<<a[i]<<endl;
ktra=1;
break;
}
}
if(ktra==1) break;
}
if(ktra==0) cout<<"NO"<<endl;
}
int main(){
int... | true |
35ce98890f81ca5f9c58cf7bb0015bc52036bc6e | C++ | Nakio195/OSSAM-20 | /Items/Weapons/Bullet.h | UTF-8 | 1,923 | 2.75 | 3 | [] | no_license | #ifndef BULLET_H
#define BULLET_H
#include <string>
#include <iostream>
#include <SFML/Graphics.hpp>
#include "Entities/Entity.h"
#include "System/Animation.h"
using namespace std;
class Weapon;
class Spaceship;
class Bullet : public Entity
{
public:
enum Type{Laser, Missile};
public:
Bul... | true |
6c25ccf88b8fc260baa9b225efab5677d3b20a1e | C++ | wwt17/BZOJ | /1629 [Usaco2007 Demo]Cow Acrobats.cpp | UTF-8 | 460 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #include <cstdio>
#include <algorithm>
#define inf 2000000000
int N,i;
struct cow {
int w,s,sum;
void read() {
scanf("%d%d",&w,&s);
sum=w+s;
}
} c[50000];
inline bool cmp(const cow &a,const cow &b) {
return a.sum<b.sum;
}
int main() {
scanf("%d",&N);
for (i=0;i<N;++i) c[i].read();
std::sort(c,c+N,cmp);
int ... | true |
b4ded0cb920c6fda381d19e6ba8e8fd003f2bef3 | C++ | lunarnuts/numerical-methods | /Project/montecarlo.cpp | UTF-8 | 4,445 | 2.59375 | 3 | [] | no_license | #include "montecarlo.h"
unsigned seed = (unsigned)std::chrono::system_clock::now().time_since_epoch().count(); //setup seed for RV generator
std::mt19937 generator;
std::normal_distribution<double> normal(0, 1.0);
Asian_vanilla_call_option::Asian_vanilla_call_option(const int &n, // n of divisions
... | true |
38a397c532717a815fbc5891017469e673ac604c | C++ | tangodown1934/Algorithm-judge | /source/1ton1/1648014_AC_0.08SEC.cpp | UTF-8 | 245 | 2.96875 | 3 | [] | no_license | #include <stdio.h>
int main()
{
int number;
int result=0;
scanf("%d", &number);
for (int i = 1; i <= number; i++)
{
printf("%d", i);
result += i;
if (number == i) break;
printf("+");
}
printf("=%d \n", result);
return 0;
} | true |
ae914501ab2bd6fa3c9e6f4df46a5a15f0ab2476 | C++ | microsoft/CCF | /src/apps/tpcc/app/tpcc_setup.h | UTF-8 | 15,149 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache 2.0 License.
#pragma once
#include "tpcc_common.h"
#include "tpcc_tables.h"
#include <exception>
#include <set>
#include <stdint.h>
namespace tpcc
{
class SetupDb
{
private:
ccf::endpoints::EndpointContext& args;
... | true |
9973588a838fa567b2b3c806e3eb44d14b900459 | C++ | kcwzzz/KCW | /cocos/170727/170727 MolesBackup_1/Classes/CScrollBg.cpp | WINDOWS-1252 | 1,535 | 2.78125 | 3 | [] | no_license | #include "CScrollBg.h"
CScrollBg::CScrollBg()
{
mpScene = NULL;
mpSpriteA = NULL;
mVecA.x = 0.0f;
mVecA.y = 0.0f;
mpSpriteB = NULL;
mVecB.x = 0.0f;
mVecB.y = 0.0f;
mScrollSpeed = 0.0f;
mZOrder = 0.0f;
}//ʱȭ
CScrollBg::~CScrollBg()
{
}
void CScrollBg::Create(float tScrollSpeed, float tZOrder)
{
mScrol... | true |
522344cc26257283ef074a0b45ebd14da85e1b02 | C++ | Toleishuangfeng/CPlus | /SortingAdvance/Optional-03-ShellSort-MergeSort-and-QuickSort comparision/MergeSort2.h | GB18030 | 967 | 3.3125 | 3 | [] | no_license | #include<iostream>
using namespace std;
template <typename T>
void _merge2(T arr[], T aux[],int l, int mid, int r) {
for (int i = l; i <= r; i++) {
aux[i ] = arr[i];
}
int i = l, j = mid + 1;
for (int k = l; k <= r; k++) {
if (i > mid) {
arr[k] = aux[j];
j++;
}
else if (j > r) {
arr[k] = aux[... | true |
0bc4323752ec08a6aa3384064d1182e2ef91f17c | C++ | Bhawna11agg/Competitive | /Maths/FizzBuzz.cpp | UTF-8 | 575 | 3.234375 | 3 | [] | no_license | vector<string> Solution::fizzBuzz(int A) {
vector<string>vect;
int i=1;
while(i<=A){
string name="";
if(i%3==0 && i%5==0){
vect.push_back("FizzBuzz");
i++;
continue;
}
if(i%3==0){
vect.push_back("Fizz");
i++;
continue;
}... | true |
fe9b8ac2c8151e4f1e5719bec6645df73693580f | C++ | hannapeters/losing-chess | /Helper.h | UTF-8 | 618 | 3.03125 | 3 | [] | no_license | #ifndef HELPER_H
#define HELPER_H
#include <random>
#include <iterator>
int gen_rand_num(int min, int max);
enum Type{king, queen, bishop, knight, rook, pawn};
template<typename Iter, typename RandomGenerator>
Iter select_random_element(Iter start, Iter end, RandomGenerator& g){
std::uniform_int_distrib... | true |
c014e471ecd5b6dedd88044478b74bee3b37aaf0 | C++ | edenreich/console-component | /src/include/console/input.h | UTF-8 | 2,128 | 3.078125 | 3 | [
"MIT"
] | permissive | #ifndef INPUT_H
#define INPUT_H
#include "interfaces/input_interface.h"
#include "interfaces/application_interface.h"
namespace Console
{
/**
* The Input Class
*/
class Input : public Interfaces::InputInterface
{
public:
/**
* Initialize the application interface.
... | true |
8dbc6533cbf70f0ce3216a58ef2cc6a1284d839c | C++ | zhoujf620/LeetCode-Practice | /C++/1319.number-of-operations-to-make-network-connected.cpp | UTF-8 | 2,770 | 3.453125 | 3 | [] | no_license | /*
* @lc app=leetcode id=1319 lang=cpp
*
* [1319] Number of Operations to Make Network Connected
*
* https://leetcode.com/problems/number-of-operations-to-make-network-connected/description/
*
* algorithms
* Medium (53.47%)
* Likes: 476
* Dislikes: 7
* Total Accepted: 19.9K
* Total Submissions: 37.1K
... | true |
1feb5ee7bc5ce4f71ae8c0caef69e5698392f20b | C++ | UAMiky/tetrisino | /include/melody_player/IMelodyPlayer.hpp | UTF-8 | 1,213 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | /**
* A melody player for Arduino
* by Miguel Company (UAMike)
*/
#ifndef UAMIKE_MELODY_PLAYER_IMELODYPLAYER_HPP
#define UAMIKE_MELODY_PLAYER_IMELODYPLAYER_HPP
#include "../interfaces/IStoppable.hpp"
namespace uamike {
namespace melody_player {
// Forward declaration of Note
struct Note;
/// An interface for a ... | true |
d3ec8b33be9d0e132d540a21febd86c8ac50dd74 | C++ | spectre-team/native-algorithms | /src/Spectre.libGenetic.Tests/ParentSelectionStrategyTest.cpp | UTF-8 | 3,959 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /*
* ParentSelectionStrategyTest.cpp
* Tests generation.
*
Copyright 2017 Grzegorz Mrukwa, Wojciech Wilgierz
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2... | true |
3180d282b5280f432fb368a9bdb4dc04dacd6a6d | C++ | BiralTuya/Contests | /contest 11/g.cpp | UTF-8 | 657 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include<cstdio>
using namespace std;
int main () {
int t;
scanf("%d",&t);
while(t--){
int first[10000];
int second[10000];
vector<int> v(10000);
vector<int>::iterator it;
int m,n;
cin>>m>>n;
... | true |
00e5a37c565c7c9d54dbd114d1e77f79ca98371b | C++ | Remi-Coulom/joedb | /test/compiler/generate_translation_header.cpp | UTF-8 | 1,498 | 2.578125 | 3 | [
"MIT"
] | permissive | #include "db/test_readonly.h"
#include "joedb/io/main_exception_catcher.h"
#include <iostream>
/////////////////////////////////////////////////////////////////////////////
static int generate_translation_header(int argc, char **argv)
/////////////////////////////////////////////////////////////////////////////
{
my... | true |
da5fead85aff12ff631e704244df0da6fd48e95a | C++ | Relics/ACM_Coding | /Poj/2299/11889636_RE.cc | UTF-8 | 546 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int a[50100];
int swapnum;
void bubble_sort(int size)
{
swapnum=0;
bool flag=false;
int i,j;
for(i=0;i<size-1;i++)
{
flag=false;
for(j=0;j<size-1-i;j++)
{
if(a[j]>a[j+1])
{
swap(a[j],a[j+1]);
flag=true;
swapnu... | true |
9b5fb941c389356afbbdc7f8cc69182e6d37b11e | C++ | kunmukh/CS-470 | /CS-470/thread_synchronization/thread.cpp | UTF-8 | 5,553 | 3.375 | 3 | [] | no_license | //File: thread.cpp
//THis project is to implement a senario where there may be multiple
//producers and consumers accessing a bounded buffer as a circular
//queue, each of which is running in a thread.
//---------------------------------------------... | true |
7dff134f06debc26556c4f099f34224dfa9543b3 | C++ | CaoMingAAA/PTA | /pta_work/2018/L2-1.cpp | UTF-8 | 937 | 2.921875 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include <vector>
using namespace std;
const int MAX = 10005;
int N, M, K;
bool isVaild(vector<int>Adj[], vector<int> V)
{
int Np;
cin >> Np;
for (int i = 0; i < Np; i++)
{
int a;
cin >> a;
V[a] = 0;
int len = Adj[a].size();
for (int j = 0; j < len; j++)
if(V[Adj[a]... | true |
ec3ed7a1e309b5ba10a306da4e78559bef8685ea | C++ | jjwmezun/boskeopolis-land-2 | /src/input.cpp | UTF-8 | 1,366 | 2.59375 | 3 | [] | no_license | #include "input.hpp"
namespace Input
{
static constexpr int MAX_INPUT_TYPES = ( int )( Type::__NULL );
static bool held_[ MAX_INPUT_TYPES ] = { false };
static bool pressed_[ MAX_INPUT_TYPES ] = { false };
static bool released_since_reset_[ MAX_INPUT_TYPES ] = { true };
static bool held_for_frame_[ MAX_INPUT_TYP... | true |
66ac5e41b566b97becbd8b0bb892e85c16c49ac0 | C++ | zxjcarrot/iris | /include/formatter.h | UTF-8 | 1,028 | 2.65625 | 3 | [
"MIT"
] | permissive | #ifndef IRIS_FORMATTER_H_
#define IRIS_FORMATTER_H_
#include "define.h"
#include "buffered_writer.h"
#include "utils.h"
namespace iris {
// fomatter do the real formatting logic, output into @obuf
// return false if there is not enough space in @obuf.
typedef void (*formatter_type)(const loglet_t & l, buffered_writer ... | true |
21fcf5c3eef74e28f51c2dec1d4e82fd61eb1439 | C++ | Pingli/SoloProjects | /pacman/src/Game/Character.cpp | UTF-8 | 2,296 | 3.203125 | 3 | [] | no_license | #include "Character.hpp"
#include "../Settings.hpp"
#include "Structs.hpp"
#include <cassert>
Character::Character()
{
positionOffset.x = TILE_WIDTH / 2.0f;
positionOffset.y = TILE_HEIGHT / 2.0f;
}
void Character::MoveToDirection(GameInfo & info, const sf::Vector2i &direction)
{
assert(abs(direction.x) + abs(direc... | true |
4b23083ba9852630b55f9f08a073b3bad5372cc2 | C++ | IgnacioMorillas/Informatica_Grafica_2019-2020 | /Practica1_IG_IgnacioMorillas/objetos_B.cc | UTF-8 | 7,284 | 2.671875 | 3 | [] | no_license | //**************************************************************************
// Práctica 1 usando objetos
//**************************************************************************
#include "objetos_B.h"
//*************************************************************************
// _puntos3D
//********************... | true |
8a737a0019437cf7bed99d222eb81d8bdbdb89b9 | C++ | shivang-saxena/IB | /DataStructure/Math & Array/Merge_Intervals.cpp | UTF-8 | 1,859 | 3.609375 | 4 | [] | no_license | /*
Merge Intervals
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the
intervals were initially sorted according to their start times. Example 1: Given intervals [1,3],[6,9] insert and merge [2,5] would
result in [1,5],[6,9]. Example 2: Give... | true |
c4911fa03affacf6591e1f530c62b86ecf1c9312 | C++ | moonbl3da/bev_prog | /week_07/Drill08/drill08_2.cpp | UTF-8 | 757 | 3.203125 | 3 | [] | no_license | #include "std_lib_facilities.h"
using namespace std;
void swap_v(int a,int b){
int temp;
temp = a;
a = b;
b = temp;
}
void swap_r(int& a,int& b){
int temp;
temp = a;
a = b;
b = temp;
}
/*void swap_cr(const int& a,const int& b){
int temp;
temp = a;
a = b;
b = temp;
} --------------------------Nem mük... | true |
7bd3536fcf410336e493feb60ccdc347f547aeff | C++ | PoojaRani24/Leetcode_Monthly_Challenge | /Diameter of a Binary Tree.cpp | UTF-8 | 437 | 3.078125 | 3 | [
"MIT"
] | permissive | pair<int,int> dfs(Node* root){
if(root==NULL)
return {0,0};
pair<int,int> left=dfs(root->left);
pair<int,int> right=dfs(root->right);
int dia=max(left.first,right.first);
dia=max(dia,(left.second+right.second));
return {dia,max(left.second+1,right.second+1)};
}
/* Computes the diameter ... | true |
3a253e0f64aceedd92b41c949db2745b0ee35490 | C++ | dedoser/cpp_modules | /cpp_03/ex00/main.cpp | UTF-8 | 2,096 | 2.734375 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... | true |
9dfe1d11dc2f7b71decb5a8d33b1301779296cb3 | C++ | markmakemate/Statistic-Learning-Theory | /Algorithms_Layer/kNN/BiNode.h | UTF-8 | 558 | 2.9375 | 3 | [] | no_license | #include<iostream>
#include<cstdlib>
using namespace std;
template<class table>
struct BiNode {
table data; //data, a table object with one row and k columns
table split_point; //split point, a table object with single element
Biode<table>* left; //left child pointer
BSTreeNode<table>* right; //right chi... | true |
a68fde54c1e13c2e24e4ec3e85e8e0a03dd248d0 | C++ | invy/qmlcycling | /riderdata.h | UTF-8 | 2,416 | 2.65625 | 3 | [] | no_license | #ifndef RIDERDATA_H
#define RIDERDATA_H
#include <QObject>
class RiderData : public QObject
{
Q_OBJECT
Q_PROPERTY(qint32 weight READ weight WRITE setWeight NOTIFY weightChanged)
Q_PROPERTY(qint32 bikeWeight READ bikeWeight WRITE setBikeWeight NOTIFY bikeWeightChanged)
Q_PROPERTY(qint32 tireWidth READ ... | true |