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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ca8cdf68bc08fb4fd6710f1e1a2ddf9d2c9ad481 | C++ | PirateLi/C-Sample | /StudentMIS/StudentMain.cpp | GB18030 | 838 | 2.875 | 3 | [] | no_license | #include <iostream>
#include "Student.h"
using namespace std;
int main()
{
StudentMIS sysu;
StudentBase* pBase;
First* pFirst;
Second* pSecond;
StudentMIS* pMIS;
pFirst=&sysu;
pSecond=&sysu;
pBase=&sysu;
pMIS=&sysu;
int n;
while (1)
{
system("cls");
cout<<"ӭʹѧϢϵͳѡȨޣ"<<endl;
... | true |
94cada3b7d32e1d00416a696c96a9ed9e1ca957b | C++ | ITA-Dnipro/BackEndMonitoring | /utils/include/CThreadPool.h | UTF-8 | 1,699 | 2.703125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <future>
#include <queue>
#include <condition_variable>
#include <functional>
#include "CEvent.h"
#include "CThreadSafeVariable.h"
#include "STaskInQueue.h"
#include "Log.h"
class CThreadPool
{
public:
using Task = std::function<void()>;
CThreadPool() = delete;
CThreadPool(std::size_t numTh... | true |
d77c0ff9b17690d426e001a6cd15545068f3c4dc | C++ | almohamedumar/awesome-coding | /count nodes in complete binary tree2.cpp | UTF-8 | 998 | 3.40625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int key;
Node *left, *right;
Node(int key)
{
this->key = key;
this->left = this->right = nullptr;
}
};
int countnum(Node *root)
{
if(root == NULL)
{
return 0;
}
int l=0,r=0;
Node*curr = root;
... | true |
e7b969dde0734b428b7d005241467e04edbffe20 | C++ | adanil/CompetitiveProgramming | /Greedy/taskD/main.cpp | UTF-8 | 14,584 | 2.765625 | 3 | [] | no_license | //#include <iostream>
//#include <string>
//#include <vector>
//#include <algorithm>
//
//using namespace std;
//using ll = long long;
//
//struct prnts{
// ll bal;
// ll negPref;
// ll posPost;
// ll id;
//};
//
//vector<string> generetedParenthesis;
//
//
//void generateParenthesis(int n,int bal,string pr... | true |
eb738fbdc8d3b61784b20ff81286e7796fc89768 | C++ | Noahbrauer/MCMCProj | /BayeSource.cpp | UTF-8 | 2,095 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include "BayesNet.h"
int main()
{
// Creating all net objects
BayesNet net1;
BayesNet net2;
BayesNet net3;
BayesNet net4;
BayesNet net5;
double numTrue[5][10] = { 0 };
double record[5] = { 0 };
// Run 1 storing count in first slice of numTrue
net1.ini... | true |
6966c2ffbd02689d9e9daec128a5e0a37114ea6a | C++ | SiChiTong/DosuBot_pkg | /src/dosubot_serial/src/dosubot_serial.cpp | UTF-8 | 2,728 | 2.765625 | 3 | [
"MIT"
] | permissive | #include <ros/ros.h>
#include <serial/serial.h>
#include <std_msgs/String.h>
#include <std_msgs/Empty.h>
#include "sensor_msgs/JointState.h"
#include <string>
#include <sstream>
serial::Serial ros_ser; //声明串口对象
//回调函数
void jointstatesCallback(const sensor_msgs::JointStateConstPtr& msg)
{
std::stringstream str;
... | true |
34abbde746a1c0ebd136cc21df9c3c5f915d0fa5 | C++ | fredericjoanis/Argorha-Pathfinding | /doc/demos/Irrlicht/src/main.cpp | UTF-8 | 11,956 | 2.671875 | 3 | [
"MIT"
] | permissive | /*
In this tutorial, I will show how to collision detection with the Irrlicht Engine.
I will describe 3 methods: Automatic collision detection for moving through 3d worlds
with stair climbing and sliding, manual triangle picking and manual
scene node picking.
To start, we take the program from tutorial 2, which loade... | true |
276aff9a945a9230903e4d8587061d3a7f4f12b7 | C++ | taceroc/Herr | /4-09/holamundo.cpp | UTF-8 | 240 | 2.71875 | 3 | [] | no_license | #include <iostream> //imprimir pantalla
//#using namespace std;: es mejor std:: dentro de std esta cout
int main(void)
{
double x = 1.0e-6;
std::cout<<"Hola Munduo\n";
// std :: cout<<"Hola Mundo"<<endl;
std::cout<<x<<"\n";
return 0;
}
| true |
3c76f2a7d8b24635b092f61cf73511ab41af4bc9 | C++ | tanv1r/cpp_concurrency_in_action | /c3_protect_shared_data/projects/listing_3_2/MutexNotEnough.cpp | UTF-8 | 1,399 | 3.8125 | 4 | [] | no_license | #include <functional>
#include <iostream>
#include <mutex>
#include <thread>
using namespace std;
class ProtectedData
{
public:
ProtectedData(unsigned x)
: data_(x)
{
}
template<typename Function>
void processData(Function func)
{
// Even th... | true |
e54dcafa91ef75cb1c748be040ca95cd9e3f756c | C++ | AprilAndFriends/april | /include/april/Cursor.h | UTF-8 | 1,216 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | /// @file
/// @version 5.2
///
/// @section LICENSE
///
/// This program is free software; you can redistribute it and/or modify it under
/// the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
///
/// @section DESCRIPTION
///
/// Defines a Cursor object.
#ifndef APRIL_CURSOR_H
#define APRIL_... | true |
d7034d3997723caca31a24ed69346513c945a2b9 | C++ | rsotani/AtCoder | /BeginnerContest/020-029/028/C.cpp | UTF-8 | 419 | 2.828125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> abcde(5);
for (int i=0; i<5; i++) cin >> abcde[i];
vector<int> ans;
for (int i=0; i<3; i++){
for (int j=i+1; j<4; j++){
for (int k=j+1; k<5; k++){
int val = abcde[i]+abcde[j]+abcde[k];
//cout << val << endl;
... | true |
c15d498b6e327be296c7437dce90aaa20da02db2 | C++ | gingteam/ds | /pointer/stack.cpp | UTF-8 | 1,008 | 3.671875 | 4 | [
"MIT"
] | permissive | #include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int data;
Node *next;
} Node;
typedef struct {
Node *top;
} Stack;
Node *makeNode(int x) {
Node *a = (Node *) malloc(sizeof(Node));
a->data = x;
return a;
}
void init(Stack &s) {
s.top = NULL;
}
int isEmpty(Stack s) {
retu... | true |
e54ba9763c0d07b277fa14841115b4338b5f3f11 | C++ | jae2900/Programing-study-YJ | /BackJoon/1267_핸드폰 요금.cpp | UTF-8 | 712 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int cnt;
vector <int> num_Y,num_M;
cin >> cnt;
for(int i = 0;i<cnt;i++)
{
int x;
cin >> x;
num_Y.push_back(x);
num_M.push_back(x);
}
int ans_Y = 0, ans_M = 0;
for(int i = 0;i<cnt;i... | true |
c51d395429ec74c5c3dcbaeaea9dc6507610c4d1 | C++ | luozhancheng/leetcode_cpp | /include/n_queens_ii.h | UTF-8 | 869 | 3.03125 | 3 | [] | no_license | //
// Created by lelezi on 2019-05-13.
//
#ifndef LEETCODE_N_QUEENS_II_H
#define LEETCODE_N_QUEENS_II_H
class Solution {
public:
int totalNQueens(int n) {
if (n < 1)
return 0;
dfs(n, 0, 0, 0, 0);
return count;
}
void dfs(int32_t n, int32_t row, int32_t cols, int32_t pie, int32_t na) {
if... | true |
a93b3fd871512bff52b2359cc7c5a27ac61e6ea9 | C++ | JGuissart/Cpp-MySailingWorld | /Lib/Concurrent.cxx | UTF-8 | 3,411 | 3.28125 | 3 | [] | no_license | #include "Concurrent.h"
#include <iostream>
using namespace std;
Concurrent::Concurrent()
{
setNumeroMatricule(0);
setNomConcurrent("defaut");
setNiveauCapacite(0);
setPlace(0);
pos.setX(0);
pos.setY(0);
setNumeroBouee(0);
}
Concurrent::Concurrent(int nM, std::string nC, float lvlC)
{
setNumeroMatricule(nM)... | true |
a30c81acb6590c968e22b0ce492ca1597dc79dfe | C++ | guilhermeleobas/maratona | /SPOJ/calcula.cpp | UTF-8 | 1,076 | 2.765625 | 3 | [] | no_license | /*
Problema - CALCULA
http://br.spoj.com/problems/CALCULA/
Guilherme Leobas
*/
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
#define num(conta) (in... | true |
93c8ed1a1da5ddcf8e26270e81fd926efeb7356f | C++ | Maigo/gea | /gea/libs/gea_math/src/gea/mth_core/type/half.inl | UTF-8 | 1,742 | 2.609375 | 3 | [] | no_license | namespace gea {
namespace mth {
// state functions
inline bool half::is_zero() const {
return (m_bits & ~HALF_SIGN_MASK) == 0;
}
inline bool half::is_finite() const {
uint16_t exp = HALF_EXP_F(m_bits);
return exp < 31;
}
inline bool half::is_negative() const {
return (m_bits & HALF_SIGN_MASK) != 0;
}
i... | true |
8405f360567d1913e05cde22802a2d75b6216da3 | C++ | Michael-prog/ExplorerListView | /src/IItemComparator.h | UTF-8 | 1,559 | 3.09375 | 3 | [
"MIT"
] | permissive | //////////////////////////////////////////////////////////////////////
/// \class IItemComparator
/// \author Timo "TimoSoft" Kunze
/// \brief <em>Communication between the \c CompareItems callback method and the object that initiated the sorting</em>
///
/// This interface allows the \c CompareItems callback method to... | true |
76f63bbce5b3c40145f16e8ebbb5f7e3ef78d635 | C++ | mitchetm/Legacy-Irrlicht-Multiplayer-RPG | /Code/MoveToComponent.cpp | UTF-8 | 607 | 2.703125 | 3 | [] | no_license | #include "MoveToComponent.h"
MoveToComponent::MoveToComponent()
{
}
MoveToComponent::~MoveToComponent()
{
}
MoveToComponent::MoveToComponent(unsigned int id) : GameComponent(MOVE_TO_COMP, id)
{
x = 0;
y = 0;
z = 0;
}
void MoveToComponent::setMoveToX(float value)
{
x = value;
}
float MoveToComponent... | true |
f8555b10dd477342e4012da2bf654c364ad18a42 | C++ | claassen/GalaxySim3D | /GalaxySim3D/Body.h | UTF-8 | 1,107 | 3.046875 | 3 | [] | no_license | #pragma once
class Body
{
public:
int id;
long long mass;
float x, y, z;
float radius;
float dx, dy, dz;
float ax, ay, az;
float r, g, b;
bool markForDeletion;
Body() : id(0) {}
Body(int id, long long mass, float x, float y, float z, float dx, float dy, float dz)
: id(id), mass(mass), x(x... | true |
89976114f27ce323b9c5d4bc949506ae2e1a2220 | C++ | ttan6729/PMRC | /src/trail_backup.cpp | UTF-8 | 4,254 | 2.6875 | 3 | [] | no_license | #include "trail.h"
#include <limits>
using namespace std;
void Trail::Run()
{
// printf("test weight matrix\n");
// for(int i = 0; i < n; i++)
// {
// for(int j = 0; j < n; j++)
// printf("%.3f ",w_matrix[i][j]);
// printf("\n");
// }
printf("begin trail, threshold %lf, number of files %d\n",e... | true |
0288042f918f8a2e43af5b8cdd46dacff2d692f2 | C++ | rbapub/homebk | /src/Partner.cpp | UTF-8 | 521 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "Partner.h"
using std::string;
int Partner::nextId = 1;
Partner::Partner(string pName)
{
id = nextId;
nextId++;
name=pName;
}
int Partner::getId() const
{
return id;
}
void Partner::setId(int i)
{
id = i;
}
string Partner::getName() const
{
return name;
}
void... | true |
c6b954b731ac97169dd8ae307855f118c6d50b18 | C++ | rouman321/code-practice | /0960-deleteColumnsToMakeSortedIII.cpp | UTF-8 | 782 | 3 | 3 | [] | no_license | /*
LeetCode 960. Delete Columns to Make Sorted III
hard
time 78.21%
space 80%
*/
class Solution {
public:
int minDeletionSize(vector<string>& A) {
int len = A[0].size();
vector<int> dp(len,1);
for(int i = len-2;i >= 0;i--){
for(int j = i+1;j < len;j++){
bool flag ... | true |
7ea02c9e7b2378977eb74f0d4e1267a4546ac123 | C++ | heyterrance/ctrie_map | /ctrie_map.h | UTF-8 | 11,774 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <algorithm>
#include <array>
#include <string_view>
#include <tuple>
#include <utility>
namespace ctrie {
template<typename... Entries> class index_node;
template<typename T, typename IndexTrie> class array_map;
template<char... Ks>
struct insert_key {
template<typename V>
... | true |
18ccc1c5579985719d8da2286bc5963f5f32d7eb | C++ | JHDReis/MetadataStudy | /metadata/metadataStudy1.h | UTF-8 | 3,078 | 2.71875 | 3 | [] | no_license | //
// Created by Joao Henriques David Dos Reis on 01/04/2018.
//
#ifndef METADATASTUDY_METADATASTUDY1_H
#define METADATASTUDY_METADATASTUDY1_H
/*
* https://www.codeproject.com/Articles/3743/A-gentle-introduction-to-Template-Metaprogramming
* https://monoinfinito.wordpress.com/series/introduction-to-c-template-metap... | true |
805dc7f9aa8e57789cee3b75fd33b035edd70e7e | C++ | StevePunak/KanoopCommonQt | /userutil.cpp | UTF-8 | 1,782 | 2.953125 | 3 | [
"MIT"
] | permissive | #include "userutil.h"
#ifndef __WIN32
#include "unistd.h"
gid_t UserUtil::gidFromName(const QString &name)
{
gid_t ret = 0;
struct group* group;
group = getgrnam(name.toLatin1().constData());
if(group != nullptr)
ret = group->gr_gid;
return ret;
}
uid_t UserUtil::uidFromName(const QString... | true |
af80f40bc44234e0a71b0fbc8c4ef2aa68c9f8cc | C++ | zachprinz/Snag_Mobile | /Classes/Level.cpp | UTF-8 | 3,520 | 2.859375 | 3 | [] | no_license | #include "Level.h"
#include "NDKHelper/NDKHelper.h"
#include "User.h"
#include <string.h>
#include <iostream>
#include <vector>
#include <algorithm>
Level::Level(){
map["data"] = "<Map></Map>";
uploaded = false;
}
Level::Level(ValueMap map){
setMap(map);
uploaded = true;
}
std::vector<Entity*> Level:... | true |
20bd278672296205aae0fcd4d0b532138345c203 | C++ | amedeo-giuliani/programming-for-tlc | /lab4/mac-hdr.cpp | UTF-8 | 979 | 2.703125 | 3 | [] | no_license | #include "mac-hdr.h"
#include <cmath>
bool mac_hdr::serialize(char* buffer, size_t& offset) const{
for(int i = 0; i < sn_size; i++){
buffer[(int)std::floor(offset/8)] |= (char) ((sn >> i & 1U) << offset%8);
offset++;
}
for(int i = 0; i < addr_size; i++){
buffer[(int)std::floor(offset/8)] |= (char) ((src >... | true |
a52e6969781c638cac582cfa65c119e1e50fd74d | C++ | eslam733/c-plus-plus-projects | /sort_array_2d.cpp | UTF-8 | 1,064 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
// Bulbasaur
struct Interval
{
int start, end;
};
bool compareInterval(Interval i1, Interval i2)
{
if((i1.start != i2.start))
return (i1.start > i2.start);
else
{
return (i1.start == i2.start &&... | true |
56789fa90065adef37628fc3e890c4c560aae5f2 | C++ | BartoszewskiA/PodstawyProgramowaniaST20 | /w04p03.cpp | UTF-8 | 298 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int x;
int tab[32];
cout << "x=";
cin >> x;
int n = 0;
do
{
tab[n] = x % 2;
x = x / 2;
n++;
} while (x > 0);
for (int i = n - 1; i >= 0; i--)
cout << tab[i];
return 0;
} | true |
2af368e96003014b39a64bc40eb04d61ac09d93e | C++ | valerieSergeevna/aistrd | /UnitTest1/list_unittest.cpp | WINDOWS-1251 | 11,644 | 3.234375 | 3 | [] | no_license | #include "stdafx.h"
#include "CppUnitTest.h"
#include <stdexcept>
#include "../3/List.cpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTest1
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestMethod_size)
{
List<int> list2;
list2.push_back(40);
list2.push_back(10);... | true |
e2b0a5d751f954948228c631d8ff421ca9c36c06 | C++ | decoda/clien-server-sync | /client/BufferStream.h | UTF-8 | 659 | 2.90625 | 3 | [] | no_license | #ifndef BufferStream_h__
#define BufferStream_h__
class MySocket;
class BufferStream
{
public:
BufferStream(uint32 bufflen);
~BufferStream(void);
bool Read(void* destination, size_t bytes);
bool Write(const void* data, size_t bytes);
int32 SocketFlush(MySocket *pSocket);
int32 SocketFill(MySock... | true |
acf091e932bab6bc6aa7c67312ee6b5c91bbf4e2 | C++ | flopezv95/Programacion3D | /Practica5/plantilla3d/project/Model.h | UTF-8 | 277 | 2.609375 | 3 | [] | no_license | #pragma once
#include "Entity.h"
#include <iostream>
class Mesh;
class Model : public Entity
{
public:
Model(const std::shared_ptr<Mesh>& mesh);
virtual void draw(float deltaTime, float angle, bool rotateInTime = false) override;
private:
std::shared_ptr<Mesh> myMesh;
}; | true |
aac2ca5fea4b1649dfa154f359b0b2ba71d5fd81 | C++ | geranium12/Programming | /C++/Labs/Labs1Sem/Assembler/5ChainString/strpbrk.cpp | WINDOWS-1251 | 2,694 | 3.640625 | 4 | [] | no_license | /*
. 1 . 7 .
:
strpbrk <cstring>.
:
s1 s1
s2.
s1 .
s2 s1.
:
input output
1 12345 45
45 5
*/
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int STR_LENGTH = 105;
// , s1
//- , s2 ( NULL).
//STRPBRK y s1 , NULL-y,
// s2... | true |
b308efaf1592d429874af56a76d942dc9e873e40 | C++ | tumluliu/hengii | /server/core/trackerenv.h | UTF-8 | 4,878 | 2.5625 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: trackerenv.h
*
* Description: tracker env, contains resources cleanup functionality
*
* Version: 1.0
* Created: 05/21/2012 04:38:14 PM
* Revision: none
* Compiler: ... | true |
80ee9f5cd97c285458d4b219f1cddf31a03f2d4d | C++ | songxinjianqwe/CppPrimerCode | /Charpter10/src/344diy.cpp | GB18030 | 1,404 | 3.765625 | 4 | [] | no_license | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
//Ʋ
//Ĭǰ<ؽ
//ûأҪԣԼƣһֶƷǴȽϵĺ
//ע⺯ΪʱҪд()
extern void deDuplication(vector<string> & sVec);
//ϣȰͬİֵ
//ҪȰֵٰճҳ㷨ڳȵԪزıǵĴ
//sortһ汾ܵһν
//νһɵõıʽ䷵ؽһֵ
//һԪνʺͶԪνʣһԪνζֻܵһԪνʽ
//һԪνʲsortν<
bool isShorter(const string & s1,const str... | true |
7ad74b043f2662bb512026bdfb3183c6cdc7f122 | C++ | Phirxian/sacred-fractal | /src/sounds/generator/TriangleGenerator.h | UTF-8 | 774 | 2.765625 | 3 | [] | no_license | #ifndef __SACRED_TRIANGLEGENERATOR__
#define __SACRED_TRIANGLEGENERATOR__
/**
* @file TriangleGenerator.h
* @brief Declares the TriangleGenerator class
*
* @author Adrien Grosjean
* @version 1.1
* @date April 27 2017
**/
#include "Generator.h"
namespace sacred
{
namespace sounds
{
/**
... | true |
f961f9902a5c600fc5ae77291a35b634174f1997 | C++ | Hao1Zhang/OOP | /practical-02/main-2-2.cpp | UTF-8 | 358 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
extern int binary_to_number(int (*)[6] , int number_of_digits)
int main()
{
int binary_digits[6] = { 1, 0, 1, 1, 1, 0 };
int number_of_digits=binary_to_number(binary_digits,(sizeof(binary_digits)/sizeof(binary_digits[0])));
cout << "" << binary_to_number(binary_digi... | true |
bc60aa6ef61e39cdae6a0f165678636ffbaef231 | C++ | mm-89/edit_uv_sa | /SpreadSheet.cpp | UTF-8 | 2,433 | 2.65625 | 3 | [] | no_license | #include "SpreadSheet.h"
#include <algorithm>
#include "IOCSV.h"
using namespace std;
SpreadSheet::SpreadSheet()
{
type = ST_Count;
for(int i = 0; i < ST_Count; i++)
{
SpreadSheetTypes thisType = (SpreadSheetTypes)i;
if(!isSupported(thisType)) continue;
if(type == ST_Count)
{ type = thi... | true |
45ea2caac5e4f717fa9d3ea92c7a7c1151b2c1ae | C++ | koonom/project-euler | /src/prob-077.cpp | UTF-8 | 1,093 | 2.84375 | 3 | [] | no_license | #include <iostream>
const int N = 100;
int k[N + 1][N + 1]; // Enough for k(N, N - 1)
bool composite[N + 1];
int main() {
for (int n = 2; n <= N / 2; ++n)
if (!composite[n])
for (int m = n + n; m <= N; m += n) composite[m] = true;
//--------------------------------------------------
// k(0, n) = k... | true |
479786ca451277cf86e31ffba76f010171eafc22 | C++ | noizzEmpresaOficial/sistemas_informacion | /main.cpp | UTF-8 | 333 | 2.9375 | 3 | [] | no_license | //Inicio de esta nueva aventura de programación
#include <iostream>
int main()
{
std::cout << "Hola mundo!" << std::endl;
std::cout << "Este es un gran día para crear una app" << std::endl;
std::cout << "Pero necesito concentrarme para ello, un poco de ruido blanco me vendría bien..." << std::endl;
r... | true |
3348913d986692b7abf4ee0f73e8fab619696055 | C++ | baibolatovads/work | /Algorithms and Data Structures/Midterm/H.cpp | UTF-8 | 387 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
string s;
int main(){
cin >> s;
vector<int> num;
int n = s.size();
for(int i = 0; i < s.size(); i++){
char ch = s[i];
if(ch >= 48 && ch <= 57){
int numb = ch - '0';
num.push_back(numb);
}
}
sort(num.begin(), num.end());
cout << num[0];
for(int i =... | true |
ac3e9efcc105e8922e8b267215dffe74db1d7293 | C++ | zmiksis/SciComp | /21210_Spring2017/SP2017_me/exam/untitled.cpp | UTF-8 | 657 | 3.015625 | 3 | [] | no_license | #ifndef WEATHER_H
#define WEATHER_H
#include <string>
#include <vector>
class Weather{
// Public interface
public:
Weather(std::string country, std::string state, std::string town, std::vector<int> temperature, std::vector<int> rain, int projected);
// Accessors / Getters
std::string get_full_name();
floa... | true |
3a123bf038aaecbdfb5989a071475132763199c0 | C++ | ydkhub/algorithm | /code/查并集.cpp | GB18030 | 749 | 2.515625 | 3 | [] | no_license | #include<cstdio>
const int maxn=100000001;
int father[maxn];
int isf[maxn];
void init(int n){
for(int i=0;i<n;i++){
father[i]=i;
isf[i]=1;
}
}
//ʼ
int findfather(int x){
int a=x;
while(x!=father[x]){
x=father[x];
}
while(a!=father[a]){
int z=a;
a=father[a];
father[z]=x;
}
return x;
}
//
void... | true |
8867966714d47bbfd59e28e0c99b99e0e508e455 | C++ | HaDriell/Permafrost | /Permafrost/include/Permafrost/Core/CommonTypes.h | UTF-8 | 938 | 2.765625 | 3 | [] | no_license | #pragma once
#include <algorithm>
#include <assert.h>
#include <memory>
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
//Unsigned integral types
using u8 = unsigned char;
using u16 = unsigned short;
using u32 = unsigned int;
using u64 = unsigned long long;
//Signed integr... | true |
b8a69c28f175ad7918f8702b6a49e104cb21117e | C++ | IlyaSirosh/ATM_client | /cardeater.cpp | UTF-8 | 834 | 2.921875 | 3 | [] | no_license | #include "cardeater.h"
#include <QVBoxLayout>
CardEater::CardEater(QWidget *parent) :
QWidget(parent),
_input(new QLineEdit()),
_submit(new QPushButton()),
_card("")
{
_submit->setText("Вставити картку");
connect(_submit,SIGNAL(clicked()),this,SLOT(submit()));
createLayout();
}
CardEater... | true |
555724351792713992050a74c29f6130657c7cb2 | C++ | mrrranjbar/SixR20GUI | /Model/Robot/TrajectoryPoint.h | UTF-8 | 2,331 | 2.703125 | 3 | [] | no_license | #pragma once
#include <vector>
//#include <deque>
class TrajectoryPoints
{
public:
double* q;
double* v;
double* a;
int TrajLength;
// ULONG dooo(ULONG a);
TrajectoryPoints()
{
q = new double[1000000];
v = new double[1000000];
a = new double[1000000];
}
~TrajectoryPoints()
{
delet... | true |
cd2de87ccf2b5dbdf3fa296b621851b2be25c083 | C++ | mattwalker101/CIS-040-Cplusplus | /Commission/Commission.cpp | UTF-8 | 1,883 | 3.390625 | 3 | [] | no_license | // Commission.cpp
// member definitions
// Author: Matthew Walker
#include <iostream>
#include <iomanip>
#include <string>
#include "Commission.h"
using namespace std;
Commission::Commission(const string fname, const string lname, const string ssn,
double bSalary, double gSales, double cRate) {
// fname = { "Mar... | true |
7db85d6d7ae27dcf5d7f58cf856d29ad48c6456f | C++ | sraman915/Comptetive-Programming | /Spoj-Solutions/ABA12C-BUYINGAPPLES.cpp | UTF-8 | 654 | 2.515625 | 3 | [] | no_license | /*
ABA12C- BUYING APPLES
SOLUTION BY RAMAN SHARMA
*/
#include<bits/stdc++.h>
using namespace std;
#define inf 10000000
int unknapsc(int val[],int k){
int dp[k+1];
dp[0]=0;
for(int i=1; i<=k; ++i){
dp[i]=inf;
for(int j=1; j<=i; ++j){
if(val[j]!=-1)
dp[i]=min(dp[i],dp[i-j]+val[j]);
}
... | true |
eca606949e47031b1f685249110cef97f7870aaa | C++ | kobe24o/LeetCode | /algorithm/leetcode294.cpp | UTF-8 | 459 | 2.765625 | 3 | [] | no_license | class Solution {
unordered_map<string,bool> m;
public:
bool canWin(string s) {
if(s.size() <= 1) return false;
if(m.count(s)) return m[s];
string t;
for(int i = 0; i < s.size()-1; ++i)
{
if(s[i]=='+' && s[i+1]=='+')
{
t = s;
t[i]=t[i+1]='-';
if(!canWin(t... | true |
7f2f04d5ec3a7c302c4a4ee76ef96c2878b03aeb | C++ | lineCode/fish | /hx/db/DbThreadPool.cpp | UTF-8 | 1,902 | 2.84375 | 3 | [] | no_license | #include "DbThreadPool.h"
#include "util/Util.h"
#include "util/format.h"
#include <stdio.h>
void DbThreadPool::threadFunc(DbThreadPool::TaskQueue *queue, DbMysql* db) {
for(;;) {
DbTask* task = queue->Get();
if(!task) {
return;
}
task->ThreadDo(db);
}
}
void DbThreadPool::TaskQueue::Close() {
std::lock... | true |
3a968875ed4856245df68e2dd83214b27b63dbae | C++ | deepakks1995/Practise | /merge_sort.cpp | UTF-8 | 839 | 3.1875 | 3 | [] | no_license |
void merge_sort(long a[], int lo, int hi)
{
if(lo < hi )
{
long mid = lo + (hi-lo)/2;
merge_sort(a,lo,mid);
merge_sort(a,mid+1,hi);
_merge(a,lo,mid,hi);
}
}
void _merge(long a[], int lo, int mid, int hi)
{
long LHS[mid-lo+1];
long RHS[hi-mid];
... | true |
7019a3fc4f4f4b843b75d531658833b04e62bc22 | C++ | liooil/leetcode | /add-and-search-word-data-structure-design.cpp | UTF-8 | 1,364 | 3.453125 | 3 | [] | no_license | #include <string>
#include <vector>
using namespace std;
// =====================================================================================================================
struct Trie {
string str;
vector<Trie*> children;
};
class WordDictionary {
public:
/** Initialize your data structure here. *... | true |
293dbf75d36278f3b49ef92a35fc9624d0a406c2 | C++ | lineCode/entity_spell_system | /entities/skills/entity_skill_data.cpp | UTF-8 | 1,970 | 2.703125 | 3 | [
"MIT"
] | permissive | #include "entity_skill_data.h"
int EntitySkillData::get_id() {
return _id;
}
void EntitySkillData::set_id(int value) {
_id = value;
}
int EntitySkillData::get_default_value() {
return _default_value;
}
void EntitySkillData::set_default_value(int value) {
_default_value = value;
}
int EntitySkillData::get_max_val... | true |
f24c25b69dd5a5c8e5fb22b7332b85390151f77f | C++ | lucastarche/aotd | /DynamicProgramming/040-01Knapsack.cpp | UTF-8 | 1,462 | 3.625 | 4 | [
"MIT"
] | permissive | //0-1 Knapsack
//Problem: We are given an array of objects, each with a weigth and value, and a knapsack, in which we can fit a certain weigth at most. Determine the maximum value we can carry in the knapsack.
//One of the classical 2D DP problems. The base cases are when we run out of items or weigth, in which the val... | true |
48b77fbc520d09675f5e77c4732c9673781f338f | C++ | 210183/CP | /Contest & Online Judge/FBHC/2017/Preliminary/loading.cpp | UTF-8 | 723 | 2.875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
const int LOWER_BOUND = 50;
int solve(vector<int> v) {
sort(v.begin(), v.end());
for(int i = 0 ; i < v.size() ; i++) {
int iter = 0;
bool ok = 1;
for(int j = i ; j < v.size() ; j++) {
int tot = 1;
while(v[j] * tot < LOWER_BOUND && iter < i) {
... | true |
f916e80291e1a3274c1062401069167828783db9 | C++ | PMarcL/LaboratoireGIF1003 | /Laboratoire9/EmployeLib/Employe.h | UTF-8 | 907 | 3.125 | 3 | [] | no_license | /**
* \file Employe.h
* \brief Classe de base abstraite Employe
* \author etudiant
* \version 0.1
* \date 2015-03-19
*/
#ifndef EMPLOYE_H_
#define EMPLOYE_H_
#include "Date.h"
#include "ContratException.h"
namespace labo10 {
/**
* \class Employe
* \brief Classe de base
*/
class Employe {
public:
Employe(co... | true |
eb7117dd8c5b92ac5f4bf41a470d7564119918d4 | C++ | CameronHosking/recombination | /same-mutations.cpp | UTF-8 | 19,244 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <set>
#include <unordered_map>
#include <vector>
#include <algorithm>
bool startMatches(const std::string &a,const std::string &b)
{
for(uint i = 0 ;i < std::min(a.size(),b.size());++i)
{
if (a[i]!=b[i])
{
... | true |
8c081f138ab9d8a6fdf08ebe6932cd5e418c35ce | C++ | GitBigNoob/lcdlearn | /442.find-all-duplicates-in-an-array.cpp | UTF-8 | 688 | 3 | 3 | [] | no_license | /*
* @lc app=leetcode id=442 lang=cpp
*
* [442] Find All Duplicates in an Array
*/
/*将每个数字,交换到其秩减一的位置重复即找到*/
class Solution {
public:
vector<int> findDuplicates(vector<int>& nums) {
vector<int> ans;
for(int i=0;i<nums.size();i++){
while(nums[i] != i + 1){
int tmp=nums... | true |
8141c6e57e3a5f23d9376b537e0b3e939909d92f | C++ | coolsnowy/leetcode | /031.Next_Permutation.cpp | UTF-8 | 2,356 | 3.8125 | 4 | [] | no_license | /**
* Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
The replacement must be in-place, do not allocate extra memory.
Here are ... | true |
5d445619404ed4df4de8a71a0f1150ed8f274647 | C++ | bacchus/bacchuslib | /src/ui/app.h | UTF-8 | 776 | 2.578125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/freeglut.h>
namespace bacchus {
class App {
public:
App(char* app_name) {
mArgc = 1;
mArgv = new char*[1];
mArgv[0] = app_name;
glutInit(&mArgc, mArgv);
}
App(int argc, char** argv)
: mArgc(argc), m... | true |
dd1f414a2fcddd76af4c53b4dc4f3be457301ccd | C++ | InfiniteRegen/Baekjoon_Algorithm | /algorithm/1181.cpp | UTF-8 | 471 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <utility>
#include <set>
#include <algorithm>
#include <string>
using namespace std;
set<pair<int, string>> p1;
string input[20000];
int main(int argc, char **argv)
{
int N;
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> input[i];
p1.insert(make_pair(input[i].length(), input[i]... | true |
e5cf95b8e55ab7d62f430f2b7c88a9369a5ff2df | C++ | zakaria-n/Syntax-Analysis | /Lexer/automate.cpp | UTF-8 | 1,835 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include "automate.h"
#include "etat.h"
using namespace std;
Automate::Automate(string chaine) {
Etat0 * etat0 = new Etat0();
pileEtats.push(etat0);
this->lexer = new Lexer(chaine);
}
void Automate::run() {
bool end = false;
while(!end){
this->affichePile();
S... | true |
c860ed5739866ac21affdee0b5191f377c12d99a | C++ | vplesko/DungeonsOfPain | /Morph_0_8/src/Object.cpp | UTF-8 | 6,312 | 2.578125 | 3 | [
"MIT"
] | permissive | #include <Morph/Object.h>
#include <Morph/CollMask.h>
#include <Morph/Look.h>
#include <Morph/Room.h>
#include <Morph/Flow.h>
using namespace morph;
Object::Object(int Depth) {
setStartValues(Depth);
}
Object::Object(sf::Vector2f startPosition, int Depth) : position(startPosition) {
setStartValues(Depth);
}
void O... | true |
80dbe5ad193700dcb4b805aee70c01259409447b | C++ | RikoOphorst/battleships | /src/memory/pool_allocator.h | UTF-8 | 474 | 2.765625 | 3 | [] | no_license | #pragma once
#include "../memory/allocator.h"
namespace igad
{
namespace memory
{
class PoolAllocator : public Allocator
{
public:
PoolAllocator(void* start, const size_t& size, const size_t& object_size, const uint32_t& object_alignment);
~PoolAllocator();
void* Allocate(const size_t& size, const u... | true |
a990fbb599d5625e611e30f946802dd3afc1d245 | C++ | HanLab-BME-MTU/extern | /mex/include/wildmagic-5.7/include/Wm5GMatrix.inl | UTF-8 | 21,153 | 2.9375 | 3 | [
"BSD-2-Clause"
] | permissive | // Geometric Tools, LLC
// Copyright (c) 1998-2011
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.4 (2011/07/27)
//------------------------------------------------------... | true |
7087c1ec3b0816168baec111e8a577165e52ba59 | C++ | DrXlor/pp_2019_autumn | /modules/task_1/rezantsev_s_min_matrix/min_matrix.cpp | UTF-8 | 2,195 | 2.734375 | 3 | [] | no_license | // Copyright 2019 Rezantsev Sergey
#include "../../../modules/task_1/rezantsev_s_min_matrix/min_matrix.h"
#include <mpi.h>
#include <algorithm>
#include <ctime>
#include <iostream>
#include <random>
#include <stdexcept>
#include <vector>
std::vector<int> getRandMatrix(int n, int m) {
std::mt19937 gen;
gen.seed(st... | true |
031f7ad696be436696cd2420605f771300a5725b | C++ | dimritium/Code | /DSprep/treeTr.cpp | UTF-8 | 580 | 2.890625 | 3 | [] | no_license | #include<bits/stdc++.h>
#define fl(a,b,c) for(a=b;a<c;a++)
#define flr(a,b,c) for(a=b-1;a>=0;a--)
#define MOD 10000000007
using namespace std;
struct treeNode
{
int data;
struct treeNode *left;
struct treeNode *right;
};
void preOrtr(struct treeNode *root)
{
if(root)
{
cout<<root->data;
preOrtr(root->left);
p... | true |
d9e84b460e9ac43ed0b2d27faa166a693c5bf18e | C++ | jristic/renderland | /source/gui.cpp | UTF-8 | 2,470 | 2.625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license |
namespace gui {
void DisplayShaderConstants(std::vector<rlf::ConstantBuffer>& CBs, ID3D11ShaderReflection* reflector)
{
D3D11_SHADER_DESC sd;
reflector->GetDesc(&sd);
u32 cb_index = 0;
for (u32 ic = 0 ; ic < sd.ConstantBuffers ; ++ic)
{
D3D11_SHADER_BUFFER_DESC bd;
ID3D11ShaderReflectionConstantBuffer* cons... | true |
8bf09d4b3019bd3cbb94cbefc9ff07624a4814a1 | C++ | Jbok/Baekjoon_Online_Judge | /9600/9663.cpp | UTF-8 | 952 | 2.78125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int leftCross[2][15] = { { 0, }, };
int upCross[30] = { 0, };
int row[15] = { 0, };
int col[15] = { 0, };
void dfs(int n, int depth, int *result)
{
if (depth == n)
{
*result = *result + 1;
return;
}
for (int i = 0; i < n; i++)
{
in... | true |
fa10ad2b499e3f5b1ab4018b3ceb8232fa2a90a0 | C++ | chromium/chromium | /third_party/abseil-cpp/absl/functional/any_invocable.h | UTF-8 | 12,535 | 2.875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"GPL-1.0-or-later",
"MIT",
"LGPL-2.0-or-later",
"BSD-3-Clause"
] | permissive | // Copyright 2022 The Abseil Authors.
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... | true |
76948d3d030c9b6260181d3cb5c53518198f2202 | C++ | ameerhaider/cpp-programs | /dimond.cpp | UTF-8 | 952 | 3.25 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
cout << "hello"<<endl;
int a = 9;
int spaces=a-3;
if (a % 2 != 0 ){
for (int stars = 0 ; stars < a ;stars = stars+2) {
for(int s = 0; s < spaces; s++) {
cout<<" ";
}... | true |
73165ddc88a05a3dad86b415f9e3813358c07f04 | C++ | atem11/ITMO_Labs | /1(stack)/f.cpp | UTF-8 | 1,103 | 3.40625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct node
{
int value;
node *next;
node()
{
}
node(int new_value, node *new_next)
{
value = new_value;
next = new_next;
}
};
struct my_stack
{
node *head = NULL;
void push(int new_value)
{
head = new n... | true |
2bb6da0c6c50447bcfd13380c0f1b854b0a5ee4e | C++ | Viv786ek/Cracking-any-interview-Code | /Minimum Swaps to Sort.cpp | UTF-8 | 1,921 | 3.15625 | 3 | [] | no_license |
class Solution {
private:
public:
//Method 1
int minSwaps(vector<int>&nums){
// Code here
int N = nums.size();
pair<int, int> arrPos[N];
for (int i = 0; i < N; i++)
{
arrPos[i].first = nums[i];
arrPos[i].second = i;
}
sort(arrPos, arrPos + N);
... | true |
095662282579afbc17beb4e70a9faf6d958361f0 | C++ | ydk1104/PS | /5575.cpp | UTF-8 | 219 | 2.65625 | 3 | [] | no_license | #include<stdio.h>
int main(void){
for(int i=0; i<3; i++){
int a,b,c,d,e,f;
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
d-=a; e-=b; f-=c;
if(f<0) f+=60,e--;
if(e<0) e+=60,d--;
printf("%d %d %d\n",d,e,f);
}
}
| true |
f2c1cadc8ce9d96f1e00f0d570694d959f8272bb | C++ | weixing0909/CppProject | /cv/opencv_base/opencv_08_image_analysis.cpp | UTF-8 | 5,540 | 2.984375 | 3 | [] | no_license | #include "main.h"
void convolveDFT(Mat A, Mat B, Mat& C)
{
// reallocate the output array if needed
C.create(abs(A.rows - B.rows) + 1, abs(A.cols - B.cols) + 1, A.type());
Size dftSize;
// calculate the size of DFT transform
dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
dftSize.height = getOptimalDFTSi... | true |
5ec2103015c1aa73b03a1feb13d9a89f08435084 | C++ | BlitzBurn/Jsontest | /JsonSlave-master/Http/HttpHeader.hpp | UTF-8 | 756 | 2.765625 | 3 | [
"MIT"
] | permissive | //
// Created by Per Andersson on 2018-02-23.
// Copyright (c) 2018 West Coast Code AB. All rights reserved.
//
#ifndef JSONSLAVE_HTTPHEADER_HPP
#define JSONSLAVE_HTTPHEADER_HPP
#include "../Config.hpp"
/**
* Object representing an Http Header
*/
struct HttpHeader
{
HttpHeader(const string& name, const string& va... | true |
fc09b6dc1ac0bd77a25e806c0dc1ec55cda3512a | C++ | Tuka96/CPP_Program | /July_30/July_30-1/Student.cpp | UTF-8 | 461 | 3.328125 | 3 | [] | no_license | #include"cStudent2.h"
cStudent::cStudent()
{
rollNo = 0;
height = 0;
weight = 0;
}
cStudent::cStudent(int r, float h, float w)
{
rollNo = r;
height = h;
weight = w;
}
void cStudent::display()
{
cout << "\nRoll No::" << rollNo;
cout << "\n Height::" << height;
cout << "\nWeight::" << weight;
}
void cStudent::Ac... | true |
1412d1e69662a19fdd713f0fa3d1fb2b997a63ba | C++ | mduarte-git/DuarteMark_CIS_40402 | /Homework/Assignment_3/Gaddis_9thEd_Chap4_Prob8_Sort_Names/main.cpp | UTF-8 | 895 | 3.484375 | 3 | [] | no_license | /*
* File: main.cpp
* Author: Dr. Mark E. Lehr
* Created on January 2, 2019, 12:36 PM
* Purpose: Creation of Template to be used for all
* future projects
*/
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
int books_purchased;
cout<<"Book Worm Points... | true |
0761c86107646fb0d5599be8987e2fea1a53a5f8 | C++ | RattleInGlasses/ps_oop | /lab03/2.Rectangles/src/rectanglesTests/RectangleTests.cpp | UTF-8 | 23,889 | 2.84375 | 3 | [] | no_license | #include "stdafx.h";
#include "..\rectangles\Rectangle.h"
BOOST_AUTO_TEST_SUITE(RectangleTests)
// init state
BOOST_AUTO_TEST_CASE(InitialState)
{
CRectangle rect(0, 0, 0, 0);
BOOST_CHECK_EQUAL(rect.GetLeft(), 0);
BOOST_CHECK_EQUAL(rect.GetRight(), 0);
BOOST_CHECK_EQUAL(rect.GetTop(), 0... | true |
6fde46a536ea34dd83008591c0bf66210d365f08 | C++ | ototsuyume/poj-solution | /3041.cpp | UTF-8 | 782 | 2.578125 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
bool g[510][510],used[510];
int result[510],n,m;
bool augument(int x){
for(int i=0;i<n;++i){
if(!g[x][i]||used[i])continue;
used[i]=true;
if(result[i]==-1||augument(result[i])){
result[i]=x;
return true;
... | true |
28c30f92bef2abbb076b7f78e59e798da68f7fd4 | C++ | paulinho-16/MIEIC-PROG | /Ficha 1/Exercício2/Exercício2.9/Exercício2.9/main.cpp | UTF-8 | 2,174 | 3.5625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
char alinea;
cout << "Enter the alinea you want to do: ";
cin >> alinea;
switch (alinea)
{
case 'a':
{
int soma = 0 , minimo = 99999999 , maximo = -99999999 , comprimento = 0 , valor = 1;
double media;
while (valor != 0)
{
cout << "Enter an ... | true |
685dad8e3c93f1cb3ddecb6bc79e9f73d72cf6bf | C++ | iCodeIN/leetcode-4 | /PrintWordsVertically.cpp | UTF-8 | 1,288 | 2.890625 | 3 | [] | no_license | class Solution {
public:
vector<string> printVertically(string s) {
int i,len=s.length(),maxlen=0,len1,j;
vector<string>words;
string temp="";
for(i=0;i<len;i++)
{
if(s[i]!=' ')
temp=temp+s[i];
else if(s[i]==' ')
{
... | true |
9f16adb30f7988a02581b8eecaa5773c48f0de46 | C++ | KamikazeChan/Contest | /CodeLib/Geometry/POJ 3168 Barn Expansion.cpp | UTF-8 | 2,259 | 2.96875 | 3 | [] | no_license | /*
** POJ 3168 Barn Expansion
** Created by Rayn @@ 2014/04/01
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define MAX 25005
using namespace std;
struct wall{
int id, pos;
int beg, end;
wall(int id=0, int beg=0, int end=0, int pos=0):
id(id), beg(beg), end(end),... | true |
7ba07aaf630827f0e92dc23058928588a0bf8eb1 | C++ | jinbooooom/coding-for-algorithms | /function/int2str.cpp | UTF-8 | 341 | 3 | 3 | [
"MIT"
] | permissive | void int2str(int n, char *str)
{
int num = n > 0 ? n : -n;
if (str == nullptr)
return;
char buf[10] = " ";
int i = 0, j = 0;
while(num)
{
buf[i++] = num % 10 + '0';
num /= 10;
}
int len = n > 0 ? i : ++i;
str[len] = '\0';
if (n < 0)
{
j = 1;
str[0] = '-';
}
for (; j < len; ++j)
{
str[j] = b... | true |
bb6231cde3e757466cee54b4160dd06f61fe4731 | C++ | Crawping/JE | /JE/Engine/Common/MathHelper.h | UTF-8 | 10,452 | 2.890625 | 3 | [] | no_license | //***************************************************************************************
// MathHelper.h by Frank Luna (C) 2011 All Rights Reserved.
//
// Helper math class.
//***************************************************************************************
#ifndef MATHHELPER_H
#define MATHHELPER_H
#include <W... | true |
2fb59f56aada0bb8a31a4e5daf5e9deada147f08 | C++ | linhphan98/C-_DataStructure | /Stack/infixToPosfix.cpp | UTF-8 | 4,417 | 4.09375 | 4 | [] | no_license | // order of operation
// 1) Parentheses() {} []
// 2) Exponents (right to left)
// 3) Multiplication and division (left to right)
// 4) Addition and subtraction (left to right)
// infix prefix postfix
// 2+3 +2 3 2 3 +
// p-q -p q p q -
// a+b*c +a *b c abc * +
#include <iostream>
#include <stack>
#i... | true |
eb3b08e077336f2d47eed4cf42b0021776a961e9 | C++ | RyanHealy11/practice | /Project4/Source.cpp | UTF-8 | 2,693 | 3.046875 | 3 | [] | no_license | #include <iostream>
int main()
{
/*
int input1 = -1;
std::cout << "Give me a number between 1 and 100 " << std::endl;
std::cin >> input1;
if (input1 < 50)
{
std::cout << "That is a small number" << std::endl;
}
else if (input1 == 50)
{
std::cout << "your number is a balenced number" << std::endl;
}
el... | true |
0fb6375abbc2cf17cd2a4fe0ad6c5dc6de8820d0 | C++ | dustin-biser/FluidSim | /external/Synergy/include/Synergy/Graphics/ShaderException.hpp | UTF-8 | 505 | 2.78125 | 3 | [] | no_license | /**
* ShaderException
*/
#pragma once
#include <exception>
#include <string>
namespace Synergy {
using std::string;
class ShaderException : public std::exception {
public:
ShaderException(const string & message)
: errorMessage(message) { }
virtual ~ShaderException() noexcept { ... | true |
7a6a7f65566e9b0eac000c88361f2e96d33964e6 | C++ | tonyskjellum/TEPPP | /main/wr_mpi.cpp | UTF-8 | 1,275 | 2.5625 | 3 | [] | no_license | #include "../include/funcs.h"
#include "mpi.h"
using namespace std;
int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
int rank, size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int num_chains = stoi(argv[3]);
int chain_length = stoi(argv[2]);
int ... | true |
37cd69f0f3470e1c73a7a5dbb8e3835433a6ea4d | C++ | RizkyKhapidsyah/SK-Lib-cmath-sqrt-Bagian6__CPP | /SK-Lib-cmath-sqrt-Bagian6__CPP/Source.cpp | UTF-8 | 357 | 2.53125 | 3 | [] | no_license | #include <cmath>
#include <iomanip>
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
long long int val1 = 1000000000000000000;
long long int val2 = 999999999999999999;
cout << fixed << setprecision(12) << sqrt(val1) << endl;
cout << fixed << setprecision(12) << sqrt(val2) << e... | true |
9cf1c9b82003e647eaa25ccd67b3e93d4d34d08b | C++ | edouarda/boost_processes | /boost/processes/scheduler.hpp | UTF-8 | 4,310 | 2.625 | 3 | [] | no_license |
#pragma once
#include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
#include <boost/container/flat_set.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/thread/mutex.hpp>
namespace boost
{
namespace processes
{
namespace detail
{
template <typename Platform>
class scheduler : public boost::nonco... | true |
9e16209061c125b719ba7d67213427a4bba8a02d | C++ | sudeshpawar008/QtOpenGL | /OpenGL/openglspotlight.cpp | UTF-8 | 879 | 2.96875 | 3 | [] | no_license | #include "openglspotlight.h"
#include <KMath>
OpenGLSpotLight::OpenGLSpotLight() :
m_depth(20.0f)
{
setInnerAngle(15.0f);
setOuterAngle(30.0f);
}
float OpenGLSpotLight::CalculateScalar(int segments)
{
float segArcLength = Karma::Pi / segments;
float yAxisLength = Karma::sec(segArcLength);
return std::ab... | true |
5c516a4e43fa1ce2ac170325d9164fdeb88c36fe | C++ | WhiZTiM/coliru | /Archive2/d6/fb1901dd868be3/main.cpp | UTF-8 | 246 | 2.671875 | 3 | [] | no_license | struct A
{
const A& operator=(const A&){ return A(); }
};
struct B : A
{
const B& operator=(const B&){ return B(); } //What does that function have to do with the function defined in another class (in our case it's A)?
};
int main(){ } | true |
802429337a386afa2cac1ede93ca582444291b30 | C++ | LuuuuuG/MyLeetCode | /Source/232_Implement Queue using Stacks.cpp | UTF-8 | 1,699 | 4.125 | 4 | [] | no_license | #include <iostream>
#include <stack>
using namespace std;
/*
Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.
pop() -- Removes the element from in front of queue.
peek() -- Get the front element.
empty() -- Return whether the queue is empty.
Example:
MyQueue... | true |
475805475f5b6167a0b60ba6fcb01dd8f6a83f47 | C++ | justinmichaud/raytracer | /Main.cpp | UTF-8 | 6,798 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <vector>
#include "Vector.h"
class Camera {
public:
Vec pos = Vec(0,0,0);
Vec up = Vec(0,1,0);
Vec right = Vec(1,0,0);
Vec forward = Vec(0,0,1);
float f = 1;
};
class Sphere {
public:
Vec pos = Vec(0,0,0);
float radius = 0.5;
Vec colour = V... | true |
6be74a3d5cdb1ad7d99ee82d8e08fbe960a84987 | C++ | josephding23/DataAnalysis | /adams2.cpp | UTF-8 | 1,998 | 3.015625 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
const int N = 1000;
double Func(double x, double y) {
return y - 2 * x / y;
}
double Solve(double x) {
return sqrt(1 + 2 * x);
}
int main() {
double x0, y0, K1, K2, K3, K4, h, yp, Yp;
double x[N], y[N], Y[N];
int N, n = 4... | true |
59429e4c12a3552f0dbbd10a2e99655d3db9ef35 | C++ | mradziwilko/NSCC2019 | /Semester 3/C++/Assignment 2/project.cpp | UTF-8 | 8,374 | 4.03125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
//movie struct definition
struct movie {
string name;
string director;
int year;
float rating;
float price;
int views;
int renter;
string dueDate;
};
void addMovie(vector<movie>& movies);... | true |
3308635bd85687428ba12393fa974235cd03ab48 | C++ | marco-c/gecko-dev-comments-removed | /third_party/libwebrtc/third_party/abseil-cpp/absl/random/poisson_distribution.h | UTF-8 | 5,611 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"Apache-2.0"
] | permissive |
#ifndef ABSL_RANDOM_POISSON_DISTRIBUTION_H_
#define ABSL_RANDOM_POISSON_DISTRIBUTION_H_
#include <cassert>
#include <cmath>
#include <istream>
#include <limits>
#include <ostream>
#include <type_traits>
#include "absl/random/internal/fast_uniform_bits.h"
#include "absl/random/internal/fastmath.h"
#inclu... | true |
af8e65dfbc1c550486c68f6e38e40a033ef12d76 | C++ | seuczk/cpp-primer | /chapter3/3_19.cpp | UTF-8 | 284 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> ivec1(10, 42);
vector<int> ivec2{42, 42, 42, 42, 42, 42, 42, 42, 42, 42};
vector<int> ivec3;
for (int i=0; i < 10; ++i)
ivec3.push_back(42);
//Obviously, the first is the best!
return 0;
}
| true |