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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0bbcb7c7cd0f2aeee5124423e555c5653d91159d | C++ | nitesh-147/Programming-Problem-Solution | /codeforces/ipay.cpp | UTF-8 | 1,824 | 3.625 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
struct node
{
int val;
node *nxt;
};
void print(node *n)
{
if(n == NULL) return;
printf("%d ", n->val);
print(n->nxt);
return;
}
void insert(node* pre, int v)
{
if((pre -> nxt) == NULL)
{
node *new_data = NULL;
new_data = (struc... | true |
afb1b19a60f0f0c1da54580a3e7ccbb30d63dc6c | C++ | wepng/ECNU-Online-Judge | /2948.cpp | UTF-8 | 1,742 | 3.078125 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
using namespace std;
int getNum(char c)
{
switch(c)
{
case 'A':
case 'B':
case 'C':return 2;
case 'D':
case 'E':
case 'F':return 3;
case 'G':
case 'H':
case 'I':return 4;
case 'J':
cas... | true |
3faeeee3b75836521469c1c153b33a5f9f0f270f | C++ | ojaster/first_project | /cpp_xcode/FIrst_Project/FIrst_Project/2darray.cpp | UTF-8 | 1,226 | 2.953125 | 3 | [] | no_license | ////
//// 2darray.cpp
//// FIrst_Project
////
//// Created by Данил on 24.08.18.
//// Copyright © 2018 Daniil. All rights reserved.
////
//
//#include <iostream>
//#include <stdlib.h>
//using namespace std;
//int main(){
// int **a;//для выделения памяти под двумерный массив нам требуется "указатель на указатель... | true |
cee4137bddbd49f005e7fe8e99fabfff3a266221 | C++ | benesle/SpillmotorArkitektur2019 | /Sound/soundsource.cpp | UTF-8 | 4,057 | 2.765625 | 3 | [] | no_license |
#include "soundsource.h"
#include "wavefilehandler.h"
#include <sstream>
#include <iostream>
SoundSource::SoundSource(std::string name, bool loop, float gain) :
mName(name),
mSource(0),
mBuffer(0),
mPosition(0.0f, 0.0f, 0.0f),
mVelocity(0.0f, 0.0f, 0.0f)
{
alGetError();
alGenBuffers(1, &mB... | true |
b017e7420f9162f7db9809339d2e5ad58fdfdc85 | C++ | dashutaOk/lab__2 | /Sequence.h | UTF-8 | 866 | 3.359375 | 3 | [] | no_license | #pragma once
#ifndef SEQUENCE_H
#define SEQUENCE_H
template <class T> class Sequence {
public:
//Decomposition
virtual T GetFirst() = 0;//get el on first index
virtual T GetLast() = 0;//get el on last index
virtual T Get(int index) = 0;//get index of Node
virtual Sequence<T>* GetSubsequ... | true |
5a989cd8d90671c29761617364b45a8f73a27aa1 | C++ | zVoxty/AppVox | /Server/Server/Source.cpp | UTF-8 | 473 | 2.890625 | 3 | [] | no_license | #include "Server.h"
int main()
{
bool serverCrash = false;
Server MyServer(1111, true); //Create server on port 100
for (int i = 0; i < 100; i++) //Up to 100 times...
{
MyServer.ListenForNewConnection(); //Accept new connection (if someones trying to connect)
}
serverCrash = true;
if (serverCrash == true)... | true |
3d19f1cb912b1dd9e6b58aa6637dec228240ddb5 | C++ | raghumag/cpp-practice | /task_scheduler.cpp | UTF-8 | 740 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int leastInterval(vector<char>& tasks, int n) {
int mp[120]={0};
int ma=0,c=0;
for(int i=0;i<tasks.size();i++)
{
mp[tasks[i]]++;
if(mp[tasks[i]]>ma)
{
ma=mp[tasks[i]];
c=1;
}
else if(mp[t... | true |
0162374009bc64e36721f7509593971b647be442 | C++ | jpvarbed/practiceproblems | /sortVector.cpp | UTF-8 | 464 | 3.265625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void print(const vector<auto> &v)
{
for (auto const& e : v)
{
cout << e << "\t";
}
cout << endl;
}
int main() {
vector<int> a{ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
vector<int> b{ 20, 18, 16, 14, 12, 10, 8, 6, 4, 2};
vector<int> c{... | true |
9439bf7bbbafcf3fff9255a49f21f3dd284ccb45 | C++ | InnocentK/Compact-QuadTrees | /back-ups_p3/2_QTNode.cpp | UTF-8 | 9,685 | 2.90625 | 3 | [
"MIT"
] | permissive | /*****************************************
** File: QTNode.cpp
** Project: CMSC 341 Project 3 - QuadTrees, Spring 2018
** Author: Innocent Kironji
** Date: 04/10/18
** Section: 03
** E-mail: wambugu1@umbc.edu
**
** This file contains the implementation of
** This class is
**********************... | true |
55ca511ef7498a428edc448d62b2606e2c040dfa | C++ | Marukyu/RankCheck | /src/Client/GUI3/Rendering/Primitives/Outline.cpp | UTF-8 | 521 | 2.84375 | 3 | [
"MIT"
] | permissive | #include <Client/GUI3/Rendering/Primitives/Outline.hpp>
namespace gui3
{
namespace primitives
{
Outline::Outline(sf::FloatRect rect, float thickness, sf::Color color, int sides) :
myRect(rect),
myThickness(thickness),
myColor(color),
mySides(sides)
{
}
const sf::FloatRect& Outline::getRect() const
{
return myRe... | true |
078256c4f79b164338d0f3bcb8886c9293f72ed6 | C++ | Seongil-Shin/Algorithm | /백준/solutions/7579 app/7579 app.cpp | UTF-8 | 819 | 2.640625 | 3 | [] | no_license | #include <iostream>
#define MAX_N 100
#define MAX_MEMORY 10000000
using namespace std;
int numOfApp, a[MAX_N], c[MAX_N], m, maxValue;
int DP[105][10020];
int getMin();
int max(int a, int b) {
return a > b ? a : b;
}
int main() {
cin >> numOfApp >> m;
for (int i = 0; i < numOfApp; i++)
cin >> a[i];
for (int i ... | true |
44682e45048dea68a2be85572df593c950adc80a | C++ | BykadorovR/Engikit2D | /src/Graphic/TextureAtlas.cpp | UTF-8 | 4,010 | 2.59375 | 3 | [] | no_license | #include <algorithm>
#include <cassert>
#include "TextureAtlas.h"
TextureAtlas::TextureAtlas(GLenum fourCC, std::tuple<float, float> size) {
_size = size;
_fourCC = fourCC;
_bitDepth = 1;
if (_fourCC == GL_RGBA)
_bitDepth = 4;
glGenTextures(1, &_textureObjectId);
assert(_textureObjectId != 0);
_data.resize(s... | true |
3da63ca38db377fff01666156d00159e29846802 | C++ | OMCS/CS264 | /include/node.h | UTF-8 | 716 | 2.796875 | 3 | [] | no_license | #pragma once
#include "grid.h"
class Node
{
private:
static int nodeCount;
int nodeId;
Node* parentNode;
Grid gridState;
int pathCost;
int xPos;
int yPos;
Direction moveDir;
public:
Node(Grid gridState, Node* parentNode, int pathCost, ... | true |
cf71b6803366eecc1a841d90fdc6abb67298c8e1 | C++ | a-kashirin-official/spbspu-labs-2018 | /zhigalin.dmitry/common/triangle.hpp | UTF-8 | 578 | 2.65625 | 3 | [] | no_license | #ifndef A1_TRIANGLE_HPP
#define A1_TRIANGLE_HPP
#include "shape.hpp"
namespace zhigalin
{
class Triangle:
public Shape
{
public:
Triangle(const point_t & point_a, const point_t & point_b, const point_t & point_c);
double getArea() const override;
rectangle_t getFrameRect() const override... | true |
3dca48a3a3164f0cd50c8184a53488c65bf454f2 | C++ | Beisenbek/kbtu-2018-fall-lecture-samples | /pp1/Saturday/week11/76946_2.cpp | UTF-8 | 554 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
bool f(pair<int, int> l, pair<int, int> r){
if(l.first > r.first) return false;
if(l.first == r.first &&
l.second > r.second) return false;
return true;
}
int main(){
int n;
cin >> n;
pair<int, int> p[n];
int x, ... | true |
f89f63f911c71245b80d0aa1fd9a79d051bcbd14 | C++ | playday3008/otc | /OTC/cpp/runtime/RuntimeHandler.cpp | UTF-8 | 4,275 | 2.765625 | 3 | [
"CC0-1.0"
] | permissive | #include "../../headers/runtime/RuntimeHandler.h"
void RuntimeHandler::ExtractSegment () {
//Allocate memory for segment, and set pointer.
PanicUtils::SetImportant (&Segment::UnsafeAllocatedPointer, reinterpret_cast<DWORD> (VirtualAlloc (NULL, SegmentHeader::Datacase::ALLOCATION, MEM_RESERVE | MEM_COMMIT, PAGE... | true |
6458714708f0073994d3d9f492425eb80ca28aae | C++ | tmcclain-taptech/Ovaldi-Win10 | /ovaldi-code-r1804-trunk/src/ArrayGuard.h | UTF-8 | 3,963 | 3.015625 | 3 | [] | no_license | //
//
//****************************************************************************************//
// Copyright (c) 2002-2014, The MITRE Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are ... | true |
6751eddc1acdd4462a2edfff37b1d53227d38e68 | C++ | uriqishtepi/uvaonlinejudge | /gattaca_11512.cpp | UTF-8 | 4,520 | 3.25 | 3 | [] | no_license | /* the goal of this problem is to find the longest repeating substring
* so one way to do it is to sort all the substrings, keep track of
* the longest one and then count how many times it shows up
* (obviously two or more).
* Since we are sorting the array, that takes nlogn (where n is the strlen).
*
* It co... | true |
741c378e101dd6a98144b37c9666f04dc0629d40 | C++ | GabyZero/Platformer-60fps | /include/block.hpp | UTF-8 | 965 | 2.515625 | 3 | [] | no_license | #ifndef BLOCK_HPP
#define BLOCK_HPP
#include <SFML/Graphics.hpp>
#include "physics/icollidable.hpp"
#include "game.hpp"
class Block : public physics::ICollidable
{
protected:
sf::Sprite* sprite;
public:
Block();
Block(sf::IntRect &, const sf::Texture &,bool scalable=true);
~Block();
/** sf::Dr... | true |
3612b5ed14dd2dccb1a571e8355e500da30b41b2 | C++ | samnoon1971/CP | /Geometry/area of two circle intersection.cpp | UTF-8 | 1,063 | 2.671875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
int main() {
double x1,y1,r1,x2,y2,r2;
cin>>x1>>y1>>r1;
cin>>x2>>y2>>r2;
double dis=sqrt(((x1-x2)*(x1-x2))+ (y1-y2)*(y1-y2));
double res=0.0;
if(dis>=r1+r2) {
res=0.0;
} else if(dis+min(r1,r2)<=max(r1,r... | true |
f445eefbb892bce46763d798f4dc6a6a5ff18eb4 | C++ | EtherTyper/algorithms_and_data_structures | /competitive/apac17/round_E/A.cpp | UTF-8 | 1,334 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int blues(string s,int st)
{
int bl=0;
for(int i=st;i<s.size();i++)
if(s[i]=='B')
bl++;
return bl;
}
int blues_end(string s,int end)
{
ll bl=0;
for(int i=end;i>=0;i--)
if(s[i]=='B')
bl++;
return bl;
}
int blues_bw(string s,int a,i... | true |
ab7fb86df719c6c466312d458fd2f3cf7bced226 | C++ | emmason9/CPSC350_SyntaxChecker | /DelimiterSyntax.cpp | UTF-8 | 5,318 | 3.640625 | 4 | [] | no_license | /*
Emilee Mason
ID#2321064
emmason@chapman.edu
CPSC 350-01
Assignment 3: Syntax Checker
*/
#include "DelimiterSyntax.h"
#include <algorithm> //for transform to lower
DelimiterSyntax :: DelimiterSyntax(){
myFiles = new FileProcessor();
currentLineNumber = 0;
delimiterStack = new GenStack<char>();
... | true |
924dbf0aee7c8e74dcfeb1ebb83954dd01b6ae22 | C++ | dolchg/game-engine-architecture | /SingleInstructionMultipleData/AddArrays.cpp | UTF-8 | 1,892 | 3.203125 | 3 | [] | no_license | #include "Tests.h"
#include <algorithm>
#include <chrono>
#include <iostream>
#include <stdlib.h>
void ArrayAdd(float* a, float* b, float* c, int n) {
for (int i = 0; i < n; i++) {
c[i] = a[i] + b[i];
}
}
void ArrayAddSIMD(float* a, float* b, float* c, int n) {
ASSERT(n % 4 == 0);
for (int... | true |
7861c61396236dc74bde13923a16fcb977e78ba4 | C++ | albertghtoun/transmem | /tests/libstdc++_validation/pair/member.cc | UTF-8 | 2,489 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <utility>
#include <cassert>
#include "tests.h"
#include "verify.h"
/// The pair we will use for our tests
typedef std::pair<int, int> intpair;
static intpair * member_pair = NULL;
void ctor_dtor_tests(int id)
{
// print simple output
global_barrier->arrive(id);
... | true |
10764651d4600625df60f1cdf5ceb35fb8b94e30 | C++ | eriser/linAnil | /vs/utils/Tween.hpp | UTF-8 | 8,838 | 3.015625 | 3 | [] | no_license | //
// Created by toramisu on 2015/7/31.
//
#pragma once
#include <math.h>
// Algorithm Reference:
//http://www.robertpenner.com/easing/
//http://www.cnblogs.com/cloudgamer/archive/2009/01/06/Tween.html
#ifndef PI
#define PI 3.1415926f
#endif
const float EPSINON = 0.000001f;
#define EQUAL_ZERO(x) ((x >= - EPSINO... | true |
17e6ea6c10a489c6b375207789d38405224b6295 | C++ | sabrinalugoa21/Spongebob_Squarepants | /Spongebob_squarepants/intermediate/type/TypeChecker.h | UTF-8 | 3,690 | 3.28125 | 3 | [] | no_license | #ifndef TYPECHECKER_H_
#define TYPECHECKER_H_
#include "intermediate/type/Typespec.h"
namespace intermediate { namespace type {
using namespace std;
using namespace intermediate::type;
class TypeChecker
{
public:
/**
* Check if a type specification is integer.
* @param typespec the type specification ... | true |
a5bfcca04b08e08d4ae01c7e29f5157e1238c60c | C++ | RippeR37/AI-2015-Vindinium-bots | /random_bot.h | UTF-8 | 363 | 2.53125 | 3 | [] | no_license | #pragma once
#include "game.h"
struct Bot
{
Bot(const Game& game, Rng& rng);
void
crunch_it_baby(const Game& game, const OmpFlag& continue_flag, const double& start_time, const double& duration);
Direction
get_move(const Game& game) const;
void
advance_game(Game& game, const Direction& ... | true |
b774d89ab1ac463b5682595d0622e6727cf7e253 | C++ | Seantheprogrammer93/CPP-Inheritance-and-Polymorphism | /Hatchback.cpp | UTF-8 | 608 | 2.984375 | 3 | [
"Unlicense"
] | permissive | #include "Hatchback.h"
int Hatchback::vehicleTrunkSize()
{
std::cout << "Hatchback trunk size: " << trunk << std::endl;
return trunk;
}
double Hatchback::vehiclePrice()
{
std::cout << "Hatchback price: " << price << std::endl;
return price;
}
int Hatchback::vehicleNumberOfDoors()
{
std::cout << ... | true |
cec56f03fb71395e6306d5f1667a3abeffc23920 | C++ | A-Hidden/zhang_liming | /作业/6-18/main.cpp | GB18030 | 562 | 3.953125 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int integerPower(int,unsigned int);//
int base=0;
unsigned int exponent=0;//
cout<<"Please enter numbers what you want to calculate";//ʾ
cin >> base ;
cin >> exponent;//ȡ
cout<<"integerPower("<<base<<","<<exponent<<")="<<integerPower(bas... | true |
b6094e70b09c8c5d117001c81edbcd3cd307d560 | C++ | ailyanlu1/c100 | /P2/test_RST.cpp | UTF-8 | 2,662 | 3.203125 | 3 | [
"MIT"
] | permissive | #include "RST.hpp"
#include "countint.hpp"
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
/**
* A simple partial test driver for the RST class template.
* P2 CSE 100
* Author: P. Kube (c) 2010, 2013
*/
int main(int argc, char** argv) {
int N = 10... | true |
334c8b9e0fc9caab02792de95554bfc5113e73dc | C++ | uaf-arctic-eco-modeling/dvm-dos-tem | /src/tbc-debug-util.cpp | UTF-8 | 1,934 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | //
// tbc-debug-util.cpp
// dvm-dos-tem
//
// Created by Tobey Carman on 9/13/13.
// 2013 Spatial Ecology Lab.
//
#include <iostream>
#include <unistd.h> // for hostname stuff...
#ifdef WITHMPI
#include <mpi.h>
#endif
#include "../include/tbc-debug-util.h"
#ifdef WITHMPI
// For now, not using any of these funcit... | true |
d57ac27a2b3e821118679cad2454fcee666e7711 | C++ | jigyasa3003/Algorithms | /Сборник моих алгоритмов/Теория чисел/Диофант через Евклида.cpp | UTF-8 | 1,002 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <cctype>
#define mp make_pair
#define pb pu... | true |
63cf13b78ca2697e6f2cd73c702d444a241f61e2 | C++ | brianrho/FPM | /examples/search_database/search_database.ino | UTF-8 | 3,953 | 2.640625 | 3 | [] | no_license | #include <SoftwareSerial.h>
#include <FPM.h>
/* Search the fingerprint database for a print */
/* pin #2 is IN from sensor (GREEN wire)
pin #3 is OUT from arduino (WHITE/YELLOW wire)
*/
SoftwareSerial fserial(2, 3);
FPM finger(&fserial);
FPM_System_Params params;
void setup()
{
Serial.begin(9600);
Ser... | true |
f5f2148870663f1ec456ddc688531945a0718346 | C++ | Shivamnirwani/Pathfinding_algorithms | /Roundrobin.cpp | UTF-8 | 1,129 | 2.671875 | 3 | [] | no_license | # include <iostream>
using namespace std;
int main()
{
int n, bt[n],f,r_bt[n], wt[n], i ,t=0, tq,tat[n];
float sum,avgwt,avgtat;
cout<<"Enter no. of process: ";
cin>>n;
cout<<"Enter the time quantum: ";
cin>>tq;
cout<<"Enter burst time: ";
for(i=0; i<n;i++)
cin>>bt[i];
for(i=0; i<n;i++)
r_bt[... | true |
fdf83d3d380b88842416753540218ea819a64cec | C++ | nijiahe/code | /code/windows/c_c++_code/早期c_c++/STL/6.set红黑树.cpp | GB18030 | 1,281 | 3.53125 | 4 | [] | no_license | #include<iostream>
#include<set>
#include<string>
using namespace std;
struct strless
{
bool operator()(const char *str1,const char* str2) const
{/*str1<str2ظֵ,str1=str20,str1>str2,ȽϴСֵһ*/
return strcmp(str1, str2)<0 ;
}
};
void main60()
{/*Ԫ,*/
set<char*, strless>myset1;
myset1.insert("zzt");
myset1.in... | true |
89f1df9adc6e4ce5770b7eef6484a403e31b412f | C++ | micahwelf/FLTK-Ada | /src/c_fl_menu_button.cpp | UTF-8 | 1,931 | 2.515625 | 3 | [
"Unlicense"
] | permissive |
#include <FL/Fl_Menu_Button.H>
#include "c_fl_menu_button.h"
#include "c_fl_type.h"
class My_Menu_Button : public Fl_Menu_Button {
public:
using Fl_Menu_Button::Fl_Menu_Button;
friend void menu_button_set_draw_hook(MENUBUTTON m, void * d);
friend void fl_menu_button_draw(MENUBUTTON m);... | true |
a71b28d91dfead00ff5468d658a3c73e59e0411a | C++ | st58229/CPP | /Cviceni_05/Exceptions.h | UTF-8 | 469 | 2.609375 | 3 | [] | no_license | #pragma once
#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
#include <string>
using namespace std;
struct Exceptions
{
private:
string message;
public:
Exceptions(string message);
virtual string getMessage();
};
struct NoSuchElementException : Exceptions { NoSuchElementException(string messag... | true |
7ffd4223f7b521bdd111af2c24619b21fc83ea0b | C++ | Delaunay/strat3 | /src/graphics/Shapes.h | UTF-8 | 2,201 | 2.953125 | 3 | [] | no_license | #ifndef STRAT3_GRAPHICS_SHAPES_HEADER
#define STRAT3_GRAPHICS_SHAPES_HEADER
#include <memory>
#include <vector>
#include "Scale.h"
#include "Painter.h"
#include "utility.h"
#include "item.h"
template<typename T>
std::unique_ptr<GraphicItem> draw_line(const std::vector<T>& v, const sf::FloatRect& rct)
{
Painter l... | true |
f3c12463429d0c3e1a6c97de66aa2994ac978035 | C++ | onievui/DuelWitch | /Sources/Utils/LoadDataHolder.h | SHIFT_JIS | 1,304 | 3.09375 | 3 | [] | no_license | #pragma once
#ifndef LOAD_DATA_HOLDER_DEFINED
#define LOAD_DATA_HOLDER_DEFINED
#include "ILoadDataHolder.h"
#include "LoadDataManager.h"
template<class T, LoadDataID DataID>
/// <summary>
/// ǂݍ݃f[^ێNX
/// </summary>
class LoadDataHolder : public ILoadDataHolder {
friend class LoadDataManager;
public:
// RÂǂݍ݃f[... | true |
c36b96ef0a5d8d2790d432df02ac0bfadd704eae | C++ | jameschristianto/cpp | /Unordered Set/src/main.cpp | UTF-8 | 3,327 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <unordered_set>
#include <iterator>
using namespace std;
void print(unordered_set<int> mySet);
void getSize(unordered_set<int> mySet);
void insert(unordered_set<int> &mySet);
void check(unordered_set<int> &mySet);
void erase(unordered_set<int> &mySet);
void eraseArea(unordered_set<int> &m... | true |
4ac3d8f8ceee8a60d6ad32ad17edaeb3a993500a | C++ | shikharkrdixit/cppstuff | /stl/containeradapters/klargestelements.cpp | UTF-8 | 497 | 2.953125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void klargestelements(int arr[],int n,int k){
priority_queue<int,vector<int>,greater<int>> pq(arr,arr+k);
for(int i=k;i<n;i++){
if(arr[i]>pq.top()){
pq.pop();
pq.push(arr[i]);
}
}
while(pq.empty()==false){
cou... | true |
f7bb8ef96f707139bd3770b9820b44ec6aaf3600 | C++ | CLEMENTINATOR/TeamWiigen | /libwiisys/headers/Libwiisys/Exceptions/Exception.h | UTF-8 | 1,079 | 2.984375 | 3 | [] | no_license | #ifndef _EXCEPTION_H_
#define _EXCEPTION_H_
#include <string>
#include <ogcsys.h>
#include "../Object.h"
/*! \namespace Libwiisys::Exceptions
*
* \brief Exceptions used in Libwiisys
*/
namespace Libwiisys
{
namespace Exceptions
{
/*! \class Exception
* \brief Simple exception class
* \author Ara... | true |
d9d893a90d904e0a7e2e589c9358a46ecf64ba3f | C++ | sslab-gatech/apisan | /llvm/tools/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp | UTF-8 | 504 | 2.578125 | 3 | [
"NCSA",
"MIT"
] | permissive | // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
void test_nonaggregate(int i) {
auto lambda = [i]() -> void {}; // expected-note 3{{candidate constructor}}
decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}}
static_assert(!__is_literal(decltype(lambda)), "");
auto lambda2 = []{};... | true |
7b2c5e176255ff6bd8a41135d6086cadc054ce46 | C++ | huisam/JinLearnedList | /Algorithm/baekjoon/c++/RGB거리.cpp | UTF-8 | 646 | 2.625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
long long a[1001][3];
int min(int num1, int num2) { return num1 < num2 ? num1 : num2; }
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<vector<int>> d(n+1, vector<int>(3));
for (int i = 1; i <= n; i++) {
cin >> d[i][0] >> d[i][1] ... | true |
7da48d0ddbbe39c9f0ba42c74575ac1ed7fdbbe9 | C++ | smitropoulos/c_client | /include/TCP_ConnectionHandler.h | UTF-8 | 809 | 2.53125 | 3 | [] | no_license | //
// Created by Stefanos Mitropoulos on 2019-05-20.
//
#ifndef TCP_CLIENT_TCP_CONNECTIONHANDLER_H
#define TCP_CLIENT_TCP_CONNECTIONHANDLER_H
#include <netdb.h>
#include <cstdio>
#include <cstdlib>
#include <strings.h>
#include <spdlog/spdlog.h>
class TCP_ConnectionHandler {
private:
TCP_ConnectionHandler() = d... | true |
3ade24cefb66460fd062b086ecb5d96bddb48a67 | C++ | wildkyske/TestLib | /Source/Utility/src/variant.cpp | UTF-8 | 3,216 | 3.0625 | 3 | [] | no_license | #include "../include/variant.h"
#include "../include/StlUtil.h"
#include <string.h>
Variant::Variant()
: mFixedSize(sizeof(long long))
, mSize(mFixedSize)
, mSharedMemory(false)
{
}
Variant::~Variant()
{
}
void Variant::destroy()
{
if (mSharedMemory)
{
free(ptr);
mSharedMemory ... | true |
ceaed554a3c79bb9707dc3409926b58b6850748d | C++ | srobbins511/Assignment4 | /Student.cpp | UTF-8 | 304 | 2.75 | 3 | [] | no_license | #include "Student.h"
Student::Student()
{
timeWaiting = 0;
id = 0;
timeArrival = 0;
waitTime = 0;
}
Student::Student(int i, unsigned int wt, unsigned int ta)
{
timeWaiting = 0;
id = i;
waitTime = wt;
timeArrival = ta;
}
Student::~Student()
{
} | true |
5d8584dc26df019fc28ecf0005c744be42ecb970 | C++ | ktaishev/lw | /source.cpp | UTF-8 | 22,941 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <sstream>
#include <locale>
#include <set>
#include "utility.h"
#include "set_of_kss.h"
#include "set_of_pipes.h"
#include "graph.h"
void pipes_setup(set_of_pipes&);
void ks_setup(set_of_kss&);
void graph_setup(set_of_pipes&, set_of_kss&, graph&);
int main()
{
set... | true |
f5425d24a1b61811c546376d73b1e6f9bc5901ff | C++ | MattMarti/Rocketry-VT_MotorControl_v1.0.0 | /include/filters.hpp | UTF-8 | 3,325 | 2.90625 | 3 | [] | no_license | #ifndef FILTERS_H
#define FILTERS_H
#include <cstdint>
#include <cmath>
#include <deque>
class low_pass
{
public:
double value, rc;
low_pass(double rc);
double step(double sample, double dt);
private:
bool first;
};
class high_pass
{
public:
double value, rc;
high_pass(doub... | true |
8d104b852916fe8bb104cc73da8b7ba584204655 | C++ | AlexeyG/HackerRank | /implementation/ViralAdvertising/main.cpp | UTF-8 | 395 | 2.765625 | 3 | [] | no_license | #include <iostream>
using namespace std;
long long solve(int day, int shared_day1=5) {
int shared = shared_day1;
int liked;
long long liked_total = 0;
while (day--) {
liked = shared / 2;
liked_total += liked;
shared = liked * 3;
}
return liked_total;
}
int main() {
... | true |
b784b94ac19ca2ab901a912d394dcf10feeb9189 | C++ | Zanzal/X-Studio2-Mirror | /Logic/EncryptedX3Stream.cpp | UTF-8 | 5,995 | 3.046875 | 3 | [
"MIT"
] | permissive | #include "stdafx.h"
#include "EncryptedX3Stream.h"
namespace Logic
{
namespace IO
{
// -------------------------------- CONSTRUCTION --------------------------------
/// <summary>Creates an encrypted file stream using another stream as input</summary>
/// <param name="src">The input ... | true |
9adc913b51549c6ec4aede7e90d819ae687b9ca2 | C++ | ygalkin/coding-challenges | /src/leetcode/remove-duplicates-from-sorted-array.h | UTF-8 | 454 | 3.1875 | 3 | [] | no_license | // https://leetcode.com/problems/remove-duplicates-from-sorted-array/
class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if (nums.empty()) {
return 0;
}
size_t unique{ 0 };
for (size_t i{ 1 }; i < nums.size(); ++i) {
if (nums[i] != nums[uniq... | true |
1277070041eae5ce3e9ddd1cb7575db293e9e4e7 | C++ | algoparc/1DVisibilityIndex | /src/BuildConvexHull.cpp | UTF-8 | 7,002 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | /*
Copyright 2016-2018 Ben Karsin, Nodari Sitchinava, Colin Lambrechts
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless... | true |
2eb4e4d03d1829a1f2b0b3c7c55fd2cde3f6839f | C++ | BradfordMedeiros/ModEngine | /src/common/util_test.cpp | UTF-8 | 2,747 | 2.78125 | 3 | [] | no_license | #include "./util_test.h"
void utilParseAndSerializeQuatTest() {
std::vector<std::string> rawQuatsTests = {
"0 0 -1 45", // 0
"3 3 3 10", // 1
"3 3 3 250", // 2
"1 2 3 30", // 3
"3 3 3 10", // 4
"1 0 -1 0", // 5
"4 3 34 0", // 6
"4 3 34 70", // 7
"0 0 -1 30", // 8... | true |
8fa0520f1a641696d2dfebd365c86caece25cd73 | C++ | rahulsah123/CodeMonk | /solutions/hackerrank/30-abstract-classes.cpp | UTF-8 | 1,234 | 3.34375 | 3 | [
"MIT"
] | permissive | /**
* @author yangyanzhan
* @email yangyanzhan@gmail.com
* @homepage http://www.yangyanzhan.com
* @github_project https://github.com/yangyanzhan/CodeMonk
* @online_judge hackerrank
* @problem_id 30-abstract-classes
* @problem_address https://www.hackerrank.com/challenges/30-abstract-classes
**/
#include <algor... | true |
c10e48d10be819384e653df3a3d0975d434d7b32 | C++ | PolytechAngersMecatroniqueClub/istiaENGRAIS | /engrais_control/src/9_WeightedModel/WeightedModel.cpp | UTF-8 | 4,083 | 3.296875 | 3 | [] | no_license | //********************************************************************************************************
#include "WeightedModel.h"
//--------------------------------------------------------------------------------------------------------
void WeightedModel::assignPoints(const Model & m, bool isFrontMsg){ //Assign ... | true |
39a0915115a15eaf95b178113d134e64c2b3fb9a | C++ | HansKing98/OOP | /lesson04/main.cpp | UTF-8 | 308 | 3.375 | 3 | [] | no_license | #include <iostream>
using namespace std;
class point
{
public:
point(int rх, int rу)
{
x = rх;
y = rу;
}
void show() { cout << "(" << x << "," << y << ")" << endl; }
private:
int x;
int y;
};
int main()
{
point p(3, 4);
p.show();
} | true |
b2647417c5471375a4f7399b3edb8f8b861ab018 | C++ | SrTobi/xnet | /samples/network_interface_lister/network_interface_lister.cpp | UTF-8 | 690 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <xnet/network_interface_lister.hpp>
void print_network_interface(const boost::asio::ip::udp& protocol)
{
boost::asio::io_service service;
xnet::udp_interface_lister lister(service, protocol);
for (auto& entry : lister)
{
std::cout << " " << entry.host_name() << ": " << entry.endpo... | true |
e3f5ea2e0fc4abbc2c2f943fe7261a966ce25c11 | C++ | shuest/leetcode | /739.cpp | UTF-8 | 623 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
using namespace std;
class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
vector<int> res(temperat... | true |
bfda2a552292fdd6dea674812591ab16f32335bc | C++ | FlorianZeni/Mage_2D_Game | /sources/FillBar.cpp | UTF-8 | 826 | 2.84375 | 3 | [] | no_license | //
// Created by zenif on 31/07/2021.
//
#include <iostream>
#include "FillBar.h"
FillBar::FillBar(sf::Vector2f position, sf::Vector2f size, float* maxValue, float* currentValue) :
GameObject(), position(position), size(size), maxValue(maxValue), currentValue(currentValue) {
backShape.setPosition(position);
... | true |
181a236dead6cae2493066fb995c126d0a661b82 | C++ | mextier/Patience | /csprite.cpp | WINDOWS-1251 | 17,122 | 2.796875 | 3 | [] | no_license | //====================================================================================================
//
//====================================================================================================
#include "csprite.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "tga.h"
... | true |
054d4caecdd6045b66319b9d763e7b9f3fefeab5 | C++ | LANLhakel/FESTR | /common/parallel/mpi/TaskPool.h | UTF-8 | 10,412 | 3.09375 | 3 | [
"BSD-2-Clause"
] | permissive | #ifndef LANL_ASC_PEM_TASKPOOL_H_
#define LANL_ASC_PEM_TASKPOOL_H_
/**
* @file TaskPool.h
* @brief Implements MPI parallelism using dynamic load balancing.
* @author Peter Hakel
* @version 0.9
* @date Created on 3 February 2016\n
* Last modified on 27 February 2020
* @copyright (c) 2016, Triad National Security,... | true |
0117afb3e01c0f8f17195f2c76a4077583a5b167 | C++ | medhaaiyah/Computer-Science-I | /Assignment_4/userListCommands.cpp | UTF-8 | 3,765 | 3.6875 | 4 | [] | no_license | /*
* Assignment 4 for CS 1337.013
* Programmer: Medha Aiyah
* Description: The userListCommands.cpp file includes the constructor and destructor and the execute code that was called
* in the userListCommands.h file.
*/
#include "userListCommands.h"
#include <iostream>
#include <string>
insertComman... | true |
7955d8cde832f548e525a3b1c5d3f138e56d39e0 | C++ | oryband/homework | /spl/assignments/hw4/client/src/ConnectionHandler.cpp | UTF-8 | 3,152 | 3 | 3 | [] | no_license | #include "ConnectionHandler.h"
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using std::exception;
using boost::asio::ip::tcp;
using boost::asio::ip::address;
using boost::asio::buffer;
using boost::system::error_code;
using boost::system::system_error;
ConnectionHandler :: ... | true |
6ea13f684ff65ece273cb2ea4313a8d691aac60b | C++ | MattKovtun/myBash | /archieve/move.h | UTF-8 | 1,557 | 2.921875 | 3 | [] | no_license | //
// Created by natasha on 3/20/17.
//
////////////////////////////////////////////////////////////
/////////////////DONE///////////////DONE////////////////////
////////////////////////////////////////////////////////////
bool asking_rename() {
char type;
while (!cin.fail() && type != 'y' && type != 'n') ... | true |
4686ec92335de66365cc74a7c9e9736dd52690f1 | C++ | gbrlas/AVSP | /CodeJamCrawler/dataset/11_18499_20.cpp | UTF-8 | 1,550 | 2.734375 | 3 | [] | no_license | #include<string.h>
#include<stdio.h>
//#include<algorithm>
#include<string.h>
#include <stdlib.h>
#include<ctype.h>
double WP(int,int);
double OWP(int,int);
double OOWP(int,int);
char fix[101][101];
int main()
{
int n,t,i,j;
double rip;
freopen("A-small-attempt1.in","r",stdin);
freopen("A-small.txt","w",stdou... | true |
c1842a8c7ae9499cf37a5bcbec74d60b9ed3e3d9 | C++ | jainiti/assignment2 | /Questions/diagnol_1_rest_0/prg7.cpp | UTF-8 | 405 | 2.84375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int rows, cols, i, j;
cin>>rows>>cols;
for(i=1; i<=rows; i++)
{
for(j=1; j<=cols; j++)
{
if(i == j || (j == (cols+1) - i))
{
cout<<"1";
}
else
{
... | true |
fcb961699df22118985af7620bf1c9681f7ec759 | C++ | marcos-willian/POO | /TP2/P1/Programa_teste.cpp | UTF-8 | 941 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include "Matrix.h"
using namespace std;
int main()
{
Matrix Y(3,2,1);
Matrix X(4,1,3);
cout << "Y:: " << endl;
Y.print();
cout << "Numero de linhas de Y:: " << Y.getRows()<<endl;
cout << "Numero de colunas de Y:: " << Y.getCols()<<endl;
cout << "Z é... | true |
e12db20898594904f1f0ab5da4bebcb25cf3ea54 | C++ | K3ikoku/Factory | /Factory/Factory/GameManager.cpp | UTF-8 | 6,106 | 3.359375 | 3 | [] | no_license | #include "GameManager.h"
GameManager::GameManager() :
m_playAgain('y'), m_dayNr(0)
{
}
GameManager::~GameManager()
{
}
void GameManager::GameLoop()
{
while (m_playAgain == 'y')
{
//Create the instances of the armies and the factory
m_factory = new UnitFactory();
m_hoard = new Z... | true |
1d96a05d2b6a7b15252e2b9346dc118aef732567 | C++ | zkEloHub/LC-SourceCode | /lc162_1.cpp | UTF-8 | 248 | 3.03125 | 3 | [] | no_license | class Solution { // 找峰值.
public: // 直接遍历, 性能一般.
int findPeakElement(vector<int>& nums) {
int len = nums.size();
int i = 1;
while (i < len && nums[i] > nums[i-1]) i++;
return i-1;
}
}; | true |
1e0e38e2d48fa7698b2127e98ce1ad625b50ae12 | C++ | souradipbakli/hacktoberfest2021 | /CPP/MultipleInheritance.cpp | UTF-8 | 992 | 3.71875 | 4 | [
"CC0-1.0"
] | permissive | /* C++ Program to demonstrate an Example of Multiple Inheritance */
#include<iostream>
using namespace std;
class M
{
protected:
int m;
public :
void get_M(int );
};
class N
{
protected:
... | true |
0caaf566a6c8fc482fb06eb26a61bded0b0417a0 | C++ | fmenozzi/learn-opengl | /src/01-getting-started/02-hello-triangle.cpp | UTF-8 | 4,502 | 2.59375 | 3 | [] | no_license | #include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <cstdio>
#include <cstdlib>
#define GLSL(src) "#version 150 core\n" #src
#define GLERR do {\
GLuint glerr;\
while ((glerr = glGetError()) != GL_NO_ERROR)\
fprintf(stderr, "%s:%d glGetError() = 0x%04x\n", __FILE__, __LINE__, glerr);\
} while (0)
... | true |
dcfde4377b1bebe5cd02fd7ab1a43993841b95e0 | C++ | SharifulCSECoU/competitive-programming | /uva-online-judge/accepted-solutions/11343 - Isolated Segments.cpp | UTF-8 | 2,311 | 3.109375 | 3 | [] | no_license | //*****************
// LAM PHAN VIET **
// UVA 11343 - Isolated Segments
// Time limit: 1s
//********************************
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
#define maxN 102
class Segment {
int x1, y1, x2, y2;
double a, b, c;
... | true |
448f2b569fb9af368d4fa0e079fb8de8841973cd | C++ | erwanbou/LatticeTester | /analysis/include/SimpleMRG.h | UTF-8 | 2,254 | 2.96875 | 3 | [] | no_license |
//
// Class for simple MRG
//
#ifndef SIMPLEMRG_H
#define SIMPLEMRG_H
#include <iostream>
#include <fstream>
#include <iterator>
#include <string>
#include <sstream>
#include <iomanip>
#include <time.h>
#include <NTL/tools.h>
#include <NTL/ctools.h>
#include <NTL/ZZ.h>
#include <NTL/ZZ_p.h>
#include "NTL/vec_ZZ.h... | true |
f51e3a86652d23f13949cccf2ae827c95f02358e | C++ | gabalwto/Prot | /system/synchronization/semaphore.hh | UTF-8 | 830 | 2.65625 | 3 | [
"MIT"
] | permissive | #ifndef __PROT_LIBRARY_SYSTEM_LOCK_SEMAPHORE_H_
#define __PROT_LIBRARY_SYSTEM_LOCK_SEMAPHORE_H_
#include "defines.hh"
#include "lock.hh"
#include <system/time/timedelta.hh>
namespace Prot {
namespace Lock {
class Semaphore : public ILock
{
public:
virtual LockType Type();
virtual Bool Get();
virtual Void Fr... | true |
854ba2c67f35ab72802beaa578b40e17ac8967ca | C++ | pkgw/casa | /code/alma/ASDMBinaries/SDMDataObjectWriter.h | UTF-8 | 34,722 | 2.859375 | 3 | [] | no_license | #ifndef SDMDataObjectWriter_CLASS
#define SDMDataObjectWriter_CLASS
#include <string>
#include <map>
#include <set>
#include <vector>
#include <bitset>
//#include <boost/regex.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
#include "SDMDataObject.h"
#include "CAtmPhaseCorrection.h"
#include "CCorre... | true |
fc8289b37183f7896b924b3bdfe33d79e0540bb2 | C++ | PedroMalho/POO | /fichapython1_6.cpp | UTF-8 | 413 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
main()
{
int segundos;
cout << "Insira os segundos: ";
cin >> segundos;
float dias = segundos / 86400.00;
float horas = dias - floor(dias);
float minutos = horas * 60.00;
float segundo = minutos * 60.00;
cout << "dias: " << ... | true |
a3f99507c7b2370869d3c2e19b245cdb487be2a8 | C++ | seqan/iGenVar | /src/modules/clustering/hierarchical_clustering_method.cpp | UTF-8 | 10,701 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "modules/clustering/hierarchical_clustering_method.hpp"
#include <limits> // for std::numeric_limits
#include <random> // for std::mt19937
#include <seqan3/core/debug_stream.hpp>
#include "iGenVar.hpp" // for global variable gVerbose
... | true |
9a33b62bfa312e29931c8a19e06775fcc17f160d | C++ | vivekverma123/OSLab | /Threads/producer_consumer.cpp | UTF-8 | 1,124 | 3.578125 | 4 | [] | no_license | #include<iostream>
#include<thread>
using namespace std;
int mutex = 1,empty = 0,full = 0,n;
void wait(int *ptr)
{
while(*ptr <= 0);
(*ptr)--;
}
void signal(int *ptr)
{
*ptr += 1;
}
void consume()
{
int i = 0;
do
{
wait(&full);
wait(&mutex);
printf("Item %d removed from buffer.\n",i);
/* this r... | true |
97aefc6834142f96679431aa22aa5258580be9dc | C++ | liukang92/hiho | /week43$/week43.cpp | UTF-8 | 1,385 | 2.640625 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#define int64 long long
#define MOD 12357
const int N = (1 << 7) + 5;
int k;
int64 n;
int t[N][N];
void dfs(int x, int y, int col, int **a){
if(col == k){
a[y][x] = 1;
return;
}
dfs(x << 1, (y << 1) + 1, col + 1, a);
dfs((x << 1) + 1, y << 1, col + 1, a);
if(col + 2 <= ... | true |
54a432a2f728a7bc2b739b25fbabf7bbe21ddc7e | C++ | TrojanOlx/AI | /Face_Dlib_C#/Dlib/DlibDotNet.Native/dlib/matrix/matrix_math_functions.h | UTF-8 | 2,623 | 2.609375 | 3 | [
"MIT"
] | permissive | #ifndef _CPP_MATRIX_MATH_FUNCTIONS_H_
#define _CPP_MATRIX_MATH_FUNCTIONS_H_
#include "../export.h"
#include <dlib/matrix.h>
#include <dlib/matrix/matrix_math_functions.h>
#include <dlib/geometry/rectangle.h>
#include <dlib/geometry/vector.h>
#include "../shared.h"
using namespace dlib;
using namespace std;
#pragma r... | true |
38152792e76e2939b9a86257c710485947dffc4d | C++ | mhcoderwl/leetcode | /4.1.3.cpp | UTF-8 | 739 | 3.734375 | 4 | [] | no_license | /*给一个数组代表一个直方图,找到最大面积的矩形
* 思路:用一个栈,如果当前高度小于栈顶,则处理掉所有比他大的元素然后入栈*/
#include<iostream>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
class Solution{
public:
int LargestRectangleArea(vector<int>& height){
stack<int> s;
height.push_back(0);
int result=0;
for(int i=0;i<height.size();){
... | true |
53cd36e31b0a34623f29cd65e855e2df98658105 | C++ | ry0u/SRM | /SRM500/MafiaGame.cpp | UTF-8 | 2,922 | 2.84375 | 3 | [] | no_license | // BEGIN CUT HERE
// END CUT HERE
#line 5 "MafiaGame.cpp"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std... | true |
2af9bf531fe499d5c1894c2db369612279662f5c | C++ | zhangzhiming1017/design_pattern | /抽象工厂模式.cpp | UTF-8 | 3,912 | 3.421875 | 3 | [] | no_license | #include <iostream>
//水果产品
class fruit {
public:
virtual void show() = 0;
};
class banana : public fruit {
public:
void show() override {
std::cout << "banana" << std::endl;
}
};
class apple : public fruit {
public:
void show() override {
std::cout << "apple" << std::endl;
}
};
class orange : public fruit ... | true |
be6e9bc92603b96c6314be8b261004d68f0241da | C++ | CavaniNicolas/CppZZ2_TPs | /TP7/pile/src/Main.cpp | UTF-8 | 167 | 2.546875 | 3 | [] | no_license |
#include "PileGen.hpp"
int main(int, char const **)
{
PileGen<int> p(10);
p.push(2);
p.push(3);
std::cout << p.top() << std::endl;
return 0;
}
| true |
32e1c2b3a464b3dcb15db99023c7f7906d5d144a | C++ | 7kia/Theory-programming | /Project/Enemy.cpp | WINDOWS-1251 | 4,453 | 2.671875 | 3 | [] | no_license | #include "Enemy.h"
#include "Items.h"
#include "UnlifeObject.h"
#include "EntityVar.h"
void initializeEntitys(TypesEnemy *typesEnemy, std::vector<Enemy> &enemy, int countEnemy,
Item &emptyItem, UnlifeObject &emptyObject)//
{
srand(time(0)); //
///////////////////////////////////////////////... | true |
305d3f4744a6c58188812d4437a174537b5982f4 | C++ | chrisantus0816/yap | /Algorithm/Greedy_Dijkstra2.cpp | UTF-8 | 3,470 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <list>
#include <set>
#include <vector>
//Program to find Dijkstra's shortest path using STL set
using namespace std;
//This class represents a directed graph using
//adjacency list representation
#define INF 0x3f3f3f3f
class Graph
{
int V; //Number of vertices
//In a weighted g... | true |
4d9ea45e611c3c408d6a28949d81a9c8a0cf6427 | C++ | ThanasisSt/Cpp_Example_Code | /Example4.cpp | UTF-8 | 1,505 | 3.296875 | 3 | [] | no_license | // Example 4
//
#include "stdafx.h"
#include <iostream>
#include "time.h"
using namespace std;
struct Point{
double x;
double y;
double z;
};
struct Sphere{
Point center;
double radius;
};
struct Grid{
Point *ptogrid;
int sizex;
int sizey;
int sizez;
};
Point SetPoint(double a,do... | true |
46096018a084eacaa78789b5d64e0459294c3311 | C++ | KeiHasegawa/ISO_IEC_14882 | /14_Templates/0_Templates/test392.cpp | UTF-8 | 245 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
template<class C1> struct S {
static const int ci = 123;
};
template<class C2> const int S<C2>::ci;
double ci;
int main()
{
printf("S<double>::ci = %d\n", S<double>::ci);
printf("ci = %f\n", ci = 456);
return 0;
}
| true |
bc3b0c5c0c6fa79b16dbb89d90d41063aee9ff14 | C++ | igor-anferov/messenger2017 | /shared/include/crypto_pki.h | UTF-8 | 1,864 | 2.53125 | 3 | [] | no_license | #include <string>
#include <functional>
#include <memory>
#include <openssl/rsa.h>
#include "crypto_common.h"
#include "crypto_hash.h"
namespace m2
{
namespace crypto
{
namespace common
{
class IAsymmetricCryptoProvider : public common::ICryptoProvider {
virtual boost::uuids::uuid fingerprint() const = 0;... | true |
e7d54a6d154c9da6c30710fe129576e5cd9abc78 | C++ | KKyang/Image-Processing | /libsources/sharememory.cpp | UTF-8 | 2,512 | 2.796875 | 3 | [] | no_license | #include "sharememory.h"
shareMemory::shareMemory()
{
}
bool shareMemory::addToSharedMemory(cv::Mat &img)
{
if(img.empty())
return false;
if (sharedMemory.isAttached())
sharedMemory.detach();
cv::Mat tmp;
if(img.type() == CV_8UC1)
{
myCV::myCvtColor(img, tmp, myCV::G... | true |
5a093775417affc3dd405614dba6eb915e8d8d23 | C++ | ansharpless90/C-Exercises | /Program1.2.cpp | UTF-8 | 267 | 2.796875 | 3 | [] | no_license | //Author Adrian Sharpless
//Last modification date: 5/4/2017
//Program outputs two lines of text
#include<iosstream>
using namespace std;
int main()
{
cout << " Computers, computers everywhere";
cout << " \n as far as I can C"; // /n sets output to a new line
return 0;
}
| true |
796d70c1dee872c5592fbbe7ba9c31e7090aedcb | C++ | KristiyanGergov/DataStructuresAndAlgorithms | /Week 02 - Sorting Algorithms/SortingAlgorithms/SortingAlgorithms/main.cpp | UTF-8 | 2,395 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
void print(int* arr, int len) {
cout << "[";
for (int i = 0; i < len; i++)
{
if (i == len - 1)
{
cout << " " << arr[i] << " ]" << endl;
break;
}
cout << " " << arr[i] << ",";
}
}
// Bubble
void bubbleSort(int* arr, int len) {
for (int ... | true |
c4c6d280cf7faf909ecc8444388a403811519792 | C++ | ohlionel/codebase | /13307130195/assignment6/2.cpp | UTF-8 | 838 | 2.609375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;
int a[110000];
void msort(int i, int j)
{
int l = i, r = j, m = abs(a[(i+j)/2]);
while (i<=j)
{
while (abs(a[i]) < m) i++;
while (abs(a[j... | true |
68286ec7a0c8194f4d383a7dce9f03d8ee569bd1 | C++ | CPSC-4377-UALR/CPSC.4377.Code.Examples | /L03.3.TinyXMLDemoAdvanced/main.cpp | UTF-8 | 5,976 | 2.78125 | 3 | [] | no_license | /*
* Example code taken from: http://www.grinninglizard.com/tinyxmldocs/tutorial0.html
*/
#include "tinyxml2.h"
#include <list>
#include <string>
#include <map>
using namespace std;
typedef std::map<std::string,std::string> MessageMap;
// a basic window abstraction - demo purposes only
class WindowSettings{
public... | true |
09e55765cdc385ea4f9ba2c86db81d694551e42b | C++ | layshua/Shock-or-Entropy-Interaction | /main.cpp | UTF-8 | 1,186 | 2.53125 | 3 | [] | no_license | /**
* main.cpp
* the main procedure to use c++ get the data and use matlab to plot the image
* Shock/Entropy Wave Interaction
*
* Created by David Wang on 16/11/5.
*
*/
#include "solver.hpp"
int main(int argc, const char * argv[]) {
solver solver;
// 对比有无MUSCL Limiter
solver.setLimiter(0);... | true |
3e0590b8369be1099a10bfa7192b0c4fd862371a | C++ | Kawser-nerd/CLCDSA | /Source Codes/CodeJamData/08/72/3.cc | UTF-8 | 1,245 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int mod(int a) {
a %= 10007;
if (a < 0) a += 10007;
return a;
}
int main()
{
int tests;
cin >> tests;
for (int test = 1; test <= tests; ++test) {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; ++i)
cin >> v[i];
... | true |
bb1a52269687bd55108f8285c62bb27f6631b29a | C++ | swapnilhota/interviewBit | /DP/Best Time to Buy and Sell Stocks I.cpp | UTF-8 | 577 | 3.578125 | 4 | [] | no_license | /*
Problem Description
Say you have an array, A, for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (i.e, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
Return the maximum possible profit.
*/
int ... | true |
c71123776651b85cc9bf96bb45b3d5621852eb2e | C++ | MarkBennett12/OpenGL-River_Valley | /RiverValley/RiverValley/DiamondSquare.cpp | UTF-8 | 6,351 | 3.34375 | 3 | [] | no_license | /*
* DiamondSquare.cpp
*
* Implements the diamond square algorithm for procedural terrain generation.
* Created on: 30 Nov 2013
* Author: Mark Bennett
*/
#include <iostream>
#include "DiamondSquare.h"
namespace Generators
{
/*
Constructs the DiamondSquare object and provied the mesh and parameters for the... | true |
71c56dfc5b83deb7f9fa78ea1fc94998b3f07a96 | C++ | ron-kap/university-projects | /C++/Assignment1/Item.h | UTF-8 | 1,446 | 3.390625 | 3 | [] | no_license | #ifndef ITEM_H
#define ITEM_H
#include <iostream>
using std::ostream;
using std::ostream;
using std::cout;
#include <string>
using std::string;
#include <cmath>
using std::pow;
using std::cos;
using std::sin;
using std::atan2;
// TODO: your code goes here
class Item {
protected:
double latitude;
double longitu... | true |