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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
41f40ac3afe13697be3c8ef15eab5cb7d0770f2a | C++ | teru01/algorithms | /dp/lcs.cpp | UTF-8 | 1,027 | 2.6875 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functi... | true |
54538e8125ff4b8f08d09ea0574e9fce2c41af0e | C++ | accepted2019/Accepted.no.1.c-.CN | /c++获取键盘事件.cpp | GB18030 | 418 | 2.546875 | 3 | [] | no_license | #include <conio.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int ch;
while (1){
if (_kbhit()){//а£_kbhit()
ch=_getch();//ʹ_getch()ȡµļֵ
cout<<ch;
if (ch == 27){ break; }//ESCʱѭESCļֵʱ27.
}
}
system("pause");
return 0;
}
| true |
0959eacb671c21d6ba203dca98ed512198ac5f24 | C++ | pgngp/practice-code | /addBinary.cpp | UTF-8 | 1,619 | 3.859375 | 4 | [] | no_license | /* Add binary (158):
Given two binary strings, return their sum (also a binary string).
For example, a = "11", b = "1", the return is "100".
http://www.programcreek.com/2014/05/leetcode-add-binary-java/ */
#include <iostream>
#include <string>
using namespace std;
string add(const string &s1, const string &s2)
{
i... | true |
682c35357e8839f2e564eba5e97fa05c9b7dcef5 | C++ | BazzalSeed/Programming-Systems-and-Languages | /labs/lab1_seeDISAWESOME/lab1_00v_1.1/lab1_00/TerminalsAST.h | UTF-8 | 403 | 2.640625 | 3 | [] | no_license | /*
This is the derived class of abstract ASTNode for terminal node(directly contains token)
*/
#pragma once
#include "ASTnode.h"
class Terminals : public ASTNode
{
public:
Terminals(std::string s, shared_ptr<Token> & t, shared_ptr<ASTNode> & parent);
~Terminals();
void visit(set<string>& valid_label... | true |
02f4ae13afc5a2a422ad6b30934fc05ae813ce94 | C++ | Rafsan15048/Calender-Application-Digital-Clock | /Calender Application Project Final/Calender Project Main.cpp | UTF-8 | 21,469 | 2.875 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
///For music play
#include<Windows.h>
#include<MMSystem.h>
///For time and date
#include <time.h>
#define LEN 150
///For Year Print
#define TRUE 1
#define FALSE 0
int days_in_month[]= {0,31,28,31,30,31,30,31,31,30,31,30,31};
///A
#includ... | true |
5f601a1da578cd247d9a8fea39081523b79e3fa0 | C++ | microsoft/CCF | /src/crypto/certs.h | UTF-8 | 3,819 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache 2.0 License.
#pragma once
#include "ccf/crypto/key_pair.h"
#include "ccf/crypto/pem.h"
#include "ds/x509_time_fmt.h"
#include <chrono>
#include <string>
namespace crypto
{
static std::string compute_cert_valid_to_string(
... | true |
b2e3ff28a4e455e37c845759506138d51f44721b | C++ | celidon/Schoolwork | /c++/Semester2/figure/triangle.h | UTF-8 | 482 | 2.75 | 3 | [] | no_license | //This is the header file triangle.h.
//This is the interface for the class Triangle.
//This is primarily intended to be used as a base class to derive
//classes for different kinds of triangles.
#ifndef TRIANGLE_H
#define TRIANGLE_H
#include "figure.h"
using namespace std;
namespace shapes
{
clas... | true |
64c8b720ec09ca6e0597837d54eeac235e9860fd | C++ | wuli2496/OJ | /UVa/1377 Ruler/Ruler(dfs).cpp | UTF-8 | 5,759 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <memory>
#include <set>
#include <cmath>
#include <map>
using namespace std;
template<typename Result>
class AlgoPolicy
{
public:
virtual ~AlgoPolicy() {}
virtual Result execute() = 0;
};
template<typename Result>
class In... | true |
069cf0049f705969e58527a790e7168df7fefbc1 | C++ | datross/dungeonMaster | /src/camera.cpp | UTF-8 | 729 | 2.71875 | 3 | [] | no_license | #include "camera.h"
Camera::Camera()
{
}
void Camera::init(float fov, float aspectRatio){
projection = glm::perspective<float>(glm::radians(fov), aspectRatio, 0.01, 100.);
}
glm::mat4 Camera::getVMatrix() {
direction.x = glm::cos(glm::radians(rotation.y)) * glm::cos(glm::radians(rotation.x));
direction.... | true |
9c7f61347e3c9cf258a407d3063b52828958f338 | C++ | kudroma/SimpleApplication | /SimpleApplication/Ellipse.cpp | UTF-8 | 1,374 | 3.328125 | 3 | [] | no_license | #include "Ellipse.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <random>
using namespace SimpleApplication;
Ellipse::Ellipse()
{
m_center = Point2d(20, 21);
m_a = 10;
m_b = 5;
m_name = "Ellipse";
int indexI = 0;
const auto angle = M_PI / 20;
while (angle * indexI < M_PI * 2)
{
auto point = po... | true |
b0b98990355ac7db98b6c779af9768dcf879f7b6 | C++ | Rockmen0113/ConsoleSnakePractice | /SnakeGame/Map.cpp | MacCentralEurope | 1,395 | 2.96875 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include "Map.h"
#include "ConsoleSetting.h"
Position Map::getPosition() const
{
return mapPosition;
}
int Map::getHeight() const
{
return Height;
}
int Map::getWidth() const
{
return Width;
}
Map::Map(Position position,int height, int width):mapPosition(position), Height(h... | true |
48be6f8ff78c1253c746850407b0833f6850f75b | C++ | o2gy84/misc | /benchmark/euclid/emb.cpp | UTF-8 | 3,969 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <chrono>
#include <vector>
#include <xmmintrin.h>
#include <math.h>
namespace
{
float l2sqr_dist_sse2(const float *pVect1, const float *pVect2, std::size_t qty)
// sqrt of Euclid distance
{
static_assert(sizeof(float) == 4, "Cannot use SIMD instructions with non-32-bit floats.");
... | true |
c53502c9096bd782ec85cbc466aa4b5c9dce3b70 | C++ | OTTFFYZY/StandardCodeLibrary | /BasicDataStructure/FenwickTree_rarq2.cpp | UTF-8 | 636 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
using namespace std;
const int M=1e5+5;
int bit0[M],bit1[M];
inline int lowbit(int x)
{
return x&(-x);
}
void init()
{
memset(bit0,0,sizeof(bit0));
memset(bit1,0,sizeof(bit1));
}
void add(int p,int x)
{
for(int i=p;i<M;i++)
bit0[i]+=x,bit1[i]+=x*p;
}
void add(int l,int r,... | true |
f00980c78c0e9e8389cbc94280008b7e04fad604 | C++ | jakubsadura/Swiezy | /src/Apps/Gimias/Core/DataHandling/src/coreLightData.h | UTF-8 | 2,298 | 2.640625 | 3 | [] | no_license | /*
* Copyright (c) 2009,
* Computational Image and Simulation Technologies in Biomedicine (CISTIB),
* Universitat Pompeu Fabra (UPF), Barcelona, Spain. All rights reserved.
* See license.txt file for details.
*/
#ifndef coreLightData_H
#define coreLightData_H
#include "gmDataHandlingWin32Header.h"
#include "coreObjec... | true |
d45fab7a593d08fa0bd68cfb94b366f79192f244 | C++ | ayanamizuta/cpro | /atcoder/arc/arc110/d.cpp | UTF-8 | 1,454 | 2.609375 | 3 | [] | no_license | #include "bits/stdc++.h"
#include <atcoder/all>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define LL long long
using mint = atcoder::modint1000000007;
#define MOD 1000000007
#define FACT_MAX 1000000
LL fact[FACT_MAX];
class... | true |
2c7b8cdfd566698075ac816e0261e0dafd313366 | C++ | s-shirayama/ProgramingContestChallengeBook | /2-2-2.cpp | UTF-8 | 569 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000;
int main() {
int N;
string S;
cin >> N >> S;
string T(S);
reverse(T.begin(), T.end());
int len = S.length(), idxS = 0, idxT = 0;
for (int i = N; i > 0; i--) {
bool chk = false;
for (int j = 0; j < N - idxS - idxT; j++) {
if (S[idxS+j] ... | true |
e9ee462ba21b00d2b42cc43e07bc4a63ef31811f | C++ | mlkood/OpenFFBoard | /Firmware/FFBoard/Src/CAN.cpp | UTF-8 | 4,514 | 2.53125 | 3 | [
"MIT"
] | permissive | /*
* CAN.cpp
*
* Created on: 21.06.2021
* Author: Yannick
*/
#include "target_constants.h"
#ifdef CANBUS
#include "CAN.h"
CANPort::CANPort(CAN_HandleTypeDef &hcan) : hcan(&hcan) {
//HAL_CAN_Start(this->hcan);
}
CANPort::~CANPort() {
// removes all filters
for (uint8_t i = 0; i < canFilters.size(); i++... | true |
2263d72abe7ad16f16ee7c0be1909fc201e595ad | C++ | flotzilla/light_table | /src/NeoLight.h | UTF-8 | 1,974 | 2.671875 | 3 | [
"MIT"
] | permissive | #ifndef NEOLIGHT_H
#define NEOLIGHT_H
#include <Adafruit_NeoPixel.h>
class NeoLight : public Adafruit_NeoPixel
{
#define MODE_LIGHT 0
#define MODE_ANIMATION 1
#define LIGHNT_MODE_0 0 // WHITE
#define LIGHNT_MODE_1 1 // GREEN
#define LIGHNT_MODE_2 2 // BLUE
#define LIGHNT_MODE_3 3 // RED
#define LIGHNT_MODE_4... | true |
f97e5c8af4ca5dc08e1f837af93ecc9335e37f72 | C++ | wandec/cmake | /cmake3/main.cpp | UTF-8 | 671 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include "version.hpp"
#include <algorithm>
#include "vector"
#include "iostream"
#if defined(BOOST)
#include <boost/range/algorithm.hpp>
#endif
void sortValues(std::vector<int> &values) {
#if defined(BOOST)
std::cout << "boost sort \n";
boost::range::sort(values);
#else
std::cout<<... | true |
0da2c2339facff9916369581358a1dc3a2d41668 | C++ | watson-intu/self | /src/gestures/VolumeGesture.h | UTF-8 | 1,550 | 2.515625 | 3 | [] | no_license | /**
* Copyright 2017 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law o... | true |
4582c711a9160d0fbf0afed164e22523ce7d63f0 | C++ | industriousonesoft/leet-code | /62.Unique Paths/main.cpp | UTF-8 | 1,775 | 3.453125 | 3 | [
"MIT"
] | permissive | /*
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).
How many possible unique paths are there?
Exa... | true |
f2f6a04e59516fc2a26d552b43aba2228d6425df | C++ | sensidev/savnet-cpp-course | /apps/exp-tinder/match_making_service.h | UTF-8 | 596 | 2.515625 | 3 | [] | no_license | #ifndef SAVNET_CPP_MATCH_MAKING_SERVICE_H
#define SAVNET_CPP_MATCH_MAKING_SERVICE_H
#include "profile.h"
#include "profile_database.h"
class MatchMakingService {
private:
ProfileDatabase *database_pointer;
/* Here will be the instance stored. */
static MatchMakingService *instance;
/* Private constr... | true |
bde950569e719223aa1f13a93b49f23278ae4869 | C++ | MakinoRuki/TopCoder | /TCO18R4Easy.cpp | UTF-8 | 745 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define N 1002
using namespace std;
const int mod = 1000000007;
class SumPyramid {
public:
int dp[N];
int comb[N][N];
int countPyramids(int lev, int top) {
memset(comb, 0, sizeof(comb));
for (int i = 0; i <= lev... | true |
7bd54f964474a1f6a59689920497adff5ec31e2f | C++ | vidalmatheus/codes | /LintCode/Medium/maximumSizeSubarraySumEqualsk.cpp | UTF-8 | 1,524 | 3.453125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
/**
* @param nums: an array
* @param k: a target value
* @return: the maximum length of a subarray that sums to k
*/
int maxSubArrayLen(vector<int> &nums, int k) {
// Write your code here
if (nums.size()... | true |
8a03f7ee0a05c99f694477fcb8849b592a8386e6 | C++ | AG-Systems/Markov | /Markov/Markov.h | UTF-8 | 3,399 | 3.65625 | 4 | [] | no_license | #pragma once
#include <string>
#include <map>
#include <random>
#include <vector>
#include <regex>
class Markov
{
public:
void SetOrder(int ord) {
order = ord;
}
void ParseText(std::string input) {
// Define what constitutes a word. Punctuation, in this case, counts.
std::regex word("([\\w-']+|[,\\.!\\?][\"... | true |
54d130847daaae2364555cbe50024380446b54df | C++ | Kapelka-Yaroslav/Kapelka-Yaroslav | /Лабораторные/Лабораторная работа №4/Лабораторная работа № 4/CMetod.h | UTF-8 | 720 | 2.65625 | 3 | [] | no_license | #include "CCountry.h"
class CMetod
{
private:
CCountry* countries;
CCountry* copy;
int next_i = 0;
int new_i = 1;
public:
void add_el(const CCountry& CCountry);
void remove_el(const int& index);
void del_all();
void get_to_Screen(const int& index) const;
CCountry find_to_index(const ... | true |
04ea2569672a3b3ad3a2c87846c607267417d5d6 | C++ | Althieris/Algoritmo_II | /Exercicio27.cpp | UTF-8 | 814 | 3.171875 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
int lerdados()
{
int a;
printf(": ");
scanf_s("%i", &a);
return a;
}
void calculonotas(int valorcompra, int valordinheiro)
{
int troco = valordinheiro - valorcompra;
int nota100 = 0;
int nota10 = 0;
int nota1 = 0;
if (troco > 0)
{
nota100 = (troc... | true |
02e0fc24db3ce5919fe263c68d60a624938b3fec | C++ | linpengchao/DataStructures | /Graph/code/adjacencylish/adjacency_lish.cpp | UTF-8 | 11,615 | 3.296875 | 3 | [] | no_license | #include "adjacency_lish.h"
#include <cstdio>
#include <iostream>
#include <queue>
#include <stack>
#include <algorithm>
// 若图G中存在顶点v,则返回v在图中的位置信息,否则返回其他信息
int LocateVex(ALGraph G, VertexType v)
{
for (int i = 0; i != G.vexnum; ++i)
if (G.vertices[i].data == v) return i;
return -1;
}
void Clear()
{
while (s... | true |
f5a6148d249a5a3a1ff53989837c4e953b5247bf | C++ | SuperWhite18/LeetCode-Solution-of-Problems | /LeetCode_April_clock_in/4_23.368.最大整除子集..cpp | UTF-8 | 1,078 | 3.25 | 3 | [] | no_license | //题目链接:
https://leetcode-cn.com/problems/largest-divisible-subset/
//代码实现:
class Solution {
public:
vector<int> largestDivisibleSubset(vector<int>& nums)
{
int n = nums.size();
//定义最大的整除子集
vector<int> f(n);
sort(nums.begin(),nums.end());
//表示取到最大值的尾节点
int k = 0;... | true |
0fd6c856af8391dd36bc7fab47f8fcde70437349 | C++ | lfahmi-ghb/CPP | /C++ projects/OOP244/OOP244 LAB09/NumbersBox.h | UTF-8 | 1,838 | 3.59375 | 4 | [] | no_license | #pragma once
#ifndef SDDS_NUMBERSBOX_H
#define SDDS_NUMBERSBOX_H
#include <iostream>
#include<cstring>
#include<iomanip>
using namespace std;
namespace sdds {
template<class T>
class NumbersBox {
//MEMBER FUNCTIONS
char name[15];
int size;
T* items;
public:
NumbersBox(int n_size, const char* n_name... | true |
2f45d3d40bb758e109685af22f5caf5c76f9a6f7 | C++ | mainmmx/cpp.fundamentals | /chapter02/exercise06.cpp | UTF-8 | 608 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int amountAstronomicalUnitsInOneLightYear = 63240;
double LightYears2AstronomicalUnits(double lightYears);
int main()
{
double lightYears = 0.0;
double astronomicalUnits = 0.0;
cout << "Enter the number of light years: ";
cin >> lightYears;
astronomicalUnits = Li... | true |
1d020a4da53c77da3187b256bfb7c393ec7f8552 | C++ | concepcionrey/CppLearning | /LearnCpp/Chapter 6 Arrays, Strings, Pointers, and References/7.cpp | UTF-8 | 2,234 | 4.15625 | 4 | [] | no_license | #include <iostream>
// Chp 7
// Pointers
// a variable is a name for a place in memory that can hold a value
// when a program reads that variable, it locates the memory adress and checks
// what value is stored in that address
int main() {
// the "&" address-of operator
int x{5};
std::cout << "This is the value: ... | true |
737d920d8c2d325465192c21af8aa4bfd5cfb467 | C++ | sturdyplum/lightcppbignum | /bigNum.cpp | UTF-8 | 8,802 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <cstdio>
#include <random>
#include <time.h>
using namespace std;
#define maxBigIntLength 300//size of numbers
struct bigInt{
int number[maxBigIntLength];//number is stored here backwards
bool pos;//pos = true if number is positive
//default constructor
b... | true |
3f28697e6fc6892416b91f04df023340bdebe17d | C++ | checkoutb/LeetCodeCCpp | /ge500/LT0542_01_Matrix.cpp | UTF-8 | 3,292 | 3.328125 | 3 | [] | no_license |
#include "../header/myheader.h"
class LT0542
{
public:
// int[][] dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
// queue.add(new int[] {r, c});
// 用Queue保存 点0,循环Queue直到empty,设置4个方向的距离,如果其他点被影响到了,就加入Queue,
//Runtime: 172 ms, faster than 98.67% of C++ online submissions for 01 Matrix.
//Memory Usage: 20.7 MB, l... | true |
8a9dfbef2cc0483a2e946e77eb55e7b1ea368bec | C++ | hoon4233/Algo-study | /2020_spring/2020_04_02/1051_JJ.cpp | UTF-8 | 735 | 2.71875 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
using namespace std;
int table[51][51];
int n,m;
int ans = 1;
bool is_in(int x, int y)
{
return (0<x && x<=n)&&(0<y && y<=m);
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++) scanf("%1d",&table[i][j]);
}
//size
... | true |
3e9d93a903fcf830da544c6a1ae46290ac09a719 | C++ | MaxStubbe/Linal2020 | /LinearAlga_opdr1/Vector3D.h | UTF-8 | 1,349 | 3.28125 | 3 | [] | no_license | #ifndef __Vector3D_h__
#define __Vector3D_h__
#include <cmath>
#include <SDL.h>
#include <SDL_main.h>
#include "Matrix.h"
class Vector3D
{
public:
float x;
float y;
float z;
const int WINDOWWIDTH = 640;
const int WINDOWHEIGHT = 480;
Vector3D() {
this->x = 0;
this->y = 0;
this->z = 0;
};
Vector3D(float... | true |
534f34bab38dd5413b4290b527b8d99c4b5a8379 | C++ | MartienLagerweij/paper_sources | /pubsub/src/pub.cpp | UTF-8 | 2,588 | 2.765625 | 3 | [] | no_license | // for ROS nodes basic needs
#include <ros/ros.h>
// for reading the vmem size from /proc/self/status
#include <fstream>
#include <string>
#include <sstream>
// the custom-made latency test message
#include "pubsub/latency_test_message.h"
int main(int argc, char **argv)
{
float publish_rate = 1;
float shutdown_aft... | true |
495259471f3843cb32561416a11e17a8102d27e6 | C++ | Lukkario/pp2_zadania | /zad4.cpp | UTF-8 | 1,251 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
using namespace std;
void wypelnij(int *tab, int a, int b, int wielkosc)
{
for(int i = 0; i < wielkosc; i++)
*(tab+i) = rand() % b + a;
}
void wypisz(int *tab, int wielkosc)
{
for(int i = 0; i < wielkosc; i++)
cout << *(tab+i) << " ";... | true |
7a7f13639ac0f0b318b0e543cb798aab0b9a6031 | C++ | HekpoMaH/Olimpiads | /Shumen AiB/more2013/Untitled Folder/ru-olymp-roi-2010-tests/1-gift/gift_sk_2.cpp | UTF-8 | 864 | 2.6875 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
freopen("gift.in", "r", stdin);
freopen("gift.out", "w", stdout);
ll n;
cin >> n, n /= 2;
ll a = (ll)(sqrt(n / 3) + 1e-6), b = a;
ll res = a * a * a;
... | true |
87a1f755bb3cddadf5536ec01d06d411ff2b41a7 | C++ | jfrascon/MANFRED_ROS_STACK | /openmrl/firmware/skybot_IRSensors/skybot_IRSensors.ino | UTF-8 | 2,216 | 2.609375 | 3 | [] | no_license | char incomingByte;
int a = 2; // LSB multiplexer
int b = 3; //
int c = 4; // MSB multiplexer
int readPin; // Select the output channel
float sensorValue = 0; // variable to store the value coming from the sensor
void sendIRdata(int number, boolean A, boolean B, boolean C, int AN, float alpha, float beta, float x, f... | true |
abcbb93cdc538061b839c251395077f9b11d8cb6 | C++ | rupeshsjce/C- | /Student.cpp | UTF-8 | 490 | 3.28125 | 3 | [] | no_license | #include "Student.h"
#include <iostream>
using namespace std;
//Student CLASS DEFINITION
Student::Student(string nm, string yr, float g) //constructor
:name(nm), year(yr), gpa(g) //initialization list
{
}
void Student::boost_grade()
{
gpa+=1.0;
if(gpa > 4.0)
gpa=4.0;
}
void Student::display()
{
cout << "Student... | true |
5f4800a3f3f9b4a90c8ee894021167c2b447e61f | C++ | bdliyq/algorithm | /misc/google/combine-intervals.cc | UTF-8 | 649 | 3.46875 | 3 | [] | no_license | // Question: Combine intervals.
struct Interval {
int start;
int end;
Interval(int s, int e) : start(s), end(e) {}
};
struct cmp {
bool operator() (Interval& i1, Interval& i2) {
return (i1.start < i2.start);
}
};
vector<Interval> solve(vector<Interval> intervals) {
vector<Interval> an... | true |
2133948f507b3740117287c777313dedc60f752e | C++ | portaloffreedom/tol-controllers | /shared/include/CppnGenome.h | UTF-8 | 4,046 | 3.109375 | 3 | [] | no_license | #ifndef OM_CPPNGENOME_H_
#define OM_CPPNGENOME_H_
#include "Defines.h"
#include "ParametersReader.h"
#include "NEAT.h"
#include <iostream>
#include <random>
class CppnGenome {
double size; //The size of the grid that should be used when translating this genome
boost::shared_ptr<NEAT::GeneticIndividual> c... | true |
b9e769e7b8c39c7f997f7214b93fcc604666a805 | C++ | alo456/Arduino | /ej9-dado/ej9-dado.ino | UTF-8 | 1,302 | 2.84375 | 3 | [] | no_license | int ledPins[7] = {2, 3, 4, 5, 6, 7, 8};
int dicePatterns[7][7] = {
{0, 0, 0, 0, 0, 1, 1}, // 1
{0, 0, 1, 1, 0, 1, 0}, // 2
{0, 0, 1, 1, 0, 1, 1}, // 3
{1, 0, 1, 1, 0, 0, 0}, // 4
{1, 0, 1, 1, 0, 0, 1}, // 5
{1, 1, 1, 1, 1, 0, 0}, // 6
{0, 0, 0, 0, 0, 1, 0} // BLANK
};
//logica al revés en el pin 7 porque el led está ra... | true |
61b884372910e6c5205c00e77cf23c27340ee614 | C++ | Hotckiss/cpp_labs | /lab7/src/my_vector.cpp | UTF-8 | 2,198 | 3.171875 | 3 | [] | no_license | #include "../include/my_vector.h"
#include <cassert>
#include <cstdlib>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <cstdio>
MyVector::MyVector() {
_data = (MySuperPuperVectorType *)malloc(sizeof(MySuperPuperVectorType) * 2);
_sz = 0;
_cp = 2;
}
MyVector::MyVector(std::size_t init... | true |
36817cfef42a5510f27a335d985b79ad954a8c0e | C++ | hafnerfe/Choice-Dictionaries | /src/Profiling/Utilities/Rf_formatter.cpp | UTF-8 | 1,239 | 3.046875 | 3 | [] | no_license | /*
*
*
* Created by Felix Hafner, 24.06.18
*/
#include "Rf_formatter.h"
#include <fstream>
#include <cmath>
#include <numeric>
#include <cassert>
double compute_mean(const std::vector<double>& v) {
double sum = std::accumulate(v.begin(), v.end(), 0.0);
return sum / v.size();
}
double compute_stdev(const std::vect... | true |
358fb63edd194d2faff1ef51c73d5c1df0802abb | C++ | BastienPateyron/Cpp_ISIMA2 | /gangster/tests.cpp | UTF-8 | 4,895 | 3.109375 | 3 | [] | no_license | #include "catch.hpp"
#include "gangster.hpp"
#include <stdexcept>
#include <sstream>
#include <cstring>
/*
TEST_CASE("Personne1") {
const char * nom = "corleone";
Personne zz(nom);
REQUIRE(nom == zz.getNom());
zz.setNom("vito");
REQUIRE("vito" == zz.getNom());
} */
/*
TEST_CASE("Personne... | true |
303ca6c3b5787369afe1580cff05a48f900e4688 | C++ | Zhenghao-Liu/LeetCode_problem-and-solution | /0076(重要).最小覆盖子串/solution_sliding_window.cpp | UTF-8 | 1,323 | 2.96875 | 3 | [] | no_license | class Solution {
public:
string minWindow(string s, string t)
{
int s_size=s.size(),t_size=t.size();
if (s_size==0 || t_size==0 || t_size>s_size)
return "";
unordered_map<char,int> t_number_of_letters;
for (char i:t)
++t_number_of_letters[i];
int left=0,right=-1;
unordered_map<char,int> window_numb... | true |
cad8228f3575bd9007af55d2981532229baa61be | C++ | Valeryn4/StaticECS | /example/Example.cpp | UTF-8 | 4,217 | 2.84375 | 3 | [] | no_license | #include "include/ECS/ECS.hpp"
#include <string>
#include <iostream>
#include <chrono>
#include <thread>
//Данные для компонента-слушателя
struct ListenerTargetData
{
std::string name = "Target_0";
int i = 0;
void Set(int v)
{
i = v;
printf("Listener %s i set to %i\n", name.c_str... | true |
8fbdb80f55390bd7554dc3753b9fc332530f0674 | C++ | softwareschneiderei/viewer | /camera_module/epics/Channel.h | UTF-8 | 677 | 2.5625 | 3 | [] | no_license | #pragma once
#include <cadef.h>
#include <string>
class Channel
{
public:
Channel(std::string const& name, capri priority=0);
Channel(Channel const&) = delete;
~Channel();
Channel& operator=(Channel const&) = delete;
channel_state state() const;
void array_get(chtype type, unsigned long cou... | true |
9a26e8518bbd673d215563497e1b53777a04d213 | C++ | Maheshmahi7/Hangman | /Test/Test.cpp | UTF-8 | 12,834 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "Coder.h"
#include "Category.h"
#include "Words.h"
#include "Difficulty.h"
#include "DatabaseXmlParser.h"
#include "DatabaseInterface.h"
#include "DatabaseImplementation.h"
using namespace std;
void test_coder();
void test_category();
void test_difficulty()... | true |
a861319fc6226a783cf105b359146dfb8c4b8003 | C++ | Louis-tiany/tiny_rpc | /src/TcpClient.cc | UTF-8 | 1,387 | 2.59375 | 3 | [] | no_license | /*
* File : TcpClient.cc
* Author : *
* Mail : *
* Creation : Tue 29 Dec 2020 04:48:23 PM CST
*/
#include <functional>
#include <iostream>
#include "../include/TcpClient.h"
TcpClient::TcpClient(EventLoop *loop, InetAddress addr):
loop_(loop),
ip_(addr.ip()),
port_(addr.port()),
connector... | true |
3d3cf08a37c334d7b2a3cc759a529bfda0dee993 | C++ | pederson/simbox | /unit_tests/hdf5/HDFFileSystemWriter_test.cpp | UTF-8 | 879 | 2.5625 | 3 | [] | no_license | #include "../../include/HDFFileSystemWriter.hpp"
#include "../../include/DataBufferWriter.hpp"
#include <iostream>
#include <vector>
int main(int argc, char * argv[]){
typedef simbox::DataBufferWriter<std::vector<int>, simbox::HDFFileSystemWriter> Writer;
std::size_t nvals = 20;
std::vector<int> v1(nvals);
fo... | true |
6e37dc5b9e3149fba77eed8ce05a9fea7b716ed2 | C++ | Falcondorf/ZurvivalArena | /Zurvival-Arena/snak/Menu.h | ISO-8859-1 | 1,617 | 3.34375 | 3 | [] | no_license | #pragma once
#include <SFML\Graphics.hpp>
/*!
* \brief Classe reprsentant le menu de demarage du jeu.
*\file menu.h
*\author Aynaou Dupont Fakir Bauwens Temsamani
*/
class Menu {
public:
/*!
* \brief Constructeur du Menu du jeu.
* \param width la longeur du menu.
* \param height la largeur du menu.
*/
Menu(fl... | true |
1816ea8a6010c7db7dcb81ebf75ff7a67333a8d8 | C++ | PaThAkavi/Trees | /BSTOperations.hxx | UTF-8 | 2,396 | 3.6875 | 4 | [] | no_license | #include<iostream>
using namespace std;
typedef long long ll;
typedef struct node {
ll data;
struct node* left;
struct node* right;
}node;
node* insert(node* root, ll value){
if(!root){
node* newnode = (node*)malloc(sizeof(node));
newnode->data = value;
newnode->left = NULL;
... | true |
32af3ec174903a0fa53603090bded5e36d4be56f | C++ | lsst-ts/ts_sal_runtime | /tcs/tcs/tpk/TrackingTarget.cpp | UTF-8 | 1,616 | 2.8125 | 3 | [] | no_license | /// \file TrackingTarget.cpp
/// \brief Implementation of the tracking target class.
// D L Terrett
// Copyright CCLRC. All rights reserved.
#include "TrackingTarget.h"
#include "slalib.h"
namespace tpk {
/// Get target position in the tracking frame.
/**
This method is called by the kernel "fast" routines an ... | true |
1be4ccd1d0d544f2a522c4faeb1cdaa778ae057d | C++ | mricha41/Data-Structures-and-Algorithms-CPP | /CircularLinkedList/main.cpp | UTF-8 | 1,709 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "CircularList.hpp"
#include "Algorithms.hpp"
typedef float mine;
int main()
{
CircularList<mine> first(15.7f);
first.pushBack(25.001f);
first.pushBack(66.575f);
first.pushBack(99.654f);
first.pushBack(100.0f);
first.pushBack(101.677f);
std::cout << "first length... | true |
02c1ab378907b107cdea5a1111d264bbde7050bd | C++ | renjiedai/SETerminal | /Classes/Character/Monster.h | GB18030 | 1,123 | 2.671875 | 3 | [] | no_license | #pragma once
/**
* @file Monster.h
*/
#ifndef MONSTER_H
#define MONSTER_H
#include "cocos2d.h"
#include "Const/Const.h"
#include "Character.h"
/**
*@brief
*/
class Monster : public Character
{
public:
/**
* @brief һMonsterʵ
* @param MonsterʵӦزļ
* @return ָMonsterʵָ
* @author ʽ
*/
static Monster* create(const st... | true |
b098ed35470c3a0bff051f1fee9c755e40b40bce | C++ | ddl1997/PTA-Test | /PTA/PTA/A1011.cpp | UTF-8 | 521 | 2.84375 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double m[3] = {0, 0, 0};
char its[3];
char select[3] = {'W', 'T', 'L'};
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
double temp;
cin >> temp;
if (m[i] < temp)
{
m[i] = temp;
its[i] = select[j];
}
}... | true |
4fb9c85fd8aa61391997ad54f75ba51aebd09b22 | C++ | fengsharp/study | /08libcurl/code/CookieCache.cpp | UTF-8 | 7,490 | 2.84375 | 3 | [] | no_license | #include "CookieCache.h"
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <vector>
#include <regex>
#include "StringUtil.h"
CookieCache* CookieCache::s_pInstance = nullptr;
CookieCache* CookieCache::instance()
{
if (s_pInstance == nullptr)
{
s_pInstance = new CookieCache();
}
... | true |
665ec8ce3e53f9753669cf64082a631d61a93190 | C++ | VipulKhandelwal1999/Coding_Blocks | /61.Interactive_Problems/02.Interactive_Problems_2_Examples.cpp | UTF-8 | 2,915 | 3.671875 | 4 | [] | no_license | /*
This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. Yo... | true |
4124c1b3566a5124802fc4247b28a034f09aea29 | C++ | HavocTheGnome/HWNUM13 | /Driver.hpp | UTF-8 | 770 | 3.65625 | 4 | [] | no_license | #include <iostream>
using namespace std;
void printArray(int* ar, int begin, int end)
{
for(int i = begin; i < end; i++)
{
cout << ar[i] << " ";
}
cout << "\n";
}
void mergeSort(int* ar, int begin, int end)
{
cout << "Merge Sorting: ";
printArray(ar, begin, end);
if(begin != end)
... | true |
ef6d7c8ecff6a5e2b27188c2802c82b6b881b67f | C++ | ghostxiu/CplusplusPrimerPlus6thEditions | /Chapter12/cow.h | UTF-8 | 432 | 2.65625 | 3 | [] | no_license | //Changed by Ghostxiu 2017/9/12
#ifndef COW_H_
#define COW_H_
class Cow{
private:
char name[20];
char * hobby ;
double weight;
public:
Cow();
Cow(const char * nm , const char * ho , double wt);
~Cow();
Cow(const Cow & c);
Cow & operator = (const Cow & c);
void ShowCow() const ;
};
#endif // CO... | true |
a0876e6191bec9d0f0e3644258468fe7733fb088 | C++ | blitz-research/blitz3d_msvc2017 | /blitz3d/meshmodel.h | UTF-8 | 1,357 | 2.53125 | 3 | [
"Zlib"
] | permissive |
#ifndef MESHMODEL_H
#define MESHMODEL_H
#include "model.h"
#include "surface.h"
class MeshCollider;
class MeshModel : public Model{
public:
typedef vector<Surface*> SurfaceList;
MeshModel();
MeshModel( const MeshModel &t );
~MeshModel();
//Entity interface
virtual MeshModel *getMeshModel(){ return this; }
... | true |
fb93a42853e90366de3292e188bb45cba29c8e23 | C++ | goeldivyansh/Data-Structures-and-Algorithms | /Searching/SearchInSortedRotatedArray.cpp | UTF-8 | 726 | 3.28125 | 3 | [] | no_license | #include<iostream>
#include <bits/stdc++.h>
using namespace std;
//Time: O(logn) Space: O(1)
int Search(int a[], int n, int x)
{
//6,7,8,9,10,1,2
int m,l=0,r=n-1;
while(l<=r)
{
m = (l+r)/2;
if(x == a[m])
return m;
else if(a[m] > a[l]) // Left Array Sorted
{
... | true |
891055a53f9db748f679af5665c82c8aa6b479de | C++ | artisdom/idUTF8lib | /tests/tests.cpp | UTF-8 | 943 | 3.234375 | 3 | [
"BSD-3-Clause"
] | permissive | #define CATCH_CONFIG_MAIN
#include "catch/catch.hpp"
#include "../lib/idutf8lib.hpp"
TEST_CASE("Initialization is correct") {
Utf8String empty_utf8str;
REQUIRE(empty_utf8str.to_string().empty() == true);
Utf8String string_to_utf8str("Hello World");
REQUIRE(string_to_utf8str.to_string() == "Hello World");
}
TEST_... | true |
a838cda0a62d9c413298482ac6648db13d660b96 | C++ | HekpoMaH/Olimpiads | /grupa A/esenen turnir/RMI/2011/day2/sorting/sorting20.cpp | UTF-8 | 864 | 2.71875 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#define MOD 999017
int N, perm[4096], uz[4096], cycle[4096], cnt;
inline int sort1(const int *perm, int N)
{
int time = 0;
for (int i = 0; i < N; ++i)
for (int j = i+1; j < N; ++j)
time += perm[i] > perm[j];
return time;
}
inline int sort2(const int *perm, int N)
{
in... | true |
02415a7f10d0d5bb0ac435936e56846f209b908e | C++ | duc-la192773/baitapc-c- | /Week78.Ex2.cpp | UTF-8 | 1,307 | 3.3125 | 3 | [] | no_license | #include<iostream>
#include<fstream>
using namespace std;
typedef struct
{
int a, b;
}PS;
ostream& operator<< (ostream& os, PS p){
os<<p.a<<"/"<<p.b;
return os;
};
istream& operator>> (istream& is, PS& p){
cout<<" Nhap tu so:";is>>p.a;
cout<<" Nhap mau so: ";is>>p.b;
if(p.b==0)... | true |
570a3385c6fa5199ec46d222e7e0e771306eedad | C++ | mahtab04/Cpp-Programs | /Array/removes_duplicates_sorted_array.cpp | UTF-8 | 899 | 3.375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int removeDuplicates(vector<int> &nums)
{
if (nums.size() == 0)
return 0;
int j = 0;
for (int i = 0; i < nums.size() - 1; i++)
{
if (nums[i] != nums[i + 1])
{
nums[j++] = nums[i];
}
}
nums[j++] = nums[nums... | true |
75e873652b12a7a91fd9cd3f1f9d92fe5f25a850 | C++ | pragmadox/data_structures | /homework13/stack5driver.cpp | UTF-8 | 1,022 | 3.84375 | 4 | [] | no_license | //File: stack5driver.cpp
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stack5.h"
using namespace std;
int main()
{
stack stack1;
const char *traverse; //pointer used to traverse the user string.
const char *user_string; //string entered by the ... | true |
8d33d52a420cd3b6d1c2f71d9c1b49819519fd61 | C++ | SeekingMini/Algorithm-Repositary | /链表/1-6.cpp | UTF-8 | 986 | 3.984375 | 4 | [] | no_license | /*
* 题目:移除重复结点
* 链表:https://leetcode-cn.com/problems/remove-duplicate-node-lcci/
*/
#include <iostream>
#include <unordered_set>
using namespace std;
struct ListNode {
int val;
ListNode *next;
explicit ListNode(int x) {
val = x;
next = nullptr;
}
};
ListNode *removeDuplicateNodes(ListNode *head) {
if (... | true |
31297dae65749af86c3f67fdf2903ce4ab85be8c | C++ | ThomasDHZ/VulkanRayTrace | /VulkanRayTraceTest/Buffer.cpp | UTF-8 | 7,417 | 3.171875 | 3 | [] | no_license | #include "Buffer.h"
#include <cassert>
#include <cstring>
#include <stdexcept>
/**
* Map a memory range of this buffer. If successful, mapped points to the specified buffer range.
*
* @param size (Optional) Size of the memory range to map. Pass VK_WHOLE_SIZE to map the complete buffer range.
* @param offset (Option... | true |
fe62e4d3a33ea9b154f4fe80a4966b0844f2e116 | C++ | noamraveh/wet2DS | /SongAll.cpp | UTF-8 | 1,012 | 3.21875 | 3 | [] | no_license | #include "SongAll.h"
SongAll::SongAll(int artist_id, int song_id, int num_streams) : artist_id(artist_id),song_id(song_id),num_streams(num_streams){}
bool SongAll::operator<(const SongAll &song) {
if (num_streams>song.num_streams){
return true;
}
else if(num_streams<song.num_streams){
retu... | true |
37bc873fcd3a56fc6d9666bb2c706d94136b2b0d | C++ | alexandrovsky/freestyle | /engine/animation.h | UTF-8 | 4,441 | 2.625 | 3 | [] | no_license | /*
* Copyright (C) 2008-2013 by Mathias Paulin, David Vanderhaeghe
* Mathias.Paulin@irit.fr
* vdh@irit.fr
*/
#ifndef ANIMATION_H
#define ANIMATION_H
#include <string>
#include <vector>
#include <map>
#include "opengl.h"
#include "assimp/anim.h"
#include <glm/gtx/quaternion.hpp>
#include "skeleton.h"
na... | true |
42d5ed89090165b1cb232052c2dabf57cda4cfeb | C++ | mihneasaracin/Distributed-CSP | /include/hps-1.0.0/src/buffer/string_output_buffer.h | UTF-8 | 1,252 | 3.109375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | #pragma once
#include <string>
#include "../serializer.h"
namespace hps {
constexpr size_t STRING_OUTPUT_BUFFER_SIZE = 1 << 10;
class StringOutputBuffer {
public:
StringOutputBuffer(std::string& str) : str(&str) { pos = 0; }
void write(const char* content, size_t length) {
if (pos + length > STRING_OUTPUT... | true |
fe8422270f0260334ece0fe6d03fdbe45d646269 | C++ | taketakeyyy/atcoder | /abc/231/e.cpp | UTF-8 | 1,579 | 2.5625 | 3 | [] | no_license | #define _USE_MATH_DEFINES // M_PI等のフラグ
#include <bits/stdc++.h>
#define MOD 1000000007
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define intceil(a,b) ((a+(b-1))/b)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pai... | true |
6cd1dcc42476347306e6f62a2ad08025d1e8e215 | C++ | sabahtalateh/Stepic_CPP | /mod4/les_5_oop/main.cpp | UTF-8 | 3,773 | 3.875 | 4 | [] | no_license | #include <iostream>
#include <iostream>
#include <string>
using namespace std;
struct Number;
struct BinaryOperation;
struct Visitor {
virtual void visitNumber(Number const *number) = 0;
virtual void visitBinaryOperation(BinaryOperation const *binary) = 0;
virtual ~Visitor() {}
};
struct Expression {... | true |
2daf8ccf81721eafde8edbf21f5b840cc5948e80 | C++ | tarraschk/Chi-Fu-Mi | /Chi-Fu-Mi/Chi-Fu-Mi/IA.cpp | UTF-8 | 878 | 2.78125 | 3 | [] | no_license | //
// IA.cpp
// Chi-Fu-Mi
//
// Created by Maxime Alay-eddine on 05/11/12.
// Copyright 2012 Ecole Centrale de Nantes. All rights reserved.
//
#include "IA.h"
#include "Coup.h"
#include "Pierre.h"
#include "Papier.h"
#include "Ciseaux.h"
#include <sstream>
#include <string>
#include <iostream>
#include <cstdlib>
... | true |
8ceb46f5383132c85de4c10d3265ce32a7ff02c4 | C++ | kksweet8845/Uva | /Uva-167/Uva-167.cpp | UTF-8 | 1,133 | 2.84375 | 3 | [] | no_license | #include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
bool visit[8][8];
bool dx[8],dy[8],ds1[15],ds2[15];
int board[8][8];
int ans,max;
void backtrack(int x, int y,int c);
int main(void)
{
int k,i,j,l;
scanf("%d",&k);
for(i=0;i<k;i++)
{
memset(visit,0,sizeof(visit));
memset(board,0,sizeof(b... | true |
5460087710f4dd417c753ed1851d1dd6893d6d92 | C++ | mboroff/V10_TFT_28_Weather_with_Chimes | /getNtp.ino | UTF-8 | 2,264 | 2.546875 | 3 | [] | no_license | void getNtp() { // update the system clock
// Serial.println();
// Serial.println(F("UpdateNTPTime"));
internetCtr++;
mysntp.UpdateNTPTime();
// Serial.println(F("Current local time is:"));
mysntp.ExtractNTPTime(mysntp.NTPGetTime(&now2, true), &timeExtract);
// Serial.print(tim... | true |
c2a1015b3691c1139342cfdd3b12033a0f587586 | C++ | Natureal/bytecamp-shm_backup | /1148/test_AF_UNIX.cpp | UTF-8 | 2,803 | 3 | 3 | [] | no_license | #include <sys/time.h>
#include <iostream>
#include <pthread.h>
#include "AF_UNIX_client.h"
#include "AF_UNIX_server.h"
int size = 32; //每次读 写的大小
char *p = (char*) "socket.address";
int pt_num = 100; //连接server的client数量
AF_UNIX_server ser(p);
bool is_end = false; //线程是否能结束
bool time_start = false; //开始计时
long ... | true |
e1c6c8419f207da7f89edd952c53480bbd9b6a26 | C++ | green-fox-academy/Boritse | /week-03/day-03/fibonacci/main.cpp | UTF-8 | 248 | 3.53125 | 4 | [] | no_license | #include <iostream>
int fibonacci(int n){
if(n==0){
return 0;
}else if(n==1){
return 1;
}else{
n=fibonacci(n-1)+fibonacci(n-2);
}
return n;
}
int main() {
std::cout << fibonacci(17);
return 0;
} | true |
4a0375cdead602d320bb339b52138e7582d458d4 | C++ | HekpoMaH/Olimpiads | /Shumen AiB/more2013/Untitled Folder/ru-olymp-roi-2010-tests/6-farmer/src/gen_frombmp/bmp.h | UTF-8 | 2,359 | 3.078125 | 3 | [] | no_license | #ifndef _BMP
#define _BMP
#include <vector>
using namespace std;
typedef struct {
char id1;
char id2;
char tmp1, tmp2;
unsigned int file_size;
unsigned int reserved;
unsigned int bmp_data_offset;
unsigned int bmp_header_size;
unsigned int width;
unsigned int height;
unsigned shor... | true |
88640f9ff8267c85374ca4e0edf97ad8e56bb7f0 | C++ | gondurovad/mp2-lab3-postfix | /Гондурова/base_test/test_tstack.cpp | UTF-8 | 960 | 3.859375 | 4 | [] | no_license | #include "stack.h"
#include <gtest.h>
TEST(TStack, can_create_stack_with_positive_length)
{
ASSERT_NO_THROW(TStack<int> st(5));
}
TEST(TStack, cant_create_stack_with_negative_length)
{
ASSERT_ANY_THROW(TStack<int> st(-5));
}
TEST(TStack, cant_create_too_large_stack)
{
ASSERT_ANY_THROW(TStack<int> st(MaxStackSize +... | true |
df9468113c5c7aa8911552918f4ff4f77719ea6c | C++ | gregormey/TestVer | /TestVer/class_BCNS.h | UTF-8 | 3,070 | 2.640625 | 3 | [] | no_license | /*
* class_BCNS.h
*
* Created on: 30 nov. 2015
* Author: Susanne Riess, following Vanessa Erbenich
*
* Implementation of the key exchange protocol described in BCNS14, originally designed by Peikert as a KEM
*/
#ifndef CLASS_BCNS_H_
#define CLASS_BCNS_H_
#include <stdio.h>
#include <NTL/ZZ_... | true |
4bcb6af6e438287766b611ca3e0a3868670df31a | C++ | simakovvv/NIIT-work-with-C | /lesson7/main.cpp | UTF-8 | 985 | 3.1875 | 3 | [] | no_license | #include "list.h"
#include "operations.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main() {
Node *phead = 0;
Node *phead1 = 0;
srand(time(0));
for (int i = 0; i < 10; ++i) {
add2list(&phead, rand() % 100);
add2listSort(&phead1, rand() % 100);
}
printf("Elements of the l... | true |
695d713d7ec9284398421fe4271842ad59f91e36 | C++ | Flowsaiba/HashLib | /CLRTest/Murmur3Test.h | UTF-8 | 2,870 | 2.640625 | 3 | [] | no_license |
#pragma once
namespace CLRTest
{
ref class Murmur3CSharpTest : TestBaseNonCryptoNonBlock
{
private:
HashLib::IHash^ m_hash = HashLib::HashFactory::Hash32::CreateMurmur3();
protected:
virtual int GetHashSize() override
{
return m_hash->Hash... | true |
a56b7b18c9d7086ec04ceb8433c35881e5f3a2a0 | C++ | Cibi-R/NeuralNetwork | /lib/neural_network/src/neural_net.cpp | UTF-8 | 792 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <MyMath.h>
#include <NeuralNetwork.h>
NN::NeuralNet::NeuralNet(const std::vector<uint32_t> &layer) : Layer(layer)
{
Z.resize(Layer.size()-1);
A.resize(Layer.size());
W.resize(Layer.size()-1);
for (int i = 0; i < W.size(); i++)
{
W[i] = MyMath::Matrix(layer[i], la... | true |
8c9f19a768451ba93315e68dc9f7c99f378f31cb | C++ | FriedrichFrankenstein/A.19-Green | /Programming/Vyacheslav_Diedov/Game/Untitled1.cpp | UTF-8 | 1,366 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
string binary(unsigned char x){
unsigned char mask=64;
string s;
for(int i=0; i<7; i++) {
s.push_back((x&mask)>0 ? '1':'0');
mask=mask>>1;
}
return s;
}
int main() {
string l;
string a;
unsigned char x;
... | true |
c197f3589f7b9a88ac3d92a753c70df26f7f42e5 | C++ | nikopo1/playground | /langs/c-cpp-test-zone/function-p-cpp/function_pointers.cpp | UTF-8 | 347 | 3.515625 | 4 | [] | no_license | #include <cstdio>
#include <iostream>
class MyClass {
public:
int my_mul(int a, int b) { return a + b; }
};
int add(int a, int b)
{
return a + b;
}
int (*f) (int, int);
int (MyClass::*g) (int, int);
int main(void)
{
MyClass c;
f = add;
g = &MyClass::my_mul;
std::cout<<f(1,1)<<std::endl;
std::cout<<(c.*g)(1,1... | true |
6eb2c07f7c9653eae8205d890bd94975aff78933 | C++ | mayankwasekar/Study | /C++/Programs/Classes/dtortest.cpp | UTF-8 | 1,838 | 4.15625 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Interval
{
public:
//Constructor - initializes the object
Interval(long s=0, long m=0)
{
seconds = 60 * m + s;
++count;
}
void SetTime(long value)
{
seconds = value;
}
long GetTime()
{
return seconds;
}
//It refers to non-static members so it req... | true |
cac91a475fa6717470b9d93b1346a26e2dbbd412 | C++ | salif45/EscapeGameIrrlicht | /create_window.cpp | UTF-8 | 5,931 | 2.578125 | 3 | [] | no_license | // create_window.cpp
#include <irrlicht.h>
#include <irrMap.h>
#include <irrList.h>
#include "create_window.h"
using namespace irr;
namespace ic = irr::core;
namespace is = irr::scene;
namespace iv = irr::video;
namespace ig = irr::gui;
/*===========================================================================... | true |
26885e02286bdf0c01cad71388e9d87dd53cf407 | C++ | jakubrospek/C_PlusPlus-Szkola-programowania | /rozdział 8/roz8cw6.cpp | WINDOWS-1250 | 2,370 | 4 | 4 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
template<typename T>
void maxn(T tab[], int rozmiar);
template<>void maxn<string>(string tab[], int rozmiar); // <string> to nowy typ zwracany przez funkcj, w tym przypadku mona go pomin bo pierwowzr funkcjii nic nie zwraca - void
int main()
{
int tab... | true |
18e3b5ff33d119573c5511af792a612c744beaec | C++ | Tigerxin/DataStructure | /About-C/基数排序.cpp | GB18030 | 493 | 2.921875 | 3 | [] | no_license | #include <stdio.h>
// ųʼ
typedef struct LinkNode{
char *data;
struct LinkNode *next;
}LinkNode, *LinkList;
// ŷ
typedef struct{ // ʽ
LinkNode *head,*rear; // еĶͷͶβָ
}LinkQueue;
/**
ҪrУռ临Ӷ=Or
һ˷O(n),һռO(r),ܹd˷䣬ռܵʱ临Ӷ=O(d(n+r))
ȶԣȶ
*/
int main(){
return 0;
}
| true |
983409404f7fe131c81b7383810f85b7b1b8bd7c | C++ | Ayeshasaif13/Object-Oriented-Programming-Project | /Library.hpp | UTF-8 | 3,411 | 2.640625 | 3 | [] | no_license |
#include <fstream>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<string.h>
#include <iomanip>
#include <iostream>
#include<windows.h>
#include"USER.h"
#include"student.hpp"
#include"book.hpp"
#include"filing.hpp"
using namespace std;
//**************************************************************... | true |
807b5206572ee3ff9c6a600221fd635bab7d5367 | C++ | ngthvan1612/OJCore | /TestModule/HK1/Users/20110299/BAI4.CPP | UTF-8 | 694 | 2.9375 | 3 | [] | no_license | #include<stdio.h>
void nhap(long a[200][200],long &n,long&m);
int NT(long x);
void tinh(long a[200][200],long n,long m);
void main()
{
long a[200][200];
long n,m;
nhap(a,n,m);
tinh(a,n,m);
}
void nhap(long a[200][200],long &n,long&m)
{
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
scanf("%d"... | true |
d76749e0a8e91808097c415fd22aea57661c121e | C++ | coreygamache/senior_design | /sd_sensors/src/ball_sensor.cpp | UTF-8 | 698 | 3.078125 | 3 | [] | no_license | //includes
#include <ball_sensor.hpp>
//#include <ros/ros.h>
//default constructor
BallSensor::BallSensor(int output)
{
//run wiringPi setup function
wiringPiSetup();
//set output pin
setOutputPin(output);
}
//basic functions
//return output pin
int BallSensor::getOutputPin()
{
return this->_outputPin;
... | true |
f6a5d0d7fae1f1d5ce3d0da2ef4c487ec57bdcd6 | C++ | bananaXu/algorithm | /算法题解/小珂的数学题(组合数学).cpp | GB18030 | 1,651 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <stack>
#include <cmath>
#include <ctype.h>
using namespace std;
int c(int m, int n)
{
int i, j;
int sum = 1;
for (i = 1; i <= n; i ++)
{
sum = sum*(m-n+i)/i;
}
return sum;
}
int main()
{
char s[30];
i... | true |
8043b5afa90437605c8098cc34ee0fd01ee3193c | C++ | thisroot/Cpp-snippets | /arrays/count_of_days_onto_birth.cpp | UTF-8 | 1,247 | 3.421875 | 3 | [
"MIT"
] | permissive | //ДНИ РОЖДЕНИЯ. Вводятся номера дней недели, на которые приходятся
//дни рождения N из Ваших знакомых в этом году (0-воскр.,1-понедельник,...6-субб.).
//Определить :
//а) количество дней рождений, приходящихся на каждый из дней недели;
//б) номер дня недели, на который приходится максимальное число дней рождения... | true |
293704938d924a5c69a7b87b70f05c642b0c6004 | C++ | acsl-technion/nuevomatch | /src/cpu_core_tools.cpp | UTF-8 | 3,483 | 2.59375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /*
* MIT License
* Copyright (c) 2019 Alon Rashelbach
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, mod... | true |