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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
be6f40eab10a617797ffad4ea45284071f31aef7 | C++ | nanlan2017/lang-cpp | /TemplateLang/haskell_subset.h | GB18030 | 5,310 | 3.125 | 3 | [] | no_license | #ifndef h_haskellsubset
#define h_haskellsubset
#include "for_test_use.h"
#include <string>
/*
"ͨ"/) Ҫдǰ桪 HaskellͬHaskellǰǰֻҪƥ䵽ãͨ䶼д
C++ requires template specialization to follow the templates general definition (or declaration, as well see later).
The pattern matching of arguments in C++ does not follow the order of... | true |
4b7e992fb0d17356ae18cf546fbc1e2d9baceb10 | C++ | thenewguy39/OOP-in-CPP | /INHERITANCE/41.cpp | UTF-8 | 1,623 | 3.65625 | 4 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
class Person{
private:
char *name;
int age, height;
public:
Person():age(0),height(0){
strcpy(name, "x");
}
Person(char* s, int a, int h):age(a),height(h) {
name = s;
}
void set(char* n, int a, int h) {
name = n;
age = a;
heigh... | true |
3334de25afb016d9b402ea8030aa8ec23db988f0 | C++ | bradlarsen/switchback | /src/search/Node.hpp | UTF-8 | 2,737 | 3.484375 | 3 | [] | no_license | #ifndef _NODE_HPP_
#define _NODE_HPP_
template <
class StateT,
class CostT
>
class Node
{
public:
typedef StateT State;
typedef CostT Cost;
private:
const Node<State, Cost> *parent;
State state;
Cost g;
Cost h;
#ifdef CACHE_NODE_F_VALUE
Cost f;
#endif
public:
Node(const State &s,
Cost ... | true |
28629e4da1c03a0664959ca4023463c7696b8d86 | C++ | dctucker/neural-tetris | /neuralfloat.cc | UTF-8 | 5,198 | 2.875 | 3 | [] | no_license | #define WeightI(i,j) weightIn[i*Ninputs+j]
#define WeightO(i,j) weightOut[i*Nhidden+j]
class NeuralNet {
private:
float *output, *hidden,
*weightIn,*weightOut,
*biasHid,*biasOut,
*errorHid, *errorOut;
int Ninputs,Nhidden,Noutputs;
public:
float *input,*target;
float bias, eta,RMSE;
priva... | true |
848066fd94f6515549d2760a0f289d8e7bed85f5 | C++ | deryrahman/if2210-virtual-zoo | /C++/VZ03/src/AnimalType/Species/puma.cpp | UTF-8 | 1,024 | 2.921875 | 3 | [] | no_license |
#include "../../../include/AnimalType/Species/puma.h"
using namespace std;
/** @brief constructor
* tanpa parameter
*/
Puma::Puma(){
setBioType('L');
setDietType('C');
setWeight(180);
setTamed(false);
setName("Puma");
Flexibility = 5;
}
/** @brief constructor
* @param _Fl... | true |
b1fcabf8f900047e4a8f9d7412976dc1b0701528 | C++ | leolnid/itmo-cpp-2018 | /(task_8)game_context/headers/functions.h | UTF-8 | 564 | 2.96875 | 3 | [] | no_license | #pragma once
/////TASK 2
typedef int*(*resultFunction)(char const*);
typedef int(*otherFunction)(double);
typedef resultFunction (*complexFunction)(int, otherFunction);
/////TASK 3
template<class T, class R>
bool compare(const T& first, const T& second, R (T::*temporaryFunction)() const) {
return ((first.*tempora... | true |
bbc86d6d7188c29c208884236b91ea1a50cb7cb0 | C++ | bentzirozen/project | /src/Interpeter/Lexer.h | UTF-8 | 664 | 2.515625 | 3 | [] | no_license | //
// Created by bentzirozen on 12/17/18.
//
#ifndef PROJECT_LEXER_H
#define PROJECT_LEXER_H
#define SPECIAL_OPERATOR {"+","-","*","/", "\"","<",">","<=",">=","=="}
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#define SEPARATOR " "
#define ASSERTSEPAR "="
using namespace std;
clas... | true |
29e4fae788c06c04dbbd29253f49128f2c520778 | C++ | GeoffreyHervet/epitek | /2/piscine/piscine_cpp_d10-2015-hervet_g/ex00/Sorcerer.cpp | UTF-8 | 1,054 | 2.875 | 3 | [] | no_license | //
// Sorcerer.cpp for ex00 in /home/hervet_g/piscine/piscine_cpp_d10-2015-hervet_g/ex00
//
// Made by geoffrey hervet
// Login <hervet_g@epitech.net>
//
// Started on Fri Jan 13 09:59:00 2012 geoffrey hervet
// Last update Fri Jan 13 09:59:00 2012 geoffrey hervet
//
#include <iostream>
#include "Sorcerer.hh"
Sor... | true |
bfa2121dc8369126c90e5940ad372fd0cfb8df52 | C++ | jsheo96/OpenGLAssn3 | /bullet.cpp | UTF-8 | 3,415 | 2.71875 | 3 | [] | no_license | #pragma once
#include "bullet.hpp"
#include <cmath>
#include <iostream>
#include <glm/mat4x4.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "objloader.hpp"
#include "shader.hpp"
#include "map.hpp"
#include "player.hpp"
#define PI 3.141592f
using namespace std;
extern bool map_bullet[ArrSize][ArrSize];
extern boo... | true |
3d96cff76ed969caf83c48347410bada749f69cd | C++ | Iggytung/GeneralRegressionNeuralNetwork | /src/grnn.cpp | UTF-8 | 864 | 3.109375 | 3 | [] | no_license | #include <cmath>
#include <iostream>
#include "grnn.h"
const double activator(const std::vector<double> input, const std::vector<double> x, const double sigma) {
double distance = 0;
for(int i = 0; i < input.size(); i += 1) {
distance += std::pow(input[i] - x[i], 2);
}
return std::exp(-distance / std::pow(sigma,... | true |
7991de1ba57e1d4b3084fc96378919ccef22731e | C++ | kks227/BOJ | /3000/3009.cpp | UTF-8 | 342 | 2.796875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int x[4], y[4];
for(int i=0; i<3; i++)
cin >> x[i] >> y[i];
if(x[0] == x[1]) x[3] = x[2];
else if(x[1] == x[2]) x[3] = x[0];
else x[3] = x[1];
if(y[0] == y[1]) y[3] = y[2];
else if(y[1] == y[2]) y[3] = y[0];
else y[3] = y[1];
cout << x[3] << ' ' << y[3] ... | true |
0e561e5404bc9fc07acf3948fd98b65781e847a3 | C++ | mathurinm/Sudoku-Centrale | /SudokuSolver/TwoOutOfThreeColumnVisitor.cpp | UTF-8 | 4,923 | 3.15625 | 3 | [] | no_license | #include "TwoOutOfThreeColumnVisitor.h"
#include "NineHolder.h"
#include "ValueEliminator.h"
#include <set>
using namespace std;
TwoOutOfThreeColumnVisitor::TwoOutOfThreeColumnVisitor()
{
}
TwoOutOfThreeColumnVisitor::~TwoOutOfThreeColumnVisitor()
{
}
//This method is quite similar to TwoOutOfThreeRowVisitor::Visi... | true |
d2f6356c13b4b0bb1b2a4aea06b5feea580e61b5 | C++ | kulate/leetcode | /src/leetcode1248.cpp | UTF-8 | 685 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int numberOfSubarrays(vector<int>& nums, int k) {
vector<int> idx;
idx.push_back(-1);
for (int i = 0; i < nums.size(); i++)
if (nums[i] & 1) idx.push_back(i);
idx.push_back(nums.size());... | true |
7493e97b154c59f0e6615f68d46999c513b9ced0 | C++ | PraneshASP/COMPETITVE-PROGRAMMING | /LEETCODE/ALL PROBLEMS/654.cpp | UTF-8 | 776 | 3.359375 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | #include <bits/stdc++.h>
using namespace std;
// Definition for a binary tree node.
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution
{
public:
TreeNode *constructMaximumBinaryTree(vector<int> &nums, int start = 0, in... | true |
c97b43870636959947564db75cfa30b2bc1f68a6 | C++ | rollfatcat/ProblemSet | /演算法題型分類/Dynamic-Program/應用題/數列相關/e562-UVa11401.cc | UTF-8 | 686 | 3.046875 | 3 | [] | no_license | /* 給 N根長度為1、2 ...、N的棍子,任選3根可以構成三角形的方法數
* 標準動態規劃解, 狀態轉移:
* 1. (不選定最長邊 N ) = N-1 根的方法數
* 2. (選定最長邊 N ) = 枚舉剩餘2根的選取方法數
* N-1時可以搭配 (2...N-2)
* N-2時可以搭配 (3...N-3)
*/
#include<bits/stdc++.h>
using namespace std;
const int MaxN=1000000;
long cnt[MaxN+1]={}; // 注意方法數需要longlong儲存... | true |
099f6cdb34431076b658c6d41e78ceb8d7697a86 | C++ | odnaks/Codeforces | /B/266b.cpp | UTF-8 | 446 | 2.671875 | 3 | [] | no_license | //29.01.19 @odnaks
#include <iostream>
using namespace std;
int main()
{
int n;
int t;
char temp;
cin >> n >> t;
char a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
if (n < t)
t = n;
for (int i = 0; i < t; i++)
{
for (int j = 0; j < n; j++)
{
if (a[j] == 'B' && a[j + 1] == 'G')
{
temp = a[... | true |
ffa360bc7e55384e0de47de898498896de8f5ffa | C++ | josephkott/subshift | /mex/functions.h | UTF-8 | 762 | 2.796875 | 3 | [] | no_license | #ifndef FUNCTIONS_H_
#define FUNCTIONS_H_
#include <cmath>
#include "Point.h"
using namespace NR;
using namespace std;
// NLS with piecewise constant nonlinearity with absence of linear potential.
// Equation for nonlinear stationary modes:
// u_{xx} + \mu u + \sigma(x) u^3 = 0
// where \sigma(x) = -1, x \in [0, L_1... | true |
f7ec9a3f9bb84c86030217a9bbd63ae90e3a8cb4 | C++ | Rr1901/C-with-DS | /Opensource Programs/max_path_sum.cpp | UTF-8 | 526 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | class Solution {
private :
int solve(TreeNode* root, int& res){
if(root==nullptr){
return 0;
}
int l=solve(root->left,res);
int r=solve(root->right,res);
int temp=max(max(l,r)+root->val,root->val);
int ans=max(temp, l+r+... | true |
042c81722e5fa70efd6f2a7c514d2296de4ee9f0 | C++ | Mit25/BoatmanProblem | /greedy1.cpp | UTF-8 | 361 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int findTime(int arr[], int n){
if(n<=2)
return arr[n-1];
int i,ans=0;
for(i=1;i<n;i++)
ans += arr[i];
ans += (n-2)*arr[0];
return ans;
}
int main() {
int n;
cin >>n;
int arr[n];
int i;
for(i=0;i<n;i++)
cin >>arr[i];
cou... | true |
f22144f989c6c23cbeded365d2f764e04c6fe143 | C++ | hinike/The-Nature-of-Cinder | /Chapter02_Forces/Ex24FluidResistance/src/Mover.cpp | UTF-8 | 1,250 | 2.890625 | 3 | [] | no_license | //
// Mover.cpp
// Ex24FluidResistance
//
// Created by Ilya Rostovtsev on 7/6/13.
//
// HWH Maintenance 8/17/13
//
#include "Mover.h"
Mover::Mover( const float mass_, const float x, const float y )
: location{ x, y },
velocity{ Vec2f::zero() },
acceleration{ Vec2f::zero() },
mass{ mass_ },
radius{ mass *... | true |
8008b1e5c885d2a367c20b084e9af4c38d583486 | C++ | ghj0504520/UVA | /11700/11777.cpp | UTF-8 | 541 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int r;
cin>>r;
for (int t = 0; t < r; ++t)
{
int G[4];
cin>>G[0]>>G[1]>>G[2]>>G[3];
int T[3];
cin>>T[0]>>T[1]>>T[2];
sort(T,T+3);
int sum=G[0]+G[1]+G[2]+G[3]+(T[2]+T[1])/2;
cout<<"Case "<<t+1<<": ";
if(sum>=90)
{
cout<<... | true |
9cc28ce8db68b2b1ca1436aa136c05d64f30efff | C++ | erdoukki/PraeTor | /Tools/WebSvcApp/include/Tools/WebSvcApp/WebSvcApp.h | UTF-8 | 4,475 | 2.578125 | 3 | [] | no_license | #ifndef INCLUDE_SERVICESLIBS_WEBSVCAPP_WEBSVCAPP_H_
#define INCLUDE_SERVICESLIBS_WEBSVCAPP_WEBSVCAPP_H_
// C++
#include <string>
// Boost
#include <boost/noncopyable.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/shared_ptr.hpp>
// Tools
#include "Tools/Configuration/Configuration.h"
#... | true |
0461354456dec246438857b83542092349f253fb | C++ | AliA1997/Halo-React-Hooks-Graphql | /server/utils/cppsrc/src/classes/postInput.cpp | UTF-8 | 2,722 | 2.828125 | 3 | [] | no_license | #include "postInput.h"
PostInput::PostInput(std::string title, std::string image, std::string dateCreated, std::string dateUpdated, int deletedInd, int permanentlyDeletedInd, std::string userId) {
this->title_ = title;
this->image_ = image;
this->dateCreated_ = dateCreated;
this->dateUpdated_ = dateUpd... | true |
bd94ea2c79f3a4992158df1f9dbbf35529be6c8d | C++ | hideindark/CCpp2017 | /practices/cpp/level1/p06_CircleAndPoint/CircleAndPoint.cpp | UTF-8 | 386 | 3.265625 | 3 | [] | no_license | #include<iostream>
#include<cmath>
void draw(point p,int size)
class point
{
private:
int cx;
int cy;
public:
void move(int x1,int y1)
{
cx+=x1;
cy+=y1;
}
point(int x1,int y1):cx(x1),cy(y1){}
}
int main()
{
int size=3;
point center(5,5);
draw(cen... | true |
c356f14d5b132881d9de4bb331a12133e2b77a40 | C++ | Ricky-Robot/CPCFI | /UVa/1. Introduction/Splitting Numbers/SplittingNumbers.cpp | UTF-8 | 487 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <bitset>
#define max 32
using namespace std;
int main(){
int n;
bool flag;
bitset<max> a;
bitset<max> b;
while(cin >> n, n != 0){
bitset<max> number(n);
flag = true;
for(int i = 0; i < max; i++){
if(number.test(i)){
if(flag){
a.set(i, true);
flag = false;
... | true |
a9dc2e47e57aa2e3cb98de7d23285afe1f27a052 | C++ | young1928/Cpp | /leetcode/打家劫舍 II.cpp | GB18030 | 1,656 | 3.28125 | 3 | [] | no_license | class Solution {
public:
int rob(vector<int>& nums) {
int n = nums.size();
if(n == 1)
return nums[0];
return max(check(nums,0,n - 2),check(nums,1,n - 1));
}
int check(vector<int>& nums,int le,int ri) {
int f_0 = 0, f_1 = 0;
for(int i = le; i ... | true |
64527acde2bedde91461916120c84c1efb2c8157 | C++ | guowee/minicap-YUV | /jni/minicap-shared/aosp/include/Minicap.hpp | UTF-8 | 3,773 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #ifndef MINICAP_HPP
#define MINICAP_HPP
#include <cstdint>
class Minicap {
public:
enum CaptureMethod {
METHOD_FRAMEBUFFER = 1,
METHOD_SCREENSHOT = 2,
METHOD_VIRTUAL_DISPLAY = 3,
};
enum Format {
FORMAT_NONE = 0x01,
FORMAT_CUSTOM = 0x02,
FORMAT_TRANSLUCENT ... | true |
5100ba1c3de9b2adf359a0c90d008b74a4c6eae4 | C++ | sinjar666/nokia-n900-workspace | /modules/data-model/surgery.h | UTF-8 | 624 | 2.515625 | 3 | [] | no_license | #ifndef SURGERY_H
#define SURGERY_H
#include <QObject>
#include <QString>
#include <QDate>
#define ID_TYPE QString
class Surgery : public QObject
{
Q_OBJECT
ID_TYPE *id;
QString *details;
QDate *date;
QList<ID_TYPE> *linkedTo;
public:
explicit Surgery(QObject *parent = 0);
~Surgery();
... | true |
c89bef493b80b833545893c802e05336e4633b90 | C++ | Yunping/leetCode | /ReverseNodesInk-Group.h | UTF-8 | 2,376 | 3.703125 | 4 | [] | no_license | /*
Problem: Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
You may not alter the values in the nodes, only nodes itself may be changed.
Onl... | true |
3e4cbc720bbed6da2f312b25992a01df4a64e62e | C++ | iNotacat/CyberEngineTweaks | /src/common/Meta.h | UTF-8 | 978 | 2.921875 | 3 | [
"MIT"
] | permissive | #pragma once
// Source: https://stackoverflow.com/questions/4041447/how-is-stdtuple-implemented
template<std::size_t i, typename Item>
struct MetaArrayEntry
{
Item value;
};
template<std::size_t i, typename... Items>
struct MetaArrayImpl;
template<std::size_t i>
struct MetaArrayImpl<i> {};
template<std::size_t ... | true |
3a75ecb91eb5c46435eb0a0d7bd796dbddb5db8d | C++ | snowrain10/BOJ | /2577.cpp | UTF-8 | 506 | 3.03125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int s[10];
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int a, b, c;
// 세 수의 입력, 한 줄에 하나씩
cin >> a >> b >> c;
// a,b,c : 100 ~ 1000 (보다 작음)
int d = a*b*c;
while(d) {
// d%10 = 1의 자리
s[d % 10]++;
// 다음 1의 자리를 뽑아내... | true |
a79a1f034631264ed5eeaa0425bd7e3a3488f7ab | C++ | YanjieHe/RegularExpression | /src/DFA.cpp | UTF-8 | 10,478 | 2.984375 | 3 | [] | no_license | #include "DFA.hpp"
#include <stack>
#include <stdexcept>
namespace regex
{
u32string UnicodeRange::ToString() const
{
if (IsEpsilon())
{
return U"ε";
}
else if (rangeType == RangeType::LineBegin)
{
return U"^";
}
else if (rangeTyp... | true |
dc102e460b18bacc69f1fb53b9ee7ab8442c7b04 | C++ | bryding/Playlist-Helper | /Sources/MyHash.cpp | UTF-8 | 5,161 | 3.296875 | 3 | [] | no_license | #include "MyHash.h"
MyHash::MyHash(){
table.reserve(TABLE_SIZE);
}
int MyHash::hashing(string key){
const char* temp = key.c_str();
int c;
unsigned int hash = 5381;
while(c = *temp++){
hash = ((hash << 5) + hash) + c;
}
return hash;
}
void MyHash::insert(string key... | true |
fe7fccd268101b779c805d46a84994158e631295 | C++ | mark-tilton/quoridor | /game/src/vectord.cc | UTF-8 | 997 | 3.203125 | 3 | [
"MIT"
] | permissive | #include "vectord.h"
#include "vectori.h"
using namespace std;
Vectord::Vectord() : Vectord(0, 0) {
}
Vectord::Vectord(const double x, const double y) : x(x), y(y) {
}
Vectord::Vectord(const Vectori& vector) : x(vector.x), y(vector.y) {
}
Vectord Vectord::operator+(const Vectord &v) const {
return Vect... | true |
4e2ee7e4dfa1a51aca526eec062313d571333762 | C++ | araetoro/C-Plus-Plus-Final-Project | /Roster.cpp | UTF-8 | 7,346 | 3.171875 | 3 | [] | no_license | #include"Degree.h"
#include"Roster.h"
#include"NetworkStudent.h"
#include"SecurityStudent.h"
#include"SoftwareStudent.h"
#include<iostream>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
Roster::Roster() {}
//Deconstructor
Roster::~Roster() {}
//Updateing the class roste... | true |
ca2b4f9aec7b412c737234ca58a7e5764a25ab69 | C++ | naiyer-abbas/Code-Forces | /Contests/18 MRACH 2021/B.cpp | UTF-8 | 1,948 | 2.546875 | 3 | [] | no_license | #pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007
int main()
{
fast;
int t;
cin >... | true |
11a2d802007c39ca084bebeec24c1f9498ae3725 | C++ | aphilippe/ClappLauncher | /src/FileSystem/Operations/ReadInformationOperationUnix.cpp | UTF-8 | 385 | 2.546875 | 3 | [
"MIT"
] | permissive | #include "ReadInformationOperation.h"
#ifndef WIN32
#include <unistd.h>
#include <sys/stat.h>
using file_system::operations::ReadInformationOperation;
using file_system::Path;
bool ReadInformationOperation::isExecutable(const Path & path) const
{
struct stat st;
if (stat(path.stringValue().c_str(), &st) < 0... | true |
1fb0fddd685e0016683b2d0e691905839a748950 | C++ | Imagine-Programming/hindsight | /hindsight/Process.cpp | UTF-8 | 6,242 | 3.28125 | 3 | [
"MIT"
] | permissive | #include "Process.hpp"
using namespace Hindsight::Process;
/// <summary>
/// Construct a new process based on a const reference to a <see cref="PROCESS_INFORMATION"/> instance, a path, a working directory and program arguments.
/// </summary>
/// <param name="pi">A const reference to a <see cref="PROCESS_INFORMATION"/... | true |
4f0113e4a1a9a44b25c156c94fccca74053b6881 | C++ | ali-bibak/corrida | /src/Intelligence.cpp | UTF-8 | 22,868 | 2.859375 | 3 | [] | no_license | /***********************************************
Intelligence.cpp
Artificial Intelligence source for Corrida
by: Ali Bibak
last modified: Jul 20, 2014
***********************************************/
#include "Intelligence.h"
// bfi's for bfsMonster and bfsStars
int bfiM[8][8], bfiS[8][8];
// check if the ... | true |
f350716dca3f46efa081de28e0c95ce583b55f46 | C++ | JohnMichaelTO/VehiclesLocation | /ClassExemplaire.cpp | UTF-8 | 711 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "ClassVehicule.h"
#include "ClassExemplaire.h"
using namespace std;
ClassExemplaire::ClassExemplaire()
{
}
ClassExemplaire::ClassExemplaire(unsigned int numero, ClassVehicule *vehicule, unsigned int Km, std::string couleur, bool disponible)
{
_numero = numero;
_... | true |
1282bab2228f2973694ab07b4c584c838e8ffcce | C++ | Lujie1996/Leetcode | /837. New 21 Game/837. New 21 Game/main.cpp | UTF-8 | 774 | 3.0625 | 3 | [] | no_license | //
// main.cpp
// 837. New 21 Game
//
// Created by Jie Lu on 2018/10/27.
// Copyright © 2018 Jie Lu. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
double new21Game(int N, int K, int W) {
if (K == 0) {
return 1.0;
}
vector<double> dp(N+1, 0);
dp[0]... | true |
fc98f74cfb349035dd1b49ea28ba84735554ee96 | C++ | eliberumen27/CSCI2270 | /Homework:Quizzes/Lab7Trees.cpp | UTF-8 | 2,769 | 3.796875 | 4 | [] | no_license | /*
Elijah Berumen
Lab 7
Instructor: Boese
*/
#include <iostream>
using namespace std;
struct Node
{
int key;
Node* left;
Node* right;
};
//function prototypes
Node* addNode(Node* root, int value);
void addHelper(Node* root, Node* newNode);
int getSize(Node* root);
int getMinValue(Node* root);
int getMaxDepth(Node* ... | true |
36463643fc81632c4894ceeec13094ac03c3e066 | C++ | jinhoyoo/GameCodeTest | /GameCodeTest/AnimationPlaybackTest.cpp | UTF-8 | 2,360 | 3.125 | 3 | [] | no_license | //
// AnimationPlaybackTest.cpp
// GameCodeTest
//
// Created by Jinho Yoo on 10/13/14.
// Copyright (c) 2014 Jinho Yoo. All rights reserved.
//
#include <math.h>
#include "PingPongLoopingAnimationController.h"
#include "GameCodeException.h"
#include "gtest/gtest.h"
const float fDiff = 0.1;
TEST(PingPongLooping... | true |
d5899e62f8821e4f7ca654820206d5f7173ebffa | C++ | jpeasgood/aalib | /headers/singleton.h | UTF-8 | 491 | 2.953125 | 3 | [] | no_license | #ifndef AA_SINGLETON_H
#define AA_SINGLETON_H
namespace aa
{
template<typename T>
class singleton
{
public:
static T *get_instance()
{
static T instance;
return &instance;
}
protected:
singleton() = default;
~singleton() = default;
private:
singleton(const singleton &other) = delet... | true |
c05f08ad64fc18c1948cd1835332b4876eecf645 | C++ | pmichaeldev/Ray-Tracer | /Ray-Tracer/Ray-Tracer/Triangle.h | UTF-8 | 1,320 | 3.28125 | 3 | [] | no_license | /*
* TRIANGLE SHAPE THAT INHERITS FROM GEOMETRY
*/
#ifndef TRIANGLE_H
#define TRIANGLE_H
#include "CommonIncludes.h"
#include "Geometry.h"
#include "Plane.h"
#include <vector>
class Triangle : public Geometry {
private:
vector<vec3> vertices; // The vertices that make up the triangle
Plane* plane; // A triangle also... | true |
a94a6cd0fe3fe986e0aa08fabbd8bcfdd1e71d36 | C++ | Code-Cube-NITP/Competitive-Programming | /monis_code.cpp | UTF-8 | 4,150 | 2.515625 | 3 | [] | no_license | // g++ monis_code.cpp -o monis_code && ./monis_code
/* ....!!!JAI SAI RAM!!!.... */
/* Writing Segment tree god support me*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll prime[1000001];
void seive()
{
ll i,j,k,l,m,n,o,p... | true |
2611c976a6850a3b71fd39987c208ff5c586672a | C++ | tbhova/YSU-Micromouse-SAC-2017 | /src/src/motor.cpp | UTF-8 | 702 | 3.21875 | 3 | [] | no_license | #include "motors.h"
Motors::Motor::Motor(const int forward, const int reverse, const int speed) {
forwardPin = forward;
reversePin = reverse;
speedPin = speed;
}
void Motors::Motor::coast() {
digitalWriteFast(forwardPin, HIGH);
digitalWriteFast(reversePin, HIGH);
}
void Motors::Motor::brake() {
... | true |
696ff5032838472ba7445250d288dc6ca6d63e45 | C++ | AutumnKite/Codes | /Codeforces/1728E Red-Black Pepper/std.cpp | UTF-8 | 1,277 | 2.625 | 3 | [] | no_license | #include <bits/stdc++.h>
int exgcd(int a, int b, int &x, int &y) {
if (b == 0) {
x = 1, y = 0;
return a;
}
int g = exgcd(b, a % b, y, x);
y -= a / b * x;
return g;
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> w(n);
l... | true |
dab2512a65aa4268b6302bc4713241e9fb9eccd3 | C++ | Shobhit130/OOPS | /multipath.cpp | UTF-8 | 2,254 | 3.375 | 3 | [] | no_license | // #include <iostream>
// using namespace std;
// class person
// {
// public:
// char name[100];
// int code;
// void input()
// {
// cout<<"\nEnter the name of the person : ";
// cin>>name;
// cout<<endl<<"Enter the code of the person : ";
// cin>>code... | true |
6c4d7095e9a3d9d734a75714a6a53eaef37af6c2 | C++ | adfilm2/algorithm | /전호설/Programmers/뉴스클러스터링.cpp | UTF-8 | 1,164 | 3.03125 | 3 | [] | no_license | #include <string>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
string a;
string b;
int up;
int down;
map<string, int> Hash;
void strSet()
{
int len = a.size();
for (int i = 0; i < len - 1; i++)
{
string temp = "";
if (!(a[i] >= 'A'&&a[i] <= 'Z')) { temp = ""; continue; }
if (!(a... | true |
887971a2f06f5ce1dfed549b63b20df1471b90fe | C++ | Legend-sky/vscode | /hdu-1013.cpp | GB18030 | 345 | 2.875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
char s[1000];
int res,i;
while(cin >> s){ //cin.getline(s,1000)ᱨ
if(s[0] == '0'){
break;
}
res = 0;
for(i = 0; s[i] != '\0'; i++){
res += s[i] - '0';
if(res > 9){
res = res % 10 + res / 10;
}
}
cout << res << endl;
}
}
| true |
4c233cab5d34713068bae47b901133736c41465e | C++ | Aomandeyi/Cpp-0-1-Resource | /第5阶段-C++提高编程资料/提高编程能力资料/代码/第三阶段-录制代码/01 常用遍历算法/01 常用遍历算法/01 常用遍历算法_for_each.cpp | GB18030 | 666 | 3.375 | 3 | [] | no_license | //#include<iostream>
//using namespace std;
//#include<vector>
//#include<algorithm>
//
////ñ㷨 for_each
//
////ͨ
//void print01(int val)
//{
// cout << val << " ";
//}
//
////º
//class print02
//{
//public:
// void operator()(int val)
// {
// cout << val << " ";
// }
//
//};
//
//void test01()
... | true |
4bdea89131e0ac385953c58929fb5f6bffd89ca3 | C++ | phepthanthong/AP1 | /TD_Mihu/Semaine11/TP11.cpp | UTF-8 | 703 | 3.71875 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
void substituer(string & mot, char s2, int n) {
for (int i = 0 ; i < mot.length() ; i++)
if (i == n)
mot[i] = s2;
}
int main()
{
string mot, find;
char replace;
int n;
cout << "Entrez le mot : ";
cin >> mot;
cout <... | true |
62f724a97edfb0b2ba9bd3e30c40ec679825cf19 | C++ | DAN-1984/Algoritmi_1 | /Индекс массы тела/Индекс массы тела.cpp | UTF-8 | 945 | 3.328125 | 3 | [] | no_license | // Индекс массы тела.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
// 1. Ввести вес и рост человека.Рассчитать и вывести индекс массы тела по формуле I = m / (h * h); где m - масса
// тела в килограммах, h - рост в метрах.
int main()
{... | true |
e5ace7bb51d30ff68e4b2224dc9490fb200afe6e | C++ | pravirtual/Leetcode | /nandincpp/Maximum Number of Non-Overlapping Subarrays With Sum Equals Target.cpp | UTF-8 | 538 | 2.828125 | 3 | [] | no_license | class Solution {
public:
int maxNonOverlapping(vector<int>& a, int target)
{
set<int> s;
s.insert(0);
int sum = 0;
int ans = 0;
for(auto i : a)
{
sum += i;
if(s.count(sum - target))
{
... | true |
17e0756b54aef60b3311ef18a572e60b3b15e080 | C++ | jiffybaba/Baba | /BABA/Cc/pointers3.cpp | UTF-8 | 221 | 2.9375 | 3 | [] | no_license | //Write a program to print the address of a variable whose value is input from user.
#include "iostream"
using namespace std;
int main()
{
int x;
int *ptr = &x;
cin >> *ptr;
cout << *ptr<<endl;
cout << ptr;
;
}
| true |
247688f6c7ba7e0364b980fdd3d9c0eb6576a5b6 | C++ | dgallitelli/ParadigmesProgramation-TPT | /ServerCPP/MultimediaObject.cpp | UTF-8 | 1,493 | 3.46875 | 3 | [] | no_license | #include "MultimediaObject.h"
/**
* @brief MultimediaObject::getName
* Getter method for the name variable
* @return the name of the object
*/
string MultimediaObject::getName() const
{
return name;
}
/**
* @brief MultimediaObject::setName
* Setter method for the name of the object
* @param _objectName - a... | true |
098c88da1a0fefe4ce0ca8c5fabc1184163f9182 | C++ | tku-iarc/wrs2020 | /disposing/librealsense/examples/cpp-headless.cpp | UTF-8 | 4,728 | 2.578125 | 3 | [
"Apache-2.0",
"Zlib",
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause",
"LGPL-2.1-only",
"BSD-1-Clause",
"MIT"
] | permissive | // License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2015 Intel Corporation. All Rights Reserved.
///////////////////
// cpp-headless //
///////////////////
// This sample captures 30 frames and writes the last frame to disk.
// It can be useful for debugging an embedded system with no display... | true |
3886e25ed90cc3e561b872d3808287d7c4b13c07 | C++ | OpticalTweezers/Optical_Tweezers | /mirror.cpp | UTF-8 | 2,201 | 2.5625 | 3 | [] | no_license | #include "mirror.h"
#include "Light.h"
#include <QTimer>
#include "game.h"
extern Game*game;
Mirror::Mirror(QLineF l){
setPixmap(QPixmap(":/images/mirror.jpg"));
setPos(l.p1());
this->mid_line = l;
this->mid_point = QPointF(0.5*(l.p1().x()+l.p2().x()),
0.5*(l.p1().y()+l.p2(... | true |
efedf12201111fb03c4a634c081e818980a97952 | C++ | yuchaozh/Cracking-The-Coding-Interview | /Chapter 2/2.3/2.3.cpp | UTF-8 | 1,896 | 4.25 | 4 | [] | no_license | /*Question:
*Implement an algorithm to delete a node in the middle of a
*single linked list, given only access to that node.
*EXAMPLE
*Innput:the node 'c' from the linked list a->b->c->d->e
*Result:nothing is returned, but the new linked list like
*a->b->d->e
*
*在删除指定节点的时候,不一定非要让前面那个节点的next指向删除节点的后一个节点
*可以让删除... | true |
6ad5a37f1a80935380b58d54fa90afbfeba64b29 | C++ | BrainSpawnInfosphere/dfec-robot | /robot/TB6612FNG.h | UTF-8 | 2,281 | 3.1875 | 3 | [
"MIT"
] | permissive |
#ifndef __TB6612FNG_H__
#define __TB6612FNG_H__
// #include <Arduino.h>
#include <stdint.h>
/**
* ATmega328P, pwm works on pins 3, 5, 6, 9, 10, and 11 at 490/980Hz
*/
class MotorDriver {
public:
MotorDriver(void){
;
}
void init(int pwmA, int a0, int a1, int pwmB, int b0, int b1, int reset=-1){
p... | true |
d090e2ed4d1a260226c0caea392ec1f6581d11b0 | C++ | bitlucky/hackerrank | /jim-and-the-orders.cpp | UTF-8 | 923 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
// #include <fstream>
using namespace std;
int main() {
// fstream fin("/home/saubhik/problems/jim-and-the-orders-testcases/input/input01.txt");
// fstream fout("output.o");
int n, ti, di;
// fin >> n;
cin >> n;
... | true |
9d9e359683518a775fb0a3c4ccb148590e5e238c | C++ | marccane/Projectes-CPP | /Exercicis EDA/ArbresBinaris Practiques/ArbreBinari.h | UTF-8 | 2,591 | 3.109375 | 3 | [] | no_license | //Marc Cané Salamià
//u1939666
//Pràctica 4
/*******************************************************************************
* Arbre Binari Caracters
*
* Conte totes les operacions, pero nomes cal implementar les necessaries
* Si no es demana el contrari, millor no implementar el destructor.
*
* 2008
* JSS - Act... | true |
60077c0ffcb985d09c69b9d7f57bebdb08b12309 | C++ | emollerstedt/arduino-halloween | /DigitalPin/Examples/RelayToggle/RelayToggle.ino | UTF-8 | 334 | 2.671875 | 3 | [] | no_license | #include <DigitalPin.h>
DigitalPin Relay1(10); // Instantiates a DigitalPin object called "Relay1" that uses pin10
DigitalPin Relay2(11);
void setup() {
Relay1.begin();
Relay2.begin();
}
void loop() {
Relay1.on();
delay(1000);
Relay1.off();
delay(1000);
Relay2.on();
delay(1000);
Relay2.off();
de... | true |
5e6fd9babe7a8b16dbae839d0bd031c3cba116b3 | C++ | PierreINP/ProjetC | /ProjetC/Software/Install/Source/test.cpp | UTF-8 | 652 | 3 | 3 | [] | no_license | /*
This programm is here to perform some functions. It must identify the lexemes, compute them to validate their conformity and then give them a type.
Input : SourceFile.vhd
Output : Data structure
*/
#include"./../Header/Lexeur.h"
#include"./../Header/Lexeme.h"
#define path_size 100
using namespace std;
int main()... | true |
5359e386b18758dd8f66b9a6dd9f091091840258 | C++ | hubert-mazur/Cpp-2019-4th-sem- | /Lokaj/include/Pomieszczenie.h | UTF-8 | 873 | 3.25 | 3 | [] | no_license | //
// Created by hubert on 09.05.19.
//
#ifndef LAB08_POMIESZCZENIE_H
#define LAB08_POMIESZCZENIE_H
#include <string>
#include <iostream>
class Pomieszczenie
{
public:
explicit Pomieszczenie (std::string str) : name (str)
{
std::cout << "Tworze pomieszczenie: " << name << std::endl;
};
void zetrzyj_kurze ()... | true |
3ebeb6f547d3b520d1a95e869bee535bd9176141 | C++ | anandman/ukf | /src/ukf.cpp | UTF-8 | 10,101 | 2.859375 | 3 | [] | no_license | #include "ukf.h"
#include "Eigen/Dense"
#include <iostream>
using namespace std;
using Eigen::MatrixXd;
using Eigen::VectorXd;
using Eigen::IOFormat;
using std::vector;
#define PI 3.14159265358979323
#define PI2 (2.0 * PI)
/**
* Initializes Unscented Kalman filter
*/
UKF::UKF() {
// initially set to false, set t... | true |
454123d23712011f1eebe58cf72ea93f6e5c3ae6 | C++ | chickenfingerwu/Chess-SFML | /Game/include/GUI.h | UTF-8 | 954 | 2.734375 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
#include "Game.h"
/*GUI class to handle all the graphics and inputs from mouse stuff*/
class GUI
{
public:
Game ChessGame;
sf::Event event;
sf::RenderWindow window;
sf::Texture PieceTexture[2][6];
sf::RectangleShape ChessBoard[8][8];
sf::... | true |
68f97ae2fb979a1b8115a14752d2f997accb9ad8 | C++ | LinggYuu/shua-ti | /MINGW&c++/shuangzhizhen.cpp | UTF-8 | 1,626 | 3.109375 | 3 | [] | no_license | // //模板
// for(i=0,j=0;i<n;i++)
// {
// while(j<i&&check(i,j))
// j++;
// //每道题具体逻辑
// }
// // 可用于优化,朴素算法优化到O(n)
// // 输出单词
// // abc def ghi将其输出每个一行
// #include<iostream>
// #include<string.h>
// using namespace std;
// int main()
// {
// char str[1000];
// gets(str);
// int n=strlen(str)... | true |
38f4f2c0028be140113794880c05aa418f330d66 | C++ | vaibhavjain2391/Spoj-Practise | /pebble_solver.cpp | UTF-8 | 1,039 | 3.1875 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
int findRes(char *str, int len);
int main()
{
int count,len,result,num;
char str[1000000];
count=1;
//while(~scanf("%s",str))
while(cin>>str)
{
num=1;
result=0;
len = strlen(str);
//result = findRes(str, len);
for(int i=0;i<len;i++)
{
if(st... | true |
d3687f50172c2693b3abf2a67ec06645ace41596 | C++ | Strel04ka/WORKs31 | /WORK31/WORK31.cpp | WINDOWS-1251 | 805 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x;
double y;
double A;
double B;
cout << "x = ";
cin >> x;
A = 8.1 + pow(x, 3);
//1
if (x < -3.5)
{
B = 1 - pow(x, -5);
}
if (-3.5 <= x && x < 1)
{
B = 1 / tan(x + 1);
}
if (1 <= x)
{
B = atan(2 * x) - log10(x / 2)... | true |
0369ecd71e40d61f6b6030fc9695b682239851da | C++ | dSyncro/Honey | /Projects/Honey/Honey/Renderer/Image.h | UTF-8 | 2,289 | 3.109375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <cstddef>
#include <Honey/Math/Math.h>
namespace Honey {
/**
* @brief Image representation.
*/
class Image {
public:
/**
* @brief Construct Image from its components.
* @param width Image width.
* @param height Image height.
* @param channels Image channels.
*/
Image(... | true |
d8194dc1f9ededbef226363d33fd9e7bd9e87592 | C++ | RayquazaW/cpp_learning | /chapter2/practice5.cpp | UTF-8 | 378 | 3.515625 | 4 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
double transform(double cel);
int main()
{
double cel, fah;
cout << "Please enter a Celsius value: ";
cin >> cel;
fah = transform(cel);
cout << cel << " degrees Celsuis is " << fah << " degrees Fahrenheit.";
cin.get();
cin.get();
return 0;
}
dou... | true |
fe11bc4500f3a9b37c3bed3a70ff7b880dea3298 | C++ | Xiaoyancg/CS307team12 | /editor/src/windows/MapWindow.cpp | UTF-8 | 7,877 | 2.734375 | 3 | [] | no_license | #include "windows/MapWindow.h"
#include "windows/MapEditor.h"
ImVec2 prevClick(0, 0);
// handleClick will return a pointer to a Tile on the current Map based on whether
// a click has occurred, or nullptr
Core::Tile *MapWindow::handleClick()
{
// Calculate the min/max coords of the MapView window
// min/max a... | true |
e763b99f33c5cacdb7fd6646c5100c653a630c2e | C++ | jeanlouhallee/inf3105-tp2 | /Histoire.cpp | UTF-8 | 3,106 | 3.03125 | 3 | [] | no_license | /*
* Histoire.cpp
*
* Created on: Mar 18, 2017
* Author: Bruno Malenfant
*/
#include "Histoire.h"
#include <sstream>
Histoire::Histoire(void) {
}
Histoire::Histoire(string a_titre) :
_titre( a_titre )
{
}
Histoire::Histoire(const Histoire& a_histoire) :
_titre( a_histoir... | true |
c1f38283f7304c4aa3c1e23dcae0815c951851e1 | C++ | seromerol/swarmNoise | /sensibleNeuronDosServos/sensibleNeuronDosServos.ino | UTF-8 | 4,285 | 3.15625 | 3 | [] | no_license | #include <Servo.h>
#define actData 9 //pin (PWM) donde conectar servo/actuador que transmite el dato input
#define senData 0 //pin (A?) donde conectar flexor/sensor que recibe el dato input
#define actWeight 11 //pin (PWM) donde conectar servo/actuador que transmite el peso del input
#define senWeight 1 //pin (A?) dond... | true |
97edc74c378de0f899af17af190aebc9e49fda15 | C++ | tmf/kicker-tacho | /speaker.h | UTF-8 | 1,729 | 2.90625 | 3 | [] | no_license | /*
* Play example using Time3 library.
*
* The sample must be raw 8bits 8KHz, please read README.md.
*
* Juan J. Martinez <jjm@usebox.net>
* https://github.com/reidrac/play-pcm-example
*/
#include <avr/pgmspace.h>
#include "TimerOne.h"
class Speaker
{
static void playISR();
static Speaker * instance;
... | true |
41a477aaffc1f4fa11b74cc04c45eab55b89b6ba | C++ | kkllPreciel/cpp14 | /cpp14/return type deduction for normal functions/main.cpp | SHIFT_JIS | 325 | 3.421875 | 3 | [] | no_license | #include <iostream>
// IuWFNgfĂяoʂ̌^Ag()̖߂l^Ƃ
template <class F>
auto g(F f)
{
return f();
}
int main()
{
// ϐresulť^int
auto result = g([] { return 3; });
std::cout << result << std::endl;
return 0;
} | true |
ec05e74871d44e948d90e03ff9717d472b56759e | C++ | henrywalters/have-some-pi | /Source/Scripts/Blink.hpp | UTF-8 | 554 | 2.578125 | 3 | [] | no_license | #ifndef BLINK_SCRIPT_HPP
#define BLINK_SCRIPT_HPP
#include <wiringPi.h>
#include "../BaseScript.hpp"
#include "../Components/LED.hpp"
class BlinkScript : public BaseScript {
LED* _led;
public:
BlinkScript() : BaseScript("Blink LED") {
_led = NULL;
}
void OnCreate() {
wiringPiSetup()... | true |
8b718f19dceb178db9d9aeb4a7c95bd044121e13 | C++ | DMurataj01/COMS3015-Graphics-Rendering-Engine | /libs/sdw/ModelTriangle.h | UTF-8 | 2,016 | 3.0625 | 3 | [] | no_license | #include <glm/glm.hpp>
#include <Colour.h>
#include <string>
#include "Materials.h"
class ModelTriangle {
public:
glm::vec3 vertices[3];
glm::vec2 vertices_textures[3];
Colour colour;
glm::vec3 normals[3]; // these correspond to the averaged normals of the vertices
MATERIAL material;
... | true |
9f7dc7a0ae34c55ce595f58ce2fb5c4f09051158 | C++ | OrsoEric/2020-07-06-Longan-Nano-RTC-Interrupt | /init.cpp | UTF-8 | 7,822 | 2.828125 | 3 | [] | no_license | /****************************************************************************
** init.cpp
*****************************************************************************
** Board initializations
** >GPIO
** >EXTI
** >ECLIC
****************************************************************************/
/**********... | true |
36fe1fd96ad167569c75c404a751d62bdd4c29a9 | C++ | Antero-Gandra/AEDA | /FinalProj/Project/Participation.h | UTF-8 | 1,347 | 2.875 | 3 | [] | no_license | class Participation {
unsigned int auditionId;
unsigned int place;
unsigned int chiefJudgeGrade;
public:
/**
* @brief Participation Contructor with their audition id, place and the resposible judge's grade
* @param auditionId an unsigned integer
* @param place an unsigned integer
* @param chiefJudgeGrade an uns... | true |
9522c403520125c562bae66fe0f94f0a82602778 | C++ | RobTillaart/Arduino | /libraries/PinOutGroup/PinOutGroup.cpp | UTF-8 | 2,584 | 2.90625 | 3 | [
"MIT"
] | permissive | //
// FILE: PinOutGroup.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.7
// DATE: 2017-04-26
// PURPOSE: PinOutGroup library for Arduino
// goal is to easily change a group of pins that logically
// belong to each other e.g. 8 data pins of a parallel printer.
// these pins can be in any o... | true |
a1fa7ce68e5c48463bd92fca077cc00eb1f308da | C++ | ordinary-developer/education | /cpp/std-11/r_lischner-exploring_cpp_11-2_ed/ch_70-metaprogramming/11-using_enabled_if_for_functions/main.cpp | UTF-8 | 299 | 3.03125 | 3 | [
"MIT"
] | permissive | #include <limits>
#include <type_traits>
template <class T>
typename std::enable_if<std::numeric_limits<T>::is_signed, T>::type
minus(T const& x)
{
return -x;
}
int main() {
int a{};
minus(a); // ok
// unsigned int b{};
// minus(b); // compilation error
return 0;
}
| true |
fa3f509c7916d20e8bf27c6f849dbecafece9cc4 | C++ | Alexis-BX/CSE306-Raytracer | /objects.cpp | UTF-8 | 1,010 | 2.984375 | 3 | [] | no_license | #ifndef OBJ
#define OBJ
#include "vector.cpp"
enum Materials{
opaque,
miror,
transparent
};
class Sphere{
public:
Sphere(Vector& center, double r, Vector& color, Materials material=opaque){
R = r;
p = center;
c = color;
m = material;
}
Vector... | true |
cb90f8beed85a8ea4a31e998d9c6b7a589605d03 | C++ | duongnguyencp/C-collection | /Untitled6.cpp | UTF-8 | 238 | 2.6875 | 3 | [] | no_license | #include<iostream>
using namespace std;
void ThuaSo (int a)
{ int i=2;
while(a>0)
{
if(a%i==0)
{
cout<<i;
a=a/i;
if(a!=1) cout<<"x";
}
if(a%i!=0)
{
i++;
}
}
}
int main()
{
int a;
cin>>a;
ThuaSo(a);
}
| true |
e915f5fef19c4bfdde2f28f66b5d84122dabcc42 | C++ | Riteshy123/CPP | /DemoCompoundAssignment34.cpp | UTF-8 | 225 | 2.875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int sum=10,x=5;
sum+=x;
cout<<sum<<endl;
int fact=10,y=5;
fact*=y;
cout<<fact<<endl;
return 0;
}
| true |
36ae8001cea059ae4d9daaec0b7772aaa4a1ce06 | C++ | PlCpp/11_gy | /aamain.cpp | UTF-8 | 1,861 | 3.125 | 3 | [] | no_license | #include <string>
#include <iostream>
#include "arrapp.h"
#include <algorithm>
#include <vector>
#include "arrapp.h"
const int max = 1000;
int main()
{
int your_mark = 1;
// 2-es
int s[] = {3, 2};
array_appender<int> ia ( s, sizeof( s ) / sizeof( s[ 0 ] ) );
for( int i = 0; i < max - 1; ++i )
{
ia.app... | true |
61e08a0626478198d58e1319634ba0bc65f3ae23 | C++ | sirlancer/Algorithm | /List/数组中次数超过一半的数字.cpp | UTF-8 | 834 | 3.203125 | 3 | [] | no_license | class Solution {
public:
int MoreThanHalfNum_Solution(vector<int> numbers) {
int res = numbers[0];
int times = 1;
for(int i=1; i<numbers.size(); i++){
if(res == numbers[i]){
++times;
}else if(times == 0){
res = numbers[i];
... | true |
9f85bd82d4b09e025212b64c8dad1f86ad9da30c | C++ | yanes328/oop | /inheritance_MakawekesYanes.cpp | UTF-8 | 812 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Person {
private:
string name;
char gender;
public:
Person();
void setName (string name);
void setGender (char gender);
string getName();
char getGender();
};
class Teacher {
private:
int nik;
string faculty;
public:
... | true |
c4a46f529696b3c5e5a5b360b64413cc3b4323c7 | C++ | chingdae1/Algorithm-2017 | /SelectionSort.cpp | UTF-8 | 513 | 2.671875 | 3 | [] | no_license | //2012017850_박창대
#include <stdio.h>
#define SWAP(x,y,t) ((t)=(x),(x)=(y),(y)=(t))
int main(){
int n,m,i,j,least,temp;
scanf("%d %d",&n,&m);
int array[n];
for(int i=0 ; i<n ; i++){
scanf("%d", &array[i]);
}
for(i=0;i<m;i++){
least = i;
for(j=i+1;j<n;j++){
i... | true |
90ef66cf2c4fe1eb9214e0672cbcd45549e58531 | C++ | xiongyihui/lsdcomm | /src/SubclassWnd.cpp | UTF-8 | 12,644 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | /** @file SubclassWnd.cpp
*
* Implementation file for CSubclassWnd.
*
* @author William E. Kempf
* @version 2.0
*
* Copyright © 2000 NEWare Software.
*
* This code may be used in compiled form in any way you desire (including
* commercial use). The code may be redistributed unmodified by any mea... | true |
5289a0b00d428a041d74929d4c10f9394c804cf9 | C++ | BackupGGCode/fgv-master-quant | /PROG1/PROG1-Lista01/src/Lista01.cpp | ISO-8859-1 | 7,269 | 3.296875 | 3 | [] | no_license | //=======================================================================
// Author : Milton Yukio Godoy Saito
// Name : Lista01.cpp
// Discipline : FGV - MPE -Programao e Mtodos Numricos em Finanas I
// Date : 13/02/2012
// Description : Lista de exerccios 1
//=========================================... | true |
3370d8b733ba56da7f6aebefe50c4e99c5b5e192 | C++ | Airbroub2019/C- | /TP4/Qt_Calculatrice/qt.cc | UTF-8 | 1,846 | 2.71875 | 3 | [] | no_license | #include "qt.hh"
#include <iostream>
calcul::calcul()
:QWidget() {
resize(450,50);
_operande1 = new QLineEdit("", this);
_operande2 = new QLineEdit("", this);
_operator = new QComboBox(this);
_resultat = new QLabel("",this);
_calculer = new QPushButton("=", this);
_quitter = new QPushBu... | true |
e54a8c74d78d3e4d07c75e85aff01c55b5d17917 | C++ | brunoalvaro130/URI-C-plus | /URI1065.cpp | UTF-8 | 254 | 2.921875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(int argc, char** argv)
{
int n;
int val, vez;
val = 0;
for(vez = 1; vez <= 5; vez++){
cin >> n;
if(n%2 == 0){
val = val + 1;
}
}
cout << val << " valores pares" << endl;
return 0;
} | true |
9a0373c39601a05426d8161a492e1d44fc4e421b | C++ | mull-project/mull | /tests/fixtures/mutators/replace_call/junk.cpp | UTF-8 | 848 | 3.296875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #define call_wrap(x) x()
extern "C" int external_function(int a, int b, int c);
extern "C" float external_function_f(float a, float b, float c);
int sum(int x, int b) {
return x + b;
}
int bar();
int foo() {
int r = sum(5, 8);
int s = bar();
int q = call_wrap(bar);
int a = external_function(r, s, q);
in... | true |
d3d8a0b77f04e921c0bbcb9c7178a069797f1d95 | C++ | GabrieleRolleri/competitive_programming | /training-olinfo/convegno/main.cpp | UTF-8 | 973 | 3.09375 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
int nFigli(int, std::list<int>*);
int coppie(int N, int C[]);
std::vector<int> under; //sottoposti of every employee
int main() {
std::ifstream in;
in.open("input.txt");
std::ofstream out;
out.open("output.txt");
int N;
in>>N;
under.resize(N);
int te[N];
... | true |
e8979fc7eeea25ae06c2cd0275467429efe158ed | C++ | scmikezhang/sqlite_wrapper | /test/test.cpp | UTF-8 | 15,854 | 3 | 3 | [] | no_license | #include "sqlite_wrapper.h"
#include <gtest/gtest.h>
#include <gmock/gmock.h>
const std::string db_file_path = "./test.db";
class TestSqliteWrapper : public testing::Test
{
public:
SqliteWrapper *sw = nullptr;
void SetUp(void) {
sw = new SqliteWrapper(db_file_path);
}
void TearDown(void) {
... | true |
d04f0d4495b80778f9b83b719c7225805acf8683 | C++ | MaclaurinYudhisthira/MySql-connection-with-c- | /mySQLwithC++/main.cpp | UTF-8 | 631 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include<windows.h>
#include<mysql.h>
using namespace std;
void exeQuery(MYSQL *conn);
int main()
{
cout << "Hello world!" << endl;
MYSQL *conn;
conn=mysql_init(0);
conn=mysql_real_connect(conn,"localhost","USER","PASSWORD","DB_NAME",0, NULL,0);
if(conn)
{
... | true |
fbac06de3b614d66625235d3b356585658687d05 | C++ | nmraz/mparse | /mparse/src/mparse/source_range.h | UTF-8 | 965 | 3.171875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <algorithm>
#include <cstdlib>
namespace mparse {
class source_range {
public:
constexpr source_range() = default;
constexpr explicit source_range(std::size_t col) : from_(col), to_(col + 1) {}
constexpr source_range(std::size_t from, std::size_t to)
: from_(from), to_(to) {}
con... | true |