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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0040bad4163d1fbb4dfbacf0c1368a398cafa02a | C++ | TheGregTanaka/csc160FinalSpaceDefense | /Program/Character.h | UTF-8 | 2,396 | 3.1875 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
#include <iomanip>
#include <typeinfo>
#include "CombatStats.h"
#include "Weapon.h"
#include "Armor.h"
#include "PowerUp.h"
#include "EmptySlot.h"
using std::string;
// define constants to avoid "magic numbers"
const int STARTING_HP = 10;
const double STARTING_MONEY =... | true |
db8707f72cdb5896f821dfa7f1cb28ef7e560ba2 | C++ | HPDRC/RasterTile | /src/TileImagerySystem/Common/global_functions.h | UTF-8 | 268 | 2.59375 | 3 | [] | no_license | #pragma once
#include <string>
using namespace std;
void Log(char *format, ...);
void LogThrow(char *format, ...);
// for now, only log assert fail events
inline void Assert(bool assert, char *msg)
{
if (assert == false)
Log("Assert failed: %s", msg);
} | true |
a2dfe3136fbfb669cb75ccac6368c774835ef28a | C++ | qq77457051/crpAlynasis | /MV200/UI/Login/userLogin.cpp | UTF-8 | 5,204 | 2.5625 | 3 | [] | no_license | #include "userLogin.h"
UserLogin::UserLogin(QDialog *parent) : QDialog(parent)
{
initForm(); //初始化
initStyle(); //界面风格
initConnect(); //连接信号与槽
initData(); //初始化数据
}
//初始化
void UserLogin::initForm()
{
fraImage = new QFrame;
labTitle = new QLabel("用户登录");
labU... | true |
c0ffcb45a9dcdfae941c613c73954a0907bbbcc1 | C++ | jackson123zz/LeetCode | /code/0137.cpp | UTF-8 | 586 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
int singleNumber(vector<int>& nums) {
unordered_map<int, int> map;
for (int i = 0; i < nums.size(); i++) {
map[nums[i]]++;
}
for (auto x : map) {
if... | true |
91021a7644fd963e4a43f2b497c2e46b0c716e3a | C++ | saulopz/rtsim | /src/TimeLine.cpp | UTF-8 | 7,571 | 2.765625 | 3 | [
"BSD-4-Clause-UC"
] | permissive | #include "config.h"
#include "TimeLine.h"
#include "Task.h"
#include "Budget.h"
#include <allegro.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
TimeLine::TimeLine(char *fName)
{
imageSize = 1;
image = NULL;
time = 0.0;
strcpy(fileName, fName);
posX = 50;
posY = 50;
type = RATE... | true |
b70d8716b425dc3e6b6b3e67d51e75ca258571e6 | C++ | ana-carolina-nunes/smartpillboxic | /arduino-rtc-bluetooth-reedswitch.ino | UTF-8 | 4,146 | 2.828125 | 3 | [] | no_license | #include <Wire.h>
#include <RTClib.h> //inclusão das bibliotecas
//#include <SoftwareSerial.h>
#define RX 8
#define TX 9
//SoftwareSerial bluetooth(RX, TX); // RX, TX
RTC_DS3231 rtc; //OBJETO DO TIPO RTC_DS3231
//DECLARAÇÃO DOS DIAS DA SEMANA
char daysOfTheWeek[7][12] = {"Domingo", "Segunda", "Terça", "Qua... | true |
305cdfda738bc2fe27fe6dff97ce4759b157a7eb | C++ | modrake/cpp-book-problems | /pointer-practice.cpp | UTF-8 | 371 | 3.40625 | 3 | [] | no_license | #include <iostream>
using namespace std;
void dostuff (int a, int *b, int *c) {
a = 3;
*b = 3;
cout << a << " " << *b << " " << *c << endl;
}
int main() {
int a = 0;
int *b = new int;
int *c = new int;
*b = 1;
*c = 2;
cout << a << " " << *b << " " << *c << endl;
dostuff (a, b, c);
cout << a... | true |
837634764997c0f90ec99d7de91eba7ce8843d26 | C++ | teetotal/library | /ui/ui_ext.cpp | UTF-8 | 16,200 | 2.53125 | 3 | [] | no_license | #include "ui_ext.h"
#define _OPACITY 0.05f
/*
drawCircleForPhysics
*/
DrawNode * guiExt::drawCircleForPhysics(Node * p, Vec2 pos, float radius, COLOR_RGB color){
auto draw = DrawNode::create();
draw->drawDot(Vec2(radius, radius), radius, color.getColor4F());
// Color4F centerCircleColor = color.ge... | true |
6b3f1a3cd5861f1a23fc85a08c2e80ef82808291 | C++ | CMilly/DeviantTools-Math_Engine-Libray | /vd1m/vd1m/ext/Mat2_rotclock.hpp | UTF-8 | 593 | 2.59375 | 3 | [] | no_license | /**
* Created by: Cameron Mims
* vDefiant1 Math Engine - Personal Project
* File - Mat2_rotclock.hpp
* Date (Started) - 05/13/19
*/
#ifndef VDEFIANT1_MATH_ENGINE_MAT2_ROTCLOCK_HPP
#define VDEFIANT1_MATH_ENGINE_MAT2_ROTCLOCK_HPP
#include <vd1m/Vec2.hpp>
namespace vd1m{
/**
* Class that represents a 2-D... | true |
f92a67e72a24c339ef6301e07e1d68bcc80ef5b7 | C++ | ppawel11/True-Life | /src/TrueLife/Controller/Controller.cpp | UTF-8 | 600 | 2.59375 | 3 | [] | no_license | /**
* @author Paweł Lech
*/
#include "Controller.h"
Controller::Controller(){}
void Controller::attachEnv(boost::shared_ptr<Observer> obs){
env_observer = obs;
}
void Controller::attachSimu(boost::shared_ptr<Observer> obs){
simu_observer = obs;
}
void Controller::notifyEnv(boost::shared_ptr<EnvDataModel> ... | true |
e7d1f5dc15bb6cf084465c7bbe9e9ff76c019d26 | C++ | talkami/OOP | /Project1/Project1/Board.cpp | UTF-8 | 10,138 | 3.21875 | 3 | [] | no_license | #include "Board.h"
#include <string>
#include <fstream>
#include <iostream>
//empty constructor
Board::Board() {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
this->matrix[i][j] = new Point;
this->matrix[i][j]->setX(i);
this->matrix[i][j]->setY(j);
}
}
this->playerABoard = new char *[1... | true |
aae0c5d852fd2b7244b563899c52e493c80006e3 | C++ | darkjedi9922/listpad | /core/TableRows.cpp | UTF-8 | 958 | 2.671875 | 3 | [] | no_license | #include "core/TableRows.h"
#include <QXmlStreamReader>
using namespace Core;
TableRows::TableRows(const QString &datafile)
{
setDatafile(datafile);
}
void TableRows::setDatafile(const QString &datafile)
{
this->datafile = datafile;
loadRows();
}
QString TableRows::getDatafile() const
{
return this->... | true |
ee33e5723308ad6b97e9c2b3559054ff7eb98fcd | C++ | mzry1992/workspace | /contest/2012summer/UESTC Summer Training #25/I.cpp | UTF-8 | 2,246 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
struct Edge
{
int to,next;
char val;
}edge[2][30000];
int L[2],head[2][2000],nxt[2000][26];
int n[2],s[2],m[2];
void addedge(int id,int u,int v,char val)
{
edge[id][L[id]].t... | true |
c85f32d0b776e23034830a4903789409b2caf538 | C++ | Sometrik/sqldb | /src/CSV.cpp | UTF-8 | 10,013 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "CSV.h"
#include <Cursor.h>
#include "TextFile.h"
#include "utils.h"
#include <vector>
#include <cassert>
#include <charconv>
using namespace sqldb;
using namespace std;
static inline vector<string> split(string_view line, char delimiter) {
vector<string> r;
if (!line.empty()) {
size_t i = 0;
... | true |
035cb7dea79478748ec6412e5f396f02aa4feed6 | C++ | BBenNguyenn/Emergency-Room-Queue-Simulation | /Queue.cpp | UTF-8 | 1,734 | 3.84375 | 4 | [] | no_license | // CLASS: Queue
// REMARKS: What is the purpose of this class?
// Linked list queue data structure.
//-----------------------------------------
#include <iostream> // for definition of NULL
#include "Queue.hpp"
#include "Node.hpp"
//we DO NOT need to #include ListItem.h here because we're not
//using any of its methods... | true |
63707326e9dcd4866cf6851e1d1b2eb233f4d19f | C++ | brayangomez22/resources-and-practices-with-c | /matrices/hallar si la matriz es simetrica.cpp | UTF-8 | 711 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
int main (){
int numeros[100][100], filas, columnas;
char bandera = 'f';
cout<<"digie el numero de filas: "; cin>>filas;
cout<<"digite el numero de columnas: "; cin>>columnas;
for( int i=0; i<filas; i++ ){
for( int j=0; j<columnas; ... | true |
c0e525fdfe63666cb627a37ff1223a470cc4965b | C++ | yuyuOWO/source-code | /CPP/string其他方法.cpp | UTF-8 | 673 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
const char * a = "abcdefghijklmnopqrstuvwxyz";
cout << a << endl;
string s1(a);
cout << "s1(a), s1 = " << s1 << endl;
string s2(a + 23, 2);
cout << "s2(a + 23, 2), s2 = " << s2 << endl;
string s3(a + 4, 5);
c... | true |
abf6f3c048f38ec6a579ecfb6a3be48150b780fd | C++ | lucaimperiale/Algo3-tps | /algo3-tp1/funciones.cpp | UTF-8 | 3,575 | 3.203125 | 3 | [] | no_license | //
// Created by Luca on 9/11/2018.
//
#include "funciones.h"
int min(int x,int y){ return (x) < (y) ? x : y; }
int sumarUno(int x){return x==INT32_MAX ? INT32_MAX : x+1;}
int optimo(int x, int y){
if(x == -1){
return y;
}
if( y == -1){
return x;
}
return min(x,y);
}
int solve... | true |
fe00f34a322a95641eb59cf0164cf3ef68aac55b | C++ | fallow24/starsensor | /src/img/Roi.cpp | UTF-8 | 2,037 | 3.484375 | 3 | [] | no_license | #include "Roi.h"
//find a focuspoint from a star
Pointf* Roi::focus(int* grayscaledImage, int width, std::vector<Point*> star)
{
//use a ROI with size nxn
Point* brightest = brightestPixel(grayscaledImage, width, star);
int n = determineSize(brightest, grayscaledImage, width); //with advanced dynamic roi
... | true |
be1f0527d1d0fd5818a97f5522935ae6ec335340 | C++ | ssilverman/libCBOR | /src_tests/tests/floating_point.inc | UTF-8 | 9,368 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | // floating_point.inc is part of libCBOR.
// (c) 2017 Shawn Silverman
// ***************************************************************************
// Floating-point tests
// ***************************************************************************
test(half_zero) {
uint8_t b[] = { (7 << 5) + 25, 0x00, 0x00 };
... | true |
762e793c8f3d2529658810c84fd63b4d29e272be | C++ | JFengWu/Cpp-homework | /cpp-homework3/Q118/Source.cpp | UTF-8 | 2,215 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class Hero {
public:
int id;
string name;
int hp;
int atk;
int atked;
Hero() : id(0), name(NULL), hp(0), atk(0), atked(0) {}
Hero(int _id, string _name, int _hp, int _atk, int _atked) : id(_id), name(_name), hp(_hp), atk(_atk), atked(... | true |
7f1967ed41b2b07f80c73ed3a4a834770a7f4afe | C++ | Nismirno/SDLSnake | /SDLSnake/Game.cpp | UTF-8 | 1,950 | 2.90625 | 3 | [
"MIT"
] | permissive | #include "Game.h"
#include <Windows.h>
Game::Game() {}
Game::~Game() {
m_gameWindow.free();
}
bool Game::init() {
// Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
return false;
}
// Initialize PNG loading
int imgFlags = IMG_INIT_P... | true |
5ec6032c7f887143f004355f0a17742033d2ee92 | C++ | v-kyle/university-labs-and-courseworks-c-cpp | /second-course/lab2_2/Laba2/Laba2.cpp | UTF-8 | 693 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include "Shannon.h"
void showInfoAboutString(Shannon& obj, string str)
{
obj.Convertion_input_string(str);
obj.show_on_display();
}
int main()
{
setlocale(0, "Rus");
Shannon example;
showInfoAboutString(example, "Классика – то, что каждый считает нужным прочесть и никто не читает.");
... | true |
67702fa483a9049dd62c83456ab4df18e08481cc | C++ | ShamimiWidat/Embedded-System | /Week_10/Example-12,13/Example-12.ino | UTF-8 | 1,018 | 2.78125 | 3 | [] | no_license | void setup() {
Serial.begin(9600);
}
void loop() {
char* ddrb = (char*)0x24; //Points to DDRB register
char* portb = (char*)0x25;//Points to PORB register
*ddrb = 0b00001111;//Set the 4 pins as output
char DriveSteps[] = {1,2,4,8};//Activation pattern of wave drive
char position = 0;
... | true |
4470d89ee1afd0cf73b0ea398d900cf78826ee8c | C++ | tuowenhao/algorithm022 | /Week_07/surrounded.cpp | UTF-8 | 2,461 | 3.03125 | 3 | [] | no_license | class UnionFind {
public:
UnionFind(int n) {
parent = new int[n];
count = n;
for (int i = 0; i < n; ++i) {
parent[i] = i;
}
}
int findRoot(int p) {
while (p != parent[p]) {
parent[p] = parent[parent[p]];
p = parent[p];
}
... | true |
f4aa4d2681cfcc22e2b30ef1e24048bc10e6fc1c | C++ | albertlis/Photovoltaic-platform-visualization---WDS | /Projekt/Software/Qt + OpenGL/platform/my/globals.cpp | UTF-8 | 523 | 2.640625 | 3 | [] | no_license | #include "globals.h"
/**
* @brief Value of the vertical rotation angle in degrees
*
*/
volatile int32_t V = 0;
/**
* @brief Value of the horizontal rotation angle in degrees
*
*/
volatile int32_t H = 0;
/**
* @brief Value of the light intensivity in lx
*
*/
volatile int32_t L = 0;
/**
* @brief Value of the... | true |
2383257abb6ae708c51f00101b9150364d504949 | C++ | johansaji/ThunderNanoServices | /examples/TestUtility/CommandCore/TestCommandBase.h | UTF-8 | 3,159 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #include <interfaces/json/JsonData_TestUtility.h>
#include "interfaces/ITestUtility.h"
#include "../Module.h"
namespace WPEFramework {
class TestCommandBase : public Exchange::ITestUtility::ICommand {
public:
TestCommandBase() = delete;
TestCommandBase(const TestCommandBase&) = delete;
TestCommandBase& op... | true |
023085e466cc3b8b3d0f9e0a62693c48943e7f65 | C++ | proscrumdev/battleship-embedded | /lib/Battleship.GameController/Position.cpp | UTF-8 | 465 | 3.3125 | 3 | [] | no_license | #include <Position.h>
#include <sstream>
namespace std {
template<typename T>
std::string to_string(const T &n) {
std::ostringstream s;
s << n;
return s.str();
}
}
enum Letters Column;
int Row;
Position::Position() {
}
Position::Position(Letters column, int row) {
Column ... | true |
dd27c52653bf775ce6548b36f3843e2a9bd51990 | C++ | uselessgoddess/Collections | /cpp/Platform.Collections.Tests/ListTests.cpp | UTF-8 | 789 | 2.765625 | 3 | [
"MIT"
] | permissive | namespace Platform::Collections::Tests
{
TEST_CLASS(ListTests)
{
public: TEST_METHOD(GetElementTest)
{
auto nullList = (IList<std::int32_t>){};
Assert::AreEqual(0, nullList.GetElementOrDefault(1));
Assert::IsFalse(nullList.TryGetElement(1, out std::int32_t el... | true |
08124336db95f4651c965031d321dc50c240e79f | C++ | Sysreqx/Cpp | /itstep/HW/06.06.2018 VehicleStore/Plane.cpp | UTF-8 | 837 | 3.140625 | 3 | [] | no_license | #include "Plane.h"
Plane::Plane(std::string color, std::string model, int max_speed, int number_of_seats, int price, int altitude, std::string arrivalGate) :
AirVehicle(color, model, max_speed, number_of_seats, price, altitude)
{
this->setArrivalGate(arrivalGate);
}
void Plane::setArrivalGate(std::string arrival... | true |
76a1a1f923e93b69a656237b89e7156a213f1ba8 | C++ | imharsh94/ALGO-DS | /linkedlist2.cpp | UTF-8 | 1,142 | 4 | 4 | [] | no_license | //! remove duplicate elements from a linked list ITERATION
//! INPUT 1->1->2->3
//! OUTPUT 1->2->3
#include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
};
Node* newNode(int data)
{
Node* temp = new Node;
temp->data = data;
temp->next = NULL;
}
void printList(... | true |
e0e58bfc175d33689a79820fbd2236959f5d5c8d | C++ | LuisBarcenas14/Programacion-Competitiva | /Otros/gauss.cpp | UTF-8 | 1,551 | 3.03125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MAX_N 100
// adjust this value as needed
struct AugmentedMatrix { double mat[MAX_N][MAX_N + 1]; };
struct ColumnVector { double vec[MAX_N]; };
ColumnVector GaussianElimination(int N, AugmentedMatrix Aug) {
// O(N^3)
// input: N, Augmented Matrix A... | true |
5f8579eb6a1eb4e2662763049c0ee51f5b8ad8b6 | C++ | MakSim345/cpp | /exceptions_edu_vs/my_exceptions.cpp | UTF-8 | 1,170 | 2.875 | 3 | [] | no_license | //============================================================
//
// Description:
// <purpose of this file>
//============================================================
#include "my_exceptions.h"
#include "div_error.h"
int throw_error::Run()
{
std::cout << "Hello World!\n";
throw std::runtime_error("Somethi... | true |
cbdf51b17a8b1427eb99fb099d0d4f5077ade9b5 | C++ | kpadmost/UNIX-Linda | /src/server/model/implementation/CommunicationManagerFIFO.cpp | UTF-8 | 998 | 2.828125 | 3 | [] | no_license | //
// Created by konstantin on 10.06.17.
//
#include "CommunicationManagerFIFO.h"
TupleMessage CommunicationManagerFIFO::receiveMessage() {
TupleMessage m;
fifo->readFromFIFO(m);
if(m.clientPid != m.INVALID_PID)
std::cout << "\nmessage received " << m << std::endl;
return m;
}
void Communi... | true |
61c0ecd4a664665ce7d969366fc0324e91ea8c5a | C++ | dropofwill/multi-tone-arduino | /multi_tone.ino | UTF-8 | 3,664 | 2.8125 | 3 | [] | no_license | /*
Multiple tone player
Plays multiple tones on multiple pins to play basic power chords
circuit:
* 3 8-ohm speaker on digital pins set by the constants LEFT_S, MID_S, RIGHT_S
* Capacative touch setup on the default I2C
base on code from Tom Igoe
based on a snippet from Greg Borenstein
This example code is ... | true |
e41d6b691d8009c6cd29ef08e4bc02bc6e0ce9f2 | C++ | LuisBarcenas14/Programacion-Competitiva | /COJ - AC/LuisBarcenas14-p2661-Accepted-s966187.cpp | UTF-8 | 512 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
#define endl '\n'
#define ios ios_base::sync_with_stdio(0); cin.tie(0);
string s;
int i;
int t, mod;
int main()
{
ios;
while(cin>>s){
t=0;
for(i=0;s[i]!='\0';i++){
t+=s[i]-48;
}
mod = t%3;
... | true |
3fc0f0065044c06609bb6b746b9a8e8362bed949 | C++ | elmspace/Charged_AB_C_System_Ion_Solubility | /HEADERFILES/Tools.hh | UTF-8 | 472 | 3.078125 | 3 | [] | no_license | double FindIntersect (double x1f, double y1f, double x2f, double y2f, double x1g, double y1g, double x2g, double y2g){
// This function will find the point of intersection between two lines, given from the 4 points above
// The two functions are called f(x) and g(x)
double af, ag, bf, bg;
double X_point;
... | true |
45e77f61dec4fdc2345c10c5355ba2211d565bc5 | C++ | ufjf-barbara/manipulacao-de-arquivos-JoaoPedroSilvaFreitas | /files.cpp | UTF-8 | 7,337 | 3.328125 | 3 | [] | no_license | /*
* Codigo C++ com exemplos para criaçao e manipulaçao de arquivos em C++.
*
* Criado por: Prof. Jose J. Camata
*
*/
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <chrono>
using namespace std;
using namespace std::chrono;
int tamanhoArquivo(fstream& ar... | true |
eee6bbbb6f2e50ae686df072a392f4c8509fbeba | C++ | vicmars5/EDA | /enclase/5-abril/LSLLSE/include/node.h | UTF-8 | 907 | 3.546875 | 4 | [] | no_license | #ifndef NODE_H
#define NODE_H
template <class T>
class Node {
public:
Node();
Node(const T&);
T& getData();
Node <T>* getPrev();
Node<T>* getNext();
void setData(const T&);
void setPrev(Node<T>*);
void setNext(Node<T>*);
private:
T data;
Node<T>* prev;
Node<T>* next;
};
... | true |
d379883cbe737158b676402d4dbc864bf33351ff | C++ | lj2759531/JaimeLuis_CIS5_Fall2017 | /Class/Budget_FED_DOD_NASA/main.cpp | UTF-8 | 816 | 2.765625 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.cpp
* Author: Luis Jaime
*
* Created on September 6, 2017, 9:49 AM
* Purpose: What is known? and What is reali... | true |
98182ee7887dd116eeefedf5fa7bb111858e1350 | C++ | ccdxc/logSurvey | /data/crawl/make/old_hunk_1599.cpp | UTF-8 | 139 | 2.65625 | 3 | [] | no_license | {
case cs_running:
c->next = children;
children = c;
/* One more job slot is in use. */
++job_slots_used;
| true |
059748c27780897abf16fe6202afdf102f526348 | C++ | alusan/patscan_project | /patscan/include/m_unit.h | UTF-8 | 368 | 2.75 | 3 | [] | no_license | #ifndef M_UNIT_H
#define M_UNIT_H
#include <Rule.h>
class m_unit : public Rule //if this, then expect pattern of type: 4...8
{
public:
m_unit(std::string s);
int getStart();
int getEnd();
protected:
int ind_s; // start of the matching range
int ind_e; // end of the mat... | true |
054c31eeed34925b91ba274cc2513a3bd570a157 | C++ | sguazt/dcsxx-commons | /inc/dcs/math/curvefit/interpolation/nearest.hpp | UTF-8 | 2,354 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | /**
* \file dcs/math/curvefit/interpolation/nearest_neighbor.hpp
*
* \brief In nearest neighbor interpolation, the value of an interpolated point
* is set to the value of the nearest data point.
*
* \author Marco Guazzone (marco.guazzone@gmail.com)
*
* <hr/>
*
* Copyright 2013 Marco Guazzone (marco.guazzone@... | true |
3e024fa1eb8a6c7975dae5e3189366d5f1006c55 | C++ | bawjensen/COMP-215-Algorithms | /Jensen_A1/Jensen_A1.cpp | UTF-8 | 5,851 | 3.9375 | 4 | [] | no_license | #include "Jensen_A1.h"
using namespace std;
String::String() {
// Default constructor - sets contents of String object to the empty character array of length 1.
// Precondition: No String object created.
// Postcondition: String object created with contents of an empty character array
// of length ... | true |
3b7af0cb53d7566c38a06eb20267698d05fd9bdb | C++ | eightnoteight/compro | /syncp/nproc-cs.cc | UTF-8 | 631 | 2.859375 | 3 | [] | no_license | /* n processes, critical section problem. */
bool waiting[n], lock = false, key;
std::fill(waiting, waiting + n, false);
do {
waiting[i] = true;
key = true;
while (waiting[i] && key)
key = test_and_set(&lock);
waiting[i] = false;
/* critical section */
j = (i + 1) % n;
while ((j != i... | true |
525db31dd202bd6057951f136cf282f7dcc6d378 | C++ | vincentwutst/LeetCode | /Sqrt(x).cpp | UTF-8 | 320 | 3.203125 | 3 | [] | no_license | class Solution {
public:
int sqrt(int x) {
int left = 0, right = x, mid;
while (left < right)
{
mid = left + (right - left) / 2 + 1;
if (x / mid == mid)
return mid;
else if (x / mid < mid) //// 不要用x > mid * mid,会溢出
right = mid - 1;
else
left = mid;
}
return right;
}
};
| true |
1f9c6d6c5f9ae25610e194009d29f5851167d4f1 | C++ | 105599004/posd_project | /src/number.cpp | UTF-8 | 539 | 3.0625 | 3 | [
"MIT"
] | permissive | #include "../include/number.h"
#include <string>
using namespace std;
Number::Number(int i){
_value = i;
_symbol = to_string(i);
}
string Number::value(){
return to_string(_value);
}
string Number::symbol(){
return _symbol;
}
bool Number::match(Number n){
return _value == n._value;
}
bool Number::match... | true |
56d9014b593aeaa4456ad280b7196943dad15c80 | C++ | jcbages/notebook | /notebook/Strings/Hashing.cpp | UTF-8 | 783 | 3 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define X 137
#define MOD ((ll)1e9+7)
#define mod(n) (((n)%(MOD)+(MOD))%(MOD))
// given a string A and a target B, print the occurrences of B in A
void hashing(const string &a, const string &b) {
// build the hash function
string s = b + "$" +... | true |
58ac262e9678b70ed171c1100547de6e5aa27d62 | C++ | CitlaliRem/Ejercicios_Clase | /Práctica05/main_prac5.cpp | ISO-8859-1 | 10,635 | 2.609375 | 3 | [] | no_license | //Semestre 2019 - II
//************************************************************//
//************************************************************//
//******** Alumno: BADILLO REMIGIO DULCE CITLALI ************//
//****** PRCTICA 5 ******//
//******** Visual Studio 2017 ******//
//**** Para mover e... | true |
074d3bd9fb9f70daae26eb481f3f83ba97669375 | C++ | flseaui/Tiler | /src/Button.cpp | UTF-8 | 2,249 | 2.828125 | 3 | [
"MIT"
] | permissive | #include "Button.h"
Button::Button(Window* window, Camera* camera, const char* pPressed, const char* pUnpressed, const char* pHover, float x, float y, float width, float height, bool check) : TexRect(camera, pPressed, x, y, 0, width, height, true)
{
stateSkek = 0;
this->check = check;
this->window = window;
this->... | true |
ee4da4241c5338ab533657408257357bcdf579c0 | C++ | rangzee/notepad2 | /scintilla/lexlib/PropSetSimple.h | UTF-8 | 704 | 2.5625 | 3 | [
"LicenseRef-scancode-scintilla",
"BSD-3-Clause",
"MIT",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Scintilla source code edit control
/** @file PropSetSimple.h
** A basic string to string map.
**/
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#pragma once
namespace Lexilla {
class PropSetSim... | true |
48c775a88c2d81d3fc0f442df781145d21cb444a | C++ | caioguedesam/message_network_posix | /common.cpp | UTF-8 | 1,282 | 3.09375 | 3 | [] | no_license | #include "common.h"
// Transforma endereço IPv4 string
void AddrToStr(const sockaddr *addr, char *str, size_t size) {
char addrstr[INET_ADDRSTRLEN + 1] = "";
uint16_t port;
if(addr->sa_family == AF_INET) {
sockaddr_in *addr4 = (sockaddr_in *)addr;
if(!inet_ntop(AF_INET, &(addr4->sin_addr),... | true |
c3d2f15d615d9f103bd1facf61d0436afa3abb78 | C++ | BCSJH/Arduino | /project_school/2019.11.11/Stream/Stream.ino | UTF-8 | 3,240 | 2.671875 | 3 | [] | no_license |
#include <SoftwareSerial.h>//와이파이 통신
#include "FirebaseESP8266.h" //파이어베이스 사용
#include <ESP8266WiFi.h> //와이파이 사용
//와이파이와 파이어베이스 연동
#define FIREBASE_HOST "arduinowebserver2.firebaseio.com"
#define FIREBASE_AUTH "cg"
#define WIFI_SSID "KBU"
#define WIFI_PASSWORD ""
//Define FirebaseESP8266 data obj... | true |
2466f73bfec02af207bd99e45217e03cac8c148c | C++ | Coolchirutha/CP | /Step3/131.palindrome-partitioning.cpp | UTF-8 | 1,007 | 3.140625 | 3 | [] | no_license | /*
* @lc app=leetcode id=131 lang=cpp
*
* [131] Palindrome Partitioning
*/
#include <bits/stdc++.h>
using namespace std;
// @lc code=start
class Solution {
public:
vector<vector<string>> partition(string s) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector<vector<string>> result;
vector<s... | true |
155a6684c996b404ee31790f3a799ec20b11a616 | C++ | Manit1/Linear-Search | /main.cpp | UTF-8 | 639 | 3.890625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int Linear_search(int arr[],int x);
int main()
{
int arr[10],x,flag;
cout<<"Enter the elements of the array\n";
for(int i=0;i<10;i++)
cin>>arr[i];
cout<<"Enter the element you want to search :";
cin>>x;
flag= Linear_search(arr,x);
... | true |
c67e445cab2eebb300d3910dce01afac7ea72664 | C++ | SourDumplings/CodeSolutions | /OJ practices/LeetCode题目集/242. Valid Anagram(easy)-红黑树(map)法.cpp | UTF-8 | 459 | 3.015625 | 3 | [] | no_license | /*
* @Author: SourDumplings
* @Date: 2019-08-29 12:51:45
* @Link: https://github.com/SourDumplings/
* @Email: changzheng300@foxmail.com
* @Description: https://leetcode.com/problems/valid-anagram/
*/
class Solution
{
public:
bool isAnagram(string s, string t)
{
map<char, int> m1, m2;
for ... | true |
f184c1ade0121c52693dca925466c28551b24c64 | C++ | BraderLh/AED | /Lista Enlazada Genérica/Nodo.h | UTF-8 | 1,597 | 3.4375 | 3 | [] | no_license | #ifndef NODO_H_INCLUDED
#define NODO_H_INCLUDED
#include <iostream>
using namespace std;
template <class nodoType>
class Nodo //definiendo la clase nodo
{
private:
nodoType dato;//es el contenido que estara dentro de cada nodo el cual será de tipo entero
Nodo *sig;//puntero al siguiente nodo
public:
te... | true |
9419dfa3bc42c60a4cd8570a164f82414f62406c | C++ | ravi-dafauti/Algoritms | /DynamicProgramming/MinimumPartition.cpp | WINDOWS-1252 | 1,343 | 3.65625 | 4 | [] | no_license | /*Given a set of integers, the task is to divide it into two sets S1 and S2 such that the absolute difference between their sums is minimum.
If there is a set S with n elements, then if we assume Subset1 has m elements,
Subset2 must have n - m elements and the value of abs(sum(Subset1) sum(Subset2)) should be minimum... | true |
9a3e4c7eb5ea8843c97c28739268d4dd466c0851 | C++ | vinodkanchi/Audio-Player-System | /CAudioPlayerController.cpp | UTF-8 | 13,961 | 2.640625 | 3 | [] | no_license | /*
* CAudioPlayerController.cpp
*
* Created on: 09.01.2020
* Author: Wirth
*/
////////////////////////////////////////////////////////////////////////////////
// Header
#define USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h> ... | true |
628eab47d61493facf7ad0b9cf3608b4838fcf95 | C++ | zhsrl/PP1 | /week14/G2/2.cpp | UTF-8 | 306 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int a = 2;
int *p = &a;
// char *c;
// double *d;
// cout << &a << "\n" << p << endl;
cout << a << "\n" << *p << endl;
*p = 10;
// int c = a;
// c = 12;
cout << a << endl;
return 0;
} | true |
c5d379ca064497ac67814da415b868923a487b8a | C++ | yalavrinenko/dscs | /src/ships/component.hpp | UTF-8 | 1,680 | 2.65625 | 3 | [] | no_license | //
// Created by yalavrinenko on 07.04.19.
//
#ifndef DSCS_COMPONENT_HPP
#define DSCS_COMPONENT_HPP
#include "../../utils/logger_factory.hpp"
#include <memory>
#include "utils/math_function.hpp"
enum class component_type{
engine,
reactor,
hull,
fuel_tank,
battery,
radar,
radio,
monitor_unit,
warhead... | true |
18ed44fba9da87f19cf90441c4319b63b6efeb6b | C++ | MohamedShanaz/xforcerepo | /Calculator/logfunctionelement.cpp | UTF-8 | 784 | 2.984375 | 3 | [] | no_license | #include "logfunctionelement.h"
LogFunctionElement::LogFunctionElement()
{
}
LogFunctionElement::~LogFunctionElement()
{
}
double LogFunctionElement::evaluate(string input){
double answer;
input += " ";
istringstream iss( input );
string word;
int cnt... | true |
298921cbf85581d2a65c710d61ebd867ce5af5a3 | C++ | youZhuang/qco-editor | /plugin/coc/coc_animation/coc_color_transform.cpp | UTF-8 | 1,449 | 3 | 3 | [] | no_license | /**
* Project coc-animation
* @author zhoubao
*/
#include "coc_color_transform.h"
/**
* ColorTransform implementation
*/
NS_COC_BEGIN
/*static*/ColorTransform ColorTransform::Identity(1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f);
void ColorTransform::contact(const ColorTransform& other)
{
rm *= other.r... | true |
62be367f106f0c34f04f12b144c8a440812bb88a | C++ | RenatoBrittoAraujo/Competitive-Programming | /URI-Online-Judge/2311.cpp | UTF-8 | 436 | 2.578125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int c;
cin>>c;
string n;
float d,s,ma,me,x;
for(int i=0;i<c;i++){
s=0;
cin >> n >> d;
for(int i=0;i<7;i++){
cin >> x;
if(i==0){ma=x;me=x;}
s+=x;
if(x>ma)ma=x;
i... | true |
e816cd442343f6db06a4ca29fd23277d1f705011 | C++ | osanseviero/C-training | /Foundations/Preparation/17.count_say.cpp | UTF-8 | 798 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
string cas(string str){
string str1;
char ch=str[0];
int chn=1;
for(int i = 1; i<=str.size();i++){
if (str[i]==ch){chn++;}
else {
char chr = chn+'0';
str1 = str1+ chr;
... | true |
a0ca255ffa985fa9acf09404158728ddf8027427 | C++ | jo80923/SysCallSocketDemo | /src/server.cpp | UTF-8 | 5,341 | 2.875 | 3 | [] | no_license | #include "server.h"
void server::setMaxConnections(int connectionsAllowed){
this->connectionsAllowed = connectionsAllowed;
}
server::~server(){
if(this->sockfd != -1){
close(this->sockfd);
}
}
server_tcp::server_tcp(){
this->port = -1;
this->host = NULL;
}
server_tcp::server_tcp(char* host, int port){
... | true |
b8dbb81dfafaede226339e47c5778117f5572196 | C++ | babakpst/Learning | /C++/112_beautiful_C++_STL_Algorithm/partial_sort.cpp | UTF-8 | 2,384 | 3.671875 | 4 | [] | no_license |
/*
Babak Poursartip
11/19/2020
Reference: Beautiful C++: STL Algorithm
PluralSight
partial sort, partial_sort
- if you have a large set and you do not want to sort the entire set, you can use partial sort.
- ex: {1,5,4,2,9,7}, sort the first 3 elements: {1,2,4,9,5,7}, now the first three are ordered, and the rest ... | true |
0eacb0559096e63a4167d4a1426c55bc58a03b7a | C++ | jeevan1133/CPP-2017 | /main/fibonacci.cc | UTF-8 | 792 | 3.609375 | 4 | [] | no_license | #include <iostream>
class fib
{
private:
size_t i {0};
size_t a {0};
size_t b {1};
public:
fib() = default;
explicit fib(size_t i_) : i{i_} {}
size_t operator*() const { return b; }
fib& operator++() {
const size_t old_b {b};
b += a;
a = old_b... | true |
a4aa4b1e6b0041666b063e7ec2d9bd25506af9c8 | C++ | shehabosama/ArrayList-implementation | /main.cpp | UTF-8 | 3,757 | 4.125 | 4 | [] | no_license | #include <iostream>
#include <cassert>
using namespace std;
class arrayListType
{
public:
arrayListType(int size = 100);
arrayListType(arrayListType& otherList); //copy constructor
~arrayListType(); // destructor
bool isEmpty();
bool isFull();
int listSize();
int maxListSize();
void print();
bool isItemAtEqu... | true |
85f0563a1d5eca08f1564dda57e7d62be503d991 | C++ | Yobretaw/AlgorithmProblems | /Leetcode/DetailImplementation/palindromeNumber.cpp | UTF-8 | 1,069 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <sstream>
#include <stack>
#include <queue>
#include <utility>
#include <unordered_map>
using namespace std;
/*
* Determine whether an integer is a palindrome. Do this without extra space.
*
* Some hints:
* Could negative int... | true |
2a098353f6014f77908025e21ebacd9aedffd209 | C++ | crimsonskylark/win32experiments | /win32um/pe.cpp | UTF-8 | 687 | 2.53125 | 3 | [] | no_license | #include "Introspect.hh"
int introspect() {
auto h = GetModuleHandle(NULL);
if (!h) {
std::cout << "unable to get module handle"
<< "\n";
return -1;
}
auto dosHdr = reinterpret_cast<IMAGE_DOS_HEADER*>(h);
auto ntHdr = reinterpret_cast<IMAGE_NT_HEADERS*>(
reinterpret_cast<uint8_t*>(dosHdr) + dosHdr->e_lf... | true |
78e7becca1ab5743f9b77d5d16c9994c4eb67534 | C++ | peichangliang123/UE4 | /Runtime/RenderCore/Public/RenderGraphBlackboard.h | UTF-8 | 4,494 | 2.890625 | 3 | [] | no_license | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "RenderGraphDefinitions.h"
#include "Misc/GeneratedTypeName.h"
/** Declares a struct for use by the RDG blackboard. */
#define RDG_REGISTER_BLACKBOARD_STRUCT(StructType) \
template <> \
inline FString FRDGBlackboard... | true |
945e26cdd8bde6dfdf142aceef005d0bb97e7fe5 | C++ | ak566g/Data-Structures-and-Algorithms | /Searching/12_searchInRowAndColumnSortedMatrix.cpp | UTF-8 | 745 | 2.953125 | 3 | [] | no_license | //by Ankita Gupta
#include<bits/stdc++.h>
using namespace std;
bool findInMatrix(int **mat, int m, int n, int key)
{
int i=0,j=n-1;
while((i<=m-1)&&(j>=0))
{
if(mat[i][j]==key)
return true;
else if(mat[i][j]>key)
{
j--;
}
else
... | true |
8e5a635b1cb489cf73f1902164d315bb161aa6b8 | C++ | abhishek1711/COdeforces | /codeforces/claswtch.cpp | UTF-8 | 364 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;cin>>n;
int k = n - 100;
int arr[200];
int cnt = 0;
for(int i = k;i<n;i++){
int temp = i;
int su = 0;
while(temp!=0){
su = su +temp%10;
temp = temp/10;
}
if(su + i ==n){
arr[cnt] = i;
cnt++;
}
}
cout<<cnt<<endl;
for(in... | true |
d348cde628248f0ca298a90d9b4a22b599110b01 | C++ | dritchie/GraphicsEngine | /GraphicsEngine/Viewing/Camera.cpp | UTF-8 | 3,734 | 3.046875 | 3 | [] | no_license | #include "Viewing/Camera.h"
#include "Common/GL.h"
#include "Math/Transform.h"
#include "Eigen/Geometry"
#include <iostream>
using namespace Eigen;
using namespace std;
namespace GraphicsEngine
{
Camera::Camera()
: eyePos(0.0f,0.0f,0.0f), lookAtPoint(0.0f,0.0f,-1.0f), lookVec(0.0f,0.0f,-1.0f),
upVec(0.0f,1.0f... | true |
ebc3d58409b9c4c3802b0250fec2d96b623c26a1 | C++ | andars/advent-of-code | /2016/day13/task.cpp | UTF-8 | 1,352 | 2.859375 | 3 | [] | no_license | #include <cstdio>
#include <bitset>
#include <queue>
#include <map>
int goal_x = 31;
int goal_y = 39;
int input = 1352;
bool is_wall(int x, int y) {
int t = x*x + 3*x + 2*x*y + y + y*y + input;
std::bitset<64> b(t);
return b.count() % 2 == 1;
}
void solve(int ix, int iy) {
std::queue<std::tuple<int, ... | true |
d1d516b7197903aa32b7577c153f7e64b90d5eb7 | C++ | SirichandanaSambatur/RCP | /Test-Packages/HtmlDocument.h | UTF-8 | 5,216 | 2.859375 | 3 | [] | no_license | #pragma once
/////////////////////////////////////////////////////////////////////////////////////////
// HtmlDocument.h - Used for creating HTML pages and all the required tags //
// ver 1.0 //
// Language: Visual C++ 201... | true |
f51d07ab3a73c84d3378cf9c30ed398accacb4df | C++ | Cirnoo/game-server | /Packdef.h | GB18030 | 5,412 | 2.546875 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
#include <QString>
#include <array>
#define PRINT(a) std::cout<<a<<"\n";
#define _DEF_PORT 1234
#define _SERVER_IP "127.0.0.1"
#define _DEF_CLIENTPORT 2000
#define _DEF_SERVERPORT 10086
#define _DEF_SIZE 64
#define _DEF_ROOMBUFFERSIZE 550*1000
#define _DEF_NUM 10
#def... | true |
69be63c2ff1b60ee925ffc1e722cc7f449d05340 | C++ | rdfostrich/ostrich | /src/test/cpp/controller/controller.cc | UTF-8 | 78,252 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <gtest/gtest.h>
#include "../../../main/cpp/controller/controller.h"
#include "../../../main/cpp/snapshot/vector_triple_iterator.h"
#include "../../../main/cpp/dictionary/dictionary_manager.h"
#define BASEURI "<http://example.org>"
#define TESTPATH "./"
// The fixture for testing class controller->
class Co... | true |
9af6326a797d1aa38b70cb5bbb779d5abeca45ce | C++ | m-paniagua/printer-queue | /paniaguamPrinterQueue/pqtype.h | UTF-8 | 338 | 2.6875 | 3 | [] | no_license | #include "heap.h"
#ifndef PQTYPE_H
#define PQTYPE_H
template<class ItemType>
class PQType
{
public:
PQType(int);
//~PQType();
void MakeEmpty();
bool IsEmpty();
bool IsFull();
void Enqueue(ItemType newItem);
void Dequeue(ItemType&);
private:
int length;
HeapType<ItemType> items;
int maxItems;
};
#include "... | true |
6ed239e4753dafc0e3cb841b9d65e31eaad97651 | C++ | ArneStenkrona/prototype2 | /src/game/game.cpp | UTF-8 | 2,398 | 2.515625 | 3 | [] | no_license | #include "game.h"
#include "src/container/vector.h"
#include "src/config/prototype2Config.h"
#include <chrono>
#include <thread>
#include <iostream>
Game::Game()
: m_input(),
m_gameRenderer(DEFAULT_WIDTH, DEFAULT_HEIGHT),
m_assetManager(RESOURCE_PATH),
m_physicsSystem(),
m_scene(m_gameRenderer, m_assetManag... | true |
fc21c68ad641af45c15fe0e7f0908249b7575b18 | C++ | SKARPG/MEWA_GUITAR_PROCESSOR | /Drivers/Pin/Pin.hpp | UTF-8 | 609 | 3.15625 | 3 | [] | no_license | #pragma once
#include <stm32h7xx_hal.h>
#include <cstdint>
namespace board{
class Pin {
private:
GPIO_TypeDef *port;
std::uint8_t pin;
public:
Pin() = delete;
Pin(GPIO_TypeDef *_port, std::uint8_t _pin) :
port(_port), pin(_pin) {
}
auto getPin() const noexcept -> std::uint8_t {
return pin;
}
auto get... | true |
b1cbf4ea92948e59282e9addc579970cd4f30e06 | C++ | kingnak/GameGenerator | /GGEditor_src/command/ggabstractcommand.h | UTF-8 | 1,220 | 2.78125 | 3 | [] | no_license | #ifndef GGABSTRACTCOMMAND_H
#define GGABSTRACTCOMMAND_H
#include <QString>
class GGAbstractCommand
{
public:
GGAbstractCommand()
: m_state(NotExecuted) {}
virtual ~GGAbstractCommand() {}
enum CommandState {
NotExecuted,
Executed,
Undone
};
CommandState state() con... | true |
0677edec0bb74a5953cec1dad11f752f4d4bd4fa | C++ | thirtiseven/CF | /AIM tech round3/A.cc | UTF-8 | 411 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
int main(int argc, char *argv[]) {
int n, b, d;
int a[100005];
std::cin >> n >> b >> d;
for(int i = 0; i < n; i++) {
std::cin >> a[i];
}
int ans=0, sum=0;
for(int i = 0; i < n; i++) {
if(a[i] > b) {
continue;
} else {
sum+=a[i];
}
i... | true |
f3cc3e4495272480b22c1f65b53508aa83e02534 | C++ | ailyanlu1/Programming-Challenges | /hdoj/hdoj1711.cpp | UTF-8 | 1,113 | 2.96875 | 3 | [] | no_license | /*
Problem: HDOJ 1711
Author: 靖难
Tag: KMP, string match, DFA
Difficulty: 1 (from 1 to 5)
*/
# include <stdio.h>
# include <string.h>
const int NMAX = 1000000;
const int MMAX = 10000;
int Pattern[MMAX];
int Next[MMAX];
int Target[NMAX];
int kmp(int n, int m)
{
Next[0] = -1;
int p = -1;
for(int i = 1; i ... | true |
8023905219d7cdc5a0cdef52e3bcc842d2e69f4b | C++ | ResonanceGroup/GMSH304 | /Post/shapeFunctions.h | UTF-8 | 33,243 | 2.59375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.0-or-later",
"LicenseRef-scancode-generic-exception",
"GPL-1.0-or-later",
"LicenseRef-scancode-proprietary-license",
"GPL-2.0-only",
"GPL-2.0-or-later",
"LicenseRef-scancode-other-copyleft",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@onelab.info>.
#ifndef _SHAPE_FUNCTIONS_H_
#define _SHAPE_FUNCTIONS_H_
#include "Numeric.h"
#include "GmshMessage.h"
class eleme... | true |
0ebc71f94136d3df74a8daa6253288e9bdcc212e | C++ | ayundina/cpp_piscine | /day01/ex07/src/ClassInput.cpp | UTF-8 | 402 | 2.8125 | 3 | [] | no_license | #include "ClassInput.hpp"
Input::Input(const std::string &input_file_name)
{
_input_file.open(input_file_name);
if (!_input_file.is_open())
{
_error.showAndExit("Unable to open " + input_file_name + " file");
}
}
Input::~Input()
{
_input_file.close();
return;
}
bool Input::getLine(std::string &line)
{
bool ... | true |
8cb1d746dd7d0d935f1b20d6b1e444fdc191082c | C++ | Fissuras/snow-leopard | /Snow Leopard/Snow Leopard/XercesString.h | UTF-8 | 5,941 | 3 | 3 | [] | no_license | /* ========== Beginning of file XercesString.h ========== */
/*!
\file XercesString.h
\brief Definition of class XercesString.
*/
#ifndef _XMLDB_XERCES_STRING_H_
# define _XMLDB_XERCES_STRING_H_
// ========== Includes ==========
// ----- standard header -----
#include <ostream> // operator<<()
... | true |
029d05cc86e56fe376bfa6a77561fc8b4e2ce1bd | C++ | esean/codingground | /linklistCPP/main.cpp | UTF-8 | 1,742 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <stdbool.h>
using namespace std;
template<class T>
class node {
public:
node() { pNext=NULL; }
node(T v) { value=v; pNext=NULL; }
~node() {}
void dump() {
dumper(this);
}
void set_value(T val) {
this->value = val;
}
void add_node(node* pNode) {
this->pNext = pNo... | true |
2f747f2739d21d8e5958137fed46e64325a916e2 | C++ | nik3212/challenges | /LeetCode/189. Rotate Array/solution_2.cpp | UTF-8 | 1,250 | 3.84375 | 4 | [
"MIT"
] | permissive | /*
189. Rotate Array
Given an array, rotate the array to the right by k steps, where k is non-negative.
Follow up:
* Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
* Could you do it in-place with O(1) extra space?
Example 1:
Input: nums = [1,2,3,4,5,6,7], k... | true |
e879f90b7c30d94c5ac2bf1618353fe5b2cd0a04 | C++ | Girl-Code-It/Beginner-CPP-Submissions | /Harsha Gupta/Milestone 11/Code For Win Q10.cpp | UTF-8 | 699 | 4.0625 | 4 | [] | no_license | //Deletion from Array
#include<iostream>
#include<conio.h>
using namespace std;
void del(int a[], int size, int x)
{
int flag=0,pos;
for(int i=0;i<size;i++)
{
if(a[i]==x)
{
flag=1;
pos=i;
}
}
if(flag==0)
{
cout<<"\nElement not found to delete.";
}
else if(flag==1)
{
for(int i=pos;i<size;i++)
... | true |
80bcc18b5248d8f657bc3587624b5710039280c2 | C++ | david-xue/chess-x11 | /pawn.cc | UTF-8 | 2,678 | 2.6875 | 3 | [] | no_license | #include "pawn.h"
#include "posn.h"
#include "move.h"
#include <cstdlib>
#include <vector>
#include "chessboard.h"
using namespace std;
Pawn::Pawn(ChessBoard* b, char c, bool player) : Piece(b, c, player), prom(0) {}
Pawn::~Pawn() {
delete prom;
}
int Pawn::val() {
return prom ? prom->val() : 1;
}
char Pawn::getN... | true |
1f8e3a27a1ba6408d2cd89b74a47c30194e31aa3 | C++ | songxinjianqwe/CppPrimerCode | /TextQuery/header/QueryBase.h | GB18030 | 2,558 | 3.09375 | 3 | [] | no_license | /*
* QueryBase.h
*
* Created on: 2016926
* Author: songx
*/
#ifndef QUERYBASE_H_
#define QUERYBASE_H_
#include "TextQuery.h"
//ԭıѯϽչ
//һʣʲѯ
// ~(word1) õвƥѯ
// (word1|word2) һ
// (word1&word2) ƥȫ
//ʹ word1 & word2 | word3
//Dzѯ䣬ʹԲʾѯͺִеĴ
//((fiery & bird)|wind)
//ṹ
//QueryBase вѯij
//WordQuery ѯij
//NotQ... | true |
658f8ca7a43561c950ac3ba181191d56508ce0e0 | C++ | Jereq/PongOut | /client/src/Input/InputLinux.cpp | UTF-8 | 8,700 | 2.609375 | 3 | [] | no_license | #include "InputLinux.h"
#include <GLFW/glfw3.h>
std::map<int, IInput::KeyCode> InputLinux::keyMapFromNative;
std::map<IInput::KeyCode, int> InputLinux::keyMapToNative;
std::map<GLFWwindow*, std::weak_ptr<InputLinux>> InputLinux::windowMap;
bool InputLinux::staticInitialized = initKeyMaps();
void InputLinux::insertKe... | true |
5f7e062819c1f5038ea80c74022df7c3fae0e6fb | C++ | TeoPaius/Projects | /c++/Diverse problems and algorithms/Algorithms/arbori/disjoint/main.cpp | UTF-8 | 1,117 | 3 | 3 | [] | no_license | #include <fstream>
using namespace std;
ifstream is ("disjoint.in");
ofstream os ("disjoint.out");
int n, m;
int t[100000], h[100000];
int op;
int a, b;
int Find(int x);
void Union(int x, int y);
int main()
{
is >> n >> m;
for(int i = 1; i <= n; ++i)
{
t[i] = i;
h[i] = 1;
}
for(i... | true |
dafd8faa67d055d360e899ba4fc702c7ea7ac2f8 | C++ | SeongmanPark/Algorithm | /SWEA/SWE 홈 방범 서비스.cpp | UTF-8 | 2,112 | 3 | 3 | [] | no_license | #include <iostream>
//#include <fstream>
#include <queue>
#define MAX(A,B) (A>B ? A:B)
using namespace std;
int map[21][21];
bool visit[21][21];
int N, M, testCase, K, answer, temp_answer;
int a = 1;
int dx[] = { -1,1,0,0 };
int dy[] = { 0,0,-1,1 };
void init()
{
a++;
answer = 0;
temp_answer = 0;
}
bool isWall(in... | true |
6a9402a36fad94f669d03b38dcd257e092a9083d | C++ | inoobkk/c-PrimerExcise | /chapter3/3.2.3/test6.cpp | GB18030 | 445 | 3.1875 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main()
{
const string s = "Keep";
for(auto &c: s)
{
//c = 'a'; // , cdz, const char& c˵
// cõĶһڵײconstauto
// autoԵײconst
const char& c = 'c';
const char& b = 'b'; // ðɾط
const char a = 'a';
}
return 0;
}
| true |
58dd3ccd4200de9e2751c4ea66d524373c964d8f | C++ | codecsp/Competitive-Programming | /online judges/Codechef/Long Challenge/APRIL 20/strno.cpp | UTF-8 | 790 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int primeFactors(int n)
{
int count = 0;
while(n%2 == 0)
{
count++; // 2
n = n/2;
}
for(int i=3;i<= sqrt(n); i = i+2)
{
while(n%i == 0)
{
count++;
n = n/i; // i
}
... | true |
19de6eaff818b0fd5096067187d9610494b818de | C++ | harshagowda/NixDOS | /EDITOR.CPP | UTF-8 | 1,923 | 2.625 | 3 | [
"MIT"
] | permissive | typedef unsigned char usc;
#define ESC 27
#define BKSPACE 8
#define ENTER 13
#define TAB 9
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
#define DEL 83
#define INSERT 128
#define F1 59
#define F2 60
#define F3 61
#define F4 64
void ndedithelp()
{
}
void open()
{
}
void save()... | true |
847a491afb758b4837de2cc664d5d28a039f912c | C++ | HarithFernando/Airline-Ticket-Reservation | /TakeHome.cpp | UTF-8 | 496 | 3.234375 | 3 | [] | no_license |
// A simple C++ program to show working of getline
#include <iostream>
#include <cstring>
#include <string>
#include <fstream>
using namespace std;
int main()
{
std::ifstream inFile("./Flights.txt");
if(!inFile)
{
cout<<"Couldn't open the file"<<endl;
exit(1);
}
string line;
int i=0;
string ar... | true |