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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ca56e691be804b9ca51a433fd03d22091bf02370 | C++ | OC-MCS/p2finalproject-01-KylerSeal99 | /game/Ship.cpp | UTF-8 | 2,400 | 3 | 3 | [] | no_license | #include "Ship.h"
// Constructor
Ship::Ship(SpriteMgr &spriteManager, Sprite &wall, Vector2f newPos, RenderWindow &window)
{
// Ships position
float shipX = window.getSize().x / 2.0f;
float shipY = window.getSize().y / 1.1f;
spriteShip = spriteManager.getShipS();
spriteShip.setPosition(newPos);
wallpaper = &wal... | true |
e77ec61a6a49fb6f0707ffd6842d551b9f0f1024 | C++ | stoneheart93/Leetcode | /[344]Reverse String.cpp | UTF-8 | 1,165 | 3.4375 | 3 | [] | no_license | //Write a function that reverses a string. The input string is given as an array
// of characters s.
//
//
// Example 1:
// Input: s = ["h","e","l","l","o"]
//Output: ["o","l","l","e","h"]
// Example 2:
// Input: s = ["H","a","n","n","a","h"]
//Output: ["h","a","n","n","a","H"]
//
//
// Constraints:
//
//
// 1 ... | true |
d71f6b7018cb8cc891ed80f3bcbd7ea517f67130 | C++ | mateuszpruchniak/gpuprocessor | /OpenCL/src/oclGPUProcessor/inc/MedianFilter.h | UTF-8 | 691 | 2.546875 | 3 | [] | no_license | /*!
* \file MedianFilter.h
* \brief File contains class Median filter.
* \author Mateusz Pruchniak
* \date 2010-05-05
*/
#pragma once
#include "NonLinearFilter.h"
/*!
* \class MedianFilter
* \brief Median filter.
* \author Mateusz Pruchniak
* \date 2010-05-05
*/
class MedianFilter :
public... | true |
973418eaaa8a5691af935ded9d7972fcf1b73850 | C++ | ariaBennett/ProjectEuler18 | /Project Euler Problem 18/Project Euler Problem 18.cpp | UTF-8 | 1,984 | 3.046875 | 3 | [] | no_license | //By starting at the top of the triangle below and moving to adjacent numbers
// on the row below, the maximum total from top to bottom is 23.
//
//3
//7 4
//2 4 6
//8 5 9 3
//
//That is, 3 + 7 + 4 + 9 = 23.
//
//Find the maximum total from top to bottom of the triangle below:
//
//
//NOTE: As there are only 16384 rou... | true |
f2849078622e34ec806dab3fdf4bd829225f4fcc | C++ | maxim76/dialogic_sip | /callserver/ssp_scp_interface.cpp | UTF-8 | 2,830 | 2.78125 | 3 | [] | no_license | #include "ssp_scp_interface.hpp"
namespace ssp_scp {
// TODO: channel передается как параметр в process(), а остальные параметры - извлекаются в конструкторе команды. Может все параметры брать в одном общем месте?
class SCPCommandAnswer : public SCPCommand {
public:
SCPCommandAnswer() {}
void process(u... | true |
a9ce68ffb72248763c46dc3897696fddf2ecd69f | C++ | lorenzomancini1/OOP-Exercises2018 | /dumpV1/dump.cc | UTF-8 | 531 | 2.984375 | 3 | [] | no_license | #include <stdio.h>
#include "dump.h"
void dump(int evN, int pN, float x, float y, float z, int* q, float* mx, float* my, float* mz){
//print event number and the decay point coordinates
cout << evN << endl << x << ' ' << y << ' ' << z << ' ' << endl;
// print number of particles
cout << pN << endl;
/... | true |
d3ab593c8d5ab4763c86ffaf4eb4c1b9656edec8 | C++ | HaoLi-China/Mobility-Reconstruction | /image/image_serializer_ppm.cpp | UTF-8 | 2,667 | 2.96875 | 3 | [] | no_license |
#include "image_serializer_ppm.h"
#include "image.h"
#include "../basic/logger.h"
#include <sstream>
Image* ImageSerializer_ppm::serialize_read(std::istream& in) {
// Read header
char buff[256] ;
std::string magic ;
in >> magic ;
if(magic != "P6") {
Logger::err("PPM loader: cannot load this type of PPM") ;
... | true |
a5c248676d9f8c05e40b9dee623a6dff23188b8c | C++ | panmari/racpp2014 | /core/tonemapper.h | UTF-8 | 291 | 2.65625 | 3 | [] | no_license | #ifndef TONEMAPPER_H
#define TONEMAPPER_H
#include "film.h"
#include "pngwriter.h"
/**
* Compresses a raw rendered {@link Film} to an image that can be displayed on typical 8-bit displays.
*/
class Tonemapper
{
public:
virtual void process(Film &film) = 0;
};
#endif // TONEMAPPER_H
| true |
6a106b622b26686c8b19f3b1f83266bbe59c4c5a | C++ | TRYang/LeetCode | /pathSum.cc | UTF-8 | 584 | 3 | 3 | [] | no_license | void find(TreeNode *root, int sum, vector<int> &cur, vector<vector<int> > &ret) {
if (!root->left && !root->right) {
if (sum == root->val) {
cur.push_back(root->val);
ret.push_back(cur);
cur.pop_back();
}
return;
}
cur.push_back(root->val);
if (root->left) find(root->left, sum - ro... | true |
b0f358fd38d76e808376c7325abbc71cb64817a9 | C++ | RaulPPelaez/ConvenientSignalFFT | /src/config.h | UTF-8 | 1,994 | 2.828125 | 3 | [
"Beerware"
] | permissive | #ifndef FFTCONFIG_H
#define FFTCONFIG_H
#include"defines.h"
#include<string.h>
#include<sstream>
#include<iostream>
void print_help();
class CommandLineParser{
int m_argc;
char **m_argv;
public:
enum OptionType {Required, Optional};
CommandLineParser(int argc, char **argv): m_argc(argc), m_argv(argv){}
st... | true |
0302d5c8187e761109f59ec08ecb73446393f9e4 | C++ | soft-bugg/AuSyORe | /AuSyORe/CTexture.cpp | UTF-8 | 2,426 | 2.796875 | 3 | [] | no_license | #include "stdafx.h"
#include "CTexture.h"
SDL_Window CTexture::*mWindow = nullptr;
bool CTexture::loadFromFile(std::string path) {
free();
_path = path;
SDL_Texture* newTexture = nullptr;
SDL_Surface* loadedSurface = IMG_Load(path.c_str());
if (loadedSurface == nullptr) std::cout << "-Unable to Load Image- Reas... | true |
3d62ad297ee62b181564dd90bd1ec10fe6f320a7 | C++ | natlehmann/taller-2010-2c-poker-servidor | /TP1_Server/Source/common_Mensajes.h | UTF-8 | 1,270 | 2.640625 | 3 | [] | no_license | #ifndef MENSAJES_H_
#define MENSAJES_H_
// Mensajes recibidos por el Servidor
#define SOY "SOY"
#define ENTRA "ENTRA"
#define SALE "SALE"
#define FIN "FIN"
// Mensajes recibidos por el Cliente
#define SI "SI"
#define NO "NO"
#define ERRORS "ERROR"
#include <iostream>
#include <sstream>
#include <stdio.h>
#i... | true |
ebb867ad15af1b62721c17c9dd40ff9188e60424 | C++ | waterpaper/Stardew | /StardewValley_Api/tileMap.h | UHC | 4,133 | 2.734375 | 3 | [] | no_license | #pragma once
#include "tile_Info.h"
class tileMap
{
private:
image *_tileMapImage; //Ÿϸʿ ̹ մϴ.
bool _isTileMapImage; //Ÿϸʿ ̹ ִ Ǵմϴ
string _tileMapImagePath;
bTileMap _tileMap; //ü Ÿ ִ 迭̴.( ü Ÿϸ Ѵ.)
vTileObject _tileObject; //ü Ʈ ִ ̴( Ʈ ũⰡ ŸϹٴڰ ٸ ü ÷̾ ȣۿϱ )... | true |
c70f3bdf37df2240722b4494db127f86865d1f9e | C++ | AilurusUmbra/NCTU_OS | /hw5/1.cpp | UTF-8 | 5,103 | 2.671875 | 3 | [] | no_license | #include<cstdio>
#include<cstdlib>
#include<iostream>
#include<iomanip>
#include<string>
#include<list>
#include<map>
#include<set>
#include<sys/time.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<unistd.h>
using namespace std;
char in_array[10100000][12];
int main(){
// open file
FILE * file;
f... | true |
8ae5863a6b01805a2caf8e4e5da735a96bce3c6a | C++ | motianlun99/leetcode | /solution225.cpp | UTF-8 | 779 | 3.984375 | 4 | [
"MIT"
] | permissive | /**
* System design: Implement Stack using Queues
*
*
* cpselvis (cpselvis@gmail.com)
* Oct 9th, 2016
*/
#include<iostream>
#include<queue>
using namespace std;
class Stack {
private:
queue<int> que;
public:
// Push element x onto stack.
void push(int x) {
que.push(x);
for (int i = 0; i < que.siz... | true |
72cdae96e81c5e54924b42fed440088c7fecbcd2 | C++ | 2myungho/algorithm_training | /Baekjoon/10000/10819_brute/answer.cpp | UTF-8 | 639 | 3.0625 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void solution() {
vector<int> arr;
int N;
int answer = 0;
cin >> N;
arr.resize(N);
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
do {
int summation = 0;
fo... | true |
a709c5dab169f6975a8010535344de9965907744 | C++ | alien93/softProj | /RoboWalk/model/actuator.h | UTF-8 | 585 | 2.796875 | 3 | [] | no_license | #ifndef ACTUATOR_H
#define ACTUATOR_H
#include <QString>
#include "mechanicalreduction.h"
#include <iostream>
#include <vector>
using namespace std;
class Actuator
{
private:
QString name;
vector<MechanicalReduction> mechanicalReduction;
public:
Actuator();
Actuator(QString name, vector<MechanicalRed... | true |
b1dd9b97c099a91d19b337b26014d49b8a34ba33 | C++ | ashishsahu321/lab8 | /lab8_q1.cpp | UTF-8 | 555 | 3.984375 | 4 | [] | no_license | // include library
#include<iostream>
//include standard library
using namespace std;
//function declaration
int sum(int arr[20],int n){
int s=0;
for(int i=0;i<n;i++)
{
//enter the number
cout<<"Enter number to be added: "<<endl;
cin>>arr[i];
//recursive calling
s=s+arr[i];
}
return s;
}
//main fu... | true |
5509f351b6a95ecc8d8560106de5912019a11d60 | C++ | hoosierEE/Homework | /Puzzles/inverter.cpp | UTF-8 | 1,228 | 3.640625 | 4 | [
"MIT"
] | permissive | #include <iostream>
// an interview question:
// "design a function such that f(f(n)) == -n, where n is a 32 bit signed int,
// and which does not use complex numbers"
//
// are globals or external state considered "complex numbers"?
// a philosophical question.
int minusItself(int n)
{
static bool hasCalledItself ... | true |
2ae7cc20ab68ade382614284c49b560b1f0abf90 | C++ | etzellux/Cpp-Demos | /Fstream1.cpp | UTF-8 | 456 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <fstream>
/* ios::app ====> append
ios::ate ====> output
ios::in ====> read
ios::out ====> write
ios::trunc ==> truncation
*/
int main()
{
char data[20];
std::fstream file("deneme1.txt", std::ios::out | std::ios::trunc );
// Open a file
file << ... | true |
7fa3bd3a183cb66d10da673f0f0069809d3390de | C++ | Befezdow/Different_Programs | /Static Huffman/treeitem.h | UTF-8 | 408 | 2.96875 | 3 | [] | no_license | #ifndef TREEITEM_H
#define TREEITEM_H
#include <memory>
class TreeItem
{
int weight;
char symbol;
public:
std::shared_ptr<TreeItem> parent;
std::shared_ptr<TreeItem> firstChild;
std::shared_ptr<TreeItem> secondChild;
TreeItem(char c, int w);
bool operator> (TreeItem& ob);
bool operato... | true |
f6f99db8945b8d5ebf445688a34ef56dafb1add2 | C++ | bmatejek/neurogaps | /pkgs/RNDataStructures/RNVector.cpp | UTF-8 | 8,782 | 3.296875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /* Source file for the vector class */
#ifndef __RN__VECTOR__C__
#define __RN__VECTOR__C__
/* Include files */
#include "RNDataStructures/RNDataStructures.h"
/* private constants */
static const int RN_VECTOR_MIN_ALLOCATED = 128;
/* public functions */
template <typename Type>
RNVector<... | true |
0b81f975408b69e33be1c163b2ac6485a786fe4e | C++ | l-iberty/MyCode | /CandC++/构造函数的显隐式调用.cpp | GB18030 | 375 | 3.59375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class demo {
private:
int data;
public:
demo(int inData) {
data = inData;
}
void showData() {
cout << "data = " << data << endl;
}
};
int main() {
demo d = demo(5); // 캯ʽ
demo d1(12); // ʽ
// Javaֻʽ: demo d = new demo(12);
d.showData();
d1.showData();
return 0... | true |
786459e89d107e8fb939397d570d817b3eab0a1a | C++ | Dexter-99/Coding-Library | /Graphs/NumberOfIslands.cpp | UTF-8 | 1,041 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
bool check(vector<int> adj[], int i, int j, int n, int m)
{
if (i < 0 || i >= n || j < 0 || j >= m || adj[i][j] != 1)
return false;
return true;
}
void bfs(vector<int> adj[], int i, int j, int n, int m)
{
queue<pair<int, int>> q;
q... | true |
a1292ed08ba06f65cea2d63342fc0f5257d3731a | C++ | pgeorgiev98/hexed | /app/byteinputwidget.h | UTF-8 | 642 | 2.6875 | 3 | [
"MIT"
] | permissive | #ifndef BYTEINPUTWIDGET_H
#define BYTEINPUTWIDGET_H
#include <QWidget>
#include <QVector>
class QLineEdit;
class QRadioButton;
class ByteInputWidget : public QWidget
{
Q_OBJECT
public:
explicit ByteInputWidget(QWidget *parent = nullptr);
public slots:
void set(quint8 byte);
bool inputValid() const;
quint8 get(... | true |
9eab66836752a39b363935ac86b9822cd34aca9e | C++ | suryakiran/Mp3Db | /TagRename/Src/Main.cxx | UTF-8 | 2,011 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <TagRename/MainWindow.hxx>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/algorithm/string/join.hpp>
using names... | true |
3da4504533d847e2b05cc60185cf6bd25243c37d | C++ | xswxq/C-Primer-Plus | /chapter12/main.cpp | GB18030 | 10,428 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include "Cow.h"
#include "String2.h"
//#include "Stock.h"
//#include "Stack.h"
#include "queue.h"
#include <ctime>
using namespace std;
//int main()
//{
// Cow c1;
// cout << c1.get_name()<< endl;
//// cout << c1.gethobby() <<endl;
////˴ָᵼºʾ
// Cow c2 = Cow("shao", "c... | true |
bb1fd674d4e549d53897fc3e67ed29d20170fafd | C++ | chris2511/xca | /lib/database_schema.cpp | UTF-8 | 12,158 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | /* The "32bit hash" in public_keys, x509super, requests, certs and crls
* is used to quickly find items in the DB by reference.
* It consists of the first 4 bytes of a SHA1 hash.
* Collisions are of course possible.
*
* All binaries are stored Base64 encoded in a column of type
* ' B64_BLOB ' It is defined here a... | true |
0b5b739bb2d3dd7e96b3ffc0d0bd98967810e987 | C++ | sqglobe/SecureDialogues | /messages/src/persistent_storage/connectionmarshaller.cpp | UTF-8 | 4,147 | 2.71875 | 3 | [
"MIT"
] | permissive | #include "connectionmarshaller.h"
#include <cstring>
#include "persistent-storage/utils/store_primitives.h"
#include "store_helpers.h"
/*
std::string userName;
std::string password;
bool tlsUsed;
std::string from;
*/
void ConnectionMarshaller::restore(ConnectionHolder& elem, const void* src) {
std::strin... | true |
e8605d238603ed688acde1872d0074e75670b237 | C++ | Shaneprrlt/penguin-2D-game | /Project/Player.h | UTF-8 | 803 | 2.828125 | 3 | [] | no_license | #pragma once
#include "grafix.h"
#include <vector>
#include "Bullet.h"
/*
* Player is the game character
* that is controlled by the user
* and is the protaganist.
* Written by Shane Perreault 11/8/2014
*/
class Player {
public:
// member data about the player
Point pos;
int size;
bool facingEast;
int xVel... | true |
291d1aee627328c93ada8ccd0165a141f1d7cafe | C++ | NevmerRoman/Ubuntu | /ClientServerSQL/Server/storage.h | UTF-8 | 659 | 2.5625 | 3 | [] | no_license | #ifndef STORAGE_H
#define STORAGE_H
#include "cashe.h"
#include "postgres.h"
#include "workwithstorage.h"
namespace ClientServerSQL {
class Storage : public WorkWithStorage{
public:
Storage() = default;
~Storage();
bool Set(int, string);
string Get(int);
private:
Cashe ca;
Postgres db;
... | true |
1ad76478c94025a725e3537831312fcb6a2a1ed7 | C++ | EndsleighCC/AllSorts | /Prototypes/CCDev/VS2010/TestCLRConsole/TestCLRConsole/TestCLRConsole.cpp | UTF-8 | 2,665 | 2.640625 | 3 | [] | no_license | // TestCLRConsole.cpp : main project file.
#include "stdafx.h"
using namespace System;
using namespace System::ComponentModel;
using namespace TestCSharpCLRObject;
using namespace TestCPlusPlusCLRObject ;
using namespace TestCSharpCLRStaticObject ;
int main(array<System::String ^> ^args)
{
//Console::WriteLin... | true |
eec944c485be600d48de9f65d05ff9eff05abd73 | C++ | kaestro/algorithms_v2 | /daily/april/week4/0420/sw-1768/user.cpp | UTF-8 | 1,907 | 2.828125 | 3 | [] | no_license | typedef struct {
int strike;
int ball;
} Result;
// API
extern Result query(int guess[]);
bool num[9877];
int number[5040];
bool flag = true;
int idx = 0;
void init() {
if (flag) {
flag = false;
for (int i = 123; i < 9876; ++i) {
int sb1 = i / 1000;
int sb2 = i ... | true |
e48f886a603cf1770a0e09c5fab1be7d7082bce1 | C++ | aeon-engine/libaeon | /src/common/public/aeon/common/string.h | UTF-8 | 17,949 | 3.3125 | 3 | [
"BSD-2-Clause"
] | permissive | // Distributed under the BSD 2-Clause License - Copyright 2012-2023 Robin Degen
#pragma once
#include <concepts>
#include <string>
#include <ostream>
namespace aeon::common
{
class string_view;
class string
{
friend class string_view;
public:
static_assert(alignof(char) == alignof(char8_t),
... | true |
a1abc34c85c14e539256463a8abfcfa3e4e114a2 | C++ | HSchmale16/HeavyWeapon | /src/HealthEntity.cpp | UTF-8 | 356 | 2.828125 | 3 | [] | no_license | #include "HealthEntity.h"
#include <cassert>
#include "Utils.h"
HealthEntity::HealthEntity()
:max_health(25), current_health(25.f) {
assert(max_health == current_health);
}
void HealthEntity::applyDamageCalculation(DamageCalculation& dc) {
if(dc.hit) {
current_health -= dc.amount;
// cout << ... | true |
508a4affe02f8692777761c124e7c91ed38c0284 | C++ | CytronTechnologies/CytronMotorDriver | /CytronMotorDriver.cpp | UTF-8 | 1,654 | 3.046875 | 3 | [
"MIT"
] | permissive | #include "CytronMotorDriver.h"
CytronMD::CytronMD(MODE mode, uint8_t pin1, uint8_t pin2)
{
_mode = mode;
_pin1 = pin1;
_pin2 = pin2;
pinMode(_pin1, OUTPUT);
pinMode(_pin2, OUTPUT);
digitalWrite(_pin1, LOW);
digitalWrite(_pin2, LOW);
}
void CytronMD::setSpeed(int16_t speed)
... | true |
e01b567faf99a863f97738be88f39424757b0696 | C++ | TyRoXx/lua-cpp | /test/add_method.cpp | UTF-8 | 3,442 | 2.578125 | 3 | [
"MIT"
] | permissive | #include <boost/test/unit_test.hpp>
#include "test_with_environment.hpp"
#include "luacpp/meta_table.hpp"
namespace
{
struct test_struct
{
bool *called;
explicit test_struct(bool &called)
: called(&called)
{
}
void method_non_const()
{
method_const();
}
void method_const() const
{
BOOST... | true |
7fb27acef992b2b52cd605e92199c73c4fcfdb35 | C++ | oalpar/Nips | /OK/NipsOriginal/Nips_MT/src/framework/hashing_more_og.h | UTF-8 | 1,683 | 2.53125 | 3 | [
"MIT"
] | permissive |
#ifndef _HASHING_MORE_H_1
#define _HASHING_MORE_H_1
#include <cstdint>
// TODO: If you have a seed of random bytes you should place it in the seed
// directory and use randomgen.h instead!
#include <random> // TODO: Replace with #include "randomgen.h"
#include "MurmurHash3_og.h"
#include "MurmurHash3.h"
/* ********... | true |
bffa68cca27f81d891bf421cf121a23d7071b75f | C++ | yohm/weighted_social_network_model | /random.hpp | UTF-8 | 734 | 2.9375 | 3 | [
"MIT"
] | permissive | #ifndef RANDOM_HPP
#define RANDOM_HPP
#include <iostream>
#include <boost/random.hpp>
//=================================================
// singleton class for random number generator
class Random {
public:
static void Init(uint64_t seed, int num_threads = 1) {
m_rnds.clear();
for(int i=0; i <num_threads;... | true |
e3897a6d99373f6b87615887f29afc2684031126 | C++ | GeekyPython/Code-Practice | /concepts/stl1.cpp | UTF-8 | 834 | 3.265625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int>v,w;
for(int i=0;i<10;i++)
{
v.push_back(i+1);
}
for(int i=10;i<20;i++)
{
w.push_back(i);
}
for(auto i=v.begin();i!=v.end();i++)
{
cout<<*i<<" ";
}
... | true |
a7ee0d8cc1d7bf7473adcd3824e1500300707eb5 | C++ | ahaddad98/42_piscine_cplusplus | /day02/ex01/Fixed.cpp | UTF-8 | 2,039 | 2.921875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Fixed.cpp :+: :+: :+: ... | true |
c25fd4cb6b8bfe52d695dd392029d47a554efd2b | C++ | S1ckick/oop_game | /Game/Player/Player.h | UTF-8 | 787 | 2.828125 | 3 | [] | no_license | //
// Created by Максим on 03.10.2020.
//
#ifndef GAME_PLAYER_H
#define GAME_PLAYER_H
#include "../Board/Cell/Cell.h"
#include "../Enemy/EnemyInterface.h"
class Player {
public:
int getHealth();
void setHealth(int health);
int getStars();
void setStars(int stars);
int getCurrentX();
void se... | true |
a8bc5f02086ff60ab208cfe1cac1be8c41eb57fc | C++ | diptu/Teaching | /CSE 225L Data Structures and Algorithms/Resources/Codes Previous/Spring-2019-CSE225 1/Lab 3 task 2( Division)/complex(9).h | UTF-8 | 657 | 2.921875 | 3 | [
"MIT"
] | permissive | #ifndef COMPLEX_H_INCLUDED
# define COMPLEX_H_INCLUDED
class Complex {
friend Complex operator - (Complex &a , Complex &b ) ;
friend Complex operator - (int value , Complex &a ) ;
friend Complex operator - (Complex &a , int value ) ;
friend Complex operator * (Complex &a , Complex &b) ;
friend Compl... | true |
9d1743674d25fe76355a603aac059e31c9d79c1b | C++ | chaemon/library | /graph/topological_sort.cpp | UTF-8 | 722 | 2.78125 | 3 | [] | no_license | //{{{ topological sort
bool visit(const Graph &g, int v, vector<int> &order, vector<int> &color,vector<int> &next) {
color[v] = 1;
FOR(e, g[v]) {
if (color[e->dst] == 2) continue;
if (color[e->dst] == 1){
order.clear();
int t=e->dst;
while(1){
order.push_back(t);
if(t==v)break;
t=next[t];
... | true |
e6afc966d1d9f675772afb08f5267ae9bc019c6b | C++ | gtangg12/Algorithm-Library | /maxflow.cpp | UTF-8 | 928 | 2.6875 | 3 | [] | no_license | // Maxflow via Ford-Fulkerson implemented using Edmonds-Karp: O(VE^2)
#include "header.h"
const int MAXN = 1024;
int N, M;
vpi adj[MAXN]; // (des, cap)
int par[MAXN];
int res[MAXN][MAXN];
int bfs(int s, int t) {
fill(par, par + MAXN, -1);
par[s] = -2;
queue<pi> q;
q.push({s, INF}); // (node, flow)
while(!q.emp... | true |
6b12399efe3ed2ead8bbda36d45b25bca0ea32c2 | C++ | omkarbuchade/CFS-scheduling | /code/threads/ioRequest.cc | UTF-8 | 1,129 | 2.75 | 3 | [
"MIT-Modern-Variant"
] | permissive | //Name: Omkar Buchade
#include "ioRequest.h"
#include <iostream>
#include "main.h"
#include "IOalarm.h"
void Request::writeRequest(std::string writeStr)
{
std::cout<<"\nCreating a write request";
int ticks= kernel->stats->totalTicks;
ioRequest *requestObj=new ioRequest(WriteInt, kernel->currentThread, wri... | true |
8ca7ecceddb617d12e6c6054d7dd7f8d7e8ab46b | C++ | varkey98/Leetcode-Solutions | /pathInZigZagTree.cpp | UTF-8 | 255 | 2.65625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<math.h>
vector<int> pathInZigZagTree(int label)
{
float k= log(label)/log(2)+1;
int level=(int)k;
int max=pow(2,level)-1;
int pos=0;
if(level%2==0)
int pos=max-label+1+pow(2,level-1)-1
} | true |
c15a2347575b3082022caafa4b04c38abe7cf43c | C++ | daweizh/cpp | /chap02/99/exam3_10-2.cpp | UTF-8 | 292 | 3.546875 | 4 | [] | no_license | 编程实现两个变量x、y之间值的交换。
#include <iostream>
using namespace std;
int main(){
float x,y,t;
x = 10.5;
y = 30.6;
cout << x << " " << y << endl;
x+=y;y=x-y;x-=y;
cout << x << " " << y << endl;
return 0;
}
| true |
917114ebac90cd2feba2035524937e701946e045 | C++ | bvbasavaraju/competitive_programming | /leetcode/top_interview_questions/easy/trees/2.cpp | UTF-8 | 1,503 | 4.03125 | 4 | [
"Apache-2.0"
] | permissive | #include <iostream>
using namespace std;
/*
Q: Validate Binary Search Tree
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows:
+ The left subtree of a node contains only nodes with keys less than the node's key.
+ The right subtree... | true |
c4d2be85fe86a0385b198bf990b6eb16515444e1 | C++ | mahyuddin/utexas-ros-pkg | /stacks/austinvilla/ground_truth/include/ground_truth/field_provider.h | UTF-8 | 5,889 | 2.65625 | 3 | [] | no_license | /**
* \file field_provider.h
* \brief This header defines the dimensions of the field, as well as
* declares the helper functions to draw out the field in 2D and 3D
*
* \author Piyush Khandelwal (piyushk), piyushk@cs.utexas.edu
* Copyright (C) 2011, The University of Texas at Austin, Piyush Khandelwal
*
* Li... | true |
910da10455f81ad88905733f464ed45514d59285 | C++ | CZAlmon/School-Programs | /C++/Binary Search Tree for Games/elements.h | UTF-8 | 779 | 3.25 | 3 | [] | no_license | #ifndef ELEMENTS_H
#define ELEMENTS_H
#include <iostream>
#include <string>
using namespace std;
class Binary_tree;
class tree_node
{
private:
string title;//title
int year_made;//year
double highest_score;//score
tree_node* left;//left node pointer
tree_node* right;//right node pointer
public:
tree_node(str... | true |
d92759df3b1f0eb5daac8261ac1ecaad5b6db564 | C++ | LinuxKernelDevelopment/cppprimer | /ch05/EXE5_4_1/word.cpp | UTF-8 | 416 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main(void) {
string preword, word, lword;
int num = 1, largest = 0;
while (cin >> word) {
if (preword == word) {
num++;
} else {
if (num >= largest) {
largest = num;
lword = preword;
}... | true |
ca571ff2b191e7992d8f68319d6c016e2b690d15 | C++ | Rosovskyy/server-client | /server.cpp | UTF-8 | 1,942 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <unistd.h>
#include <netinet/in.h>
#include <sstream>
#include <time.h>
int main() {
struct sockaddr_in server;
char buf[1024];
int sd = socket(AF_INET, SOCK_STREAM, 0);
if (sd < 0) {
exit(EXIT_FAILURE);
}
memset(&server, 0, sizeof(struct sockaddr_in));
... | true |
7bef34536ad2c76beb40d061cdf2be59b4da51a3 | C++ | niks333/dsacodes | /stackUsingLL.cpp | UTF-8 | 1,106 | 3.734375 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class StackNode{
public:
int data;
StackNode* next;
};
StackNode* newNode(int value){
StackNode* stackNode = new StackNode();
stackNode->next=NULL;
stackNode->data=value;
return stackNode;
}
bool isEmpty(StackNode* root){
return !root;
}
v... | true |
a2f10a9a9e7b630aedbdbfe8589060b0f4867e0e | C++ | stdstring/leetcode | /Algorithms/Tasks.1001.1500/1108.DefangingIPAddress/solution.cpp | UTF-8 | 645 | 3.296875 | 3 | [
"MIT"
] | permissive | #include <string>
#include "gtest/gtest.h"
namespace
{
class Solution
{
public:
std::string defangIPaddr(std::string const &address) const
{
std::string result;
for (char ch : address)
{
if (ch == '.')
result.append("[.]");
else
... | true |
59eb7f9b195482028533745234a48cd87907a081 | C++ | alexandraback/datacollection | /solutions_5631989306621952_1/C++/Stummfilm/a.cpp | UTF-8 | 527 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <cmath>
using namespace std;
string solve(string s){
string result = "";
result += s[0];
for(int i = 1; i < s.size(); i++) {
if(s[i] >= result[0])
result = s[i] + result;
else
resul... | true |
869a712feebccc3b0919c5010758b5d881e9720e | C++ | DavidMilot/openGameEngine3D | /openGameEngine3D/src/Platforms/OpenGL/OpenGLVertexArray.cpp | UTF-8 | 3,873 | 2.640625 | 3 | [
"MIT"
] | permissive | #include "ogepch.h"
#include "Platforms/OpenGL/OpenGLVertexArray.h"
#include <glad/glad.h>
/*
Hazel Engine
License : Apache 2.0
*/
namespace openGameEngine3D
{
static GLenum ShaderDataTypeToOpenGLBaseType (ShaderDataType type)
{
switch (type)
{
case ShaderDataType::Float: return GL_FLOAT;
case Shad... | true |
299c9785443c938cb9fa6ad3ae4ac5061f1e4ead | C++ | gwkdgwkd/examples | /c++/STL/effective_stl/31.cpp | UTF-8 | 6,179 | 3.90625 | 4 | [] | no_license | #include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
// 了解各种与排序有关的选择
class Widget {};
bool qualityCompare(const Widget &lhs, const Widget &rhs) { return false; }
// sort是一个非常不错的算法,但也并非在任何场合下都是完美无缺的。
// 只需排序出前20好的,可以使用partial_sort。
// 选出最好的几个,可以使用nth_element。
// partial_sort和nth_element效果基本相同... | true |
65103be0c9d54fd9825c1cb7ccfa4f8d8dc7658e | C++ | mtorresdemello/Taller1 | /CalcuSimple_PSTCompiler/listaInstrucciones.cpp | ISO-8859-1 | 9,923 | 2.890625 | 3 | [] | no_license | #include "listaInstrucciones.h"
void listaInstruccionesPROC_crearLI(listaInstrucciones &li){
li = NULL;
}
void listaInstruccionesPROC_destruirLI(listaInstrucciones &li){
if (li != NULL)
{
listaInstruccionesPROC_destruirLI (li->sig);
delete li;
li = NULL;
}
}
... | true |
665e0fae1e88d20056c1c170fe22707aee8aa38d | C++ | Ampersandnz/se306-project-1 | /src/upstage_pkg/src/renderer/Texture.cpp | UTF-8 | 713 | 2.578125 | 3 | [] | no_license | #include "Texture.hpp"
#include "Renderer.hpp"
#include "../Util.hpp"
ups::Texture::Texture(ups::Texture::Texture::TextureType tt, unsigned int width, unsigned int height, unsigned int innerWidth, unsigned int innerHeight) :
_tt(tt),
_width(width),
_height(height),
_isInRenderer(false),
_data(0)
{
_in... | true |
12665f5fbf59b4af8b41a7e13038d41a9f06f988 | C++ | IndiraBobburi/Algos-and-DS | /SortingAlgorithms/QuickSortoptimal.h | UTF-8 | 598 | 2.671875 | 3 | [] | no_license | //
// QuickSortOptimal.hpp
// SortingAlgorithms
//
// Created by Indira Bobburi on 11/11/17.
// Copyright © 2017 sjsu. All rights reserved.
//
#ifndef QUICKSORTOPTIMAL_H_
#define QUICKSORTOPTIMAL_H_
#include "QuickSorter.h"
/**
* The class that implements the optimal quicksort algorithm
* for a vector of data ... | true |
cc55e8e27d1faf914c2517538c32a23b1fb0f527 | C++ | BasvRossem/AllForBread | /Inventory/InventoryDisplay.cpp | UTF-8 | 17,191 | 2.515625 | 3 | [] | no_license | #include "InventoryDisplay.hpp"
#include <SFML/Graphics/Color.hpp>
InventoryDisplay::InventoryDisplay(Party & party, sf::RenderWindow & window) :
party(party),
window(window),
leftScreen(leftScreenSize.x, leftScreenSize.y),
rightScreen(rightScreenSize.x, rightScreenSize.y)
{
////Make virtualscreens
sf::Vector2f ... | true |
f717a275df94549a026d15e22b5c3b874c2006a9 | C++ | cbehren/Iltis | /DustModule.H | UTF-8 | 2,419 | 2.515625 | 3 | [] | no_license | #ifndef __DUST_MODULE_H
#define __DUST_MODULE_H
#ifdef _OPENMP
#include "omp.h"
#endif
#include <iostream>
#include "BaseParticle.H"
#include "BaseCell.H"
//This defines a number of implementations for the treatment of dust.
//TODO this is all for the Lyman-alpha line, more or less. Make it more general?
enum DUS... | true |
ffade0b6ff7bacd289b93fd05ee48769cf8555ed | C++ | CathalRedmond/Games-Jam-2018 | /GamesJam2018/GamesJam2018/Field.cpp | UTF-8 | 674 | 2.640625 | 3 | [] | no_license | #include "Field.h"
Field::Field()
{
}
Field::~Field()
{
}
void Field::render(sf::RenderWindow & t_window)
{
t_window.draw(m_fieldSprite);
}
void Field::setTexture(sf::Texture const & t_fieldTexture)
{
m_fieldTexture = t_fieldTexture;
setUpSprites();
}
sf::Sprite Field::getSprite()
{
return m_fieldSprite;
}
... | true |
5870d50a217a199136c535ec218f87d04f783683 | C++ | captabhi/CodechefArchive | /robot&batons.cpp | UTF-8 | 802 | 2.671875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int n,m,i,j,k,count1;
cin>>n;
cin>>m;
int arr1[n];
char arr2[n];
for(i=0;i<n;i++)
arr2[i]='#';
for(i=0;i<n;i++)
{
cin>>arr[i];
}
i=0;
while(i<n)
{
cin>>temp;
arr2[temp]='*';
... | true |
b6480d3e1f0d7b05d894bb5a2c50d43db71a5bf4 | C++ | crisdeodates/Robotics-control-toolbox | /ct_optcon/include/ct/optcon/filter/SystemModelBase.h | UTF-8 | 1,854 | 2.546875 | 3 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**********************************************************************************************************************
This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
Licensed under the BSD-2 license (see LICENSE file in main directory)
****************... | true |
595f6f0d8b106cb2d5faaa3a128ea40db832368c | C++ | beaucha3/LeetCode-OJ | /longest_substring_without_repeating_characters.cpp | UTF-8 | 1,801 | 3.703125 | 4 | [] | no_license | class Solution
{
public:
int lengthOfLongestSubstring(string s)
{
/* Idea: A hash table can be used to keep track of which characters have been seen so far in a given substring */
unordered_map<char, int> charTrack; /* Declare hash table */
int maxLength = 0; /* Length ... | true |
94edc77b3c5854f5fe70887f3331b49b1373708b | C++ | anddregarcia/Laboratorio-PequenosExemplosC | /LISTA4.CPP | UTF-8 | 1,475 | 3.21875 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
#include <malloc.h>
struct reg {
int id;
struct reg *prox;
struct reg *ant;
};
struct reg *pos = NULL;
void add(int novo_id) {
struct reg *novo = (struct reg *) malloc(sizeof(reg));
novo->id=novo_id;
if (pos==NULL) {
novo->prox=NULL; // A
novo->ant=NULL; /... | true |
1fd0cedd47a44aa11dacca47c4d21f94d648a7fd | C++ | msdedwards/FieldSweeper | /Board.cpp | UTF-8 | 2,564 | 2.96875 | 3 | [] | no_license | #include "StdAfx.h"
#include "Board.h"
#include <ctime>
CBoard::CBoard(void) :
SquareRowCount(16),
SquareColumnCount(16)
{
Reset();
}
CBoard::~CBoard(void)
{
}
CSquare& CBoard::GetSquare(int row, int col)
{
return _Squares[row][col];
}
void CBoard::Reset()
{
GameOver=false;
GameWon=false;
for(UIN... | true |
22cba554cb3923eff92fe5091a573a31e2d0817e | C++ | mkbn-consultancy/modern_cpp | /noexcept/3_nested_exception.cpp | UTF-8 | 2,127 | 3.140625 | 3 | [] | no_license | //-------- MKBN Training and Consultancy --------//
//--------------- miri@mkbn.co.il ---------------//
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
void manipulateFile(const std::string& fName){
//open the file and do some manipulation on it
try{
std::ifstream fin(fName);... | true |
12928c6060e3e905b7f60ffde69e76aefcc6ce46 | C++ | Curiouser/simplex | /SimplexProblem.cpp | UTF-8 | 7,975 | 3.09375 | 3 | [] | no_license | #include "stdafx.h"
#include "SimplexProblem.h"
using namespace std;
SimplexProblem::SimplexProblem()
{
nbInequations = 0;
nbVariables = 0;
systemIneq = new double * [nbInequations]; //each systemIneq[nbIneq] is of size nbVariables + 2, for relational sign and result // we have deleted the +2
z = new do... | true |
1615f29154be41777ceaeadbd9e4e9f4d06d4eb6 | C++ | PrinceClover/cpp_learn | /20160615/src/complex.cc | UTF-8 | 1,930 | 3.4375 | 3 | [] | no_license | ///
/// @file complex.cc
/// @author PrinceClover(871353611@qq.com)
/// @date 2016-06-15 21:47:37
///
#include <iostream>
#include <stdio.h>
using std::cout;
using std::endl;
using std::cin;
class Complex
{
//the inputstream and outputstream structure must be overload by friend
//return value must be a ... | true |
06f2b0eeae75dc63b38faed94f30bfb864ee11ae | C++ | zhongxuanS/- | /PieceSet.h | UTF-8 | 645 | 3.203125 | 3 | [] | no_license | #pragma once
#include "Piece.h"
//管理所有的图形,一共有7*4=28种
class PieceSet
{
public:
enum{ NUM_PIECES = 7, NUM_ROTATIONS = 4 };
PieceSet();
~PieceSet();
// 按照指定的id和rotation获取对应的图形
Piece* getPiece(int id, int rotation = 0) const;
// 获得随机图形
inline Piece* getRandomPiece() const
{
return getPiece(rand() % NUM_PIECES... | true |
13bf03905810944b9780b39d7410ef1613cd8882 | C++ | Heihuang/view | /algorithm/stack/外观数列.hpp | UTF-8 | 1,115 | 4 | 4 | [] | no_license | /*
题目:给定一个正整数 n(1 ≤ n ≤ 30),输出外观数列的第n项,注意:整数序列中的每一项将表示为一个字符串。
「外观数列」是一个整数序列,从数字 1 开始,序列中的每一项都是对前一项的描述。
1. 1
2. 11
3. 21
4. 1211
5. 111221
*/
class Solution {
public:
string countAndSay(int n) {
if(n == 1) return "1";
string previous = countAndSay(n-1), result = ""; // 使用递归来一层一层... | true |
c921bdc05e56e46ec7b6997bfd637fbf06f4c346 | C++ | eddiehoyle/sevengine | /src/Utilities.cc | UTF-8 | 3,000 | 2.90625 | 3 | [
"MIT"
] | permissive | //
// Created by Eddie Hoyle on 6/08/16.
//
#include <iostream>
#include <vector>
#include <cmath>
#include "Utilities.hh"
void test( std::string x ) {
// TODO
}
const char* readShaderFile( const std::string& path )
{
// Try open the file
FILE* fp = fopen(path.c_str(), "r");
if ( fp == NULL )
{
... | true |
1c958e9e3dcee812bf35931c599420ab76c4c00c | C++ | sllujaan/Modern-OpenGL | /Modern-OpenGL/Util.h | UTF-8 | 482 | 3.125 | 3 | [] | no_license | #pragma once
#include"pch.h"
namespace util {
static int loop = 0;
/*
* slows down the current thread.
* @param[in] milliseconds: time for sleeping the current calling thread.
* @param[in] logIteration: true or false, it prints the loop iteration.
*/
static void handleloopCount(size_t milliseconds, bool logIt... | true |
c8d34582c99d81a658dbd4453a483bbe84215e1a | C++ | Equinox-/Mirage-- | /SGE/GLUtil/GLTexture.cpp | UTF-8 | 5,948 | 2.578125 | 3 | [] | no_license | /*
* GLTexture.cpp
*
* Created on: Jul 31, 2013
* Author: lwestin
*/
#include "GLTexture.h"
#include "GLColor.h"
#include <stdio.h>
#include <stdlib.h>
#include <png.h>
#include <GL/gl.h>
GLTexture::GLTexture() {
pixFMT = 0;
rawData = NULL;
height = 0;
width = 0;
textureID = 0;
rowBytes = 0;
bitsPer... | true |
f427aeb99c5a3ebbbc65ca3475c0dbaa42cc4c32 | C++ | mmmatjaz/SL-hoap3 | /user/cbUser/src/SampleTask.cpp | UTF-8 | 2,728 | 2.65625 | 3 | [] | no_license | /*============================================================================
==============================================================================
SampleTask.cpp
==============================================================================
Remarks:
... | true |
ac349e1c38f755979727aa812add68ba6257e7ba | C++ | EliezerDY/c- | /class registration/Instructor.cpp | UTF-8 | 1,208 | 3.390625 | 3 | [] | no_license | // project -E.Brown
#include "Instructor.h"
// instance functions
Instructor::Instructor(): Instructor("Staff") {
}
Instructor::Instructor(std::string n): Instructor(n,""){
}
Instructor::Instructor(std::string n, std::string d): name(n), department(d){
}
std::string Instructor::getName() const {
ret... | true |
61ffd8a49bc454047a3800ffe93737361226620f | C++ | lineCode/SpaceshipWarriorCombatED | /client/include/network/NetworkConfig.hpp | UTF-8 | 734 | 2.828125 | 3 | [] | no_license | #if !defined(NETWORK_CONFIG_HPP)
#define NETWORK_CONFIG_HPP
#include <string>
class NetworkConfig
{
public:
NetworkConfig();
NetworkConfig(const std::string &server_ip, short server_port);
~NetworkConfig();
void setServerIp(const std::string &ip);
void setGameServerIp(const std::string &ip);
... | true |
ea787c0993cf938120f7592c89acb3cc70f62fbe | C++ | mgorvat/Compression | /HuffmanEncoder.h | WINDOWS-1252 | 1,463 | 3.59375 | 4 | [] | no_license | #ifndef HUFFMANENCODER_H_INCLUDED
#define HUFFMANENCODER_H_INCLUDED
#include <vector>
#include <map>
#include <utility>
using namespace std;
/**
@author mgorvat
Class, which associate values with their codes. Values after constructing class
are immutable.
*/
template <class T>
class HuffmanEncoder{
p... | true |
88b8843f6343e2a6ad8bc7bb8c8036dbe7976547 | C++ | Arangear/The15Puzzle | /The15Puzzle/Coursework2/UI.h | UTF-8 | 2,287 | 3.0625 | 3 | [] | no_license | //Author: Daniel Cieslowski
//Date created: 23.10.2019
//Last modified: 24.10.2019
#pragma once
#include "Solver.h"
#include "PuzzleGenerator.h"
#include "FileReader.h"
#include "FileWriter.h"
#include <set>
//Class responsible for communication between users and the application.
class UI
{
public:
//Methods
... | true |
30f1508e922e58041783dcad4241ca0b2939efd4 | C++ | StHamish/various-algorithms | /algorithms/bit-manipulation/find-unique/aim.hpp | UTF-8 | 322 | 2.703125 | 3 | [
"MIT"
] | permissive | /*
The aim of this topic is:
http://www.programcreek.com/2012/12/leetcode-solution-of-single-number-in-java/
Given an array of integers, every element appears twice except for one. Find that single one.
*/
// Algorithm to be tested
template <class It> typename It::value_type find_unique(It&& beg, It&& end);... | true |
98f03c5547d46fe4933c8e6e4d0c6a94cf579aa0 | C++ | declard/diploma | /src/basiclayer.cpp | UTF-8 | 1,054 | 2.65625 | 3 | [] | no_license | #include "basiclayer.h"
double BasicLayer::bound(const MatrixD&m,MatrixIndex point) {
if (point<0||point>=m.size()) return 0;
return m.at(point);
}
QImage BasicLayer::toImage(const MatrixD&m) {
QImage res(m.size(),QImage::Format_RGB16);
MatrixIndex i,f,t(m.size());
for2DIncr(i,f,t) {
char v(m.at(i));
res.set... | true |
247d71347112661eaabd709a0c2c813190059cdc | C++ | yueyiqiu178/DataStructure | /set.cpp | UTF-8 | 1,564 | 2.71875 | 3 | [] | no_license | #include<iostream>
using namespace std;
void Union(int [],int,int);
int find(int [],int);
int main(){
int parent[]={0,4,-2,7,-3,7,7,-5,4,3,2};
for(int i=1;i<=10;i++)
cout<<parent[i]<<" ";
cout<<endl;
Union(parent,2,4);
for(int i=1;i<=10;i++)
... | true |
a37774a9eac817c35dec95e2362f19bf2866f9f4 | C++ | sguzwf/Algorithms | /sort/src/priority_queue.h | UTF-8 | 4,734 | 3.59375 | 4 | [
"WTFPL"
] | permissive | #ifndef __PRIORYT_QUEUE_H__
#define __PRIORYT_QUEUE_H__
#include<iostream>
#include<vector>
#include<cassert>
using std::vector;
template<typename Real>
class Priority_Queue
{
public:
Priority_Queue();
Priority_Queue(vector<Real>v);
void insert(Real v);
void updateKey(int idx, Real ... | true |
9d6cfc34ece0f2e7738af62bce57ad1ab94f2804 | C++ | HemanDas/cpp_project | /Lab_works/Lab_functions/User_defined/argument_returnvalue.cpp | UTF-8 | 368 | 3.078125 | 3 | [] | no_license | #include<iostream>
using namespace std;
double getarea(double,double);
int main()
{
double base,height,area;
cout<<"input base and height:"<<endl;
cin>>base>>height;
area=getarea(base,height);
cout<<"area of triangle is:"<<area<<endl;
}
double getarea(double b,double ht)
{
double area;
... | true |
196de1adb606770603bb9742dab9087efdef784e | C++ | Abdulrehman964/ICT-project | /pgm1.cpp | UTF-8 | 300 | 3.203125 | 3 | [] | no_license | #include<stdio.h>
int factorial(int n)
{
if(n==0||n==1)
return n;
else
return(n*factorial(n-1));
}
int main()
{
int n=0,c=0;
printf("Enter the number whose factorial has to be calculated : ");
scanf("%d",&n);
c=factorial(n);
printf("The factorial of %d is %d ",n,c);
printf("Bug");
}
| true |
a26a96258be411281410bf4a67d22bb598d9cde6 | C++ | amorim/Pesquisa-Operacional | /clique/Source.cpp | UTF-8 | 1,343 | 2.703125 | 3 | [] | no_license | #include <ilcplex/ilocplex.h>
#include <vector>
#include <set>
ILOSTLBEGIN
class Graph {
private:
vector<set<int>> adjacencia;
public:
int nvertices;
Graph(int nvertices) {
this->nvertices = nvertices;
adjacencia.resize(nvertices);
}
Graph(string filename) {
ifstream file(filename);
int vertices;
file... | true |
c4d3543550a4045bc347e230793347d98f4a6921 | C++ | wangzilong2019/text | /蓝桥杯算法训练2/图/并查集/并查集找祖宗节点.cpp | GB18030 | 1,218 | 3.359375 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
using namespace std;
const int N = 100001;
int father[N];
int n, m; //ֱ¼ͱߵĸ
struct Edge{
int u, v; //ÿߵ
}e[N];
//ʼÿĸڵ
void init() {
for (int i = 1; i <= n; i++) {
father[i] = i;
}
}
//
int find(int x) {
if (x != father[x]) {
father[x] = find(father[x]); //ѵǰڵ㵽ڽڵļϺȫΪڽ... | true |
ae14b0e1887b0b53ceb39f635db2104bebc644e2 | C++ | invincibleadam28/My-Coding-Journey | /Spiral Matrix.cpp | UTF-8 | 882 | 2.96875 | 3 | [] | no_license | vector<int> solve(vector<vector<int>>& matrix)
{
vector<int> ans;
int n = matrix.size();
if (n == 0) return ans;
int m = matrix[0].size();
int left = 0, right = m - 1, top = 0, bottom = n - 1;
int dir = 0;
while (left <= right && top <= bottom)
{
if (dir == 0)
{
for (int i = left; i <= r... | true |
3723d034bb5a7db7ca0d79ee777463964801eb50 | C++ | zpoint/Reading-Exercises-Notes | /The_C++_Standard_Library/multimap1.cpp | UTF-8 | 1,435 | 3.484375 | 3 | [] | no_license | #include <map>
#include <string>
#include <iostream>
#include <iomanip>
int main()
{
// create multimap as string/string dictionary
std::multimap<std::string, std::string> dict;
// insert some elements in random order
dict.insert({ { "day", "Tag" }, { "strange", "fremd" },
{ "car", "Auto" }, { "smart",... | true |
f803b647546ca277f9dddcb3d4ef7a2ed44feb4b | C++ | fsofelipe/CompGraficaUFPel | /Trabalho 1/mesh.cpp | ISO-8859-1 | 3,538 | 2.96875 | 3 | [] | no_license | #include "mesh.hpp"
Mesh::Mesh(char * path) {
bool res = loadOBJ(path, vertices, uvs, normals);
indexVBO(vertices, uvs, normals, indices, indexed_vertices, indexed_uvs, indexed_normals);
createPriorList();
}
std::vector<glm::vec3> Mesh::getVertices() {
return indexed_vertices;
}
std::vector<glm::ve... | true |
f238ca5e4de66fc12d83c2315d703113188f457f | C++ | alekseytanana/coding-challenges | /cpp_stepik_p1/3/string_constructor3.cpp | UTF-8 | 701 | 3.59375 | 4 | [] | no_license | #include <cstddef> // size_t
#include <cstring> // strlen, strcpy
struct String {
String(const char *str = "") : size(strlen(str))
{
this->str = strcpy( new char [size+1], str );
}
String(size_t n, char c) : size(n), str(new char [n+1])
{
for (size_t i=0; i!=n; ++i)
*(str + i) = c;
... | true |
ba684ab975d64c7bd558d0f8f13566ba18b6a8c1 | C++ | joy-mollick/Only-Uva-Online-Judge-Solutions | /11151 - Longest Palindrome.cpp | UTF-8 | 1,113 | 3.171875 | 3 | [] | no_license | #include<bits/stdc++.h>
/*
Nayeem Mollick Joy , Electrical & Electronic Engineering , University of Rajshahi.
Passionate Contest Programmer , Coder , Android Developer */
using namespace std;
// normal dp problem
typedef unsigned long long ll;
ll longest_pal(string str)
{
ll n =str.size();
ll i... | true |
9625122df7a4770c8a8bb1c8edaa5784ba64986d | C++ | riophae/exercises | /the-method-of-programming/ch01-string/06-find-longest-palindrome/01.cpp | UTF-8 | 1,272 | 3.359375 | 3 | [] | no_license | #include <cstring>
#include <iostream>
void findLongestPalindrome(const char *str) {
int max = 0;
int max_start = -1;
int max_end = -1;
int len = strlen(str);
int n;
int start;
int end;
for (int i = 0; i < len; ++i) {
for (int j = 0; i - j >= 0 && i + j < len; ++j) {
if (str[i - j] != str[i ... | true |
7ce1dcd47e5c710eff6142375a20e1c2421b3feb | C++ | ayundina/cpp_piscine | /day04/ex03/include/AMateria.hpp | UTF-8 | 493 | 2.875 | 3 | [] | no_license | #ifndef AMATERIA_H
#define AMATERIA_H
#include "ICharacter.hpp"
#include <iostream>
class ICharacter;
class AMateria
{
private:
protected:
std::string _type;
unsigned int _xp;
public:
AMateria();
AMateria(std::string const &type);
AMateria(const AMateria &m);
AMateria &operator=(const AMateria &m);
virtual... | true |
a61dcb367badc5a15977162917d184a2ec264788 | C++ | bunnyDrug/aoc-2020-cpp20 | /day_4/main.cpp | UTF-8 | 4,808 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <map>
#include <string>
#include <fstream>
#include <vector>
#include <regex>
using namespace std;
int main() {
// read input
vector<map<string, string>> vector1;
map<std::string, std::string> m;
fstream inputFile("../input.txt");
string line;
// create vector of ... | true |
0c060093387a3e49de60f7f0c7a58ee5552d3dc2 | C++ | nosolobots/algo | /ds_algo_c/ch2/creativity/c_2_9.cpp | UTF-8 | 2,071 | 3.65625 | 4 | [] | no_license | /*
Write a C++ program that can input any polynomial in standard algebraic
notation and outputs the first derivative of that polynomial.
*/
#include<iostream>
#include<string>
#include<map>
#include<cstdlib>
#include<cmath>
#include<iomanip>
using namespace std;
class Polynom
{
public:
Polynom(const string& spol... | true |
93c27b8eca1b5a23c938650dddeac6cc104d3cf5 | C++ | jorgevag/CompPhysAss1 | /main.cpp | UTF-8 | 6,305 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <fstream>
// For RNG
//#include <stdlib.h> // srand, rand
//#include <time.h> // time
#include <random> // for generator and uniform distribution, need C++11, so remember flag -std=c++11
//.................
// Global Constants
//''''''... | true |