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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
362e1f039560c705e4a773578c83d8473d4671be | C++ | weishichun/DesignPattnsStudy | /Mediator_2.cpp | UTF-8 | 1,876 | 3.4375 | 3 | [] | no_license | #include<iostream>
using namespace std;
class Mediator;
class Person{
protected:
Mediator *m_pMediator;
public:
virtual void SetMediator(Mediator* pM) = 0;
virtual void GetMsg(string strMsg) = 0;//从中介获取消息
virtual void SendMsg(string strMsg) = 0;//向中介发消息
};
class Mediator{//抽象中介
public:
virtual ~Medi... | true |
8f58e2052af438b755c0237032d1b545e49b31d2 | C++ | DomWilliams0/CitySimulator | /CitySimulator/src/world/world_terrain.cpp | UTF-8 | 8,493 | 2.640625 | 3 | [] | no_license | #include "world.hpp"
#include "service/logging_service.hpp"
bool isCollidable(BlockType blockType)
{
static const std::set<BlockType> collidables(
{BLOCK_WATER, BLOCK_TREE, BLOCK_BUILDING_WALL, BLOCK_BUILDING_EDGE, BLOCK_BUILDING_ROOF,
BLOCK_BUILDING_ROOF_CORNER, BLOCK_BLANK});
return collidables.find(blockTy... | true |
d4b878fcac0a2735000d74789f2abf64cae69499 | C++ | Dijaq/SistemasInteligentes-Semana10 | /main.cpp | UTF-8 | 949 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
string line;
ifstream f("testb.txt");
ofstream write("_testb.csv");
if (f.is_open())
{
while ( getline (f,line) )
{
//cout << line << '\n';
int j=0;
string linea = "";
for(int i=0; i<line.length(); i++)
... | true |
b209f4453eb96d8945c22d4fb936e72d139a4006 | C++ | rvaughn4/dragonpoop_alpha | /dragonpoop_alpha/dragonpoop/gfx/model/model_animation_frame/model_animation_frame.cpp | UTF-8 | 2,263 | 2.625 | 3 | [] | no_license |
#include "model_animation_frame.h"
#include "../../../core/dpbuffer/dpbuffer.h"
namespace dragonpoop
{
//ctor
model_animation_frame::model_animation_frame( dpid id, dpid animation_id, dpid frame_id ) : model_component( id, model_component_type_animation_frame )
{
this->animation_id = animatio... | true |
9ed086545fed1092df840b4234c9d5a8684a983e | C++ | rathore-rahul/leetcode | /solutions/309. Best Time to Buy and Sell Stock with Cooldown.cpp | UTF-8 | 765 | 2.9375 | 3 | [] | no_license | class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
if(n == 0)
return 0;
vector<int> sold(n,0);
vector<int> un_sold(n,0);
for(int i = 1; i < n; i++){
un_sold[i] = sold[i] = sold[i-1];
for(int j = 0; j < i; j... | true |
ce04945a3dbfcf5e7107124bc8d6c94f0fe83bb4 | C++ | foolchi/QuickHull3D | /src/zonotope.h | UTF-8 | 5,380 | 3.0625 | 3 | [] | no_license | #ifndef ZONOTOPE_H
#define ZONOTOPE_H
/**
* @file zonotope.h
* @brief class for calculate
*/
#include <QtGlobal>
#include <QString>
#include <QChar>
#include "face.h"
#include <vector>
#include "quickhull3d.h"
using namespace std;
/**
* @brief The Zonotope class
*/
class Zonotope
{
public:
/**
* @bri... | true |
649b31c5e0d105be452030808b8bb73d4c8b5c5b | C++ | Jubayer-Hossain-Abir-404/Problem-Solving-Using-C-C- | /above average.cpp | UTF-8 | 477 | 2.90625 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
int main()
{
int i,j,n;
int a[100];
float sum=0;
int c=0;
float average;
printf("The value of n:");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("The numbers:");
scanf("%d",&a[i]);
sum=sum+a[i];
}
average=(float)sum/n;... | true |
49450aa00545835eb7adc9269c35729b4c21b974 | C++ | sunchun1979/gojo | /src/gameEngine.cpp | UTF-8 | 4,527 | 2.59375 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <unistd.h>
#include "common.h"
#include "gameEngine.h"
#include "player.h"
using namespace std;
GameEngine::GameEngine() : GameEngine(9)
{
}
GameEngine::GameEngine(int size):m_size(size)
{
startGNUGo();
string cmd("boardsize... | true |
0052dd25d5b2009b28b4d01f7b3593205b4b4246 | C++ | cbrghostrider/Hacking | /leetcode/_000317_shortestDistAllBuildings_accepted.cpp | UTF-8 | 2,235 | 2.8125 | 3 | [
"MIT"
] | permissive | class Solution {
struct Coord {
int r=0;
int c=0;
};
int R, C;
int num_houses=0;
vector<vector<int>> dist; // total dist to all houses
vector<vector<int>> touched; // how many houses could visit me
// O(R*C) time.
void bfs(vector<vector<int>>& gr... | true |
c7f1d23a342d7a1f1dd01f702c5e357740c574be | C++ | cristian-szabo-university/2d-graphics-programming-opengl | /MonkeyInvasion/include/game/game.h | UTF-8 | 3,549 | 2.578125 | 3 | [
"MIT"
] | permissive | /**
* Name : Game
* Author : B00233705
* Version : 1.0
* Copyright : (c) 2013 http://videogamelab.co.uk/monkey-invasion
* Description : This file presents the variables and functions declarations
* of class Game which setup the game objects and how they are
* rendered, updated and any mouse or keyboa... | true |
ff092117d41cade37b08e1b6fc7ef33554c02be5 | C++ | mviseu/Cpp_primer | /Chapter18/18_8_Query.cc | UTF-8 | 610 | 2.546875 | 3 | [] | no_license | #include "18_8_Query.h"
#include "18_8_BaseQuery.h"
#include "18_8_NotQuery.h"
#include "18_8_AndQuery.h"
#include "18_8_OrQuery.h"
#include <memory>
namespace chapter18 {
Query operator~(const Query &qr) {
return std::shared_ptr<BaseQuery>(new NotQuery(qr));
}
Query operator&(const Query &lhs, const Query &rhs) {... | true |
d5b42edc7e20663dc3fbb7c990dde4478eef1eea | C++ | rohit1309d/Operating-Systems-Lab-CS39002 | /Asgn5/Ass5_43_18CS10013_18CS10024/Ass5_43_18CS10013_18CS10024_process.cpp | UTF-8 | 3,957 | 2.59375 | 3 | [] | no_license | #include <unistd.h>
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <bits/stdc++.h>
#include <chrono>
#include <signal.h>
#include <pthread.h>
using namespace std;
using namespace std::chrono;
#define max_size 8
struct job{
pid_t process_id;
i... | true |
a730f808b4120e75f3452daf97a06c63911b57de | C++ | eglrp/PointCloudPractice | /week3/src/kmeans.cpp | UTF-8 | 3,039 | 2.890625 | 3 | [] | no_license | #include "kmeans.h"
void Kmeans::fit(const std::vector<Eigen::VectorXd> &data) {
// 检查输入有效性
assert(data.size() > 0 && k <= data.size() && "Data not valid\n");
numDimensions = data[0].size();
for (auto &item:data) {
if (item.size() != numDimensions) {
std::cerr << "Data dimension not... | true |
5990f1095d2e3183772ae3f0615cc8b8ec3a57d7 | C++ | JonMoore75/SDL_GUI | /Source/Font_TTF.cpp | UTF-8 | 1,080 | 2.890625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | #include "Font_TTF.h"
#include <SDL2\SDL_ttf.h>
FontTTF::FontTTF()
{
}
FontTTF::~FontTTF()
{
Release();
}
bool FontTTF::LoadFont(const char* file, int ptsize, Color textColor)
{
m_pFont = TTF_OpenFont(file, ptsize);
if (m_pFont == nullptr)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error!", "Font not... | true |
fe9c17c5c136432775b07f05626d1a6f9096170c | C++ | rahulsud48/cpp | /englcon1.cpp | UTF-8 | 1,407 | 3.890625 | 4 | [] | no_license | #include<iostream>
using namespace std;
class Distance{
private:
int feet;
float inches;
public:
Distance() : feet(0), inches(0.0){
/* First Constructor */
}
Distance(int feet_, float inches_) : feet(feet_), inches(inches_){
/* Second Construct... | true |
5e1c5a29840a122dfef02fca5997a6c953bc407a | C++ | Warboss-rus/concurrencycourse | /src/8_thread_safe_queue.cpp | UTF-8 | 831 | 2.84375 | 3 | [] | no_license | #include <benchmark/benchmark.h>
#include "OptimizedThreadSafeQueue.h"
#include "SimpleThreadSafeQueue.h"
#include "JoinableThread.h"
#include <thread>
// Do not modify
template <class T>
void bench_body(benchmark::State& state)
{
srand(0);
for (auto _ : state)
{
T queue;
JoinableThread<std::thread> t1([&] {
... | true |
761ab2e12c9029122f71b38edc6e09793a08a1c4 | C++ | peeyush11/bag-of-words | /src/clustering/feature_point.ipp | UTF-8 | 3,146 | 3.328125 | 3 | [] | no_license | /**
* @file feature_point.ipp
*
* @author Jan Quakernack
* @version 1.0
*/
#include <numeric>
#include "tools/linalg.hpp"
namespace igg {
template <class T>
size_t NearestNeighbor
(const FeaturePoint<T>& kQueryPoint,
const std::vector<FeaturePoint<T>>& kPointSet)
{
if (kPointSet.empty())
{throw std... | true |
1e3c3e14ac1d03de11270ab0590eb5e545ffb633 | C++ | Sadeeb96/Genetic-Algorithm | /GeneticAlgorithm.cpp | UTF-8 | 11,995 | 2.734375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct chromosome
{
string a;
string b;
} pop[5],ch1,ch2;
bool complete(int visA[],int visB[])
{
for(int i=0; i<8; i++)
{
if(visA[i]==0 || visB[i]==0)
{
return false;
}
}
return true;
}
void popu... | true |
947c4a9bb653de3c53c3db11636a94db2e0588fd | C++ | quzery/Leetcode2019 | /118.杨辉三角.cpp | UTF-8 | 1,124 | 3.328125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=118 lang=cpp
*
* [118] 杨辉三角
*
* https://leetcode-cn.com/problems/pascals-triangle/description/
*
* algorithms
* Easy (63.13%)
* Likes: 174
* Dislikes: 0
* Total Accepted: 32K
* Total Submissions: 50.5K
* Testcase Example: '5'
*
* 给定一个非负整数 numRows,生成杨辉三角的前 numRows 行。
* ... | true |
6cbd906ab0c2ea40fb74ee2035fbc538870d332b | C++ | fconrotte/android_astronomy | /cepheids.ino | UTF-8 | 2,241 | 3.75 | 4 | [
"LicenseRef-scancode-public-domain"
] | permissive | /*
Cepheids pulsing period & brightness
This example shows how to fade 2 LEDs on pins 3 and 5 using the analogWrite()
function, to simulate Cepheids stars.
This is to illustrate the relation between period & brightness in Cepheid stars,
as discovered by Henrietta Swan Leavitt in 1908.
Read https://e... | true |
239ff16c9f1dff02d22e0c7848a8f56b4f9937c7 | C++ | Bloodclot24/clown1 | /Trabajo Practico 2/BloqueDeRegistros.h | UTF-8 | 738 | 2.65625 | 3 | [] | no_license | #ifndef BLOQUEDEREGISTROS_H_
#define BLOQUEDEREGISTROS_H_
#include <iostream>
#include <string.h>
#include "Registro.h"
#include "LockFile.h"
#define MAX_REG_MEM 100
class BloqueDeRegistros {
private:
int numeroBloque;
Registro registros[MAX_REG_MEM];
int cantidadDeRegistros;
void acomodarBloque(int posicion);
... | true |
b06b837e0bdcca9ef6de32ea7f58106a59af4a8a | C++ | asdlei99/p81z | /sources/FMOperator.cpp | UTF-8 | 1,125 | 2.53125 | 3 | [] | no_license | #include "FMOperator.h"
void FMOperator::setup(float sampleRate)
{
eg_.setup(sampleRate);
osc_.setup(sampleRate);
}
void FMOperator::clear()
{
eg_.clear();
osc_.clear();
}
void FMOperator::adjustBuffer(unsigned size)
{
buffer_.reset(new float[size]);
}
void FMOperator::noteOn(int note, float vel... | true |
3e9c7f222ba628b1418aa4bd2c37f0621d8cb55f | C++ | coveleski/jawsome | /dispatcher.h | UTF-8 | 1,198 | 3.15625 | 3 | [] | no_license | /**
* Authored by David Vriezen
* 27 October, 2013
* Com S 352 Project 1
*/
#include <queue>
#include <vector>
#include <time.h>
/**
A container class to hold the thread context, priority, and ready_time, while in the queue
*/
class Task{
public:
//Constructor
Task(int pri, ucontext_t *con);
//The task's pri... | true |
cd24436ea308b0ed8751a5bab08e6cbbe648d370 | C++ | dawnarc/high_level_container | /multi_type_list/unreal_version/VarObject.h | UTF-8 | 815 | 2.59375 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
enum EValueType
{
Integer,
Float,
String,
Object,
None,
};
/**
*
*/
class TOWERDEFENSE_API VarObject
{
public:
VarObject();
VarObject(int Val);
VarObject(float Val);
VarObject(const FStr... | true |
22de40521944b2881553aad32d7855ce884c7222 | C++ | Siapran/dunkleheld | /DunkleHeld/src/Collidable.h | UTF-8 | 1,092 | 2.71875 | 3 | [] | no_license | /*
* File: Collidable.h
* Author: siapran
*
* Created on February 5, 2015, 9:17 AM
*/
#ifndef COLLIDABLE_H
#define COLLIDABLE_H
#include <SFML/Graphics.hpp>
class Actor;
//enum CollideReaction {
// RESOLVE, DAMAGE, ACTION, NONE
//};
class Collidable {
public:
Collidable(sf::Vector2f m_position = sf... | true |
930610d319c10d423f4ca2680c5ddeeb9b8bc514 | C++ | bdajeje/SDLEngine | /graphics/animation.hpp | UTF-8 | 594 | 2.625 | 3 | [] | no_license | #ifndef ANIMATION_HPP
#define ANIMATION_HPP
#include <string>
#include <vector>
#include "graphics/drawable.hpp"
namespace graphics {
namespace info {
static const std::string Framerate {"framerate"};
static const std::string NbrClips {"nbr_clips"};
}
class Animation : public Drawable
{
public:
Animatio... | true |
b339c71c6d20e4d922f07c4a41fe801a1efee6d1 | C++ | twbikeman/advance | /deepcopying.cpp | UTF-8 | 821 | 3.40625 | 3 | [] | no_license | #include <cstring>
#include <cassert>
#include <iostream>
class MyString {
private:
char *m_data;
int m_length;
public:
MyString(const char *source="") {
assert(source);
m_length = std::strlen(source) + 1;
m_data = new char[m_length];
for (int i = 0; i < m_length; ++i)
m_data[i] = source... | true |
90c7a0d54a195128dd5d6e0947748f09d0b69846 | C++ | abarankab/competitive-programming | /zachetik/zachetik/zachetik.cpp | UTF-8 | 4,529 | 3.046875 | 3 | [] | no_license | // Munin.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <fstream>
using namespace std;
typedef long double ld;
const ld EPS = (ld)1e-9;
const ld Pi = 3.14159265359;
... | true |
c29645d369e83c35547dc89697ebbdd2e85b765f | C++ | rlj1202/problemsolving | /baekjoon/1342/main.cpp | UTF-8 | 734 | 2.953125 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
using namespace std;
char str[12];
bool check(char* s) {
for (int i = 1; s[i] != 0; i++)
if (s[i - 1] == s[i]) return false;
return true;
}
void swap(char* a, char* b) {
char temp = *a;
*a = *b;
*b = temp;
}
int perm(char* s) {
if (*s == 0) {
... | true |
837c7c09531cc5b0c7817f36194091ff8ec55894 | C++ | david20571015/Introduction-to-Computers-and-Programming | /hw4/2.cpp | UTF-8 | 181 | 2.703125 | 3 | [] | no_license | #include<stdio.h>
int main(void){
int n=1,sign=1;
double ans=0;
while(1.0/n>=1E-06){
ans+=(1.0/n)*sign;
sign=-sign;
n+=2;
}
printf("PI/4 = %lf",ans);
return 0;
}
| true |
c63f8dd6eda57ef2b96f385cd86c4aa944804386 | C++ | ChengSashankh/SudokuSolver | /Header.cpp | UTF-8 | 5,032 | 3.25 | 3 | [] | no_license | #include<iomanip.h>
#include<math.h>
#include<stdio.h>
void getpuzzle(int s[9][9],char *A) //gets the given values for the grid and set all other cells to 99
{
for(int i=0;i<9;i++) //set all cells to 99.
{
for(int j=0;j<9;j++)
{
s[i][j]=99;
}
}
int r,c,value,number;
freopen(A,"r",stdin... | true |
2ebfe9d6cfbc6d6f7d1871d87d7880928e46a672 | C++ | drlongle/leetcode | /algorithms/problem_0469/solution.cpp | UTF-8 | 2,312 | 3 | 3 | [] | no_license | /*
469. Convex Polygon
Medium
You are given an array of points on the X-Y plane points where points[i] = [xi, yi]. The points form a polygon
when joined sequentially.
Return true if this polygon is convex and false otherwise.
You may assume the polygon formed by given points is always a simple polygon. In other word... | true |
c77aff09002403f2fbce65684e13966dcd21dcc5 | C++ | ashleygwinnell/firecube | /Tools/SceneEditor/CollisionShapeWindow.cpp | UTF-8 | 5,263 | 2.546875 | 3 | [
"MIT"
] | permissive | #include "CollisionShapeWindow.h"
#include "Descriptors/CollisionShapeDescriptor.h"
#include "Commands/CustomCommand.h"
#include "EditorState.h"
using namespace FireCube;
CollisionShapeWindow::CollisionShapeWindow(FireCube::Engine *engine) : Object(engine)
{
}
void CollisionShapeWindow::Render(EditorState *editorSt... | true |
169e942461c53116c18d4b55698a12304e0dc069 | C++ | dennyown/CrazyTanks.v.1 | /CrazyTanks.v.1/Tank.h | UTF-8 | 294 | 2.609375 | 3 | [] | no_license | #ifndef TANK_H
#define TANK_H
#include "Point.h"
#include "Bullet.h"
#include "Player.h"
class Tank: public Player {
public:
Tank();
Tank( Point position, char sign, int health );
~Tank();
void action( Tank& tank, Bullet& bullet );
private:
void move( Tank& tank );
};
#endif // TANK_H | true |
8f0be48d8c9b3d22b1dac48ae59a87885f12c93f | C++ | 543877815/algorithm | /leetcode周赛/2351. First Letter to Appear Twice.cpp | GB18030 | 344 | 3.03125 | 3 | [] | no_license | // ϣ
// ʱ临ӶȣO(n)
// ռ临ӶȣO(n)
class Solution {
public:
char repeatedCharacter(string s) {
int n = s.size();
unordered_map<char, int> mymap;
for (int i = 0; i < n; i++) {
mymap[s[i]]++;
if (mymap[s[i]] == 2) return s[i];
}
return -1;
}
}; | true |
7cf48db38c53ac32dbf3eb7e15f7ce261496b97b | C++ | chenminhua/math | /matrix/multiply/matmul_eigen/main.cpp | UTF-8 | 713 | 2.734375 | 3 | [] | no_license | /**
* @ Author: Minhua Chen
* @ Create Time: 2019-08-24 11:00:32
* @ Modified by: Minhua Chen
* @ Modified time: 2019-08-24 15:00:57
* @ Description: g++ -I eigen -O3 main.cpp
*/
#include <iostream>
#include <Eigen/Dense>
using namespace::Eigen;
#define DEFAULT_SIZE_M 5
typedef Eigen::Matrix<int, Dynamic, Dyna... | true |
e223f6c249adb83bbd0c9ffeaf543a372446fffb | C++ | HaiZeizhouyuan/HZOJ | /596.cpp | UTF-8 | 805 | 2.953125 | 3 | [] | no_license | /*************************************************************************
> File Name: 596.cpp
> Author:
> Mail:
> Created Time: Fri Jul 24 21:31:33 2020
************************************************************************/
#include<iostream>
#include <algorithm>
using namespace std;
#define max_n 5000
str... | true |
ad313b0e170f89e9a8d3908a65cac35e0d055d0b | C++ | xSeanliux/CompetitiveProgramming | /AtCoder/ARC_087/pC.cpp | UTF-8 | 249 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <map>
using namespace std;
int N, x;
map<int, int> frq;
int main(){
cin >> N;
while(N--){
cin >> x;
frq[x]++;
}
int ans = 0;
for(auto [a, b] : frq){
ans += (a <= b ? b - a : b);
}
cout << ans << endl;
}
| true |
b126389c46cb9ae6712330f29afee35162906573 | C++ | ygagneja/CS335-Compiler | /src/3ac.cpp | UTF-8 | 10,325 | 2.625 | 3 | [] | no_license | #include "3ac.h"
#include "type_check.h"
long long counter = 0;
vector<quad> code_arr;
string new_symbol(){
counter++;
string new_sym = "_tmp_" + to_string(counter);
return new_sym;
}
qid newtmp(string type, unsigned long long level, unsigned long long* level_id){
string sym = new_symbol();
retu... | true |
0984f5fd9700d4b9a1b8152c7f9b9e32dcd426a8 | C++ | Rulygl/C | /pag_124/Bucles_ej_2_pag_124_.cpp | UTF-8 | 238 | 3 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int n = 26;
cout<<" Estos son los numeros pares menores de 26 "<< endl ;
while((n <= 26)&&(n >=10)&&(n%2==0 )){
cout << n << endl;
n = n-2;
}
return 0;
}
| true |
53c3581bf11c5f103d0c2586e5b6881782c8ad3d | C++ | hungntth/T2004E_C | /assignment5/4.cpp | UTF-8 | 287 | 2.5625 | 3 | [] | no_license | #include <stdio.h>
int main(){
int a,b,c,d;
printf("Nhap so a: ");
scanf("%d",&a);
printf("Nhap so b: ");
scanf("%d",&b);
if(a*b==0){
printf("Sai so");
}else{
for(c = 1; c <= a || c <= b; c++) {
if( a%c == 0 && b%c == 0 )
d = c;
}
printf("USCLN = %d", d);
}
}
| true |
e0f74ce643726739c061637dc15707bf6ae65709 | C++ | Robin-P/indie-studio | /include/Socket.hpp | UTF-8 | 1,431 | 2.59375 | 3 | [] | no_license | //
// EPITECH PROJECT, 2018
// cpp_indie_studio
// File description:
// Socket
//
#pragma once
#include <unistd.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <cstring>
#include <iostream>
#include <vector>
namespace Indie {
enum PowerUpType {
FIRST_UP = 3,
SPEED_UP = 4,
BOMB_UP = 5,
FIRE_UP = 6,
W... | true |
f502e31389241d04475e035e3a9a834e27ae138f | C++ | zhiqianglife/Leetcode-Practice | /DP/303. Range Sum Query - Immutable.cpp | UTF-8 | 1,136 | 4.09375 | 4 | [] | no_license | /*
给定一个整数数组 nums,求出数组从索引 i 到 j (i ≤ j) 范围内元素的总和,包含 i, j 两点。
示例:
给定 nums = [-2, 0, 3, -5, 2, -1],求和函数为 sumRange()
sumRange(0, 2) -> 1
sumRange(2, 5) -> -1
sumRange(0, 5) -> -3
说明:
你可以假设数组不可变。
会多次调用 sumRange 方法。
*/
/*class NumArray {
public:
vector<int> m_nums;
NumArray(vector<int>& nums) {
m_nums... | true |
cf0d0ccbbe8841093f0b44e5a1bd36290faf0a5a | C++ | dandanjoseph/Regular-Pentagon | /RegularPentagon.cpp | UTF-8 | 861 | 3.546875 | 4 | [] | no_license | /*
* File: RegularPentagon.cpp
* Author: Joseph Dandan
*
* This program calculates the area and perimeter of a regular pentagon
*/
#include "RegularPentagon.h"
#include <cmath>
RegularPentagon::RegularPentagon(double sideArg, string name) : GeometricObject (name)
//this method takes in a side argument and can ... | true |
bcd8f36a71e106fa24ff76e1e7a8a02797856fb4 | C++ | rajaniket/Data-Structures-and-algorithms | /coding blocks/Arrays 2.0/solving a string challenge.cpp | UTF-8 | 2,078 | 3.84375 | 4 | [] | no_license | //order string
//question link => https://www.hackerrank.com/contests/morgan-stanley-codeathon-2017/challenges/shell-sort-command
#include<iostream>
#include<string>
#include<cstring>
#include"algorithm"
using namespace std;
//extract string will give Kth number using string tokenizer
string extract(string a,int k)
... | true |
2815f394820da260756d10f59cb594d7ef9b7fd2 | C++ | seifgamal/Social_ConsoleApp | /DateTime.h | UTF-8 | 1,045 | 3.03125 | 3 | [] | no_license | #ifndef SOCIAL_DATETIME_H
#define SOCIAL_DATETIME_H
#include <bits/stdc++.h>
using namespace std;
class DateTime {
private:
int day, month, year;
int second, minute, hour;
string dayName, monthName;
bool validDate(int day, int month, int year);
bool validDate(string &DDMMYY);
void setCurrent();... | true |
8d6692a1dc843152edb87c018902cdabd3796829 | C++ | ryecao/MiniSQL | /index_info.h | UTF-8 | 1,155 | 2.59375 | 3 | [] | no_license | // @copyright (c) 2014 sodabeta, ryecao
// @license: MIT
// @author(s): sodabeta/rxzxx0723@gmail.com, ryecao/ryecao@gmail.com
// created by sodabeta , Oct. , 2014
//
// MiniSQL
// A course project for Database System Design, Fall 2014 @Zhejiang Univ.
//
// @file:index_info.h
// @brief: used to store index information.
... | true |
38aa6f7bfad25046f27075d70748c6f8868ddf89 | C++ | cantina-lib/cantina_common | /inline/cant/physics/PhysicalShape.inl | UTF-8 | 3,123 | 2.78125 | 3 | [] | no_license |
#ifndef CANTINA_PHYSICS_PHYSICALSHAPE_INL
#define CANTINA_PHYSICS_PHYSICALSHAPE_INL
#pragma once
#include <c3ga/Mvec.hpp>
#include <c3ga/c3gaTools.hpp>
#include <cant/common/macro.hpp>
CANTINA_PHYSICS_NAMESPACE_BEGIN
template <size_u dim, typename T>
PhysicalShape<dim, T>::PhysicalShape(DistanceFunctor func, T rad... | true |
8494aa7e4c027e1c42f4d8bbd77ba5670ce12634 | C++ | Polynominal/Lucy3D | /include/Lucia/Collider/Manager.h | UTF-8 | 3,490 | 2.546875 | 3 | [
"LicenseRef-scancode-other-permissive"
] | permissive | #ifndef MIKUS_LUCIA_COLLIDER_MANAGER_H
#define MIKUS_LUCIA_COLLIDER_MANAGER_H
#include <Lucia/Collider/Collider.h>
#include <Lucia/Collider/Tools.h> // matrix<uint> and inf vector;
#include <Lucia/Collider/Algorithm/Octtree.h>
namespace Lucia {
class Collider::Manager
{
public:
friend class Shape;
... | true |
6927b508440c5115934d299dcd39b48107b7f965 | C++ | gengyouchen/atcoder | /beginner-contest-141/e-who-says-a-pun/binary-search-solution.cpp | UTF-8 | 1,468 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
using LL = long long;
#define MOD 1000000007
class RollingHash {
private:
LL mod(LL x) { return (x % MOD + MOD) % MOD; }
LL h = 0, w = 0;
public:
template <class I>
RollingHash(I first, I last) {
for (auto it = first; it != las... | true |
07c6fc51849298797791c61738ee081d9cf6abd1 | C++ | LeFou-k/RTRenderer | /include/hittable_pdf.h | UTF-8 | 621 | 2.578125 | 3 | [] | no_license | //
// Created by VRLAB on 2020/12/6.
//
#ifndef HITTABLE_PDF_H
#define HITTABLE_PDF_H
#include "pdf.h"
#include "hittable.h"
class hittable_pdf : public pdf{
public:
//origin is the not the hittable point, but the Ray origin point
hittable_pdf(shared_ptr<hittable> p, const point3& origin): ptr(p), o(origin){}... | true |
3eeceb457d20695e0a5b8af9f05f2c98bbb9a732 | C++ | remerson/uva | /solutions/10205-StackEmUp/generator.cpp | UTF-8 | 945 | 2.6875 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#ifndef ONLINE_JUDGE
#define DEBUG(X) { X; }
#else
#define DEBUG(X)
#endif
using namespace std;
const int MAX_N = 100;
const int MAX_C = 52;
int main(int argc, char **argv)
{
srand(... | true |
82ef6431a479899ef16106421b02e9af5dbdc00d | C++ | PhilCK/vortex | /Code/Caffeine/Tests/AnyDataTest.cpp | UTF-8 | 2,670 | 3.484375 | 3 | [] | no_license |
#include <UnitTest.hpp>
#include <Caffeine/Utilities/AnyData.hpp>
TEST(SimpleUse)
{
// Ints and String
{
const Caffeine::Utilities::AnyData data(123);
ASSERT_IS_EQUAL(123, data.asInt8())
ASSERT_IS_EQUAL(123, data.asUInt8())
ASSERT_IS_EQUAL(123, data.asInt16())
ASSERT_IS_EQUAL(123, data.asUInt16())
ASS... | true |
e3ac025b6776e502aa49330c5fdb084e4d216170 | C++ | xeppaka/ganids | /common.cpp | UTF-8 | 909 | 3 | 3 | [] | no_license | #include <iomanip>
#include "common.h"
using std::hex;
//std::ostream& print_sequence_val32(std::ostream &stream, const sequence_val32 &val) {
// int cur_node_type = val & NODE_TYPE_PATTERN;
// switch (cur_node_type) {
// case NODE_NORMAL:
// stream << static_cast<int>(val & NODE_VALUE_PATTERN);
// ... | true |
7e9050c61ea40b55c6ba99cc1cf6df2d3265209b | C++ | happydhKim/MyDataStructureAlgorithm | /newMyDataStructureAlgorithm/algorithm/permutation.cpp | UTF-8 | 403 | 2.546875 | 3 | [] | no_license | // https://www.acmicpc.net/problem/15649
#include <stdio.h>
int n, m, i, c[9];
char d[20];
void dfs(int depth) {
if (depth == m) {
printf("%s\n",d);
return;
}
for (int i = 1; i <= n; i++) {
if (c[i]) { continue; }
d[depth * 2] = i + '0';
c[i] = 1;
dfs(depth + 1);
c[i] = 0;
}
}
int main() {
scanf(... | true |
6e07eff93f96071acaf322bce748b53fe097435c | C++ | xliu45/Job-Fun | /LeetCode/C++/94_Binary_Tree_Inorder_Traversal.cpp | UTF-8 | 1,548 | 3.9375 | 4 | [] | no_license | //94. Binary Tree Inorder Traversal
/*
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [1,3,2].
Tag: Tree, Hash Table, Stack
Author: Xinyu Liu
*/
#include <iostream>
#include <vector>
#include <stack>
using namespac... | true |
443f1f8c6ddb026eb98298b975fe681891a9bbc1 | C++ | barajasr/Snake | /include/Definitions.hpp | UTF-8 | 1,311 | 3 | 3 | [] | no_license | #ifndef __DEFINITIONS_HPP__
#define __DEFINITIONS_HPP__
#include <SFML/Graphics.hpp>
enum Direction{UP, DOWN, LEFT, RIGHT};
enum TileType{EMPTY, FOOD, HAZARD};
// Constants for 2D gameboard, max indices
const unsigned BOARD_X = 61;
const unsigned BOARD_Y = 61;
const unsigned IMAGESIZE = 8;
// Total margin between ... | true |
1e16e840bb35585d8d60fa3f24cea0afcb6c5494 | C++ | julianbeek/openFrameworksHKU | /les3BounceKeys/src/ofApp.cpp | UTF-8 | 1,146 | 2.890625 | 3 | [] | no_license | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup()
{
amount = 1;
addOne = 0;
for (int i = 0; i < amount; i++)
{
Triangle newTriangleA;
newTriangleA.setup();
TriangleA.push_back(newTriangleA);
}
}
//------------------------------------------------------... | true |
6aedc575f423df44db6838df94209bec674177be | C++ | monircse061/Lab-Problems-Solution-Codes | /Others/binary search std.cpp | UTF-8 | 845 | 3.171875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> v ;
v.push_back(2);
v.push_back(3);
v.push_back(5);
v.push_back(9);
v.push_back(10);
v.push_back(13);
/*bool ans= binary_search(v.begin(),v.end(),9);
if(ans) cout<<" Found ";
else cout<<" N... | true |
6e7ecb900c28274dcaeb776db7501b10b0f25666 | C++ | MeLikeyCode/QtGameEngine | /example projects/example9/main.cpp | UTF-8 | 2,368 | 3.28125 | 3 | [] | no_license | // Basic GUI
// Hello again and welcome back to another QGE tutorial!
//
// Today, I will show you how to create a basic GUI.
//
// All Gui objects inherit from qge::Gui. They can be added to a Game (via Game::addGui()) or to a Map (via Map::addGui()).
// If they are added to a Game, they will be positioned relative t... | true |
ecbf18ada503fc140b7981283bf1fb952ae3a864 | C++ | Syhawk/LeetCode | /divide_two_integers.cpp | UTF-8 | 2,287 | 3.578125 | 4 | [] | no_license | //uri: https://leetcode.com/problems/divide-two-integers/
/*
* 由于不允许使用乘、除以及取余运算,所以可以采用加、减以及位运算来实现除法。
* 首先考虑特殊情况,主要是int整数越界情况。然后将被除数与除数转化为正整数,
* 对正整数进行操作。由于所有的int整数都可以转化成二进制来表示,那么一个
* 十进制整数x可以由另一个十进制整数y以及余数z来表示。
* x = (2 ^ a1 + 2 ^ a2 + 2 ^ a3 + ... 2 ^ an) * y + z。其中ai均为非负整数,
* 且ai < 32, ai < ai+1
* 那么,我们可以先找出最... | true |
78a6471fe9a07a59487cb40fd5c8a071cbfe826e | C++ | miviwi/Hamil | /Hamil/include/py/object.h | UTF-8 | 2,387 | 2.859375 | 3 | [] | no_license | #pragma once
#include <py/python.h>
#include <string>
#include <utility>
#include <type_traits>
namespace py {
class TypeObject;
class List;
class Dict;
class Tuple;
// RAII wrapper around PyObject (does Py_DECREF automatically)
// - nullptr can be passed to the constructor as the 'object'
// and will be ha... | true |
5df896689d6e73b9175df63b2f0d817b7212987c | C++ | Anonymous-V/Principles-and-Practice-Using-CPP-2nd-edition | /chapter_08/task_10/main.cpp | UTF-8 | 4,602 | 3.5 | 4 | [] | no_license | /*
* Описание задачи:
* ================
* Напишите функцию, которая находит наименьший и наибольший элементы вектора,
* являющегося ее аргументом, а также вычисляющую их среднее и медиану. Не
* используйте глобальные переменные. Результаты можно вернуть либо в виде структуры
* struct, либо с помощью механизма пе... | true |
330ac0dc8feb2fe132108a0d5e0c25f51bf5015f | C++ | shantanudwvd/Coding_Problems_in_C- | /Queue_operations.cpp | UTF-8 | 943 | 2.875 | 3 | [] | no_license | //
// Created by Shantanu on 2/14/2020.
//
#include <iostream>
#include <deque>
using namespace std;
int main() {
deque<int> array;
deque<int>::iterator itr;
int s1, s2;
cin >> s1;
for (int i = 0, val; i < s1; ++i) {
cin >> val;
array.push_back(val);
}
cin ... | true |
31cad6e72c64b057d70aa821e73d70013cd2aa27 | C++ | lynli/radiomicfeatures | /Extraction/Collage/Code/MEX_ComputeHaralick/ComputeHaralick.cpp | UTF-8 | 8,979 | 2.53125 | 3 | [] | no_license | #include "mex.h"
#include <algorithm>
#include <iostream>
using namespace std;
inline double logb(double x, double b)
{
return std::log(x) / std::log(b);
}
void graycomtx(const double *image, double *comtx, int ws, int dist, int graylevels,
const int background, int rows, int cols, int row, int col)... | true |
cc1d75b493ecf617012fc9d53daf886ef9dc15c8 | C++ | raghuit/DSA-REVISION | /FAANG IMP. INTERVIEW QUE3/LCS.cpp | UTF-8 | 804 | 3.546875 | 4 | [] | no_license | PROBLEM STATEMENT: Longest Common Subsequence
Given two sequences, find the length of longest subsequence present in both of them.
Both the strings are of uppercase.
LANGUAGE USED:C++
CODE SOLUTION:
class Solution
{
public:
//Function to find the length of longest common subsequence in two strings.
... | true |
88fb331c37e729eac283d5a32043ea94419fc01c | C++ | carlosaffrc/HackerRank-CPP | /30DaysOfCode/day8-Maps-PhoneBook.cpp | UTF-8 | 937 | 3.515625 | 4 | [] | no_license | #include <vector>
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
int main() {
int entries;
int value;
std::string key;
//map
std::map<std::string, int> phoneBook;
//iterator
std::map<std::string, int>::iterator it;
//pair for return value o... | true |
9e5c545eabba618130e23352e31513bd1b3070ac | C++ | wdeng7714/Minesweeper | /src/Number.h | UTF-8 | 310 | 2.53125 | 3 | [] | no_license | /*
* Numbers.h
*
* Created on: Apr 22, 2016
* Author: Wendy
*/
#ifndef NUMBER_H_
#define NUMBER_H_
#include "Tile.h"
class Number :public Tile {
private:
int m_number;
public:
Number();
virtual ~Number();
void setNumber(int n);
int getNumber();
};
#endif /* NUMBER_H_ */
| true |
076e1175605dd8f7255f23d4e45b042824194763 | C++ | timkpaine/aat | /aat/cpp/include/aat/config/enums.hpp | UTF-8 | 5,754 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <iostream>
#include <unordered_map>
#include <vector>
#include <aat/common.hpp>
using namespace aat::common;
namespace aat {
namespace config {
enum class TradingType {
LIVE = 0,
SIMULATION = 1,
SANDBOX = 2,
BACKTEST = 3,
};
enum class Side {
NONE = 0,
BUY = 1,
... | true |
f621b326e5f422dd44343449b6f8970a2a8d8c6b | C++ | mt-revolution/Competition | /Atcoder/ABC168D.cpp | UTF-8 | 1,208 | 3.40625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
// 幅優先探索(最短距離の計算)
struct bfs {
vector<vector<int>> G;
vector<int> mark;
bfs(int N) {
G.assign(N, vector<int>{});
mark.assign(N, -1);
};
void make_edge(int u, int v) {
G[u].push_back(v);
}
void make_twoedge(int u, int v... | true |
91a523ecf13afcc3c5ecbdc707b872ab8e9c3073 | C++ | marwababelly/OOP | /car/distanse.cpp | UTF-8 | 517 | 3.03125 | 3 | [] | no_license | #include "distanse.h"
#include <iostream>
using namespace std;
void distanse::setdistsnse(int f, float n)
{
feet = f;
inches = n;
}
void distanse::print()
{
cout << "Feet = " << feet << "\t" << "Inches = " << inches << endl;
}
distanse :: distanse() :feet(0), inches(0.0)
{
}
distanse :: distanse(int f, float n) : ... | true |
0c4556b72959a7d806365ed7da0a5ebffb1d0f37 | C++ | OmkarSsawant/Programming-Battle- | /LeetCode/easy/common_prefix.cpp | UTF-8 | 1,693 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution
{
string prefix = "";
int j = 0;
public:
string longestCommonPrefix(vector<string> &strs)
{
if (strs.capacity() == 0)
return "";
bool is_prefix = false;
... | true |
dd0cb7b89c8bde270c31009a38206e7555b9420c | C++ | roomyroomy/algorithm | /algospot/DRAWRECT.cpp | UTF-8 | 688 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <set>
using namespace std;
int T;
set<int> pointX;
set<int> pointY;
int main()
{
cin >> T;
for(int idxTest = 0; idxTest < T; idxTest++)
{
set<int>::iterator it;
pointX.clear();
pointY.clear();
for(int idxPoint = 0; idxPoint < 3; idxPoint++)
{
int x, y;
cin >> x >> y... | true |
853f42e85bbfdbfc07337d96527406225c7125df | C++ | Davian99/Acepta_El_Reto | /AR_237.cpp | UTF-8 | 523 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
string polidiv(string num) {
string ret = "POLIDIVISIBLE";
int n = num.length();
long double d = stoll(num);
unsigned long long ll = stoll(num);
while (n > 1) {
if (d / n != ll / n) {
ret = "NO POLIDIVISIBLE";
n = 0;
}
else {
num.pop_back()... | true |
5d3d6aa558aff3b12b56bd47b97e8241c3851f93 | C++ | ChristianSchweichler/EasyTimer | /EasyTimer.h | UTF-8 | 906 | 2.984375 | 3 | [] | no_license | /*
EasyTimer.h - Timer Library for Arduino.
Created by Christian Schweichler, 2016
*/
#ifndef EasyTimer_h
#define EasyTimer_h
#include "Arduino.h"
class EasyTimer {
typedef void (*callback_function)();
public:
EasyTimer(int maxTimers);
~EasyTimer();
int setInterval(unsigned long millisecond... | true |
0138159f9fd91c673f8dbdc1fdc9f00ecba53670 | C++ | CyJay96/Lab-cpp | /lab_7/lab_7.6/lab_7.6.cpp | UTF-8 | 1,249 | 3.03125 | 3 | [] | no_license | /*
Дата сдачи: 01.03.2021
Выполнить задания, используя двусвязные динамические структуры данных в виде связных компонент.
Оценить асимптотическую сложность алгоритма.
Даны натуральное число n, действительные числа x1, x2, ..., xn.
Разработать программу вычисления значения выражения следующего вида:
(x[1] + x[n]) * ... | true |
f1175796054dca055118e4f7e16588db7b6c3233 | C++ | adambloniarz/CAGe | /cage_src/cost.cpp | UTF-8 | 3,387 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | /**
* Copyright 2015 Adam Bloniarz, Jonathan Terhorst, Ameet Talwalkar
*
* 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.0
*
* Unles... | true |
fee8384484cdc87cb215a1028b4f860e9fa50c31 | C++ | facundososagonzales/pa-2021-lab6 | /class/Usuario.cpp | UTF-8 | 797 | 3.09375 | 3 | [] | no_license | #include "../class/Usuario.h"
Usuario::Usuario(){}
Usuario::Usuario(string nombre, string imagenUrl, string email, string password){
this->nombre=nombre;
this->imagenUrl=imagenUrl;
this->email=email;
this->password=password;
}
string Usuario::getnombre() {
return this->nombre;
}
void Usuario::se... | true |
f5e8dfba63efba4c467ed0a7cae22ac7366622bb | C++ | AlloSphere-Research-Group/AlloSystem | /allocore/examples/math/vector.cpp | UTF-8 | 6,132 | 4.03125 | 4 | [
"BSD-3-Clause"
] | permissive | /*
AlloCore Example: Vectors
Description:
This shows basic usage of the Vec class which represents an n-dimensional vector
or n-vector.
Author:
Lance Putnam, 10/2012, putnam.lance@gmail.com
*/
#include "allocore/math/al_Vec.hpp"
using namespace al;
int main(){
// Lesson 1: Declarations
// =======================... | true |
cacfb7c91b73fa420106057ec980609eb74ba4f5 | C++ | sculg/TestOne | /TestOne/TestOne/main.cpp | UTF-8 | 13,186 | 3.390625 | 3 | [
"MIT"
] | permissive | //
// main.cpp
//
// Created by lg on 2019/7/27.
// Copyright © 2019 sculg. All rights reserved.
//
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <list>
using namespace std;
struct ListNode {
ListNode* next;
int val;
};
struct BinaryTreeN... | true |
33ca8c153669593ff921f8f42521b7942e654dbd | C++ | jeffersonfr/jhanoi | /hanoi-v01.cpp | UTF-8 | 1,585 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <cmath>
#include <string>
std::vector<int>
tower1,
tower2,
tower3;
void move(int from, int to)
{
int value;
if (from == 1) {
value = tower1.back();
tower1.pop_back();
} else if (from == 2) {
value = tower2.back();
tower2.pop_back();
} else ... | true |
d4d7ce414227107df4af7461bb5428fda6cdf082 | C++ | 7thsanctum/Intro_to_Graphics_Coursework | /GFX_Submission/GFX_Submission/texture.h | UTF-8 | 320 | 2.578125 | 3 | [] | no_license | #pragma once
#include <string>
#include <GL\glew.h>
#include <glm\glm.hpp>
class texture
{
private:
GLuint _image;
std::string _filename;
public:
texture(const std::string& filename);
~texture();
GLuint getImageID() const { return _image; }
bool create();
bool create(int width, int height, glm::vec4* data);
}; | true |
9741e340f900f96b81beeceb78efc539f873d3b2 | C++ | xwudennis/Algorithms | /QuickSort/QuickSort.cpp | UTF-8 | 4,459 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
void readFile(char * fileName, int ** nArray, int * nArraySize)
{
ifstream infile(fileName);
string line;
vector<int> nVector;
int i = 0;
whi... | true |
e31d99a45f87173f741b3df088d7c1ac82d90ee1 | C++ | tonnac/TCP_IP | /NonBlockServer/P_Server.cpp | UHC | 1,862 | 2.625 | 3 | [] | no_license | #include "Util.h"
int main(void)
{
const u_short port = 15000;
const char* IPAddr = "127.0.0.1";
if (WSAStart() != 0)
{
return -1;
}
SOCKET ListenSock = socket(AF_INET, SOCK_STREAM, 0);
if (ListenSock == INVALID_SOCKET)
{
return -1;
}
SOCKADDR_IN addr;
memset(&addr, 0, sizeof(addr));
addr.sin_port =... | true |
b541fe4d58ec8494231ec29c1437b250f42ee0c9 | C++ | V1t4/JumpMan | /src/Instrucciones.cpp | UTF-8 | 645 | 2.625 | 3 | [] | no_license | #include "Instrucciones.h"
Instrucciones::Instrucciones() {
//Se agrega un margen
margen.setTexture(Global::t_margen);
}
void Instrucciones::actualizar (Juego & j) {
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Return)){//Con enter se inicia un nivel
Global::nivActual=1;
j.cambiarEscena(new Nivel());
}
if(sf:... | true |
a5136e37c696c4f0ee2ec9e84051051cdc99e0d0 | C++ | shakirali2244/associates | /CPSC_2150/3_SList/testSList.cpp | UTF-8 | 475 | 2.5625 | 3 | [] | no_license | /*
* testSList.cpp
*
* Created on: Oct 19, 2016
* Author: Shakir
*/
#include "SList.h"
#include "SList.cpp"
#include <iostream>
using namespace std;
int main(){
SList<int> tmp;
Node<int>* test = tmp.getheader();
int level = 0;
tmp.insert(3);
tmp.insert(2);
tmp.insert(3);
tmp.insert(5);
tmp.insert(... | true |
9ec0647ce197c952e9ad1ccc60fda181744789c0 | C++ | carlixyz/Galaxy-Olympics_ULL | /proyecto-galaxy-olympics/auroraengine/AuroraEngine/AuroraEngine/Game/Scene/Player.h | ISO-8859-3 | 1,266 | 2.734375 | 3 | [] | no_license | #ifndef PLAYER_H
#define PLAYER_H
#include "../../Libraries/MathLib/MathLib.h"
#include "Object.h"
enum ePlayerState {
ePS_Crash = 0,
ePS_Running,
ePS_Turbo,
ePS_StandBy };
class cPlayer : public cObject
{
public:
cPlayer() { meType = ePlayer; meState = ePS_Running; mfFloatingSwap = 0.0f; mfTurboBoost = 10.... | true |
512aede2469ba37209eada3a829ed15338b8ca7b | C++ | tim-fa/Yugen | /Yugen/Events/Event.cpp | UTF-8 | 857 | 2.78125 | 3 | [] | no_license | // STL
#include <string>
// Local
#include "Event.h"
namespace Yugen::Events
{
Event::Event(EventType type)
: m_Type(type)
, m_Handled(false)
{
}
std::string Event::toString() const
{
return "Event: ";
}
std::string Event::typeToString(EventType type)
{
switch (type) {
case EventType::KeyPressed... | true |
add661489642e4ebaef2fef6487f1c5a23897e54 | C++ | Natureal/Codeforces | /Templates/t_dsu.cpp | UTF-8 | 247 | 2.890625 | 3 | [] | no_license | // Remember to define the range of fa[].
const int maxn = ;
int fa[maxn];
int Find(int x){
return fa[x] == x ? x : fa[x] = Find(fa[x]);
}
void Union(int a, int b){
int x = Find(a), y = Find(b);
if(x != y){
fa[x] = y;
}
}
| true |
88c16ca6c1c44ddf11f5e404e047d9d20601bd1d | C++ | Justforfunc1/net | /reactor_test/main.cpp | UTF-8 | 1,694 | 2.65625 | 3 | [] | no_license | #include <sys/socket.h>
#include <arpa/inet.h>
#include <iostream>
#include <errno.h>
#include "reactor.h"
#include "event_handler.h"
#include "accept_handler.h"
#include "event.h"
#include <fcntl.h>
//设置非阻塞模式
int setnonblocking( int fd )
{
int ret = fcntl(fd, F_SETFL, O_NONBLOCK );
if(ret < 0)
print... | true |
2c64fb09d1d1cfd068934a5b744aef017b49aa2e | C++ | danyaljj/combinatorialCircuitOptimization | /visualizer/digital_gate.h | UTF-8 | 1,624 | 3.28125 | 3 | [] | no_license | #ifndef DIGITAL_GATE_H
#define DIGITAL_GATE_H
#include <vector>
class digital_gate
{
public:
digital_gate();
digital_gate( int g_pos_x,
int g_pos_y,
int g_input1_x,
int g_input1_y,
int g_input2_x,
int g_inp... | true |
47c56428be1505a808de6119c2d312dd453c95fe | C++ | uniyalprashant9/CodeSpace | /Strings/stringSortLexicoGraphicOrder.cpp | UTF-8 | 538 | 3.1875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool compare (const string &s1, const string &s2) // & is used to prevent object copy which save time
//const is used to prevent modifications
{
return s1.length()<s2.length();
}
int main(){
string str[]={"h... | true |
b6c1a365ef66d2aa5358f7ebe7dd2b3ed81a0b8f | C++ | tody411/MeshViewerFramework | /src/core/GreedyFlooding.h | UTF-8 | 861 | 2.71875 | 3 | [
"MIT"
] | permissive |
//! GreedyFlooding definition.
/*!
\file GreedyFlooding.h
\author Tody
\date 2016/03/10
*/
#ifndef GREEDYFLOODING_H
#define GREEDYFLOODING_H
#include "Eigen/Dense"
#include "Mesh.h"
//! GreedyFlooding implementation.
class GreedyFlooding
{
public :
//! Constructor.
GreedyFlooding ( Mesh* me... | true |
12e1f3c14f5bc7f624116e8893a1fbf2e79c5dae | C++ | Graham-ella/leetcode | /每日一题/lc/lc6Z字形变换.cpp | UTF-8 | 658 | 2.953125 | 3 | [] | no_license | class Solution {
public:
string convert(string s, int numRows) {
string res = "";
int n = numRows;
int len = s.size();
if (n == 1 || len == 1) {
return s;
}
for (int k = 0; k < n; k++) {
if (k == 0 || k == n - 1) {
for (int i = k; i < len; i += (2 * n - 2)) {
... | true |
ea5aa61594fe4b49beca927e03aa01d2df22c68d | C++ | reckeyzhang/private-data-objects | /common/packages/block_store/block_store.h | UTF-8 | 4,482 | 2.578125 | 3 | [
"CC-BY-4.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"Zlib",
"MIT"
] | permissive | /* Copyright 2018 Intel Corporation
*
* 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.0
*
* Unless required by applicable law or agreed ... | true |
f54149bc321805540747b17c6c02abb9a0457cb3 | C++ | QPKJEDL/deskgame | /NiuNiu_zhubo_mod/Structure.h | UTF-8 | 726 | 2.515625 | 3 | [] | no_license | #ifndef __STRUCTURE_H__
#define __STRUCTURE_H__
#include <QLabel>
#include <string>
using namespace std;
typedef struct{
int num = 0;
int color = -1;
bool hua = false;
QLabel *label;
string face = "";
}CARD;
typedef struct node{
int num;// 0 代表闲家1 3代表庄家
struct node *next;
CARD data[5]... | true |
201b54a28735fc9d35508fcd42965ebf3ee1d02a | C++ | mdmccra/programming-1 | /GardenStore.cpp | UTF-8 | 1,124 | 3.84375 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int x, y;
cout << "How many plants are you purchasing? ";
cin >> x; // user enters amount of plants being purchased
cout << endl;
if (x < 0) // no negative integers because the value of plants cannot be negative
cout << "That's impossible!";... | true |
b9a693d279f29b1673888c24c17d4ca9da7ee409 | C++ | Angelo768/Exercicios-em-C | /Classes/NumeroRacional.h | UTF-8 | 384 | 3.46875 | 3 | [] | no_license | #include <iostream>
using namespace std;
class NumeroRacional{
public:
NumeroRacional(int numerator, int denominator);
int num1;
int num2;
};
NumeroRacional::NumeroRacional(int numerator, int denominator){
num1 = numerator;
if(denominator <= 0){ cout << "Denominador inválido!"
" por isso será inicializa... | true |
5da0e31f3c9395da3b2a156ef239bf2ef312ef58 | C++ | aashima91/ParallelHMM-master | /src/hmm.cc | UTF-8 | 605 | 2.515625 | 3 | [] | no_license | #include "hmm.hh"
#include <iostream>
using namespace std;
void HMM::print(){
/*cout<<"# of States "<<noOfStates<<endl;
cout<<"# of Symbols "<<noOfSymbols<<endl;
cout<<"Transition Probability"<<std::endl;
cout<<transMat;
cout<<"Emission Probability"<<endl;
for(int idx=0;idx<noOfStates;idx++){
cout<<emission... | true |
9a52f1e97496eadb193d710facec3960920c7afd | C++ | rbangamm/raytracer | /shapes.h | UTF-8 | 4,811 | 3.265625 | 3 | [] | no_license | // Header file for geometry classes
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <fstream>
template<typename T>
class Vec3
{
public:
T x, y, z;
Vec3() : x(T(0)), y(T(0)), z(T(0)) {}
Vec3(T xx) : x(xx), y(xx), z(xx) {}
Vec3(T xx, T yy, T zz) : x(xx), y(yy), z(zz) {}
Vec3& normali... | true |