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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
121b6e0bed9aff69326d6701f7300bd6484bbd5d | C++ | Nightmare4214/connect_four | /Project1/TranspositionTable.cpp | GB18030 | 1,487 | 2.96875 | 3 | [] | no_license | #include "TranspositionTable.hpp"
void TranspositionTableNode::setValue(const uint64_t & key, const int & value, const int & depth, const int & flag, const int& bestMove)
{
this->key = key;
this->value = value;
this->depth = depth;
this->flag = flag;
this->bestMove = bestMove;
}
TranspositionTable::Transposition... | true |
c5164e1f0a0b87ca34b5d9b3e85bd698643b640c | C++ | aaronsonderegger/Spring2020_StrainGauges | /Filter/TestFilter.cpp | UTF-8 | 2,924 | 3.015625 | 3 | [] | no_license | #include <stdio.h>
#include "Filter.cpp"
void GenerateSignals(int numSignals, Filter fltr); // This generates signals for a filter.
bool Test1(); // This test checks filter before UpdateFilter() function
bool Test2(); // This test checks filter with 1 signal reading of UpdateFilter()
bool Test3(); // This test... | true |
1b4db219675fd3c100fbd0b8401a95d6157105a6 | C++ | gdarchen/webusb-arduino-nfc | /3-webusb/arduino/libraries/NDEF-master/NdefMessage.h | UTF-8 | 1,110 | 2.515625 | 3 | [
"MIT",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | #ifndef NdefMessage_h
#define NdefMessage_h
#include <Ndef.h>
#include <NdefRecord.h>
#define MAX_NDEF_RECORDS 4
class NdefMessage
{
public:
NdefMessage(void);
NdefMessage(const byte *data, const int numBytes);
NdefMessage(const NdefMessage& rhs);
~NdefMessage();
NdefMessa... | true |
5c748d71cf6ec13c08b30e4868336e630f965220 | C++ | takoikatakotako/atcoder | /aoj_ALDS1_1_D.cpp | UTF-8 | 534 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int aoj_ALDS1_1_D() {
int N;
cin >> N;
vector<int> R(N);
for (int i = 0; i < N; ++i) {
cin >> R[i];
}
int maxBenefit = R[1] - R[0];
int minNum = R[0];
for (int i = 1; i < N; ++i) {
if (R[i-1... | true |
fbdaa7a54c350c42d9989b17af5b19a5d2bb7166 | C++ | yuujun09/yuuku | /草稿编程/源.cpp | UTF-8 | 337 | 2.609375 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
int arr[20];
int i = 0;
int sum = 0;
for (i = 0;;)
{
scanf("%d", &arr[i]);
if (arr[i] <= 0)
break;
if (arr[i] % 2 == 1)
sum += arr[i];
i++;
}printf("%d", sum);
... | true |
ee64b4865dadcee2c8389617ba583e1ad82d6058 | C++ | arubiom/ED | /reto2/piecelist.h | UTF-8 | 2,905 | 3.59375 | 4 | [] | no_license | /**
* @file Piecelist.h
* @author Alejandro Rubio, Ximo Sanz
* @brief The file which contains the TDA object Piecelist, a vector of pieces
*/
#ifndef PIECELIST_H
#define PIECELIST_H
#include "piece.h"
#define MAX_PIECES = 4
/**
* @brief The Piecelist class
*
*/
class Piecelist {
private:
Piece* currentP... | true |
420f45c0aa1dac0dfcd1f7116946fdf81e18eb9b | C++ | HusseinYoussef/Problem-Solving | /Code/Shortest path of the king.cpp | UTF-8 | 2,634 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main ()
{
int i=0,steps,lower;
string home,end;
char current;
cin >> home >> end;
if(abs(home[0]-end[0]) > abs(home[1]-end[1]))
{ steps = abs(home[0]-end[0]);
lower = abs(home[1]-end[1]);
}
else
{ steps = abs(ho... | true |
606974ee7a4932dcfa3ab3b81ba4af205bc4272c | C++ | bes-germes/Vector | /vector.cpp | UTF-8 | 1,697 | 3.296875 | 3 | [] | no_license | #include "vector.h"
MyVector::MyVector(size_t size, ResizeStrategy,float coef){
this->_size = size;
this->_capacity = 1;
this->_data = nullptr;
this->_coef = coef;
}
MyVector::~MyVector(){
}
MyVector::MyVector(size_t size, ValueType value, ResizeStrategy, float coef){
this->_size = size;
thi... | true |
1b7d9ba57c1c379a82f7c5348f68095b322bc3db | C++ | flutter/engine | /third_party/accessibility/base/simple_token.h | UTF-8 | 1,509 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_SIMPLE_TOKEN_H_
#define BASE_SIMPLE_TOKEN_H_
#include <functional>
#include <optional>
#include <string>
namespace base {
// A simple strin... | true |
922fc114df38a0c3899890c914b68804754881de | C++ | datnguyen25082000/SimplePongGame | /Source/Project2/Paddle.cpp | UTF-8 | 1,133 | 2.984375 | 3 | [] | no_license | #include "Paddle.h"
// get x(y) value of object
int Paddle::GetX()
{
return _x;
}
int Paddle::GetY()
{
return _y;
}
// get and set color of Paddle object
int Paddle::Getcolor()
{
return _color;
}
void Paddle::Setcolor(int color)
{
_color = color;
}
int Paddle::Getsize()
{
return _size;
}
... | true |
a187eba8217a502b517a744371b5d1c662b52391 | C++ | tonningp/cis201-class-examples | /bcpp3-sourcecode/ch07/sec03/strings.cpp | UTF-8 | 1,993 | 4.5 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <cstdlib>
#include <cctype>
using namespace std;
/**
Makes an uppercase version of a string.
@param str a string
@return a string with the characters in str converted to uppercase
*/
string uppercase(string str)
{
string result = str; // Make a copy of str
... | true |
5bce5d15e65eed007f79d797a0cd4274a9baff2e | C++ | eunjin917/algorithm | /Baekjoon/10951.cpp | UTF-8 | 237 | 2.84375 | 3 | [] | no_license | // A+B - 4
// https://www.acmicpc.net/problem/10951
// 2021.03.07
#include <iostream>
using namespace std;
int main()
{
int A, B;
while (scanf("%d %d", &A, &B) != EOF)
{
cout << A + B << '\n';
}
return 0;
} | true |
0fff6eb1496deb66e70bbc5148049437eadd6d2a | C++ | yilehu/CG_C | /MatrixOperation.cpp | UTF-8 | 1,483 | 3.046875 | 3 | [] | no_license | void MatrixDefinition(double **Matrix,int m,int Bandwidth)
{
int i,j,k;
for(i=0;i<m;i++)
{
Matrix[i][i] = (double)Bandwidth;
if(i <= m-Bandwidth)
{
k = Bandwidth;
}
else
{
k = m - i;
}
for(j=1;j<k;j++)
{
Matrix[i][i+j] = Bandwidth - j;
Matrix[i+j][i] = Bandwidth - j;
... | true |
0109cf2bcbec3096653d8ab617853ef9633bc47d | C++ | DragaSahiti/lab5 | /sahiti4.cpp | UTF-8 | 324 | 3.484375 | 3 | [] | no_license | /*
program to print all even numbers between 1 and 100
*/
//library
# include <iostream>
using namespace std;
//main function
int main() {
//declarations
int i = 1;
//loops
while( i <= 100 ) {
//condition
if(i % 2 == 0){
cout << i << endl;
}
i++;
}
return 0... | true |
99553668f4ee2a437a71f257893300a12ecc4d02 | C++ | Xopher00/binary-search | /binary_search.cpp | UTF-8 | 3,402 | 4.21875 | 4 | [] | no_license | // This program demonstrates a Binary Search
//Kris Price
#include<iostream>
using namespace std;
int binarySearch(int [], int, int); // function prototype
const int SIZE = 16;
int main()
{
int found, value;
int array[SIZE] ={0,2,2,3,5,9,11,12,12,12,13,17,18,19,19,34};
cout << "Enter an integer to search f... | true |
292f9c111c6a4cd2ed1866a07c7a38703944c492 | C++ | webstorage119/easyeye | /easyeye/src/easyeye/common/mylog.cc | UTF-8 | 2,682 | 3.046875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | #include <iostream>
#include <cstdarg>
#include <cstdlib>
#include "mylog.h"
#include <string>
using namespace std;
using namespace mylog;
const string Logs::kGlobalName = "";
Logger Logs::global_logger(Logs::kGlobalName);
LoggerSet Logs::logger_set;
LoggerSet::LoggerSet()
: loggers()
{}
Logger* LoggerSet::Get... | true |
1fc28698087ac00a927ee2dece45955f6a720b1f | C++ | vikaskbm/pepcoding | /foundation/cpp/1_basics_of_programming/3_function_and_arrays/1.cpp | UTF-8 | 521 | 3.6875 | 4 | [
"MIT"
] | permissive | // Digit Frequency
// 1. You are given a number n.
// 2. You are given a digit d.
// 3. You are required to calculate the frequency of digit d in number n.
// n=994543234
// d=4
// 3
#include <iostream>
using namespace std;
void digit_frequency(int num, int k) {
int count = 0;
int n = num;
while(n >... | true |
50f667358bb3e89a4a4bbeee68e666e9e4254ff4 | C++ | rajatgirotra/study | /cpp/ThreeArrowsCapital/reverseString.cpp | UTF-8 | 4,614 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
#include <fstream>
#include <boost/program_options.hpp>
#include <thread>
#include <memory>
using namespace std;
namespace po = boost::program_options;
namespace
{
//Reverse a string in place.
//Will only reverse charCount characters
//Is re-entrant
void reverse... | true |
bc35fd3217ffac9fed4a8c2171a1b97c11068b1f | C++ | ikrima/cxl | /include/cxl/iterator.hpp | UTF-8 | 1,778 | 3.40625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "utility.hpp"
#include <type_traits>
namespace cxl
{
template <typename T, index_t Index>
struct iterator
{
using container_type = T;
constexpr auto index() const { return ::std::integral_constant<index_t, Index>{}; }
constexpr auto operator*() const { return T{}[::std::integral_constan... | true |
312dc33887bc85d40076a8660eb7c20ceea44dfa | C++ | rystills/RaiderEngine | /RaiderEngine/audio.hpp | UTF-8 | 696 | 2.625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "stdafx.h"
/*
initialize audio via OpenAL-Soft
*/
void initAudio();
void closeAudio();
/*
custom deleter for smart pointers containing openal-soft audio buffers; deletes the buffer's contents before deleting the buffer itself
@param b: the audio buffer to delete
*/
void deleteAudioBuffer(ALuint... | true |
3dcfd57e52a7270d2ba7faaad42a75cb658bf761 | C++ | barisayyildiz/cpp-notes | /conversion_constructor.cpp | UTF-8 | 1,196 | 4.0625 | 4 | [] | no_license | #include <iostream>
using namespace std;
class A
{
private:
int x, y;
public:
A();
// conversion constructor??
A(int a);
A(int a, int b);
// copy constructor
A(const A& right);
// assignment operator
A& operator=(const A& right);
// destructor
~A();
// print
void print()const;
};
A::A() : x(0), y(0)
... | true |
7ab19c2e3dde8a00e6df1da30a6aebd427885c14 | C++ | joos5295/OOAD_SemesterProject | /inc/Game/Terrain/Goal.h | UTF-8 | 616 | 2.671875 | 3 | [] | no_license | //
// Created by user on 2019-04-23.
//
/*
* The goal state of each level
* When the player enters this cell they will move to the start of the next level
*/
#ifndef OOAD_SEMESTERPROJECT_GOAL_H
#define OOAD_SEMESTERPROJECT_GOAL_H
#include "Terrain.h"
class Goal : public Terrain {
Goal() = default;
Goal... | true |
5dfce89d894cea291506977fa2724991ff555048 | C++ | elf-audio/cppsketch | /examples/audioweb/Biquad.h | UTF-8 | 4,202 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | //
// Was called - CFxRbjFilter.h
// Someone's implementation of Robert Bristow-Johnson's biquad eqns.
//
// Created by Marek Bereza on 02/10/2012.
// (found it on musicdsp.org)
// Modified 04/04/19 by Marek Bereza
#pragma once
#include <cmath>
class Biquad {
public:
constexpr static int LOWPASS = 0;
constexp... | true |
37498ca868d143a95300336e53efcecd1b070a87 | C++ | LGriggles/3DGameEngine | /Actor.hpp | UTF-8 | 1,328 | 2.8125 | 3 | [] | no_license | #ifndef ACTOR_HPP
#define ACTOR_HPP
//GLM
#include <glm.hpp>
//3DGameEngine
#include "DrawingInstance.hpp"
#include "Transform.hpp"
#include "Collider.hpp"
class CollisionEngine;
class Scene;
/*! The base object that all game objects derive from */
class Actor
{
private:
bool _gridLocked;
sf::Vector2i _gridPos;
... | true |
48e4060541c47adefef45f0fb875e734733ed4ac | C++ | Hanggansta/MirageRender | /src/materials/dielectric.cpp | UTF-8 | 2,893 | 2.84375 | 3 | [
"MIT"
] | permissive | // std includes
#include <iostream>
// mirage includes
#include "dielectric.h"
#include "../macros.h"
namespace mirage
{
DielectricMaterial::DielectricMaterial(vec3 kd, vec3 ks, vec3 ke, float ior) : Material(nullptr, nullptr, nullptr, kd, ks, ke, true), m_ior(ior)
{
}
DielectricMaterial::~DielectricMaterial(... | true |
3faa0ee112359fcb07b4fc530a6aff3a9e7212c5 | C++ | ProkopHapala/SimpleSimulationEngine | /cpp/common/math/Convex2d.cpp | UTF-8 | 7,015 | 2.796875 | 3 | [
"MIT"
] | permissive |
//#include "arrayAlgs.h"
#include "Convex2d.h" // THE HEADER
/*
bool Convex2d::lineIntersections( const Line2d& line, const Vec2d& p1, Vec2d& p2 ){
int i0,i1;
double sign0 = line.dist_unitary( corners[0] );
double sign = line.dist_unitary( corners[1] );
for( i0=2; i0<n; i0++ ){ double sign = lin... | true |
8f5ac20926aea7b1f5cbdbccbb51b8d6d0f29b7a | C++ | wembikon/baba.io | /detail/os/impl/kqueue_timer_impl.h | UTF-8 | 688 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* MIT License
* Copyright (c) 2020 Adrian T. Visarra
**/
#pragma once
/**
* Kqueue only needs an ident (not a file descriptor, but just an incrementing integer
* to associate the timer) for EVFILT_TIMER.
*
* From BSD manual:
* ident - Value used to identify this event. The exact interpretation
* ... | true |
f49b0b91d93681d80ebbdacc66b869e368096149 | C++ | n-shingo/signal_finder | /src/SignalFinder2019.cpp | SHIFT_JIS | 21,046 | 2.71875 | 3 | [] | no_license | //-------------------------------------------------
// SignalFinder2019.cpp
// S. NAKAMURA
// since: 2019-11-05
//-------------------------------------------------
#include "SignalFinder2019.h"
#include "ToolFunc.h"
using namespace sn;
using namespace sn::Tool;
// Mo̊Jn
void SignalFinder2019::Start()
{
MoveMode... | true |
57eadbf20eb9a6278fc8589b70081414f4a10c68 | C++ | cryptocrowd-city/libxayagame | /xayagame/sqlitestorage.hpp | UTF-8 | 7,970 | 2.59375 | 3 | [
"MIT"
] | permissive | // Copyright (C) 2018-2020 The Xaya developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef XAYAGAME_SQLITESTORAGE_HPP
#define XAYAGAME_SQLITESTORAGE_HPP
#include "storage.hpp"
#include <xayautil/uint256.hpp>
#incl... | true |
c700d89edf1d39394090af8d255ebe5a9f5164be | C++ | louislaaaw/CS161-162-260 | /Assign01/Person.cpp | UTF-8 | 6,119 | 3.46875 | 3 | [] | no_license | //----------------------------------------------------------
// CS260 Assignment 1 Starter Code
// Copyright Andrew Scholer (ascholer@chemeketa.edu)
// Neither this code, nor any works derived from it
// may not be republished without approval.
//----------------------------------------------------------
#include "P... | true |
1975ab953560dc16cfa10277c4634f9bc9cba499 | C++ | phiwen96/MyLibs | /libs/ph/libs/core/src/core.cpp | UTF-8 | 677 | 2.75 | 3 | [
"MIT"
] | permissive | #include <ph/core/core.hpp>
namespace ph::core {
template <>
inline bool isInteger(const std::string & s) {
if(s.empty() || ((!isdigit(s[0])) && (s[0] != '-') && (s[0] != '+'))) return false;
char * p;
strtol(s.c_str(), &p, 10);
return (*p == 0);
}
template <>
inline bool isIn... | true |
71f6ba5dc068dced90fa66f4498e9c6a39d3df96 | C++ | nathangurnee/Snake | /src/Pineapple.cpp | UTF-8 | 1,273 | 3.046875 | 3 | [] | no_license | #include "../include/Pineapple.h"
#include "../include/PineappleMovement.h"
// Dimensions of pineapple
const int PINEAPPLE_WIDTH = 50;
const int PINEAPPLE_HEIGHT = 50;
Pineapple::Pineapple() : Graphic(), renderer(NULL)
{
collisions = 0;
x = 40 + rand() % 634;
y = 40 + rand() % 634;
}
void Pineapple::set... | true |
e6967d62dde9777f62e2302fff6a34bd7f0aef3d | C++ | watashi/AlgoSolution | /zoj/16/1655.cpp | UTF-8 | 1,518 | 2.71875 | 3 | [] | no_license | #include <cstdio>
double mp[101][101];
double maxr[101];
double weight[101];
void Dijkstra(const int n)
{
static bool mark[101];
for (int i = 1; i <= n; i++) {
mark[i] = false;
maxr[i] = 0.0;
}
maxr[n] = 1.0;
for (int i = 1; i <= n; i++) {
int k = 0;
for (int j = 1... | true |
06e80fcf5ec338ec1841db0956c97ac972136849 | C++ | HyeongGunLee/ProblemSolving | /CrackingCoding/ConnectedCelss_DFS.cpp | UTF-8 | 928 | 3.28125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int getRegionSize(int matrix[100][100], int row, int col) {
if (row < 0 || col < 0 || row > 100 || col > 100) {
return 0;
}
if (matrix[row][col] == 0) {
return 0;
}
matrix[row][col] = 0;
int size = 1;
for (int i = row-1; i <= row+1... | true |
d3535264a8fcad1a07cc9926a73cffb809fbd2c5 | C++ | iloveooz/podbelsky | /03/p3-04.cpp | UTF-8 | 728 | 3.453125 | 3 | [] | no_license | //p3-04.cpp - переопределение внешнего имени внутри блока
#include <iostream>
using namespace std;
int main() {
char cc[] = "Число"; // массив автоматической памяти
float pi = 3.14; // переменная типа float
cout << "Обращение по внешнему имени: pi = " << pi;
{ // переменная типа double переопределяет... | true |
28471b1169a4d27924b9afe6fafb212a36190b14 | C++ | ByteLeopord/Examination | /剑指offer/offer04二维数组中的查找.cpp | UTF-8 | 526 | 3.09375 | 3 | [] | no_license | class Solution {
public:
bool findNumberIn2DArray(vector<vector<int>>& matrix, int target) {
if(matrix.empty()) return false;
int row = matrix.size();
int col = matrix[0].size();
int x = col-1, y = 0;
while(x >= 0 && y < row){
if(matrix[y][x] > target){
... | true |
19897d01834931c72bbbd76ac5953f254b6fadce | C++ | TheSennin/Arquivos_Facul | /Estruturas de Dados/2018 - 2/Trabalhos/M2/Trabalho M2 - Filas e Pilhas/Questão 2/Fila.cpp | ISO-8859-1 | 4,007 | 3.421875 | 3 | [] | no_license | #include "Fila.h"
#include "NodoDuplo.cpp"
#include <stdio.h>
#include <iostream>
using namespace std;
template <typename T>
Fila<T>::Fila(){
this->numeroElementos = 0;
this->inicio = NULL;
this->fim = NULL;
}
template <typename T>
Fila<T>::~Fila(){
NodoDuplo<T> *nodo;
while(th... | true |
37a084473c72994a9cdd7f4c10f2926d058235e7 | C++ | Verdagon/extrude | /src/monotonify.cpp | UTF-8 | 27,299 | 2.75 | 3 | [] | no_license | #include "monotonify.h"
#include <unordered_map>
#include <set>
using std::unordered_set;
using std::unordered_map;
using std::vector;
using std::set;
using std::pair;
using std::make_pair;
using glm::vec2;
namespace monotonify {
owning_ptr<Graph> assembleNodes(const vector<vector<PointFromFont>> & contours) {
owni... | true |
8c2c9ab30184fe842972be2cebb861183c4bf6a7 | C++ | SergioQuijanoRey/smallPrograms | /C++/Game of Life/Grid.cpp | UTF-8 | 2,279 | 3.265625 | 3 | [] | no_license | #include "Grid.h"
#include "Functions.h" //Contains some useful funtions
//CONSTRUCTOR METHODS
Grid::Grid(int _cols, int _rows){
cols = _cols;
rows = _rows;
population = 0;
generation = 0;
vector<int> aux(_cols, 0);
vector<vector<int> > aux2(_rows, aux);
data = aux2;
}
//MODIFIER'S METHODS
void Grid::startG... | true |
aaa40c96164281e27e48ce4b0a9da7a578391819 | C++ | kliment-olechnovic/voronota | /src/scripting/operators/set_tag_of_contacts.h | UTF-8 | 1,683 | 2.671875 | 3 | [
"MIT"
] | permissive | #ifndef SCRIPTING_OPERATORS_SET_TAG_OF_CONTACTS_H_
#define SCRIPTING_OPERATORS_SET_TAG_OF_CONTACTS_H_
#include "../operators_common.h"
namespace voronota
{
namespace scripting
{
namespace operators
{
class SetTagOfContacts : public OperatorBase<SetTagOfContacts>
{
public:
struct Result : public OperatorResultBase... | true |
fefeff05ae1f8eff21a7d05a51b50de4f43fe291 | C++ | faaizhashmi/DataStructuresAndAlgorithms-CPP | /tree/tree link list.cpp | UTF-8 | 1,991 | 3.640625 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct node{
int value;
node *l;
node *r;
};
class tree{
node *root;
void initialize(){
root = NULL;
}
void insertroot(int r){
if (root != NULL){
cout << "Root exists" << endl;
return;
}
root = new node();
root->value = r;
root->l = NUL... | true |
d6389ea50138c1c6e1702bb8edc6a2d3e5e5e150 | C++ | alex8092/Sig | /include/signal.hpp | UTF-8 | 2,308 | 3.046875 | 3 | [
"MIT"
] | permissive | #ifndef SIG_SIGNAL_HPP
# define SIG_SIGNAL_HPP
# include <vector>
# include <functional>
# include <map>
using namespace std::placeholders;
namespace sig
{
template <int N>
struct _my_placeholder {};
}
namespace std
{
template<int N>
struct is_placeholder<sig::_my_placeholder<N>> : public integral_constan... | true |
844491a67ea1d78856eae66158ad256cfc07ad73 | C++ | UnholyCreations/programmiersprachen-raytracer | /framework/scene.hpp | UTF-8 | 2,936 | 2.625 | 3 | [
"MIT"
] | permissive | #ifndef SCENE_HPP
#define SCENE_HPP
#include "shape.hpp"
#include "box.hpp"
#include "sphere.hpp"
#include "camera.hpp"
#include "material.hpp"
#include "light.hpp"
#include <map>
#include <iostream>
#include <ostream>
#include <string>
#include <memory>
#include <vector>
struct Scene
{
std::string file_name;
u... | true |
f12713a10fe66a61c7fe034029fdb2aaad6f6236 | C++ | atlc/WearMyHeartOnMySleeve | /HeartBeatLED.ino | UTF-8 | 2,970 | 2.625 | 3 | [] | no_license | #include "LedControlMS.h"
/*
LED Matrix array pinout:
Pin 12 is connected to DataIn
Pin 11 is connected to CLK
Pin 10 is connected to LOAD
4 MAX72XX devices in array
*/
LedControl lc=LedControl(12,11,10,4);
/* Use heartrate sensor to obtain this value */
// unsigned long delaytime=500;
/* Consts for a full... | true |
a872496ca2c8bee3123bea75e992e81708254333 | C++ | kimyir111/kimyir | /partc3/Part 3/Chapter 1/part3_ch1_prob9.cpp | UTF-8 | 475 | 3.21875 | 3 | [] | no_license | #include <stdio.h>
struct node {
int data;
struct node* left_link;
struct node* right_link;
};
int main () {
struct node n7 = {70, NULL, NULL};
struct node n6 = {60, NULL, NULL};
struct node n5 = {50, NULL, NULL};
struct node n4 = {40, NULL, NULL};
struct node n3 = {30, &n6, &n7};
struct node n... | true |
a8c3b62bf4c001dc85599acbc296998f54a21eff | C++ | BhuiyanMH/Uva | /10346 peter's Smoke myself.cpp | UTF-8 | 364 | 2.6875 | 3 | [] | no_license | //it shows time limit exit
#include <stdio.h>
int main()
{
int a,b,eex;
long int sum;
while(scanf("%d %d", &a, &b)==2){
sum=a+(a/b);
eex=(a/b)+a%b;
while(1){
eex=eex/b;
sum+=eex;
if(eex<b) break;
eex=eex+eex%b;
... | true |
1da6c724f1b44e48a204b98b97717084398b52ab | C++ | jackson-nestelroad/cpp-keyboard-hook | /source/Error.cpp | UTF-8 | 322 | 3.375 | 3 | [] | no_license | // Implementation file for Error class
#include "Error.h"
// Constructor
Error::Error(int code, std::string reason)
{
this->code = code;
this->reason = reason;
}
// << operator overload
std::ostream &operator<<(std::ostream &stream, const Error &error)
{
stream << "ERROR: " << error.reason;
return stream;... | true |
2f260c773b202fbe535629bf19b2977153e9f37b | C++ | moozon/Lcd_Encoder | /Lcd_Encoder.ino | WINDOWS-1251 | 4,112 | 2.578125 | 3 | [] | no_license | #include <OneButton.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define PIN_A 2
#define PIN_B 4
#define SW 5
#define PULSE_PIN_LEN 5 //8
volatile unsigned long failingTime = 0;
volatile bool fl = false; //
volatile bool value_b = 0;
volatile byte prevA = 0;
volatile int Value0 = 0;
volatile in... | true |
c0143d55462a5aa9beb2d9b24cebb7066331ab2f | C++ | chromium/chromium | /components/user_notes/interfaces/user_note_metadata_snapshot.h | UTF-8 | 2,469 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_USER_NOTES_INTERFACES_USER_NOTE_METADATA_SNAPSHOT_H_
#define COMPONENTS_USER_NOTES_INTERFACES_USER_NOTE_METADATA_SNAPSHOT_H_
#include <memory>
#include <str... | true |
045b11cc9c56484f5042ecca4604ff52dc5c4762 | C++ | RyanSwann1/Top-Down-Shooter | /TopDownShooter/TopDownShooter/src/States/StateBase.h | UTF-8 | 626 | 2.84375 | 3 | [] | no_license | #pragma once
#include <States\StateType.h>
#include <SFML\Graphics.hpp>
class StateManager;
class StateBase
{
public:
StateBase(StateManager& stateManager, StateType stateType)
: m_type(stateType),
m_stateManager(stateManager)
{}
virtual ~StateBase() {}
StateBase(const StateBase&) = delete;
StateBase& operat... | true |
8cbde5bc0c9974011a54591aa29fe1a026e81020 | C++ | cltwski/Engine | /Engine/FPS.cpp | UTF-8 | 336 | 2.75 | 3 | [] | no_license | #include "FPS.h"
FPS::FPS()
{}
FPS::FPS(const FPS& other)
{}
FPS::~FPS()
{}
void FPS::Init()
{
_fps = 0;
_count = 0;
_startTime = timeGetTime();
}
void FPS::Frame()
{
_count++;
if (timeGetTime() >= (_startTime + 1000))
{
_fps = _count;
_count = 0;
_startTime = timeGetTime();
}
}
int FPS::GetFps()
{... | true |
308ec5df3eb3a7e5515f80c81435a52dbb5090d4 | C++ | Sunday361/leetcode | /leetcode_456.h | UTF-8 | 953 | 2.96875 | 3 | [] | no_license | //
// Created by panrenhua on 3/24/21.
//
#ifndef LEETCODE_LEETCODE_456_H
#define LEETCODE_LEETCODE_456_H
#include "allheaders.h"
/** 456. 132 模式
*
* 用一个数组存储 一个数左边最小的值, 用一个单调栈存储依次递减的数
* 当栈中有比当前元素大的数, 查看是否满足 132原则
* */
class Solution {
public:
bool find132pattern(vector<int>& nums) {
vector<int> lm(nums... | true |
33941b328b92f0d1f46ae7311e2aab52539074a3 | C++ | buddyw/project-euler | /cpp/p004.cpp | UTF-8 | 1,325 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
#define MAXSEARCH 999
int get_n(unsigned long int, int);
bool check_pal(unsigned long int);
int main()
{
int i_mx,i_my;
int i_big;
i_big = 0;
cout << "checking palendromes as multipls of 3 digit #'s up to"<< MAXSEARCH << endl << endl;
cout << endl <<... | true |
2e7a0ba20559c1b62a9d019fef373df8a32dc845 | C++ | Delthii/AoC2018 | /day6.cpp | UTF-8 | 2,185 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <numeric>
#include <functional>
#include <algorithm>
#include "Helpers.h"
#include "Stopwatch.h"
using namespace std;
void partA6(vector<string> input) {
auto co = unordered_map<int,p... | true |
4f25fbd5165a40acec55b13761e82d439ba92f23 | C++ | sathish1000/workspace | /BigNumberAddition.cpp | UTF-8 | 877 | 3.71875 | 4 | [] | no_license | //The code is to add two big numbers that dont fall inside the size of the regular integer types.
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int N;
int maxSize = 0;
cout << "Enter the number of the items to be added" << endl;
cin >> N;
vector<string> Items(N);
fo... | true |
cd6a76ac24c58ddc28f0de147bf78f67f30af8d7 | C++ | m43/fer-irg | /src/linalg/i_vector.h | UTF-8 | 5,478 | 2.953125 | 3 | [] | no_license | //
// Created by m43 on 16. 03. 2020..
//
#ifndef FER_IRG_I_VECTOR_H
#define FER_IRG_I_VECTOR_H
#include <vector>
#include <stdexcept>
#include <boost/serialization/array.hpp>
#include <array>
#include "i_vector.h"
#include "i_matrix.h"
namespace linalg {
class IMatrix; // TODO Got a circular reference, this is... | true |
c61bc6a3e25b76c43ac486a39b233335f244bfbb | C++ | Youlissize/polycube | /src/parsing.h | UTF-8 | 5,818 | 2.890625 | 3 | [] | no_license | #ifndef PARSING_H
#define PARSING_H
#endif // PARSING_H
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include"Mesh.h"
namespace MeshIO{
template< class point_t > bool open( const std::string & filename , std::vector< point_t > & vertices , std::vector< int > & tetras )
{
std::i... | true |
0b87cb259e6a4ec594aa36ae86693646c4918f67 | C++ | ak566g/Data-Structures-and-Algorithms | /Graph/18_bottom.cpp | UTF-8 | 3,232 | 2.984375 | 3 | [] | no_license | //by Ankita Gupta
// https://www.spoj.com/problems/BOTTOM/
// Basically the question is if you can visit one vertex to another then there must be a reverse path.
// Idea to solve is find all the strongly connected components.. and if there is outgoing edge b/w first scc to second scc then don't include first
// scc in... | true |
f50f40ec95bf4a292afb93d4120918d6f92af102 | C++ | diohabara/competitive_programming | /aoj/dpl3_b.cpp | UTF-8 | 2,964 | 3.0625 | 3 | [] | no_license | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;
#define MAX 1400
struct Rectangle {
int height;
int pos;
};
int getLargestRectangle(int size, int buffer[]) {
// 行ごとに計算する
stack<Rectangle> S;
int maxv = 0;
buffer[... | true |
bf8abe0572193ff0ced2061c3b8c1264d4fa144d | C++ | OutOfTheVoid/ProjectRed | /include/Xenon/Math/Vec3.h | UTF-8 | 2,891 | 2.765625 | 3 | [
"MIT"
] | permissive | #ifndef XENON_VEC3_H
#define XENON_VEC3_H
#include <Xenon/Xenon.h>
#include <Xenon/Math/Math.h>
namespace Xenon
{
namespace Math
{
class Quaternion;
class Vec2;
class Vec3
{
public:
enum NoInit
{
NO_INIT
};
const static Vec3 RIGHT; // + X
const static Vec3 LEFT; /... | true |
0b0022dee87c80c6d0352fddaa57317b0ce212ad | C++ | hayat16/basic-programs | /vector related.cpp | UTF-8 | 561 | 3.265625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
vector<int>v;//array declare
v.push_back(5);//value insert
v.push_back(11);
cout<<v[0]<<endl;
v.push_back(9);
v.push_back(200);
for(int i=0;i<v.size();i++)
{
cout<<v[i]<<endl;
}
int ... | true |
f257eae847b313bc99da4cf822a276bb5d107aab | C++ | hbashift/lab3 | /functions.cpp | UTF-8 | 2,220 | 2.953125 | 3 | [] | no_license | #include "functions.h"
#include "Complex.h"
#include "Person.h"
int add_two(int a){
return a+2;
}
int square(int a){
return a*a;
}
int mult_tree(int a){
return a*3;
}
int mod_two(int a){
return a%2;
}
int sum(int a){
return a+a;
}
int mult_ten(int a){
return a*10;
}
int add_one(int a){
... | true |
5d4a6c551bdccf8fc7a08d05f9ff4056473663c6 | C++ | google-code/advisor-consultant | /SOZ/Etaps/psyhtestvariantbutton.cpp | UTF-8 | 2,301 | 2.53125 | 3 | [] | no_license | #include "psyhtestvariantbutton.h"
PsyhTestVariantButton::PsyhTestVariantButton(int ID, int GroupID, QString lbl,int weight, QWidget *parent) :
QWidget(parent)
{
this->ID=ID;
this->GroupID=GroupID;
this->label=lbl;
this->weight=weight;
update();
}
void PsyhTestVariantButton::pain... | true |
f31f319594b4d962f288e7eafd7cec16cfe45286 | C++ | yazidrm98/tugas1 | /knapsack fractional.cpp | UTF-8 | 1,902 | 3.890625 | 4 | [] | no_license | // Permasalahan Knapsack Fractional dengan greedy
#include <bits/stdc++.h>
using namespace std;
// Structure untuk item/barang
// dimana terdapat weight dan profit
struct Item {
int profit, weight;
Item(int profit, int weight)
{
this->profit=profit;
this->weight=weight;
}
};
// Fungsi untuk ... | true |
31ebcfe11a3a4673c015ca8529c698267ee33554 | C++ | runngezhang/sword_offer | /leetcode/cpp/494. 目标和.cpp | UTF-8 | 741 | 2.703125 | 3 | [] | no_license | class Solution {
public:
int my_abs(const int& x) {
return (x >= 0 ? x : -x);
}
int findTargetSumWays(vector<int>& nums, int S) {
int n = nums.size(), sum = accumulate(nums.begin(), nums.end(), 0);
if (my_abs(S) > sum) {
return 0;
}
int row = n + 1, col = ... | true |
7c5ac30fa44f384c769bf09bd9ca1d2852d815c7 | C++ | csqs/homeworks | /design_pattern/hw4/search.cpp | UTF-8 | 696 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string.h>
#include <vector>
#include "search.h"
Search::Search(std::string input_id) {
student_id = input_id;
}
Search::~Search() {
}
void Search::dbSearch(){
std::ifstream db;
db.open("/Users/macx/Desktop/database/database.txt", std::ios::out | std::ios:... | true |
1ae5a1d11487b4e6648330a6a8c7eaa0408ab360 | C++ | demalexx/small-backup | /CommonClasses.cpp | UTF-8 | 10,782 | 3.265625 | 3 | [] | no_license | #include "CommonClasses.h"
///////////////////////////////////////////////////////////////////////////////
// CString
///////////////////////////////////////////////////////////////////////////////
CString::CString(WORD wInitSize)
{
Init(wInitSize);
}
CString::CString(LPCTSTR ccText)
{
Init();
Assign((LPTSTR) ccTe... | true |
8a68701846e5630b79ea9c2b6acd895b6a69c9aa | C++ | indjev99/Particle-Structures | /sources/draw.cpp | UTF-8 | 2,342 | 2.890625 | 3 | [
"MIT",
"Zlib"
] | permissive | #include "../headers/draw.h"
#include "../headers/window_size.h"
#include "../headers/settings.h"
#include "../headers/my_math.h"
const double DEG2RAD = PI / 180;
void initDraw(GLFWwindow* w)
{
float ratio;
int width, height;
glfwMakeContextCurrent(w);
glfwGetFramebufferSize(w, &width, &height);
... | true |
11d1ef8ec0fd3859c7f067a671ea3b8a02026c63 | C++ | patonoide/TrabalhoTP1 | /TP1/view/user/cadastrar.cpp | UTF-8 | 3,570 | 2.71875 | 3 | [] | no_license | #include "cadastrar.hpp"
#include "../Home.hpp"
#include "../../controller/user.hpp"
#include <ctype.h>
void CadastrarView::printTitulo(){
printw("\t\t\t%s\n", "Cadastrar");
refresh();
}
void CadastrarView::ConfirmarDados(){
UserController newctr;
std::string toPost[5];
toPost[0] = cpf;
toPost[1] = pass... | true |
3635a61a7d1865358bedada73156cddb3e2187e7 | C++ | LQNew/Openjudge | /王道机试/北京航空航天大学-素数/素数.cpp | GB18030 | 791 | 2.90625 | 3 | [] | no_license | //ѶȲʱ临ӶΪO(n)+O(n/10)*O(sqrt(n)),n<10000ҲʮСڰû~
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int n;
int prime[10000];
bool judge(int m)
{
for(int i=2;i<=sqrt(m);i++)
if(m%i==0) return false;
return true;
}
int main()
{
while(cin>>n)
{
memset(prime,0,sizeof(... | true |
eab0f446640ec96a27c40f1441d226ceb16cb313 | C++ | Kushwaha-abhay/Placement-Preparation | /DSA/GeeksForGeeks/DSA-Self-Paced/Recursion/Power Set Using Recursion.cpp | UTF-8 | 910 | 3.234375 | 3 | [] | no_license | // { Driver Code Starts
//Initial Template for C++
// CPP program to generate power set
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
//Complete this function
void sub(vector<string> & ans, string s, string curr, int i)
{
if(i == s.length())
{
... | true |
074a8ef4e9fff55139c875058b2e3f678c037463 | C++ | Abdelrahman-Atia/My-Algorithms | /MCMF_using_SPFA.cpp | UTF-8 | 1,743 | 2.609375 | 3 | [] | no_license |
#define MAXN 507
#define MAXM 130000 // n*(n - 1)/2
typedef vector<int> VI;
const int INF = 1e9; // $infinity$: be careful to make this big enough!!!
int S; // source
int T; // sink
int FN; // number of nodes
int FM; // number of edges (initialize this to 0)
// ra[a]: edges connected to a (NO MATTER WHICH W... | true |
09fc80dfed648d9db0b98e37ed5bb7ad0ec1fef8 | C++ | AndriusDap/SDL2 | /SDL2/Input.cpp | UTF-8 | 1,687 | 2.734375 | 3 | [] | no_license | #include "Includes.h"
#include "Input.h"
using namespace std;
Input::Input(GLFWwindow *Window):Anchor(SCREEN_WIDTH/2, SCREEN_HEIGHT/2)
{
window = Window;
PointerAngle = 0;
Shoot = false;
HorizontalMotion = 0.0f;
VerticalMotion = 0.0f;
Quit = false;
for(int i = 0; i < 100; i++)
{
presed_keys[i] = false;
}
}
... | true |
02a877382c3593d22ff218156499578d4aed467a | C++ | lemben01/SolutionLaboARemettre03 | /SalairesDesRepresentants/BenjaminLemire.cpp | ISO-8859-1 | 2,929 | 3.578125 | 4 | [] | no_license | // But :
/*
Dveloppez un programme qui entre les ventes brutes hebdomadaires de chaque reprsentant et qui calcule et
affiche son salaire. Entrez -1 la valeur des ventes pour quitter le programme.
*/
// Auteur : Benjamin Lemire
// Date : 2020-10-02
#include <iostream>
using namespace std;
int main()
{
// commande ... | true |
bc9d0cb5097bb24876f3aa097bf3d1666e223f73 | C++ | lquatrin/CGT1-1D_DCT_IDCT | /CG_T1/src/ButtonGenerateValues.h | ISO-8859-1 | 4,010 | 2.984375 | 3 | [] | no_license | /*Arquivo referente aos componentes usados
na gerao de valores para a amostra inicial*/
#ifndef ___BUTTON__GENERATE___VALUES__H____
#define ___BUTTON__GENERATE___VALUES__H____
#include <SCV/Button.h>
#include "MyDCTS.h"
#include "Values.h"
#include <SCV/Spinner.h>
#include <SCV/Label.h>
/*Label do gerador... | true |
2f33d85f72f878ee279b9f8fcea0dea6fa082ddc | C++ | fanxiaochen/Multi-View-Registration | /mvr/include/light_source.h | UTF-8 | 931 | 2.578125 | 3 | [] | no_license | #pragma once
#ifndef LIGHT_SOURCE_H
#define LIGHT_SOURCE_H
#include "renderable.h"
namespace osg
{
class Light;
class LightSource;
class TranslateAxisDragger;
}
namespace osgManipulator
{
class TranslateAxisDragger;
}
class LightSource : public Renderable
{
public:
LightSource(unsigned int num);
virtual... | true |
fb187baefc26d490b092d1fe98c011b7c358b2ef | C++ | adityanjr/code-DS-ALGO | /HackerRank/Algorithms/Implementation/Angry Professor.cpp | UTF-8 | 619 | 3.1875 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
bool isCancelled(int *arr, int n, int k){
int count = 0;
for(int i=0; i<n; i++){
if(arr[i]<=0){
count++;
}
}
if(count < k){
return true;
}
else {
return false;
}
}
int main(){
int t;... | true |
bb40117ffcb9dd3b81ec2ad01de8517d0bf14cab | C++ | elreplicante/algorithm-analysis | /algorithm-analysis/src/Helper.cpp | UTF-8 | 1,498 | 3.125 | 3 | [] | no_license | /*
* Helper.cpp
*
* Created on: 18/12/2012
* Author: repli
*/
#include "../include/Helper.h"
void Helper::createRandomArray(int V[], int n, int maxInteger) {
for (int i = 0; i < n; i++) {
V[i] = rand() % maxInteger;
}
}
void Helper::copyArray(int V[], int W[], int n) {
for (int i = 0; i < n; i++) {
... | true |
5455ef88d9bab02305410b6d2b6296074507ceb0 | C++ | gabialverga/competitiveProgramming | /spoj/SENHATIA.cpp | UTF-8 | 724 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
using namespace std;
int main(){
int N,M,A,K,contM=0,contA=0,contK=0;
string nome;
cin >> N >> M >> A >> K;
cin >> nome;
if (nome.size() < N){
cout << "Ufa :)";
return 0;
}
for (int i =0; i< nome.size();i++){
if ((nome[i] >= 65) && (nome[i] <=90)){
contA++... | true |
57583fbd72e2f1b1775460a5eb6b1ca89b886dbf | C++ | rocksat/Quad3DR | /quad_planner/include/quad_planner/rendering/shader_program.h | UTF-8 | 1,683 | 2.78125 | 3 | [
"MIT"
] | permissive | //==================================================
// shader_program.h
//
// Copyright (c) 2016 Benjamin Hepp.
// Author: Benjamin Hepp
// Created on: Aug 19, 2016
//==================================================
#pragma once
#include <iostream>
#include <vector>
#include <map>
#include <GL/glew.h>
#include ... | true |
589add57022633df9b0bafc904147142851d9657 | C++ | yunpengxiao/LeetcodeSolution | /CppSolution/threeSumClosest.cpp | UTF-8 | 1,381 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
int threeSumClosest(vector<int> &num, int target)
{
//vector<vector<int> > r;
//vector<int> triple(3);
sort(num.begin(), num.end());
int j, k;
int min = 999999999;
int sum;
for (int i = 0; i < num.... | true |
296407aa2ea2fadb2a47bc67185e5c4839824485 | C++ | fdkeylabhu/CPP_PRIMER | /第7章类/answer_7_1_1.cpp | UTF-8 | 1,196 | 3.359375 | 3 | [] | no_license | /*****************************************************
C++ Primer 5th edition P230
*****************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <numeric>
using namespace std;
struct Sales_data {
string bookNo;
unsigned units_sold =... | true |
c86eeac5113279014e2c175e7b8e72b786d5e9f7 | C++ | LG-LuisGarcia/Mis-20-programas-en-c-y-menu | /palindroma.cpp | UTF-8 | 397 | 3.1875 | 3 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
int main(){
char cadena[100], copia[100];
cout<<"Poner la palabra aca: "<<endl;
cin>>cadena;
for(int i=(strlen(cadena)-1);i>=0;i--){
copia[strlen(cadena)-1-i]=cadena[i];
}
copia[strlen(cadena)]='\0';
if(strcmp(cadena,copia)==0){
cout<<"Es palin... | true |
9897278cfd61c88546c087f45437808fc6208299 | C++ | kure-ict-club/competition-assignment | /pointN/Q2/main.cpp | UTF-8 | 383 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include "Vector2D.h"
int main() {
Vec2 v1(3, 4);
Vec2 v2(5, -6);
Vec2 v3(0, 0);
Vec2 v4 = v1 + v2;
std::cout << v1.dot(v2) << std::endl;
std::cout << v1.cross(v2) << std::endl;
std::cout << v4.lengthSquare() << std::endl;
if (v1.isZero()) std::cout << "v1 is zero" << std::endl;
... | true |
4207c716191e79ba8d9a7c858286d7e9f3530c6e | C++ | the-coding-cloud/UBB | /Year I/Sem II/Data Structures and Algorithms/Lab 5/Lab5_Binary_Heap/Lab5_Binary_Heap/Heap.h | UTF-8 | 2,928 | 3.609375 | 4 | [] | no_license | #pragma once
#include <list>
using namespace std;
typedef int TElem;
typedef bool(*Relation) (TElem e1, TElem e2);
typedef struct {
list<TElem>::iterator currentPosition;
list<TElem>::iterator endOfList;
} myPair;
typedef myPair iteratorPair;
class Heap
{
private:
Relation relation;
iteratorPair* elements;
in... | true |
a4a841c9c19e03ee227061a48f0049aa0db5446f | C++ | omp13188/CPlusPlus | /Set 2/currency/currency_tes.cc | UTF-8 | 1,650 | 3.09375 | 3 | [] | no_license | #include "currency.h"
#include "gtest/gtest.h"
using namespace std;
TEST(Currency,DefaultConstructor) {
Currency a1;
EXPECT_EQ(0.0,a1.getrupees());
EXPECT_EQ(0.0,a1.getpaise());
}
TEST(Currency,ParameterizedConstructor) {
Currency a1(12,5);
EXPECT_EQ(12,a1.getrupees());
EXPECT_EQ(5,a1... | true |
2f52670f8f6e042f6b2d98ecf53921d735d73538 | C++ | kyum1n/videocontrols | /DistSensorAttinySerial/DistSensorAttinySerial.ino | UTF-8 | 624 | 2.609375 | 3 | [] | no_license | #include <TinyDebugSerial.h>
int sensorPin = A1; // select the input pin for the potentiometer
int sensorPin2 = A2;
int sensorValue = 0; // variable to store the value coming from the sensor
TinyDebugSerial mySerial = TinyDebugSerial();
void setup() {
Serial.begin(9600);
}
void sendInt(int val) {
Ser... | true |
f5185c12084c8af14e961b382003c2bdf02848cd | C++ | Bendomey/homework | /a5_10670196.cpp | UTF-8 | 3,166 | 3.359375 | 3 | [] | no_license | #include<iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
void validateInput(int);
struct studentType
{
string id, name;
int age, score;
char gender;
string grade;
};
int main(int argc, char const *argv[])
{
studentType student[5];
ofstream outfile;
double averageAge, averag... | true |
cdfe786f65ae246bcebd225b6c032025f7511fa2 | C++ | Tsuzee/PortfolioProjects | /CrossPlatformEngine/PC_Engine/PC_Engine/PInput.cpp | UTF-8 | 3,339 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | // Darren Farr
#include "../../SharedCode/PInput.h"
#include <DirectXMath.h>
using namespace DirectX;
// --------------------------------------------------------
// Default Constructor
// --------------------------------------------------------
PInput::PInput() {}
// -------------------------------------------------... | true |
ff233aa6b002aaf34ab9dfa22ce3981a0a8f2811 | C++ | j-dong/FPS | /VertexArray.cpp | UTF-8 | 1,973 | 3.09375 | 3 | [] | no_license | #include "VertexArray.h"
VertexArray::VertexArray(GLsizei size, GLenum mode) : id(0), buffers(), indices(), size(size), mode(mode), index_type(0) {
glGenVertexArrays(1, &id);
}
VertexArray::VertexArray(VertexArray &&move) : id(move.id), indices(std::move(move.indices)), size(move.size), mode(move.mode), index_typ... | true |
8ec14c8ecb0f675b49b86ec9f5609c44dbb245ba | C++ | vaibhavarena/cpp-reference | /Memory Management/9.smart_pointers.cpp | UTF-8 | 2,509 | 4.0625 | 4 | [] | no_license | #include<iostream>
#include<string>
#include<memory>
class myClass
{
private:
std::string _text;
public:
myClass(){}
myClass(std::string t){
_text = t;
}
~myClass(){
std::cout<<"\n" << _text << " Destroyed";
}
void setText(std::s... | true |
a5528c577a5a8025900383b39821f7b712da75bb | C++ | Arinarina/TickTackToe | /Game.cpp | UTF-8 | 11,635 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include "Game.h"
using namespace std;
Game *Game::myGame = nullptr;
// конструктор без параметров
Game::Game() {
first = 1;
second = 2;
firstMove = 'O';
secondMove = 'X';
cout << "Enter side value" << endl;
cin >> side;
this->board = new char*[side];
for (int i = ... | true |
e4b1912bcc462fb1f9bb6603c7b5844b890428e8 | C++ | kevinhughes27/2809_vision2013 | /segmentTargets.cpp | UTF-8 | 4,741 | 2.609375 | 3 | [] | no_license | #include "segmentTargets.h"
using namespace cv;
using namespace std;
void segmentTargets(const Mat &image, vector<Mat> &candidates, vector<Point> &locations, bool log, bool debug)
{
candidates.clear();
locations.clear();
if(log)
{
imwrite("logs/0_image.png", image);
}
// Convert to CV_8UC1 (8 bit single cha... | true |
b2b4ad8555ac4cc5ec03e015504194004dbc7256 | C++ | reed123456/c- | /Test_06_24/Test_06_24/test.cpp | GB18030 | 3,646 | 3.109375 | 3 | [] | no_license | #include<iostream>
#include<vld.h>
#include<string>
using namespace std;
int main()
{
cout << "hh" << endl;
}
//template<class Type>
//class BST;
//
////ʵһö
//template<class Type>
//class BSTNode
//{
// friend class BST<Type>;
//public:
// BSTNode(Type d = Type(), BSTNode<Type> *left = nullptr, BSTNode<Type> *right ... | true |
46dfb1f00adb9316afe11edb5b1b1baaaf4f8786 | C++ | Justin-Singh125125/CISP-360 | /CISP 360/Problem set #2/6.cpp | UTF-8 | 172 | 2.53125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int units;
float mass;
double weight;
units = 4;
mass = 34.2;
units = mass;
cout <<units;
return 0;
}
| true |
d41c952566dd64780b82ee4d69d94fef4957ae59 | C++ | lewellen/proceduralEnvironment | /src/Vector.cpp | UTF-8 | 1,335 | 3.46875 | 3 | [] | no_license | #include <cstdio>
#include <cmath>
#include "Vector.h"
#define PI 3.14159265
Vector::Vector() {
x = y = z = 0;
}
Vector::Vector(Vector* v) {
if (v == NULL)
return;
x = v->x;
y = v->y;
z = v->z;
}
Vector::Vector(float _x, float _y, float _z) {
x = _x;
y = _y;
z = _z;
}
Vector* Vector::Cross(Vector* b) {... | true |
cdf65e973c9bb21a9a0d3c85c7d3ad8b4852741f | C++ | AbelTesfaye/Competitive-Programming | /week 9/nonDecreasingArray.cpp | UTF-8 | 1,044 | 2.53125 | 3 | [] | no_license | class Solution {
public:
bool checkPossibility(vector<int>& nums) {
vector<int> lModified, rModified;
lModified.push_back(nums[0]);
rModified.push_back(nums[0]);
bool isModified = false;
for(int i = 1; i < nums.size(); i++){
int p = nums... | true |
30fa4429f543bb363a8639892c3716f6f229796f | C++ | martinamalberti/ECAL | /Calibration/CommonTools/templateUtils.cc | UTF-8 | 1,207 | 2.875 | 3 | [] | no_license | #include "templateUtils.h"
/*** double crystall ball ***/
double crystalBallLowHigh(double* x, double* par)
{
//[0] = N
//[1] = mean
//[2] = sigma
//[3] = alpha
//[4] = n
//[5] = alpha2
//[6] = n2
//[7] = scale
//double xx = x[0] * par[7];
double xx = x[0];
double mean = par[1];
double sigma... | true |
1824929aa8ec214c83771832b79c70d33180f702 | C++ | daimonster/Graduate-Life | /C++primer/1708262_stock10.h | UTF-8 | 2,251 | 3.875 | 4 | [] | no_license | /*析构函数
用构造函数创建对象后,程序负责跟踪该对象,直到其过期为止。对象过期时,程序将自动调用一个特殊的成员函数:析构函数/析构函数完成清理工作。
例如,如果构造函数使用new来分配内存,则析构函数将使用delete来释放内存。Stock的构造函数没有使用new,因此析构函数实际上没有要完成的任务。在这种情况要,只需要让编译器生成一个什么都不做的隐私析构函数即可
和构造函数一样析构函数的名称也很特殊:在类名前加上~.因此,Stock类的析构函数为~Stock().另外,和构造函数一样,异构函数也可以没有返回值和声明类型。与构造函数不同的是,析构函数没有参数,因此Stock的原型必须是这样的:
~Stock()
可以将它... | true |
be00f36ed064f8fe7781e5bb04cd18e4595fdf4f | C++ | hoholidayx/Android-App-Security | /appsecurity/src/main/cpp/utils/md5.cpp | UTF-8 | 7,425 | 3.109375 | 3 | [] | no_license | #include "md5.h"
MD5::MD5() {}
MD5::MD5(const string &str) : input_msg(str) {}
void MD5::init() {
// init the binary message
bin_msg.clear();
for (std::size_t i = 0; i < input_msg.size(); ++i) {
auto temp = bitset<8>(input_msg[i]);
// cout << temp << " " << input_msg[i] << endl;
... | true |