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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fd9ede65efec2e8e83b0ce472b3906c62e515f71 | C++ | wes5510/codeforces | /357/A/main.cxx | UTF-8 | 477 | 2.9375 | 3 | [] | no_license | #include <iostream>
int c[100];
int main()
{
int m, x, y, beginnerGrp = 0, intermediateGrp = 0;
std::cin >> m;
for(int i = 0; i < m; i++)
{
std::cin >> c[i];
intermediateGrp += c[i];
}
std::cin >> x >> y;
for(int i = 0; i < m; i++)
{
if(beginnerGrp >= x && beginnerGrp <= y && intermediateGrp >= x && in... | true |
2c5022275e188dba1c3c31ff705a495cb3927b3b | C++ | sysfce2/SFML_Addons | /modules/ParticleSystem/ParticleSystem.hpp | UTF-8 | 4,952 | 3.28125 | 3 | [] | no_license | #ifndef PARTICLE_SYSTEM_HPP
#define PARTICLE_SYSTEM_HPP
#include <map>
#include <list>
#include <SFML/Graphics.hpp>
/**
* ParticleSystem is singleton which stores, updates and draws particles
*/
class ParticleSystem: public sf::Drawable, sf::NonCopyable
{
public:
class Particle;
/**
* Emitters launch particles... | true |
51754b963170d6d65d01bba65e4bb27b7ed192da | C++ | nrupprecht/OpenGLAnimals | /vec2d.hpp | UTF-8 | 1,391 | 3.25 | 3 | [] | no_license | /*
* Author: Nathaniel Rupprecht
* Start Data: May 12, 2017
*
*/
#ifndef __VEC_2D_HPP__
#define __VEC_2D_HPP__
#include "Utility.hpp"
typedef float RealType;
/*
* @class vec2
* Two dimensional vector class
*
*/
struct vec2 {
// Default constructor
vec2() : x(0), y(0) {};
// Initialized constructor
... | true |
f221525f834c99287710447663c86c5838af131f | C++ | wasimsurjo/basicCppProgramming | /Methods - Constructors.cpp | UTF-8 | 632 | 3.8125 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class WasA{
public:
WasA(string z){ /*Constructors with Same Class Name/Used For Easy Communication Between Object & Function & Setting Auto Functions*/
findName(z);
}
void findName (string y){ //This value was sent to cons... | true |
9ca6ec0fa2028911a39ef6e63ad142f63a307cc6 | C++ | voladoddi/ctci | /ch3_Stacks/general/balancedParantheses.cc | UTF-8 | 1,362 | 3.859375 | 4 | [] | no_license | /*
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
Return 0 / 1 ( 0 for false, 1 for true ) for this problem
*/
bool isPair(char a, ch... | true |
a64b5a4ac117ea296b7b5d8ec1cddec28f37944b | C++ | cigui/lab-cse | /lab5/lock_server.cc | UTF-8 | 1,609 | 2.859375 | 3 | [] | no_license | // the lock server implementation
#include "lock_server.h"
#include <sstream>
#include <stdio.h>
#include <unistd.h>
#include <arpa/inet.h>
lock_server::lock_server():
nacquire (0)
{
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cond, NULL);
}
lock_protocol::status
lock_server::stat(int clt, lock_protoco... | true |
d62a34cc7204f8b7573c4f09d3ad672498d79d66 | C++ | paulrahul/algo | /codechef/FROGV1.cc | UTF-8 | 915 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
struct t {
int v;
int idx;
};
bool compare_t(const t& a, const t& b) {
return a.v < b.v;
}
int main() {
int n, k, p;
cin >> n >> k >> p;
vector<t> arr(n, t());
for(int i = 0; i < n; ++i) {
cin >> arr[i].v;
... | true |
24d0e8521272a2176a569539a3aae2be96512be8 | C++ | Plkjaan/Data-structure | /selection_sort.cpp | UTF-8 | 409 | 2.875 | 3 | [] | no_license | //selection sort:w
#include<iostream>
#define n 10
using namespace std;
int main()
{
int min,i,j;
int a[n];
for(i=0;i<n;i++)
{
a[i]=rand()%10;
cout<<a[i]<<" ";
}
cout<<" Sorted array "<<endl;
for(i=0;i<n;i++)
{
min=i;
{
for(j=i+1;j<n;j++)
{
if(a[j]<a[min])
min=j;
swap(a[min],a[i]);
... | true |
9dd6d176cc8570c5e1c715a6f61daca1432956d6 | C++ | eklavaya2208/practice-ml-cp | /Data Structures/week2_priority_queues_and_disjoint_sets/build_heap.cpp | UTF-8 | 1,425 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int min(int a,int b){
if(a<b)
return a;
else
return b;
}
int swap(int arr[],int i){
int temp = arr[i];
arr[i]=min(arr[2*i],arr[2*i+1]);
if(arr[i]==arr[2*i]){
arr[2*i]=temp;
return 2*i;
}
else{
... | true |
cb0b243742a3765d390e3f56adaaed8777498ebc | C++ | hamstache/ExpressionOperatorOverloading | /main.cpp | UTF-8 | 1,065 | 3.21875 | 3 | [] | no_license | #include "Expr_node.h"
#include "Expr.h"
#include <iostream>
using namespace std;
void display(Expr const& e){
cout << e << " = " << e.eval() << endl;
}
int main(){
Expr n(7);
Expr unary("-", 5);
Expr binary("+", 3, 4);
Expr e(Expr("*", unary, binary));
Expr ternary("!=", unary != binary, Expr("*", 20, 10)... | true |
46bfc17d54a9c6b876eeaf793faee89031ee4512 | C++ | mohityadav7/CP-Code | /CodeShala/Trees/Assignment questions/Balance Tree or Not.cpp | UTF-8 | 1,922 | 3.75 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
struct node {
int data;
struct node * left;
struct node * right;
} * root = NULL;
struct node * insertNode(struct node * tNode, int value) {
if(tNode == NULL) {
struct node * newNode = (struct node *)malloc(sizeof(struct node));
ne... | true |
29b9a2fc82505c52c2df2a468cb36c20910f73a4 | C++ | raisazaman02/Sales-System-for-a-Fast-Food-Restaurant | /Project #2/Project2/Project2/Sandwiches.cpp | UTF-8 | 1,124 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "Sandwiches.h"
//Implementation of default constructor
sandwiches::sandwiches()
{
sandwicheType = " ";
}
//Implementation of constructor with parameters
sandwiches::sandwiches(string Sn, double Sp, int Sc, int Sq, string St)
:Item(Sn, Sp, Sc, Sq)
{
sandw... | true |
ddb740e48c7bb1ccf7ccb5b19e09fdeae008e271 | C++ | zeph7/Competitive_Programming | /Basic-programming/basics-of-input-output/play_with_numbers.cpp | UTF-8 | 540 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
long long i, q, l, r, n, x, y, sum;
vector <long long> v;
cin >> n >> q;
for(i=0; i<n; i++){
cin >> x;
if(i >= 1)
y = v.at(i-1) + x;
else if(i == 0)
y = x;
v.push_back(y);
... | true |
7777535a72de62e2f740b39dee559138eba871f5 | C++ | Yashvishnoi/Cpp | /lab2.cpp | UTF-8 | 230 | 2.90625 | 3 | [] | no_license | #include<iostream>
using namespace std;
class fun
{
public:
int n[100],i=0;
int function(int x)
{
for(int k=x;k>0;k=k/2)
{
n[i++]=k%2;
}
for(int j=i-1;j>=0;j--)
cout<< n[j];
}
};
int main()
{
fun f;
f.function(7);
return 0;
}
| true |
662d38f8f99468781d3e3235e30728870dbe00ed | C++ | SandoKaravelovRado/UP-1-vi-kurs | /Zadachi_3sedmica.cpp | UTF-8 | 3,650 | 3.5625 | 4 | [] | no_license | #include<iostream>
#include <stdbool.h>
#include <math.h>
#include <string>
using namespace std;
int main(){
//редицата ai = a^i +3i.
int number, ai = 0;
cin>>number;
for(int index = 1; index <= number; index++){
ai = pow(index,2) + 3*index;
cout<<ai<<endl;
... | true |
c2f9b5625801380616886494a9b29947db0f8373 | C++ | YusefBM/Algorithms-and-Data-Structures | /Iterative-Algorithms/8/Problema8RescateAereo.cpp | UTF-8 | 1,369 | 2.953125 | 3 | [] | no_license | // Nombre del alumno:Eduardo Martínez Martín
// Usuario del Juez: E31
// La solucion obtenida tiene un coste O(n), siendo "n" la longitud del vector
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
using namespace std;
// función que resuelve el problema
void resolver(vector <int> const... | true |
50852ba58b5d49726cddf516c6f48b60d0b00f8d | C++ | keymanky/sites | /UNO/Marcos/Archivos/C++/GRAFICACION/1.cpp | UTF-8 | 1,251 | 2.78125 | 3 | [] | no_license | #include <iostream.h>
#include <conio.h>
#include <graphics.h>
#include <dos.h>
//#include <winbgim.h>
class Circulo
{
private:
float radio;
float x,y;
float pi;
int ver;
public:
//constructor
Circulo(float orad, float ox, float oy)
{
radio=orad;
x=o... | true |
9acd039dbc0445fcf2251490996da51a55159982 | C++ | sony0905/Data-Structures- | /circular_queue_using_linked_list.cpp | UTF-8 | 3,239 | 3.4375 | 3 | [] | no_license | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node *next;
};
Node *front=NULL;
Node *rear= NULL;
Enqueue(){
Node *newNode= new Node();
cout<"\nEnter data to be inserted:\t";
cin>>newNode->data;
if(front==NULL && rear==NULL){
front= ne... | true |
520ab14ea95cfbb77103c37b74adf78039dc50d6 | C++ | mrnglory/C-Plus-Plus-OOP | /GraphicEditor/GraphicEditor/Shape.h | UTF-8 | 376 | 3.140625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
using namespace std;
class Shape
{
Shape* next;
protected:
virtual void draw() = 0;
public:
Shape() { next = NULL; }
virtual ~Shape(){}
void paint() { draw(); }
Shape* add(Shape* p) { this->next = p; return p; }
Shape* getNext() { return next; }
... | true |
ea07578eeda86da0b366496eafc55d450bfd76c4 | C++ | vipulchhabra99/In-Memory-KvStore | /comparisions/trie/a.cpp | UTF-8 | 9,606 | 3.3125 | 3 | [] | no_license | /*
SPECIFICATIONS:
Max key size: 64 bytes
Each key char can be (a-z) or (A-Z): Total 52 possible chars
Max Value Size: 256 bytes, any ASCII value
No DS/boost/STL etc Libraries to be used
Only pthread to be used for multithreading
Keys to be in strcmp (cstring) Order
API calls would be blocking
EVALUATION:
B... | true |
e988ddcfac938ac1136bd83a9acda05c48352505 | C++ | awais987123/Libarary-Management-System-with-complete-GUI | /books.h | UTF-8 | 1,895 | 3.5 | 4 | [] | no_license | #pragma once
#ifndef BOOKS_H
#define BOOKS_H
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;
class books // declaration of class
{
private://members variables
string title,
author,
publisher,
status;
int production_year,
copies,
item_id;
public://member functions
... | true |
7dcfc2f29a4b85ef6b9cb449230fdae36d583eb6 | C++ | hero1796/C-Cplus2 | /codeAcm/P171PROD.cpp | UTF-8 | 1,688 | 2.921875 | 3 | [] | no_license | #include <stdio.h>
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
void import_array(long a[], long b[], long n) {
for(long i = 0; i < n; i++)
scanf("%ld %ld", &a[i], &b[i]);
}
void export_array(long a[], long b[], long n) {
printf("\n");
for(long i = 0; i < n; i++)
printf("%ld %ld\n", a[i], b[... | true |
ce062ed158ca46d88e184bbe7d5f24df1652ec0d | C++ | krishna-NIT/100DaysCodingChallenege | /Day55/A chessboard.cpp | UTF-8 | 375 | 2.8125 | 3 | [] | no_license | /*
Platform :- Hackerearth
Problem :- A Chessboard
Hint :- Brute Force
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
int d=abs(x2-x1);
d=max(d,abs(y2-y1));
if(d==0){
cout<<"SECOND"<<endl;
}
else if(d==1) {
co... | true |
f00aff334b12d384ab76f06d5d7eddce17b70796 | C++ | ghworld/algorithm | /最大乘积子序列/maxProduct.cpp | UTF-8 | 640 | 3.21875 | 3 | [] | no_license | //
// Created by mi on 2/24/18.
//
#include <iostream>
#include <vector>
// 最大乘积子序列问题
using namespace std;
class Solution{
public:
int maxProduct(vector<int> A){
int maxPro=0 ;
int minPro=0 ;
for(int i=0; i<A.size();i++){
maxPro=max(max(A[i],maxPro*A[i]),minPro*A[i]);
... | true |
229770fe93c02cbabcad5f836cfefdfeb5393c04 | C++ | hamko/sample | /tbb/comparison.cpp | UTF-8 | 2,777 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include <omp.h>
#include <cmath>
#include <cstdlib>
#include "tbb/task_scheduler_init.h"
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
#include "tbb/tick_count.h"
using namespace std;
using namespace tbb;
const int task_num = 100;
const int rep = 100000000;
class ... | true |
0e1f83bbf1e4251439160a384a859af1e3a08ff6 | C++ | Thomas-Malcolm/Conways-Game-of-Life-Recreation | /src/Life.cpp | UTF-8 | 1,414 | 2.828125 | 3 | [] | no_license | #include "Life.h"
#include "olcPixelGameEngine.h"
#include <vector>
#include <random>
void Life::ResetLife()
{
for (int i = 0; i < boardWidth; i++)
{
for (int j = 0; j < boardHeight; j++)
{
LifeMap[j][i] = 0;
}
}
}
void Life::NextGen()
{
int neighbours;
for (int i = 1; i < boardWidt... | true |
f1d0d836ee6168507dd810e94f56d82d062ef4c5 | C++ | copyzerov3/JackOne | /JackLumberOne/Screen.h | UTF-8 | 668 | 2.765625 | 3 | [] | no_license | #pragma once
#ifndef __SCREEN_H
#define __SCREEN_H
#include <SDL.h>
#include "Texture.h"
#include "Managers.h"
class Screen
{
public:
Screen();
~Screen();
virtual void Update() = 0;
virtual void Draw() = 0;
virtual bool Init() = 0;
bool GetLeave()
{
return mLeave;
}
Screen* GetNextScreen()
{
return ne... | true |
3eebee4a62323bba89381cd20a13c3a5ff2496a9 | C++ | shuichih/oreoren | /src/vecmath/color4.h | UTF-8 | 3,463 | 3.109375 | 3 | [] | no_license | #ifndef SEVERE3D_COLOR4_H
#define SEVERE3D_COLOR4_H
//#include "severe3d/base.h"
#include "vecmath_def.h"
/**
* ARGB色を表現するクラスです。
*/
class Color4
{
public:
/** 透明度 (透明 < 不透明) */
float a;
/** 赤成分 */
float r;
/** 緑成分 */
float g;
/** 青成分 */
float b;
Color4(): a(0), r(0), g(0), b(0) {}
Color4(float sr, fl... | true |
b2ff8c127a9758eccf61a909ad51badbf861c329 | C++ | teddy-hoo/leetcode | /palindrome_partitioning_2.cpp | UTF-8 | 867 | 3.109375 | 3 | [] | no_license | class Solution {
private:
bool isPalindrome(string s, int begin, int len){
int end = begin + len - 1;
while(begin <= end){
if(s[begin] != s[end]){
return false;
}
begin++;
end--;
}
return true;
}
public:
int minCut(string s) {
int len = s.size();
int minSplit = 100... | true |
08471292b5380babb78b2582bdde29cf63e7567e | C++ | sebasqr22/TEC-File-System | /text_box.cpp | UTF-8 | 2,689 | 3.640625 | 4 | [] | no_license | /**
* @file text_box.cpp
* @title Text Box
* @brief Class that creates a text box
* */
#pragma once
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
class text_box {
private:
Text text;
string textStr;
RectangleShape textbox;
bool isSelected = false;
... | true |
e69d84630369054d81dcc733c0015606e4a4f6e9 | C++ | soumya-ranjan7/Algorithms | /Sorting/bubbleSort/cpp/bubble_sort.cpp | UTF-8 | 517 | 3.890625 | 4 | [
"MIT"
] | permissive | /* Bubble Sort implementation in C++
* Author : Manvi Gupta
* Input : array length and elements
* Output : Sorted array elements
*/
#include <iostream>
using namespace std;
int n;
void bubble_Sort(int a[])
{
for(int i=0; i<n-1; i++)
for(int j=0; j<n-1-i; j++)
if(a[j] > a[j+1])
{
swap(a[j+1], a[... | true |
aa0f65ea274852b931e54e627c43933129ff82c3 | C++ | lheckemann/namic-sandbox | /UNCShapeAnalysisLONIpipeline/StatNonParamTestPDM/PvalToRGB.cxx | UTF-8 | 2,920 | 2.78125 | 3 | [] | no_license |
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cmath>
#include <cstdio>
#include "argio.h"
using namespace std;
int main (int argc, const char ** argv)
{
if (argc <=1 || ipExistsArgument(argv, "-usage")) {
cout << ... | true |
f2afd1e8b0a3ffb6bdc91a67feed1bd0d17c304d | C++ | guilhermegals/asteroids-sdl | /Fonte/Asteroides.hpp | ISO-8859-1 | 5,160 | 2.875 | 3 | [] | no_license | /*
* Asteroides.hpp
*
* Created on: 11/06/2016
* Author: Guilherme
*/
#ifndef ASTEROIDES_HPP_
#define ASTEROIDES_HPP_
#include"Nave.hpp"
//Asteroids
class AsteroideGrande {
public:
SDL_Texture *pedraGrande;
float velocidadeGrande;
float anguloPedraGrande;
float vxP, vyP;
float anguloRadiano;
bool in... | true |
8f490309b7c3cc29aaf10ca13817fdee809ca44c | C++ | arorasam/adhoc | /CodingBlocks/CodingBlocks/BackTrack_StringPermutations.cpp | UTF-8 | 1,418 | 3.375 | 3 | [] | no_license | #include "stdafx.h"
#include <set>
static int counter;
void ExecPrintStringPerms()
{
char arr[100];
cout << "Enter a string to permute" << endl;
cin >> arr;
set<string> s;
s.insert(arr);
//PrintStringPerms(arr, boolArr, strlen(arr), 0);
int count = PrintStringPerms_InClass(arr, 0);
cout << count << " permuta... | true |
1b49475f3a0d6b2ead5b9d0d7d02b1287fb8ccda | C++ | huashuolin/DesignModel | /单例模式/Singleton.h | UTF-8 | 354 | 2.78125 | 3 | [] | no_license | #pragma once
class CSingleton
{
private:
CSingleton()
: m_iCount(0)
{
}
virtual ~CSingleton()
{
}
int m_iCount;
public:
static CSingleton* GetInstance()
{
static CSingleton inst;
return &inst;
}
void CountAdd(int iNum)
{
m_iCount += iNum;
}
int GetCountNum... | true |
7fee096ba5ea79bf82e8fa5ab2e3a3090750408c | C++ | OtemPsych/Slide-Puzzle | /Slide Puzzle/Grid.h | UTF-8 | 793 | 2.890625 | 3 | [] | no_license | #ifndef Grid_H_
#define Grid_H_
#include <SFML/System/NonCopyable.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <vector>
class Grid : public sf::Drawable,
private sf::NonCopyable
{
private:
// Private Member(s)
sf::RectangleShape mOutline;
std::vector<sf::Vector2f> mTilePositions;
private:
//... | true |
680181ba524fe4f3865e457334d9fd6935cee29e | C++ | boga95/shared_ptr | /BG_share_ptr/BG_share_ptr/graph.hpp | UTF-8 | 884 | 3.09375 | 3 | [] | no_license | /*
Created by Borsik Gabor
gabor.borsik@gmail.com
*/
#ifndef GRAPH_HPP_INCLUDED
#define GRAPH_HPP_INCLUDED
#include <iostream>
#include "shared_ptr.hpp"
template <class T>
class Graph
{
public:
Graph() {}
Graph(T *object_) : _object(object_) {}
Graph(const Graph<T>& graph);
~Graph() {}
void set_ptr1(const shared... | true |
c6e3d48bd892286d016d4d97ae571fa68f3d2777 | C++ | schaefer-dev/embeddedSystems | /project01/src/collector/CollectorLineSensors.cpp | UTF-8 | 2,876 | 2.609375 | 3 | [] | no_license | #include "stdint.h"
#include "Arduino.h"
#include "CollectorLineSensors.h"
#include "Zumo32U4LineSensors.h"
#include "CollectorState.h"
Zumo32U4LineSensors CollectorLineSensors::lineSensors;
bool CollectorLineSensors::onLine;
const uint8_t CollectorLineSensors::threshold;
void CollectorLineSensors::init(CollectorSta... | true |
305c13aa3ca140015c1b2f4ed46bd57f929cdfe3 | C++ | MsNahid/Uva-Problem-Solutions | /uva-10469-solution.cpp | UTF-8 | 224 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
unsigned int a, b;
while(scanf("%u%u", &a, &b) == 2){
printf("%u\n", a ^ b);
}
return 0;
}
| true |
6caae9c6918edb2d1e62282c9497b4c6a6b5d7e4 | C++ | Farkash/Arduino | /9x16-matrix/9x16-matrix.ino | UTF-8 | 4,026 | 2.65625 | 3 | [] | no_license | #include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_IS31FL3731.h>
#include <Adafruit_NeoPixel.h>
int neoPixelCount = 12;
int neoPixelPin = 13;
// If you're using the full breakout...
Adafruit_IS31FL3731 ledmatrix = Adafruit_IS31FL3731();
// If you're using the FeatherWing version
//Adafruit_IS31FL3731_Wing ... | true |
994714a77e60e841de3626fd84003e962ad7e720 | C++ | hangyu0100/pplp | /include/pplp_ray.h | UTF-8 | 760 | 2.78125 | 3 | [] | no_license | /*******************************************************************************
* Copyright (c) 2016 Dec. Verimag. All rights reserved.
* @author Hang YU
* A ray starts from a point and goes to infinity along a direction.
* As in the raytraing method all the rays start from the same point which is
* stored in Ra... | true |
81e406941fcbadd1a5e967d7ded512ef94e885a8 | C++ | el-bart/WiFiChopper | /commons/src/Net/ClientServer.t.cpp | UTF-8 | 1,530 | 2.734375 | 3 | [] | no_license | #include <tut/tut.hpp>
#include <string>
#include <iterator>
#include <algorithm>
#include "Net/Server.hpp"
#include "Net/connectToServer.hpp"
using namespace std;
using namespace Net;
namespace
{
struct TestClass
{
TestClass(void):
addr_( {{127,0,0,1}}, 9666 )
{ }
const Address addr_;
};
typedef tut::te... | true |
e315ab10eee5317dc1cbbce7490652569c3dcd4c | C++ | MihaiAnghelin/StepIT-C | /13) 20.01.2019/Sir Subsir.cpp | UTF-8 | 867 | 3.109375 | 3 | [] | no_license | //program pentru a cauta numarul de aparitii
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define N 100
int functie(const char* sir, const char* subsir)
{
int l1 = strlen(sir);
int l2 = strlen(subsir);
int contor = 0;
for (int i = 0; i <= l1 - l2 + 1; i++)
{
int j = 0;
... | true |
b94b59e2cb8d12885b1477589d9fc6d7691244b8 | C++ | nolanderc/school-n- | /N++/Ninja.h | ISO-8859-1 | 3,507 | 2.703125 | 3 | [] | no_license | #pragma once
#include "ConvexHull.h"
#include "Collider.h"
#include "Interpolate.h"
// De olika stt en Ninja kan rra sig p
enum NinjaMovement {
NINJA_STILL,
NINJA_LEFT,
NINJA_RIGHT,
NINJA_JUMP,
NINJA_CANCEL_JUMP,
NINJA_DROP
};
// De olika stt en ninja kan gra en pose
enum NinjaPose
{
POSE_NONE,
POSE_VICT... | true |
8d7372dffa881e1d4a59458a7dccfb83cf725cdd | C++ | joaopedroxavier/Competitive-Programming | /imeplusplus/2018-tryouts/i.cpp | UTF-8 | 1,831 | 2.796875 | 3 | [] | no_license | //
// 내가 나인 게 싫은 날
// 영영 사라지고 싶은 날
// 문을 하나 만들자 너의 맘 속에다
// 그 문을 열고 들어가면
// 이 곳이 기다릴 거야
// 믿어도 괜찮아 널 위로해줄 magic shop
//
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
c... | true |
77fcba746084c69b53463982beffd907d0f9e8da | C++ | eitilabs/proi0-robot | /include/RobotDrive.h | UTF-8 | 330 | 2.5625 | 3 | [] | no_license | #ifndef ROBOTDRIVE_H
#define ROBOTDRIVE_H
class RobotDrive
{
public:
RobotDrive();
virtual ~RobotDrive();
void driveForward(double distance);
void driveBackwards(double distance);
double getPosition();
protected:
private:
double position;
};
#endif // ROB... | true |
2e47f02342db7ef2b3bebb19b5b53ef9196e558a | C++ | Ch3shireDev/WIT-Zajecia | /semestr-2/Programowanie/2020/kolokwium-2/zad12.cpp | UTF-8 | 399 | 3.640625 | 4 | [] | no_license | #include <iostream>
using namespace std;
void clock(int hours, int minutes, double &x, double &y)
{
x = hours % 12 * 30 + minutes / 60. * 30;
y = minutes % 60 * 6;
}
int main()
{
int hours, minutes;
cout << "Podaj godziny: ";
cin >> hours;
cout << "Podaj minuty: ";
cin >> minutes;
doub... | true |
5a1a5c1041c64bc03502a69f73e26476de57a728 | C++ | Sysreqx/Cpp | /itstep/HW/17.05.2018 PrintQueue, List/singleLinkedList/Source.cpp | UTF-8 | 294 | 2.703125 | 3 | [] | no_license | #include "singleLinkedList.h"
#include <ctime>
int main()
{
srand(time(0));
singleLinkedList<int> l;
int tmp;
for (int i = 0; i < 10; i++)
l.push_back(tmp = rand() % 10);
l.print();
std::cout << std::endl;
l.printReverse();
std::cout << std::endl;
system("pause");
return 0;
} | true |
418e0b4107003de5ebe62ffdaf4d0bd63846e975 | C++ | pelican/pelican | /pelican/server/test/src/LockableStreamDataTest.cpp | UTF-8 | 1,842 | 2.515625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | #include "server/test/LockableStreamDataTest.h"
#include "server/LockableStreamData.h"
#include "server/LockableServiceData.h"
#include "server/LockedData.h"
#include "comms/StreamData.h"
#include <QtCore/QString>
namespace pelican {
CPPUNIT_TEST_SUITE_REGISTRATION( LockableStreamDataTest );
/**
*@details LockableS... | true |
a9897e5bbd7c56ac4f3341dee5d91583d1983da3 | C++ | Giantpizzahead/comp-programming | /Other/Google/Kick Start 2020/Round E/highbuildings.cpp | UTF-8 | 1,966 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int MAXN = 100;
int N, A, B, C;
int arr[MAXN];
void solve(int tn) {
cin >> N >> A >> B >> C;
A -= C;
B -= C;
if (A + B + C > N) {
cout << "Case #" << tn << ": IMPOSSIBLE\n";
return;
}
int leftOver = N - A - B - C;
if (N > 2)... | true |
9405fc10d6070560c0e1c5cc874b0fbe47bc618b | C++ | lyleshaw/Cpp | /stand/1.1 奇数阶魔阵.cpp | GB18030 | 1,295 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
int main()
{
int n, k;
while (cin >> n) {
int *p = new int [n*n];
for (k = 0; k < n *n; k++)
p [k] = 0;
int row = 0, col = n / 2;
for (k = 1; k <= n*n; k++) {
p [ row *n+col] = k;
int newRow, newCol;
newRow = (row - 1 + n) % n;
new... | true |
d6b2ad6028b8f095cb75cbfca40178552b1cb968 | C++ | xiaoqixian/Wonderland | /leetcode/threeSum.cpp | GB18030 | 1,243 | 3.40625 | 3 | [] | no_license | /*
Leetcode: 15.֮
vectorеÿαΪ֮͵СֵȻȽֻҪ˫ָԺ
*/
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int>> res;
sort(nums.begin(), nums.end());
int i;
int mid, max;
unordered_map<int, int*> m;
for (i = 0; i < nums.size(); i++) {
... | true |
90a8b00c167ae29a89296eb2f4da121bdd24c00b | C++ | FloopCZ/forge | /src/api/cpp/exception.cpp | UTF-8 | 2,317 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | /*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
**********************************************... | true |
1af62c14c553d6e22d3bc27e424c9e1256724053 | C++ | moy/cours-tlm | /code/smartpointer/main_refcount.cpp | UTF-8 | 1,182 | 2.71875 | 3 | [] | no_license | /********************************************************************
* Copyright (C) 2009 by Verimag *
* Initial author: Matthieu Moy *
********************************************************************/
#include "refcount_ptr.h"
#define PRI... | true |
a5c0b2d760ee267ea42aa9ea9f0625f920115979 | C++ | Svilensk/Unity_Tool_DLL | /VSProject/code/UTool_StaticLib/sources/BrushPainting.cpp | ISO-8859-1 | 9,625 | 3.09375 | 3 | [] | no_license | /*
* // Made By: Santiago Arribas Maroto
* // 2018/2019
* // Contact: Santisabirra@gmail.com
*/
#include "BrushPainting.hpp"
typedef unsigned char uint8_t;
//Establece el color de los pxeles al color introducido en el rea y posicin indicada
uint8_t* UTool::BrushPainting::paint_pixel_buffer(int size_x, int si... | true |
c3b7ec2684d4ecb55ca1dd5485285f7e9e65b2b5 | C++ | ToLoveToFeel/LeetCode | /Cplusplus/_0032_Longest_Valid_Parentheses/_0032_main.cpp | UTF-8 | 1,259 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <stack>
using namespace std;
/**
* https://www.bilibili.com/video/BV1PK4y147uk 14:00
* 思路:如果某段中右括号比左括号多一个,则可以将该段切分开,最长的有效括号不会跨越该段
* 执行用时:8 ms, 在所有 C++ 提交中击败了52.63%的用户
* 内存消耗:7.4 MB, 在所有 C++ 提交中击败了61.19%的用户
*/
class Solution {
public:
int longestValidParentheses(string s) {
... | true |
625283aed8df62fbc7bd202b8b4209f5188a37c7 | C++ | FelixKirmse/ProjectR | /src/ProjectR.MapGen/Generators/HallwayGenerator.cpp | UTF-8 | 1,195 | 2.84375 | 3 | [] | no_license | #include "HallwayGenerator.hpp"
#include "ProjectR.Model/RMap.hpp"
namespace ProjectR
{
HallwayGenerator::HallwayGenerator(int minWidth, int minHeight, int maxWidth, int maxHeight, std::shared_ptr<RMap> map)
: Generator(minWidth, minHeight, maxWidth, maxHeight, map)
{
}
void HallwayGenerator::GenerateImpl(int row, ... | true |
b6b04f50209c53a4c2a6fdcd45023453e1ada0b9 | C++ | zhouxiaoy/pat | /王道数据结构/线性表/2-2 链表/2-2.25.cpp | GB18030 | 982 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct node {
int data;
node* next;
};
//ҵм
node* fun(node* root) {
if (root == NULL) return NULL;
node* p = root, *q = root;
//Ҫq->next ֽΪֻʣһ
while (q->next != NULL && q->next->next != NULL)
{
p = p->next;
q = q->next->next;... | true |
180efa9ecf95fa95b2a0bc3d4f4a86b3ed835fb5 | C++ | Michael-K-Stein/Sound-Classifier | /Backup/ClassifyFrequencyArray Template/ClassifyFrequencyArray.cpp | UTF-8 | 2,936 | 2.640625 | 3 | [] | no_license | // ClassifyFrequencyArray.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <time.h>
#include <fstream>
#include "AudioFile.h"
#include <direct.h>
#define GetCurrentDir _getcwd
std::string get_current_dir() {
char buff[FILENAME_MAX]; //create str... | true |
216ce96f32a55d05565b1705b47136ba22a6babf | C++ | AlbinStenqvist/Programmering-1 | /Bonus3/main.cpp | ISO-8859-2 | 614 | 3.1875 | 3 | [] | no_license | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main() {
float t1, m1, s1, t2, m2, s2, t3, m3, s3;
cout << "Ange tiden fr lopp 1 (TT MM SS): ";
cin >> t1;
cin >> m1;
cin >> s1;
cout << "Ange tiden fr lopp 2 ... | true |
bae58fcbf34f11a389a1c305518c719ef884e5c2 | C++ | piotrek6598/ASD | /mid-term tasks/jablka/main.cpp | UTF-8 | 2,117 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
const int M = 1e9;
const int MAX_N = 1e6 + 1;
static int ile_el[MAX_N]; // Liczba elementów drzewa o numerze i.
static int poziom [MAX_N][2]; // Liczba drzew o numerze i na pewnym i nastepnym poziomie
int main()
{
ios_base::sync_with_stdio(0);
... | true |
57fbc4047f3079158e79cc1685c92899ac78b8d6 | C++ | wesmail/hydra | /old_hydra/hydra/trunk/base/util/hgeantfilter.cc | UTF-8 | 3,337 | 2.609375 | 3 | [] | no_license | //*-- AUTHOR : R. Holzmann
//*-- Modified : 31/03/2004 by
//_HADES_CLASS_DESCRIPTION
///////////////////////////////////////////////////////////////////////////////
//
// HGeantFilter
//
// Reconstructor to filter the simulated event data produced by HGeant
// rescaling the multiplcity of particle id by acc.
//
/... | true |
1090a8493f6e54901222d769177226167ca59496 | C++ | savicci/algorithms-homework | /sorted lists/merging.cxx | UTF-8 | 1,971 | 3.390625 | 3 | [] | no_license | //by Grzegorz Koziol
#include<iostream>
#include<string>
#include<list>
#include"sortedArrayList.hxx"
#include"SortedLinkedList.hxx"
using std::cout;
using std::cin;
using std::endl;
main(int argc, char const *argv[])
{
if(argc!=3){
cout<<"Podaj wielkosci list tablicowych"<<endl;
... | true |
ecf3bcfb61277fb6fc30ef856e3a5a7b4e5bfdce | C++ | KushnirDmytro/SocketServerLab3 | /ServerBoost.cpp | UTF-8 | 5,722 | 2.8125 | 3 | [] | no_license |
#include <cstdlib>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
// forward declarations
class serverUDP;
class serverTCP;
class session;
const std::string currentTime() {
time_t now = time(0);
struct tm tstruct;
char buf[20];
tstruct = *localtime(&now);
s... | true |
11584fed221af922034c020b13aa097b1af234d3 | C++ | viatom-develop/Hyt | /lpble/src/main/cpp/offline/main.cpp | UTF-8 | 2,071 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include "swt.h"
#include <deque>
#include <string>
#include <fstream>
#include "commalgorithm.h"
#include "streamswtqua.h"
#include <cmath>
using namespace std;
StreamSwtQua streamSwtQua;
void readfile(string path, deque <double> & data)
{
ifstream infile(path.c_str());
... | true |
c86969a1851b3ad301b1b9cf2e28cad080db2886 | C++ | shruthi019/lean-in-interview-prep | /arrays/wiggle_sort.cpp | UTF-8 | 669 | 3.859375 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
// Problem: https://www.lintcode.com/problem/wiggle-sort/description (MEDIUM level)
void wiggleSort(vector<int>& nums) {
int size = nums.size();
for (int i = 0; i < size; i += 2) {
if (i > 0 && nums[i] > nums[i - 1]) {
... | true |
05a8b0ca59169e608e0775a161f67651c3016f1a | C++ | mehmetozbek26/SoftWareEng | /otomasyon/main.cpp | ISO-8859-9 | 2,635 | 3.015625 | 3 | [] | no_license | #include <cstdlib>
#include <iostream>
using namespace std;
//hastane otomasyon sistemi
typedef struct hastakimlik {
char *ad;
char *soyad;
int no;
int tcno;
int id;
}Kimlik;
typedef struct polkimlik {
char *poladi;
int numara;
int id;
... | true |
e3d4f44fc836dd962b62067ecc5591ac5760d66c | C++ | nathanlo99/daily-coding-problem | /cpp/problem001.cpp | UTF-8 | 1,381 | 4.21875 | 4 | [] | no_license | /*
This problem was recently asked by Google.
Given a list of numbers and a number k, return whether any two numbers from the
list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can you do this in one pass?
*/
#include <iostream>
#include <unordered_set> // For st... | true |
2c0cc0ce33febeb3229772f52c46718c9fe0f447 | C++ | mihail-m/CP-implementations | /1-Searching/c++/3-exponential-search.cpp | UTF-8 | 823 | 3.078125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool bin_search(vector<int> arr, int l, int r, int num) {
while (l <= r) {
int mid = (l + r) / 2;
if (arr[mid] == num) {
return true;
}
if (arr[mid] < num) {
l = mid + 1;
} else {
r = mid - 1... | true |
5a0cff56866c5a76dac051330565f14f05730cd0 | C++ | anishanainani/workspace-Cplusplus | /Sorting/Selection Sort/selection_sort.h | UTF-8 | 1,147 | 3.609375 | 4 | [] | no_license | /*
* selection_sort.h
*
* Created on: Jan 28, 2015
* Author: Komani
*
* n-1 + n-2 + n-3 + ..... = O(n^2)
*
* Advantage:
* atmost n-1 swaps, the situations in which moving data elements is more expensive than comparing, selection sort is good.
*
* Not stable
* inplace
*/
#ifndef SELECTION_SORT_... | true |
8bed04d174503a52df071a7e2826624a1253f2b9 | C++ | thegamer1907/Code_Analysis | /scrape/data/Organized/LJlessthanme/LJlessthanme_A.cpp | UTF-8 | 966 | 2.546875 | 3 | [] | no_license | //HDU2196 求树中每个点能达到的最大距离,结合解题报告看
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAX= 2e5 + 50;
typedef long long LL;
LL a[MAX];
int main(int argc, char const *argv[])
{
LL n, m, k;
scanf("%I64d%I64d%I64d", &n, &m, &k);
for(LL i = 0; i < m; i++){
scanf("%I64d", &a[i]);
}
L... | true |
f1a82d5c04c7ec5fa1f4540b6b603637d895f29a | C++ | fjola17/VLN1 | /homap/controller/adminmenucontroller.cpp | UTF-8 | 7,433 | 3.21875 | 3 | [] | no_license | #include "adminmenucontroller.h"
using namespace std;
AdminMenuController::AdminMenuController()
{
AdminMenuController::init();
}
AdminMenuController::~AdminMenuController()
{
//dtor
}
//Get user input
void AdminMenuController::init(){
// Pre
Topping newTopping;
Item newItem;
Pizza newPizza;... | true |
4e180f7a222c201faaeb04d34719a964153e3912 | C++ | lougithub/libguiex | /tools/LibguiexResourceEditor/Core/ReModelBase.h | UTF-8 | 4,073 | 2.921875 | 3 | [] | no_license | // -----------------------------------------------------------------------------
// Author: GameCrashDebug.
// Date: 20101120.
// -----------------------------------------------------------------------------
#ifndef _RE_MODEL_BASE_H_
#define _RE_MODEL_BASE_H_
// ---------------------------------------------------... | true |
b5e06a7175ded405d3d407b21dcbae6e1198ccdf | C++ | luckyxuanyeah/Algorithm_Practice | /PAT/code/fourth/4.1/4.1 6 A1055(1)(25) -3score/4.1 6 A1055(25)/4.1 6 A1055(25).cpp | GB18030 | 1,541 | 2.640625 | 3 | [] | no_license | // 4.1 6 A1055(25).cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <stdio.h>
#include "string.h"
#include <algorithm>
using namespace std;
const int maxn = 100010;
struct person{
char name[9];
int age, netWorth;
}per[maxn];
struct query{
int num, age1, age2;
}que[maxn];
bool cmp1(person a, person b)
{
return a.age > b.... | true |
1f2d8942bf252afcc7c242e70ad1082ca1c3bc87 | C++ | zhangzhizhongz3/CppPrimer | /ch15/ex15.27/main.cpp | UTF-8 | 262 | 2.578125 | 3 | [
"CC0-1.0"
] | permissive | //!
//! Exercise 15.27:
//! Redefine your Bulk_quote class to inherit its constructors.
//!
#include "Quote.h"
#include "Disc_quote.h"
#include "Bulk_quote.h"
#include "Limit_quote.h"
using namespace std;
int main()
{
Bulk_quote bq("sss", 20.0, 2, 0.3);
}
| true |
7c409d18f2912f331245c9ac3cc02c69ed0774b5 | C++ | ddonix/sfjs2 | /12107/12107.cpp | UTF-8 | 5,350 | 3.28125 | 3 | [] | no_license | /* uva 12107: 题意:改动数字谜语中的某几位,使得谜语有唯一解。要求改动的位数最小。如果有多个改动
* 输出结果谜语字典序最小的那个。
* 分析:本题分为两个问题,第一是判断谜语是否有唯一解。第二是在原谜语基础上进行最少改
* 动成为有唯一解的新谜语。判断是否有唯一解,思路是枚举谜语左边所有*取值,看看
* 与谜语右边匹配的可能有多少。最大计算量为pow(10,4)*4=40000。
* 第二个问题可以枚举所有改动。可选改动的数量:谜语最多8位,可以改动0-8位,每位
* 有10个... | true |
6d47417cbb6c9ea6a6df3777e21c576aaefee379 | C++ | TESLA-Self-Driving-Car/Lane-Change-Simulation | /header/vec2D.h | UTF-8 | 8,322 | 3.453125 | 3 | [] | no_license | //
// vec2D.hpp
// CarGame
//
// Created by HJKBD on 8/20/16.
// Copyright © 2016 HJKBD. All rights reserved.
//
#ifndef vec2D_h
#define vec2D_h
#include <cfloat>
#include <climits>
#include <tuple>
#include "globals.h"
#include <iostream>
using std::ostream;
/*The Vector2d class is an object consisting of simply... | true |
4e43f448df0e4834967b80abb4dd3a1a304665c9 | C++ | hamdanjaveed/Learning-CPP | /Input/Input.cpp | UTF-8 | 1,087 | 4.1875 | 4 | [] | no_license | // ask for the user's name, and then generate a framed greeting
#include <iostream>
#include <string>
// say that we're using the std namespace
using namespace std;
int main() {
// ask for the person's name
cout << "Please enter your name: ";
// read the name
// a variable to hold the user's name
string name;
... | true |
37d7b76e08273d2690a44da3a4cb720a1306adf2 | C++ | goncaloacteixeira/feup-aeda | /aeda1920_fp03/Tests/grafo.h | UTF-8 | 6,697 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
/**
* Versao da classe generica Grafo usando a classe vector
*/
template <class N, class A> class Aresta;
template <class N, class A>
class No {
public:
N info;
vector< Aresta<N,A> > arestas;
No(N inf) {
info = inf;
}
};
template ... | true |
50a0e5bcd025820ed391ffff9d954b17813a4416 | C++ | per1234/arduino-nemeus-lib | /examples/LoRa_02_send_frame_OTAA/LoRa_02_send_frame_OTAA.ino | UTF-8 | 3,959 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | /* Basic example for LoRaWAN OTAA
*
* Uses Nemeus Library
* Offers the possibility to change the app UID and the app KEY
* In main loop,sends a frame using LoRaWAN.
*
*/
#include <NemeusLib.h>
#include <Wire.h>
/* Define APPUID and APPKEY, change value here if needed */
#define APPUID "70B3D53260000100"
/... | true |
b97c0d455f388f29bd89d423b9dd6d08c3cafe8b | C++ | neptune46/design-pattern-cpp | /facade/Facade.cpp | UTF-8 | 1,053 | 2.578125 | 3 | [] | no_license | //This source code was generated using Premium Visual Studio Design Patterns add-in
//You can find the source code and binaries at http://VSDesignPatterns.codeplex.com
////Provide a unified interface to a set of interfaces in a subsystem. Facade defines
//a higher-level interface that makes the subsystem easier to us... | true |
98b6efa2dc7baf01a4f1b7425f548d4ad5cb15f4 | C++ | toskov/CodiCamp | /MyGame/SpaceGame/SpaceGame/Thing.cpp | UTF-8 | 3,774 | 2.640625 | 3 | [] | no_license | #include "Thing.h"
Thing::Thing()
{
}
Thing::Thing(CIndieLib *mI, IND_Surface *thingsPicture, int type, int x, int y, int life, int angle, vector<Frame*> frms)
{
// random speed and direction (rand() % 2 - 1)
//srand(time(NULL));
*velosityX = rand() % 100;
*velosityY = rand() % 100;
this->thingPictures = things... | true |
fab1d7524668c130ea33bbb765bd9d8f8b783635 | C++ | benbancroft/2DEngine | /Common/tiles/tilesystem.cpp | UTF-8 | 8,368 | 2.59375 | 3 | [
"MIT"
] | permissive | #include "tiles/tilesystem.h"
namespace Core {
TileSystem::TileSystem(Level* level, TileGenerator* generator, std::string tilesheetUrl, int tileSize, int chunkSize){
this->level = level;
this->generator = generator;
this->tileSize = tileSize;
this->chunkSize = chunkSize;
this->tilesheetUrl = tiles... | true |
346803912440fc25a4982128c14131702aeffb85 | C++ | xiekch/leetcode | /Single_Number.cpp | UTF-8 | 672 | 3.703125 | 4 | [
"MIT"
] | permissive | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
// Given a non-empty array of integers, every element appears twice except for
// one.
// Find that single one.
class Solution {
public:
int singleNumber(vector<int> &nums) {
sort(nums.begin(), nums.end());
int i;
... | true |
55beb0d59a3c9d2f178498cad54a7c6d6d209257 | C++ | fromradio/ProjectEuler | /src/51-100/spiral_prime_58.cpp | UTF-8 | 756 | 2.765625 | 3 | [] | no_license | #include "prime.h"
#include <iostream>
#include <climits>
constexpr long limit = 1e9;
int main(int argc, char *argv[])
{
std::cout<<LONG_MAX<<std::endl;
auto primes = primeList(limit);
long side = 3;
long f = 3;
long ps = 0;
long n =1;
double ratio;
while (true)
{
if(f>(*primes.rbegin()))
{
std::cout... | true |
22f43fefa89d984b5d1954928ec5cdc30c3435a5 | C++ | VicSch/Prata_S_Cpp_2011 | /Chapter_08/Exercises/Exerc_07.cpp | UTF-8 | 808 | 3.515625 | 4 | [] | no_license | #include <iostream>
using namespace std;
template <class T>
T sumArray(T* arr, int n); // template #1
template <class T>
T sumArray(T* arr[], int n); // template #2
struct debts {char name[20]; double amount;};
int main() {
int things[6] = {21, 15, 34, 9, 155, 6};
cout << sumArray(things, 6) << endl; // templa... | true |
c044796253ec1f2da02e2c4c139a9cd94ba26328 | C++ | Czyzmanski/simple-http-server | /main.cpp | UTF-8 | 15,967 | 2.703125 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <regex>
#include <fstream>
#include <iostream>
using requests_t = std::deque<std::string>;
using correlated_resources_t = std::map<const std::string, const std::string>;
using response_map_t = std::map<con... | true |
c3b6c9d9bb59f895b58b1f43c1625cd527141b1c | C++ | j-a-h-i-r/Online-Judge-Solutions | /LightOj/1009 - Back to underworld.cpp | UTF-8 | 1,365 | 2.515625 | 3 | [] | no_license | #include<cstdio>
#include<vector>
#include<queue>
#include<cstring>
using namespace std;
queue<int> q;
int bfs( vector<int> a[], int s) {
int vis[20005], f[2];
f[0]=0; f[1]=0;
memset(vis, -1, sizeof(vis));
f[0]++;
vis[s] = 0;
while(!q.empty()){
int n = q.front(); q... | true |
fb5fbfa1f3fcce98328141055322a5e8d8a6de44 | C++ | egnuez/interpreter | /chapter07/parser.hpp | UTF-8 | 2,827 | 3.546875 | 4 | [] | no_license | /**
* Grammar:
* expr : term ((PLUS | MINUS) term ) *
* term : factor ((MUL | DIV) factor ) *
* factor: INTEGER | LPAREN expr RPAREN
*
*/
#include <string>
#include <cctype>
#include <stdexcept>
#include <iostream>
#include <sstream>
namespace lsbasi {
struct VisitorPrint {
virtual std::stringstream visi... | true |
8db7eb10729236d5ae35a1ceaaab3136d42ddba2 | C++ | oikkoikk/ALOHA | /important_problems/BFS.cpp | UTF-8 | 898 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int MAX = 10000;
vector<int> graph[MAX+1];
queue<int> q;
bool visited[MAX+1];
void BFS(int start) //start = 처음 시작할 정점
{
q.push(start);
visited[start] = true; //큐에 넣고 방문 표시
while(!q.empty()) //큐가 비어있지 않을 때(연결된 정점이 있을 때)
... | true |
6dd0992d4121db32bf65bd5634b86a975b6c3992 | C++ | Yunhao0799/Metodologia-de-la-Programacion-UGR | /Practica 2/Ejercicio 3/src/utilidades 2018-03-27 15_30_24.cpp | UTF-8 | 880 | 3.265625 | 3 | [] | no_license | #include "utilidades.h"
#include<iostream>
using namespace std;
void obtenerMayorSecuenciaMonotonaCreciente( int array[], int util_array, int salida[], int &util_salida){
util_salida = 0;
int maximo = 0;
int pos, valor;
int i;
for ( i = 0; i < util_array; i++){
valor = ascendentesDesdei(array, util_arra... | true |
08b0a55c68a39aa2576293aa475ea10416d46672 | C++ | FranciscoThiesen/cses_solutions | /queries/1739.cpp | UTF-8 | 1,824 | 2.828125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
template <typename T> struct BIT2D
{
vector<vector<T>> table;
int n, m;
T id;
BIT2D(int _n, int _m, T _id) : n(_n + 1), m(_m + 1), id(_id)
{
table.assign(n, vector<T>(m));
}
// 0-indexed!
inline void modify(int i, int j, T delta)
{
++i, ++j;
int x = i... | true |
0ad24fbd7ee317cfd6482a351e264e5eb43bb253 | C++ | mParticle/mparticle-apple-sdk | /mParticle-Apple-SDK/Utils/MPBracket.h | UTF-8 | 774 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #ifndef __mParticle__Bracket__
#define __mParticle__Bracket__
#include <cstdint>
#include <memory>
using namespace std;
namespace mParticle {
class Bracket final {
public:
int64_t mpId = 0;
short low = 0;
short high = 100;
bool shouldForward();
Bracke... | true |
aaff44cca00abf00ba9bbe9957bef7e546e10f02 | C++ | malzantot/uva_solutions | /uva537.cpp | UTF-8 | 1,958 | 3.25 | 3 | [] | no_license | /**
Author: Moustafa Alzantot (malzantot@ucla.edu)
All rights reserved.
**/
#include <string>
#include <iostream>
#include <iomanip>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::setprecision;
float ReadValue(string statement, int pos, char unit) {
int field_end = statemen... | true |
7c9d2ba2578fb7f689d864418a8361c07bb2cf96 | C++ | gbrlas/AVSP | /CodeJamCrawler/dataset/08_2562_75.cpp | SHIFT_JIS | 2,915 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
double sR;
double f, R, t, r, g;
double M_PI = acos(-1.0);
double lx;
double integral(double x)
{
return 0.5*sR*(x*sqrt(1-x*x/(sR*sR)) + sR*asin(x/sR));
}
double area(int x, int y)
{
double Lx, Ly, Rx, Ry;
... | true |
9f90375444f9091ebaaccb985f9a9124111600c9 | C++ | mikecancilla/ProgrammingProblems | /ProgrammingProblems/src/StringFromDictionary.cpp | UTF-8 | 2,113 | 3.953125 | 4 | [] | no_license | /*
This problem was asked by Microsoft.
Given a dictionary of words and a string made up of those words(no spaces), return the original sentence in a list.If there is more than one possible reconstruction, return any of them.
If there is no possible reconstruction, then return null.
For example, given the set o... | true |
d6d549f70046d19cd8c974704dc8faf4ed18fed2 | C++ | lylythechosenone/g | /DataStream.h | UTF-8 | 1,791 | 3.171875 | 3 | [] | no_license | #ifndef G_DATASTREAM_H
#define G_DATASTREAM_H
#include <memory>
template<typename T>
class DataStreamBase
{
public:
virtual ~DataStreamBase() = default;
virtual T get() = 0;
virtual bool done() = 0;
virtual bool doneNow() = 0;
};
template<typename T>
class DataStream
{
public:
explicit DataStream... | true |
08265b37bc56bb69f22f471674ccec4460a0e3fc | C++ | hikachi/ZMPO-lab3 | /ZMPO lab2/CMenuCommand.cpp | UTF-8 | 394 | 2.71875 | 3 | [] | no_license | #include "pch.h"
#include "CMenuCommand.h"
#include "CCommand.h"
using namespace std;
CMenuCommand::CMenuCommand(string s_name,string s_comm,CCommand* commandPointer)
{
pointer = commandPointer;
name = s_name;
command = s_comm;
}
CMenuCommand::~CMenuCommand()
{
}
void CMenuCommand::run()
{
if (pointer) {
poi... | true |
4b8b86c0289a0c9791d04e167e90d5dbb7e4529e | C++ | pastaread/TanksBattle | /Classes/GameScene.cpp | UTF-8 | 8,152 | 2.609375 | 3 | [
"MIT"
] | permissive | //
// GameScene.cpp
// Tanks
//
#include "GameScene.h"
Scene* GameScene::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = GameScene::create();
// add layer as a child to scene
scene->addChild(layer);
... | true |
0d3397251d04dcf240b4f5cb720a4773923d8533 | C++ | minersail/The-Unfortunate-Adventure-of-Joe | /Character.h | UTF-8 | 652 | 2.890625 | 3 | [] | no_license | #pragma once
#include "stdafx.h"
#include "Entity.h"
class Character : public Entity
{
public:
Character(float initX, float initY, std::string textureID, std::string name);
~Character();
// In order for this to work, the spritesheet provided for characters should be 4x4:
// Vertically the walk animatio... | true |