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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
03bdd573b2cc1ec079c7eded883841a0deb5cbf1 | C++ | francescoriccio/Matilde | /naoqi/modules/R2module/src/task.cpp | UTF-8 | 23,943 | 2.78125 | 3 | [] | no_license | /**
* @class: Task
* This class (and related hierarchy) defines a generic task in the HQP framework.
*
* @file transform.h
* @author Claudio Delli Bovi, Chiara Picardi, Francesco Riccio
*/
#include "task.h"
#define INFO(x) std::cerr << "\033[22;34;1m" << "[Task] " << x << "\033[0m" << std::endl;
//#define TASK_DEBUG
... | true |
5054558b64b26be4d034a703866c173e8927a61f | C++ | marioxe301/TrabajosEstructuraDatos1 | /Hash Table/HashEntry.h | UTF-8 | 128 | 2.515625 | 3 | [] | no_license | #pragma once
class HashEntry {
private:
int key;
int value;
public:
HashEntry(int, int);
int getKey();
int getValue();
}; | true |
2dea768c0bc5f1e4e81500d56d0ccf5c9a297c91 | C++ | logic-three-body/WordCountSystem | /MapCount/MapCount.cpp | UTF-8 | 611 | 3.21875 | 3 | [] | no_license | #include <map>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
void display_map(map<string, int> &wmap);
int main()
{
const char *szInputFileName = "data.txt";
ifstream ifs(szInputFileName);
string szTemp;
map<string, int> wmap;
while (ifs >> szTemp)
wmap[szTemp]++;... | true |
82a01b27026e8c74e6980f313cba51349efc3f12 | C++ | kuonanhong/UVa-2 | /10168 - Summation of Four Primes.cpp | UTF-8 | 1,148 | 3.265625 | 3 | [] | no_license | /**
UVa 10168 - Summation of Four Primes
by Rico Tiongson
Submitted: June 10, 2013
Accepted 0.032s C++
O(sqrt(n)) time
*/
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
vector<int> p;
int lim,lim2,n,ans[3];
void addprime( int x ){
lim = sqrt(x) + 1;
for( int i=1; p[i] < l... | true |
af4f5e0853fa5f973d6f2f6035e07b2256f56c90 | C++ | jwlawson/qv | /include/cycle.h | UTF-8 | 4,434 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive | /*
* cycle.h
* Copyright 2014-2015 John Lawson
*
* 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 l... | true |
e1d324566d86edbedd04c87192b422b067c36f23 | C++ | tyhe12/DesignPatterns | /SingletonPattern/SingletonDatabase.h | UTF-8 | 461 | 2.6875 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
#include "Database.h"
using namespace std;
class SingletonDatabase : public Database
{
private:
SingletonDatabase();
SingletonDatabase(string database_name);
string db_name = "singleton database";
public:
SingletonDatabase(SingletonDatabase const&) = delete;
v... | true |
eeb321e38928566c1ee79e73713ce45ecbb45795 | C++ | 8l/HrwCC | /codegen/typearith.cpp | UTF-8 | 6,985 | 3.15625 | 3 | [] | no_license |
#include "typearith.h"
#include "../include/hrwcccomp.h"
/** Create type of array element of variable. */
syntaxTreeNode* type_CreateArrayElmType( syntaxTreeNode* varDef)
{
if( type_IsAPointerVar(varDef) )
return type_RemoveStarFromType( syntax_GetChild(syntax_GetChild(varDef,0),0));
if( type_IsAArrayVar(... | true |
bf883e38198ed2cc4a7691280e5e574bdd419aca | C++ | BennetLeff/engine | /Core/Transform.cpp | UTF-8 | 725 | 2.734375 | 3 | [] | no_license | /*
* Transform.cpp
*
* Created on: Apr 22, 2016
* Author: bennetleff
*/
#include "Transform.h"
glm::mat4 Transform::getModel() const
{
glm::mat4 posMatrix = glm::translate(mPosition);
glm::mat4 rotXMatrix = glm::rotate(mRotation.x, glm::vec3(1, 0, 0));
glm::mat4 rotYMatrix = glm::rotate(mRotation.y, ... | true |
4a36dba4588da572817783ea3a19efbb0a041411 | C++ | muthuubalakan/cpu-usage | /src/logging.h | UTF-8 | 1,540 | 3.03125 | 3 | [] | no_license | #ifndef LOGGING_H
#define LOGGING_H
#include <iostream>
#include <ctime>
using namespace std;
enum loglevel{
// Apache Log4J2 log levels int level.
TRACE,
DEBUG,
INFO,
WARN,
ERROR,
SUCCESS,
FATAL
}
struct ConfigLogging
{
};
extern ConfigLogging config;
... | true |
92717dcb25421d19699caea5e8d6dbe744911a0b | C++ | ilyasemikin/AlgorithmsAndStructures | /sort/include/insertion_sort_array.hpp | UTF-8 | 600 | 3.90625 | 4 | [] | no_license |
namespace learn::sort_array {
template <typename T, typename Compare>
void insertion_sort(T *array, size_t size, Compare comp) {
size_t j;
for (size_t i = 1; i < size; i++) {
auto key = array[i];
j = i;
while (j > 0 && comp(key, array[j - 1])) {
... | true |
4dcfb279c32355ec5a8f82d3dda078e7938619dc | C++ | svetthesaiyan/uni-projects-1st-year-2nd-trimester | /2021.01.22 Exercise 3/exercise_3.cpp | UTF-8 | 437 | 3.34375 | 3 | [] | no_license | // Да се изведат елементите на масив a {1,2,3,4,5} чрез индексни променливи и чрез указатели:
#include <iostream>
using namespace std;
int main()
{
int a[]={1,2,3,4,5}; int i;
for(i=0; i<5; ++i)
cout<<a[i]<<" "; // извежда 1 2 3 4 5
cout<<endl;
for(i=0; i<5; ++i)
cout<<*(a+i)<<" "; // извежда 1 2 3 4 5
cout<... | true |
420660b41827d031d04afe678db389dc7c94b9af | C++ | CRASHGRIM/lab2 | /game/game.ino | UTF-8 | 5,227 | 2.703125 | 3 | [] | no_license | #include <LedControl.h>
#include <Wire.h>
#include <Servo.h>
#include "Game.h"
#define INVALID_DIRECTION -1
const char keyUp = 'U';
const char keyDown = 'D';
const char keyRight = 'R';
const char keyLeft = 'L';
const char keyNone = 'N';
const int keypadAdderss = 10;
const int boardSizeX = 24;
const int boardSizeY... | true |
fa5e8b3d3204411458f13fae5f0f9a0c0f07f0ab | C++ | AALEKH/solutions | /leetcode_107.cpp | UTF-8 | 1,361 | 3.75 | 4 | [
"MIT"
] | permissive | // Question: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), l... | true |
3d3b73a822fe9e8783bad0e50312dfe6f991b9b3 | C++ | Ubpa/UGM | /include/UGM/Interfaces/IArray/IArray.hpp | UTF-8 | 45,478 | 2.953125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "../../basic.hpp"
#include "../ImplTraits.hpp"
#include <array>
#include <vector>
#include <iostream>
#include <cmath>
#include <cassert>
#include <compare>
namespace Ubpa {
template<typename Base, typename Impl>
struct IArray1D;
}
namespace Ubpa::details {
enum class ArrayMode {
One,
... | true |
43c79de6da204e7eb825906e73cc633b8516aeab | C++ | ac-lan/AiningLiu_MediaArt206_Homework | /Aining Liu - Final Project/src/utils.cpp | UTF-8 | 1,497 | 2.90625 | 3 | [] | no_license | #include "utils.h"
void drawBox(ofPoint position, ofPoint dimensions, ofColor color) {
ofPushMatrix();
ofTranslate(position.x + dimensions.x / 2, position.y + dimensions.y / 2, position.z + dimensions.z / 2);
ofBoxPrimitive box = ofBoxPrimitive(dimensions.x, dimensions.y, dimensions.z);
ofSetColor(color);
bo... | true |
bafc5f1bc7e887f23dae955f51f981ca11a71f14 | C++ | osom8979/example | /wxwidgets/tutorials/t24.cpp | UTF-8 | 908 | 2.875 | 3 | [
"Zlib"
] | permissive | #include "tutorial.h"
class MyFrameT24: public wxFrame
{
public:
MyFrameT24(const wxString& title);
void OnMove(wxMoveEvent & event);
wxStaticText *st1;
wxStaticText *st2;
};
MyFrameT24::MyFrameT24(const wxString& title) :
wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 130))
... | true |
8987b0af1bad41d0021f61de7684ec42b2cff524 | C++ | jiangyinzuo/icpc | /exercise/ecfinal_2019/m.cpp | UTF-8 | 843 | 2.625 | 3 | [] | no_license | //
// Created by Jiang Yinzuo on 2020/12/10.
//
#include <algorithm>
#include <cstdio>
long long a[100001], b[100001];
int n;
long long max_score;
void dfs(int base, int cur_v, long long score) {
if (cur_v > n) {
max_score = std::max(max_score, score);
return;
}
dfs(base, cur_v * base, s... | true |
e6795df0a89a98fab06ea3e94a7cb7b3ca197a21 | C++ | YueLung/Game2048 | /Game2048/main.cpp | UTF-8 | 1,274 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <SFML/Graphics.hpp>
#include "TxtAnimation.h"
#include "BlockMgr.h"
#include "Block.h"
#include "GameStage.h"
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 700), "2048");
GameStage stage;
BlockMgr mgr;
TxtAnimation gameOverAn;
mgr.init();
while (window.isOpen())
{
s... | true |
023aeb79b05750d42c78e6396a2d6e88cc7ff599 | C++ | phanhuytran/Base-TechniquesProgramming | /Programming Base/BTH04_BT07.cpp | UTF-8 | 1,394 | 3.15625 | 3 | [] | no_license | //Project: BTH4_BT07.cpp
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
system("color 0a");
int a, b;
int pt, lc;
do {
cout << endl << "-----Menu-----\n" << "1. Cong\n" << "2. Tru\n" << "3. Nhan\n" << "4. Chia\n" << "5. Thoat\n";
cout << "Moi ban chon phep tinh: ";
cin >> pt;
switch(p... | true |
c3691a0440208240c807c304dac8970343ba5fe1 | C++ | hazelguo/Computer-Network-Practicum | /Cluster/k_to_schools.cc | UTF-8 | 1,449 | 2.640625 | 3 | [] | no_license | #include "k_to_schools.h"
#include <vector>
//#include <unordered_set>
#include <set>
#include <string>
using namespace std;
KStudentsToSchools::KStudentsToSchools(
const vector<set<int> >& school_ids_for_student,
const vector<SchoolScore>& school_score) {
_school_ids_for_student.clear();
_school_score.clear()... | true |
620a4007631fd9ba0b947d5b75a2bca310176415 | C++ | RhythmBoys/AlgoContest | /topcoder/BuyingTshirts.cpp | UTF-8 | 1,888 | 2.609375 | 3 | [] | no_license | #include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <fstream>
#include <sstream>
#include <typeinfo>
#include <algorithm>
using namespace std;
typedef long long int64;
// Single Round Match 641 Div
// BuyingTshirts 250
// Me... | true |
5295fdf283295b8c37735f19c7ccaf974b57b20e | C++ | xiangyu/sgwater-dpseg | /Scoring.h | UTF-8 | 2,317 | 3.09375 | 3 | [] | no_license | #ifndef _SCORING_H_
#define _SCORING_H_
#include <iostream>
#include "Utterance.h"
#include "typedefs.h"
/*
Scoring class calculates number of words correct
in each utterance and keeps a running tally.
Calculates precision and recall, and lexicon precision.
*/
class Scoring {
public:
Scoring():
_utterances(0),... | true |
df0d94a7507b5286e74cfa3a2996b89e10ed7c27 | C++ | qqsskk/opcua-server | /opcua-plugin/logger/Logger.h | UTF-8 | 2,202 | 2.625 | 3 | [] | no_license | /*
* --- License -------------------------------------------------------------- *
*/
/*
* Copyright (c) 2015
*
* Hochschule Offenburg, University of Applied Sciences
* Institute for reliable Embedded Systems
* and Communications Electronic (ivESK)
*
* All rights reserved
*/
#ifndef _LOGGER_H
#define _LOGGER... | true |
60b0f86272cf1e0d1f65b772ed73d292515408d0 | C++ | mikeNickaloff/ChessBlitz | /square.h | UTF-8 | 783 | 2.703125 | 3 | [] | no_license | #ifndef SQUARE_H
#define SQUARE_H
#include <QObject>
#include <QQuickItem>
class Piece;
class Square : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(int row READ row WRITE setRow)
Q_PROPERTY(int col READ col WRITE setCol)
public:
Square();
int m_row;
int m_col;
Piece* m_piece;
Q_INVOKABLE i... | true |
24f50c36dc88b899a50b325ae7c0fae0694ebb9f | C++ | hyeseonko/Algorithm-Baekjoon | /물통_baekjoon2251.cpp | UTF-8 | 1,414 | 2.984375 | 3 | [] | no_license | /*
TITLE: WATER BOTTLE
BAEKJOON 2251
CATEGORY: BFS
DATE: 2017-07-17
*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <queue>
#include <vector>
#include <algorithm> // sort
using namespace std;
typedef struct {
int A;
int B;
int C;
}water;
queue <water> q;
vector <int> v;
... | true |
8aa64d1616f283a1b4637b7d6c3a9c9e4680c6c9 | C++ | moukraintsev/oop_project | /film.h | UTF-8 | 532 | 2.890625 | 3 | [] | no_license | #ifndef FILM_H
#define FILM_H
#include "video.h"
class Film: public Video {
public:
// Сonstructors
Film();
Film(const std::string &, const int &, const std::string &, const std::string &, const bool &, const std::string &);
Film(const Film &);
// Getters
const std::string &get... | true |
d7fb3bd3295592a40e071b283d881c19e5048815 | C++ | keithroe/keithscode | /mview/src/mesh/HalfEdge.h | UTF-8 | 1,740 | 3.046875 | 3 | [] | no_license |
/*****************************************************************************\
*
* filename: HalfEdge.h
* author : r. keith morley
*
* Changelog:
*
\*****************************************************************************/
#ifndef _HALFEDGE_H_
#define _HALFEDGE_H_
#include <utility>
class Vertex... | true |
876f77c392ec1d8533b3781bdcd9a7df1b62ec56 | C++ | SVolkoff/- | /List.cpp | UTF-8 | 1,587 | 3.734375 | 4 | [] | no_license |
#include <iostream>
using namespace std;
class List
{
private:
int *list;
int size;
public:
List()
{
list = nullptr;
size = 0;
}
~List()
{
delete list;
size = 0;
}
List(const int& value)
{
list = new int[value]();
size = value;
}
void add(int & pos, int & value)
{
if (pos >= size)
{
... | true |
c993bb2e9ea16523b67f2b9ea9c0293879dad634 | C++ | ArneStenkrona/Prototype | /Prototype/src/System/GUI/UIElement/UIGridEditor.h | UTF-8 | 2,022 | 2.71875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "UIElement.h"
#include "UIGridTile.h"
#include "World\room.h"
#include "UISelect\UISelector\UITileSelector.h"
#include "UISelect\UISelector\UIColliderSelector.h"
#include "UISelect\UISelector\UIObjectSelector.h"
#include "UISelect\UISelector\UIToolSelector.h"
#include "UIBorder.h"
#include "UIPane... | true |
529f16dd639e9fc47de55a5991f75bf7d3a4b8eb | C++ | katherinr/snippets | /theTime.cpp | WINDOWS-1251 | 3,528 | 3.34375 | 3 | [] | no_license | #include "stdio.h"
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cctype>
#include <locale> // std::locale, std::tolowe
//
template <typename T1, typename T2>
struct less_letter
{
typedef std::pair<T1, T2> type;
bool operator ()(type const& ... | true |
7d98be6b78e54bfdeeef230954a0c78d063bda3e | C++ | Nedusat/MurderEngine | /src/nodes/node_render.cpp | UTF-8 | 2,052 | 2.765625 | 3 | [] | no_license | #include "node.h"
#include "node_render.h"
#include "../renderer/render_helper.h"
double node_render_get_sock_x(node_socket* socket, node* _node)
{
return (socket->dir==NODE_SOCKET_OUT?_node->scaleX:0) + _node->posX + socket->offX;
}
double node_render_get_sock_y(node_socket* socket, node* _node)
{
return _node->... | true |
1a401ed3b79f772844c5994aae67ab6e1486f066 | C++ | alice965/LaonSillv2 | /LaonSill/src/core/Broker.cpp | UTF-8 | 6,787 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | /**
* @file Broker.cpp
* @date 2016-12-19
* @author moonhoen lee
* @brief
* @details
*/
#include "common.h"
#include "Broker.h"
#include "SysLog.h"
#include "Param.h"
#include "MemoryMgmt.h"
using namespace std;
map<uint64_t, Job*> Broker::contentMap;
mutex Broker::contentMutex;
map<uin... | true |
b770a30db17854117ade97e860bba1a80a08fc56 | C++ | ALaDyn/Smilei | /src/Radiation/RadiationTables.h | UTF-8 | 9,660 | 2.5625 | 3 | [] | no_license | // ----------------------------------------------------------------------------
//! \file RadiationTables.h
//
//! \brief This class contains the tables and the functions to generate them
//! for the Nonlinear Inverse Compton Scattering
//
//! \details This header contains the definition of the class RadiationTables.
/... | true |
805811c7be8c6d7d2a54db778bfe61f2e562acf6 | C++ | adrian2004/tpa | /exercicio29.cpp | ISO-8859-1 | 378 | 3.125 | 3 | [] | no_license | /*
Funo: calcular o fatorial de um nmero digitado pelo usurio
Data:16/10/2019
Autor: Adrian Wilmer Jaquier
*/
#include <iostream>
#include <locale.h>
int main() {
setlocale(LC_ALL, "");
int m = 0, r = 0;
printf("digite um nmero: ");
scanf("%i", &m);
printf("\nTabuda de %i\n",m);
for(int p = 0; p<=10; p++){
r... | true |
ea86181429978efbd64f75e981ab93d3c140fbde | C++ | HaooWang/C--Projects-forClion | /src/demo_1to6/指针ptr与数组array/01.指针.cpp | UTF-8 | 329 | 2.9375 | 3 | [] | no_license |
#include <iostream>
using namespace std;
#if 0
int main(){
int i;
int *ptr=&i;
i=10;
cout<<"i="<<i<<endl;
cout<<"*ptr="<<*ptr<<endl;
return 0;
}
#else
int main(){
void *pv;
int i=5;
pv = &i;
int *pint = static_cast<int*>(pv);
cout<<"*pint= "<<*pint<<endl;
return 0;
... | true |
e56a87bf5db8674c86660b1f5cd83829e607bff7 | C++ | jc4250/coding | /ccl/merge-triplets.cpp | UTF-8 | 944 | 2.96875 | 3 | [] | no_license | //https://leetcode.com/problems/merge-triplets-to-form-target-triplet/
class Solution {
public:
bool mergeTriplets(vector<vector<int>>& triplets, vector<int>& t) {
for (int i = 0; i < triplets.size(); i++) {
if (triplets[i] == t) return true;
}
int ans[3] = {0,... | true |
80a4fb1eab1023c76fb8ebfc606e61fe1543247c | C++ | antimatterhorn/SPH-Routines | /wvt/wvt_mass.cpp | UTF-8 | 1,954 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <math.h>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
/* This code will read in the inputh.dat and inputmodel.dat files */
/* to produce the correct cutoff that corresponds to the desired mass */
using namespace std;
const double pi = 3.1415926;
const double... | true |
5e058946591b64511424fa1d33c3f51aedc375ea | C++ | LLNL/cardioid | /elec/unitTests/CellModelTests/OneCell.cc | UTF-8 | 5,985 | 2.875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <cstdio>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <vector>
#include "Anatomy.hh"
#include "Reaction.hh"
#include "TT04_CellML_Reaction.hh"
#include "TT04Dev_Reaction.hh"
#include "TT06_CellML_Reaction.hh"
#include "TT06Dev_Reaction.hh"
#include "TT06_RRG_Reaction.hh"
... | true |
8233ff872abe7e50d68eb18b21207701627cd9ab | C++ | flupes/smake | /moving.cpp | UTF-8 | 1,161 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | #include <cstdio>
using namespace std;
struct NoMove {
NoMove(int n) : id{n} {
printf("NoMove(%d) @ %p\n", id, this);
buffer = new char[4];
for (int i = 0; i < 3; i++) buffer[i] = n + 96;
buffer[3] = 0;
}
NoMove(const NoMove& nm) {
id = nm.id;
buffer = new char[4];
for (int i = 0; i... | true |
1fa0df9fa727cde5410faf4cf1a1baddac739880 | C++ | EnsicoinDevs/ensicoin-cpp | /src/message/messages.cpp | UTF-8 | 685 | 2.703125 | 3 | [] | no_license | #include "messages.hpp"
#include "constants.hpp"
#include "networkable.hpp"
#include "networkbuffer.hpp"
#include <iostream>
#include <string>
namespace message{
Message::Message(message_type messageType) : magic(constants::MAGIC),
type(messageType) {}
message_type Message::getType() const{
return type;
}
... | true |
63c8b6fba16dd7f9beafae5ea028e4b56dac5a00 | C++ | Stenardt-9002/CODECHEF-Datastructure-and-algo | /Gfg_list/Microsoft_30_Days/Day10/3-add_2_numbers_LL.cpp | UTF-8 | 1,856 | 3.015625 | 3 | [] | no_license | // https://practice.geeksforgeeks.org/batch/microsdaysoft-29/track/microsoft-29days-day10/problem/add-two-numbers-represented-by-linked-list
#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds ;
typedef long long int... | true |
5469c90eac8aee5a9cdb21fe09f6b77f1f309bd2 | C++ | tzn893/little-ray-tracer | /Main/Shape.h | UTF-8 | 2,193 | 2.828125 | 3 | [] | no_license | #pragma once
#include "../Tool/geometry.h"
struct Ray {
Vec3f p, dir;
Ray(Vec3f p, Vec3f dir)
:p(p),dir(dir){}
};
struct Insection { Vec4f color; Vec3f n; float t; float reflect = 0.0;};
class Shape {
public:
virtual bool insection(Ray r,Insection*) = 0;
virtual ~Shape() {}
};
class Sphere :public Shape{
pu... | true |
c982e5526f0480af73bd76d292d2301dd9a69e90 | C++ | mpsm/spyc | /src/Call.hh | UTF-8 | 952 | 2.8125 | 3 | [
"MIT"
] | permissive | #ifndef __SPYC_CALL_HH__
#define __SPYC_CALL_HH__
#include "Method.hh"
#include <functional>
#include <unordered_set>
#include <utility>
namespace spyc {
using Call = std::pair<std::reference_wrapper<const Method>,
std::reference_wrapper<const Method>>;
struct CallHasher {
std::size_t
... | true |
2111405ef6adaedf7b72cdb414bfdaf36289974d | C++ | harsimarsingh8/C-AND-Cpp-Questions- | /C++ Questions/Q-41.cpp | UTF-8 | 967 | 3.8125 | 4 | [] | no_license | #include<iostream>
using namespace std;
class counter
{
static int count;
public:
void increment();
void decrement();
static void print();
};
int counter::count; ... | true |
cad7be39b4a7bebd478fc011874252f36b2ff35e | C++ | shpp-vhrebenko/cs-b-assignment1 | /4-Flesch-Kincaid/src/FleschKincaid.cpp | UTF-8 | 3,651 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include "console.h"
#include <fstream>
#include "tokenscanner.h"
using namespace std;
//Function prototypes
void settingFile();
void fleschKincaid(ifstream &infile);
int syllablesIn(string word);
bool checkVowels(char letter);
double grade(int words,int sentens,int syllables);
int main() {
setti... | true |
b2ce901a254378c771b25b6406de7092ffa4a9ee | C++ | MythaelX/Projet_Ultime | /Cpp/Widgets/Scene.hpp | UTF-8 | 631 | 2.640625 | 3 | [] | no_license | /*!
*
* \file Scene.hpp
* \author Mathias CABIOCH-DELALANDE
* \date 30 mai 2018
*
*/
#ifndef HEADER_SCENE
#define HEADER_SCENE
#include <QtWidgets>
#include <iostream>
/*!
* \class Scene
* \brief An implementation of QGraphcsScene with an updator
*/
class Scene : public QGraphicsScene {
Q_OBJECT
public:
/*! \... | true |
780d2d2339ced935e187c740335f97d585bb8785 | C++ | pulkitag/caffe | /include/caffe/layers/topography_layer.hpp | UTF-8 | 2,215 | 2.578125 | 3 | [
"BSD-3-Clause",
"MIT",
"BSD-2-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | #ifndef CAFFE_TOPOGRAPHY_LAYER_HPP_
#define CAFFE_TOPOGRAPHY_LAYER_HPP_
#include <vector>
#include "caffe/blob.hpp"
#include "caffe/layer.hpp"
#include "caffe/proto/caffe.pb.h"
namespace caffe {
/**
* @brief: The channels are arranged in a 2D topography.
*
*/
template <typename Dtype>
class TopographyLayer : publ... | true |
07f9a0d878cc68cb4f3088ac4a00927992e1dc3e | C++ | Elescant/SevenColor | /CusLabel.cpp | UTF-8 | 1,144 | 2.65625 | 3 | [] | no_license | #include "CusLabel.h"
#include <QPalette>
#include <QDebug>
CusLabel::CusLabel(QWidget *parent, Qt::WindowFlags f):
QLabel(parent,f)
{
}
CusLabel::CusLabel(const QString &text, QWidget *parent, Qt::WindowFlags f):
QLabel(text,parent,f)
{
}
CusLabel::~CusLabel()
{
}
void CusLabel::mouseReleaseEvent(QMouse... | true |
af18e00ace152635d3b32f63a6f441f7d0108c95 | C++ | henryzrr/hackerEart | /cod/e-maze.cpp | UTF-8 | 538 | 2.65625 | 3 | [] | no_license | #include<stdio.h>
using namespace std;
int main(){
char cad[205];
scanf("%s",cad);
int i=0,posx=0,posy=0;;
while(cad[i]!='\0'){
switch (cad[i])
{
case'L':
posx -=1;
break;
case'R':
posx +=1;
break;
... | true |
70b3866b383c81e519a1cc7cc9dec6e3239764f0 | C++ | duchevich/c-plus-plus-VS2017-course | /Project3/Project3/main.cpp | WINDOWS-1251 | 2,796 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include "SDL.h"
#include "Game.h"
using namespace std;
Game *game = nullptr;
int main(int argc, char* argv[]) {
game = new Game;
game->init("Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, true);
while (game->running()) {
game->handleEvent();
game->update();
game->rende... | true |
e9ee8a146e5082f10ecde3476dedb86176a8d832 | C++ | MaximBombardier/Arena-v-2.0 | /Magic/AttackMagic/AttackMagic.h | UTF-8 | 705 | 2.890625 | 3 | [] | no_license | #ifndef ATTACK_MAGIC_H_
#define ATTACK_MAGIC_H_
#include "../Magic.h"
class AttackMagic : virtual public Magic
{
public:
AttackMagic(std::string name, int manaCost, int damage);
virtual void effectUnit(Unit& unit) override;
virtual void uneffectUnit(Unit& unit)const override;
virtual MagicPtr clone()const overrid... | true |
079916d9eb915515683c67b50d112b82798be369 | C++ | CaroRomo1/InterviewQuestions | /TopTecProgrammer/2623 - Super Encryption/Caro/2623 - Super Encryption/2623 - Super Encryption/main.cpp | UTF-8 | 983 | 3.203125 | 3 | [] | no_license | //
// main.cpp
// 2623 - Super Encryption
//
// Created by Carolina Romo on 2/7/17.
// Copyright © 2017 CaroRomo. All rights reserved.
//
#include <iostream>
using namespace std;
string reverseString(string str){
int i = 0, j = int(str.length()-1);
char aux;
while (i < j) {
aux = str[i];
... | true |
14415b3f97311a979fe0424655a31cd455e64420 | C++ | wzxchy/code_c | /20150527/LU_Decomposition.cpp | UTF-8 | 1,184 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include "stdio.h"
#include "string.h"
#include <cmath>
using namespace std;
const int maxn=20;
double a[maxn][maxn];
double x[maxn],b[maxn];
void backward(int n)
{
int i,j;
for(i=n;i>0;i--)
{
double s=0;
for(j=i+1;j<=n;j++)
{
s+=a[i][j]*x[j];
... | true |
f2ab05f2b0091bf9c8849f415cd89cfe5d377cdb | C++ | dry3ss/MLF | /machine_learning_framework/src/framework_headers/MLF_InterfaceLayers.h | UTF-8 | 1,106 | 3.109375 | 3 | [] | no_license | #pragma once
#include <vector>
template<class T>
using VectorMatrix3D = std::vector< std::vector < std::vector<T> > >;
template <class T>
class InterfaceLayers// this is quite ugly, I just want to hold something like vector<vector<vector<float>>>
{ //where i can do in[layer_nb][neuron_nb][weight_nb], but be ab... | true |
4cd3caccca5007c72eb24d65c161e555e574353f | C++ | AlMazyr/algorithms | /sw_tests/magn/magnetic_dev2.cpp | UTF-8 | 6,361 | 2.65625 | 3 | [] | no_license | #include <iostream>
using namespace std;
#define N_MAX 100
#define QUEUE_MAX 10000000
#define extract_bit(bit_arr,idx) ((bit_arr[(idx)/8] >> (idx)%8) & 1)
#define set_bit(bit_arr,idx) (bit_arr[(idx)/8] |= 1 << ((idx)%8))
typedef unsigned char uint8;
struct Elem {
uint8 bit_arr[13]; // 100 bits == 12.5 bytes
uint... | true |
1cca72bfb60802d6579247ae7f5b1e4dfd3944db | C++ | necabo/ppcpp | /chapter4/primes.cpp | UTF-8 | 711 | 3.703125 | 4 | [] | no_license | #include <vector>
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cout << "Enter a number up to which you want to know the prime numbers:\n";
cin >> n;
vector<bool> striked(n, false);
striked[0] = true;
striked[1] = true;
vector<int> primes;
for (int i =... | true |
582fee171ce20b8c71445b15d623dafc78bb7b9a | C++ | ClaudioTazza/listecpp | /likePython/nodo.cpp | UTF-8 | 960 | 3.625 | 4 | [] | no_license | #include <iostream>
using namespace std;
#include "nodo.hpp"
#include <cstddef>
nodo::nodo(int n){
setNum(n);
setNext(NULL);
}//Costruttore del nodo
void nodo::setNum(int n){
num = n;
}//Setta il valore all'interno del nodo
void nodo::setNext(nodo* nextNodo){
next = nextNodo;
}
int nodo::getNum(){
return... | true |
6db95fa81b890ecfad761663620517fc00690bd6 | C++ | akashmodak97/Competitive-Coding-and-Interview-Problems | /Leet Code/Time Needed to Buy Tickets.cpp | UTF-8 | 1,873 | 3.546875 | 4 | [
"MIT"
] | permissive | /* Leet Code */
/* Title - Time Needed to Buy Tickets */
/* Created By - Akash Modak */
/* Date - 14/05/2023 */
// There are n people in a line queuing to buy tickets, where the 0th person is at the front of the line and the (n - 1)th person is at the back of the line.
// You are given a 0-indexed integer array ticke... | true |
e9dac7f4c0e149b06c16f1cd3c14d7fac1016867 | C++ | deadzora/Zorlock | /Zorlock/src/Zorlock/Core/Math.cpp | UTF-8 | 5,048 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #include "ZLpch.h"
#include "Math.h"
#include "Zorlock/Renderer/Color.h"
namespace Zorlock
{
Vector3::Vector3(ColorRGB& c) : x(c.x), y(c.y), z(c.z)
{
}
Vector3 Vector3::lerp(float t, const Vector3& a, const Vector3& b)
{
t = MathF::clamp(t, 0, 1);
return (1.0f - t) * a + t * b;
}
Vector4::Vector4(Color... | true |
2535904023c3b1fc79900e50ea9954a9de80bc30 | C++ | asteroid-612/BattleShip | /GameManager.cpp | UTF-8 | 3,558 | 3.015625 | 3 | [] | no_license | #include "GameManager.h"
#include "Player.h"
#include "Ship.h"
#include "Aircraft.h"
#include "Battleship.h"
#include "Cruiser.h"
#include "Destroyer.h"
#include <iostream>
using namespace std;
GameManager::GameManager()
{
m_Attacker = NULL;
m_Defender = NULL;
}
GameManager::~GameManager()
{
if(m_Attacke... | true |
96cd27033533ccdbd3453cc21a69446b263dcd9a | C++ | DanteRARA/STUST | /max and min.cpp | UTF-8 | 464 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
using namespace std;
int main(){
int size;
cin >> size;
for(int i = 0; i < size; i++){
float tmp, max, min;
for(int j = 0; j < 10; j++){
cin >> tmp;
if(j == 0) max = min = tmp;
if(tmp > max) max = tmp;
if(tmp < min) min = tmp;
}
cout << ... | true |
0f044c06d4cce3c62ab55f0eb2ff6dd6eed54fa4 | C++ | scanberg/particle-skinning | /src/Camera.h | UTF-8 | 444 | 2.734375 | 3 | [] | no_license | #pragma once
#include "Entity.h"
class Camera : public Entity
{
public:
Camera(float fov = 60.0f, float near = 0.1f, float far = 100.0f, float aspectRatio = 4.0/3.0);
void lookAt(const glm::vec3 & position);
glm::mat4 getViewMatrix();
glm::mat4 getInvViewMatrix();
glm::mat4 getProjMatrix();
glm::mat4 getInvP... | true |
06baaaac80cb19ad8bbf9a6fe9ee470d229de456 | C++ | shifuxiang/NvrControl | /NvrControl/NvrControl/Server/C_FileCopyProtocolServer.h | GB18030 | 2,137 | 2.59375 | 3 | [] | no_license | /****************************************************************************
*@file: C_FileCopyProtocolServer.h
*@brief: AQ33_CSԵȷļͨЭʵ
*
*@author: zhangchao@oristartech.com
*@dade: 2015-11-12
****************************************************************************/
#ifndef C_FILECOPYPROTOCOLSERVER_H
#define C_F... | true |
e91940e91a66c31cbdc860aca623e81e737eafd0 | C++ | iamsourav37/C_plus_plus_program_practice | /intemediate/question_2.cpp | UTF-8 | 404 | 3.953125 | 4 | [] | no_license | // C++ Program to Reverse a Number
#include <iostream>
using namespace std;
int main()
{
int number;
cout << "Enter any number : ";
cin >> number;
int reverseNumber = 0;
while (number != 0)
{
int rem = number % 10;
number /= 10;
reverseNumber = (reverseNumber * 10)... | true |
4829677e367b168e534c2e32e1cbc4425feac862 | C++ | mdegirolami/sing | /test/tests_results/siege.cpp | UTF-8 | 1,094 | 3.3125 | 3 | [
"BSD-3-Clause"
] | permissive | #include "siege.h"
static uint32_t uint32_sqrt(uint32_t x);
void print_primes_to(int32_t top)
{
std::vector<int32_t> primes;
// note: for all the numbers in the range excluing even numbers
for(int32_t totry = 3, totry__top = top; totry < totry__top; totry += 2) {
const int32_t max_val =... | true |
edff87bbd5dbcc8c945e1537fc2fac56e98dac82 | C++ | ShahJabeen/Exception-handling | /sajs2720/TextBox.cc | UTF-8 | 1,337 | 3.5625 | 4 | [] | no_license | //
// CS 2720 Assignment 1 Solution
//
/// \author Howard Cheng
/// \date Sep 13, 2017
///
///
/// The TextBox class is an abstraction of a rectangular box containing
/// a text string that can be drawn on a Screen.
///
#include "TextBox.h"
// constructs a TextBox
//
// \param[in] row the row of the first character
/... | true |
62cf77b108981cfb795bc28994a77b13fa22a25a | C++ | sagarmohanty2k00/DSA-450 | /recursion/TOH.cpp | UTF-8 | 633 | 3.546875 | 4 | [] | no_license | // Tower of Hanoi - Recursive solution
// By Sagar Mohanty
#include <bits/stdc++.h>
using namespace std;
void solve(int n, string s, string h, string d, int* step){
if(n == 1){
*step += 1;
cout << "One plate moved from \"" << s << "\" to \"" << d << "\"\n";
return;
}
else{
solve(n-1, s, d, h, step);
solve... | true |
b1d5465f7432157103cd901fc097a64a29e1acab | C++ | jmellorcrummey/llvm-openmp-5 | /runtime/src/extractExternal.cpp | UTF-8 | 15,217 | 2.78125 | 3 | [
"MIT",
"Apache-2.0",
"LLVM-exception",
"NCSA",
"LicenseRef-scancode-arm-llvm-sga",
"LicenseRef-scancode-generic-cla"
] | permissive | /*
* extractExternal.cpp
*/
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
/... | true |
22e01f056eb7f4cff0ff451e37fcbcc497a7197b | C++ | acadboostcpp/CPP- | /skillBoost/C++/binarySearch.cpp | UTF-8 | 598 | 3.984375 | 4 | [] | no_license | #include<iostream>
using namespace std;
int BinarySearch(int arr[], int size, int ele) {
int ans = -1;
int start = 0;
int end = size - 1;
while(start <= end) {
int mid = (start + end) / 2;
if(arr[mid] == ele) {
ans = mid;
break;
}
else if(arr[mid] > ele) {
end = mid - 1;
}
else {
start = mi... | true |
6abbc32694420a532c3c31802d30bbbda6aae052 | C++ | OKullmann/oklibrary | /Satisfiability/Transformers/Generators/Ramsey.hpp | UTF-8 | 8,086 | 2.5625 | 3 | [] | no_license | // Oliver Kullmann, 26.7.2004 (Turin)
/* Copyright 2004 - 2007, 2009, 2010, 2012 Oliver Kullmann
This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation and included in this li... | true |
98ba7247af05591a5a436a822f506d58f72822f7 | C++ | LaurentStar/SFNV-Game-Testing | /Joker.h | UTF-8 | 709 | 2.65625 | 3 | [] | no_license | #ifndef JOKER_H_INCLUDED
#define JOKER_H_INCLUDED
//#include "Character.h"
class Joker
{
//The king is not the joker's friend. Joker accesses nothing!
friend class King;
private:
/* ALL DATA CURRENTLY NEEDED FROM THE CHARACTER CLASS.
*Character_state
* X Y Z Coords
*/
float x_coord, y_c... | true |
7bc182aa780cd60ff18c6ba11adcf8f805544701 | C++ | rvillegasm/iot-mock-app | /src/main.cpp | UTF-8 | 153 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include "Calculator.hpp"
int main() {
std::cout << "The cube of 5 is " << Calculator::cube(5.0f) << std::endl;
return 0;
} | true |
b431f38cb0d158b7d551aca64ae72292af37da16 | C++ | cqw5/Algorithms_CPP | /Algorithms/divede_and_conquer_method/minmax_recursive.cpp | UTF-8 | 2,713 | 4.0625 | 4 | [] | no_license | /*! Author: qwchen
*! Date : 2016-10-20
*
* 求一组数中的最大值和最小值(递归解法)
* 思路:用递归的分治算法可以求解
*/
#include <iostream>
#include <vector>
using namespace std;
/*
* 递归函数
* Parament:
* a: 待查找的数组
* low: 第一个元素
* high: 最后一个元素的下一个位置
* indexOfMin: 最小元素的索引
* indexOfMax: 最大元素的索引
* return:
* 通过形参数传引用的... | true |
54f25e4d6d585d4ebe1a6b45704b42d734e958ad | C++ | hgorjiara/ComputerNetworks | /validator.cpp | UTF-8 | 21,809 | 2.6875 | 3 | [] | no_license | #include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <time.h>
#include <errno.h>
#include "utilities.h"
#include "cryptogram.h"
/*{
return 0;
}
int process_server_comm(vector<string> tokens, int num_of_tokens, char res[MAX_STR_SIZE], char* dirnm)
{
return 0;
}
int pro... | true |
cc46da1fdb232b794229975c3b5da89e89912778 | C++ | KimTNguyen/Introduction-3D-Game-Programming | /workshop1/framework/RendererOpenGL.cpp | UTF-8 | 10,131 | 3.203125 | 3 | [] | no_license | // Implementation of RendererOpenGL.h
// Aim: To encapsulate all OpenGL specifics into one class
// to enable easy replacement of OpenGL with other
// graphics APIs (and enable placement of the renderer class into other programs)
//
// Created: 31 May 2005
// Modified: 3rd August 2005
// Author: Martin... | true |
d24c5b7f890854506e6aa8f9dcb300b67de44efa | C++ | cz78/BST | /bstmain.cpp | UTF-8 | 954 | 3.59375 | 4 | [] | no_license | #include "bst.h"
int main()
{
BST tree;
cout << "inserting 7" << endl;
tree.insert("7");
cout << "inserting 4" << endl;
tree.insert("4");
// cout << "inserting 12" << endl;
// tree.insert("12");
cout << "inserting 1" << endl;
tree.insert("1");
cout << "inserting 6" << endl;
tree.insert("6");
cout << "inser... | true |
a9045a7442d522d72a212c4f0ef75f231d36dee5 | C++ | ThatOtherOtherBob/Solitaire | /ButtonEventCreator.cpp | UTF-8 | 1,660 | 2.921875 | 3 | [
"MIT"
] | permissive | #include "ButtonEventCreator.hpp"
ButtonEventCreator::ButtonEventCreator()
{
for (size_t buttonNumber = (int)ButtonsEnum::First; buttonNumber < (int)ButtonsEnum::Size; buttonNumber++)
{
oldButtons[buttonNumber] = false;
newButtons[buttonNumber] = false;
}
}
std::vector<ButtonsEnum> ButtonEventCreator::Generate... | true |
6a79d29c61c448c1e6d13b9045e04b7662ec03fb | C++ | ipang21/ip1 | /hr/eight/stockmax.cpp | UTF-8 | 835 | 2.90625 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
unsigned long long getMax(vector<unsigned long long> *x) {
unsigned long long max = 0;
vector<unsigned long long>::iterator peak;
while (x->size() > 0) {
peak = max_element(x->begin(), x->end());
f... | true |
cbcd32a324cb1a6448278eddcffddcbc24376496 | C++ | shoaib0657/Competitive-Programming-Problems-2020 | /Queue/Implement Queue using one stack.cpp | UTF-8 | 774 | 3.8125 | 4 | [] | no_license | //implement queue using only one stack
#include<iostream>
#include<stack>
using namespace std;
template<class X>
class Queue {
private:
stack<X> s;
public:
Queue() {
}
void enQueue(X d) {
s.push(d);
}
X deQueue() {
if (s.empty()) {
return -1;
}
X temp = s.top();
s.pop();
if (s.empty())
return t... | true |
aa645728d42681364f06ac56ce9ac9f9a77a4af4 | C++ | IllgamhoDuck/42SiliconValley | /c++_piscine/education/Day02/Integer.cpp | UTF-8 | 1,760 | 3.21875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Integer.cpp :+: :+: :+: ... | true |
51cf958fb2fb3607c8f10644506b3345ec2b5818 | C++ | opQuack/CPfiles | /POLYREL.cpp | UTF-8 | 476 | 2.78125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int findSides(int N){
if(N==3) return 3;
else if(N==4) return 4;
else if(N==5) return 5;
else{
return N+findSides(N/2);
}
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int T, N;
long int x;
scanf("%d",... | true |
02a122341571760c54a24fabf83d9b2dacb2970a | C++ | RedGry/ITMO | /Algorithms/Part_4/Task O.cpp | UTF-8 | 1,090 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool dfs (int i, vector <vector <int>> ¶, int *trade, bool start = true){
trade[i] = !start;
bool answer;
for (auto p : para[i]){
if (trade[p] == -1){
answer = dfs(p, para, trade, !start);
} els... | true |
855cced7e7eb24daa1bbf2486b00c69a1aa2d340 | C++ | yfqiu98/QFSDK | /ver_1/separa_data.cpp | UTF-8 | 2,272 | 3.15625 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <windows.h>
int Decoder(FILE *File, int window_size, int feature_size, int dataLen, double *inputBox, double *outputBox);
int normalizer(double *input, double *output, int method);
int main(){
int dataLen = 2048;
int feature_size = 4;
int wi... | true |
986d8a25600659ef4cf0ae25138160018690e959 | C++ | yogendrarp/udemyc- | /stl/queue.cpp | UTF-8 | 615 | 3.859375 | 4 | [] | no_license |
#include <iostream>
#include <string>
#include <queue>
class Test
{
std::string name;
public:
explicit Test(std::string name) : name(name)
{
}
~Test()
{
}
void print() const
{
std::cout << name << std::endl;
}
};
int main()
{
std::queue<Test> test_queue;
tes... | true |
f3861451755d1d6c5be48221c676ee961f6d2c72 | C++ | Dwgjjdxq/Offer2017 | /sorts/heapSort.cpp | GB18030 | 3,087 | 3.828125 | 4 | [] | no_license | #include <iostream>
using namespace std;
void swap(int &a, int &b) {
a ^= b;
b ^= a;
a ^= b;
}
/*
1. ʵ "ǰڵ" "ӽĽ" Ƚϣ
2. "ǰڵ" ģôҪֱbreak
3. "ֵ" ǵ "ǰڵ"ͬʱ "ֵ" λø "ǰڵ"
"ǰڵ"Ѱȷλã "ֵ" "ӽ" ȥȽϣ
(ûһӴȥǸӵĺȥȽϣֱҵӶλã
ûкӵʱͽȻøλ)
4. ѭֱ "ǰڵ" µλñˣûӽˣʱ˳ȥ
"ǰڵ" ֵŵ "ǰλ"
*/
void maxHeap(int *arr, int cur... | true |
612415784b30cc3f5a8cce79bb37196332196984 | C++ | Chuncheonian/oop-tutorial | /05_largeDataProcessing-1.cpp | UTF-8 | 3,485 | 3.828125 | 4 | [] | no_license | /**
* @file 05_largeDataProcessing-1.cpp
* @author Dongyoung Kwon (ehddud2468@gmail.com)
* @brief string, file stream
* @date 2020-04-07
*/
#include <iostream>
#include <fstream> // ofstream, ifstream Class 사용
#include <string>
using namespace std;
// 1. string
int main() {
// string: string class or ... | true |
a6f2fc3adf2f0d2444fe83cdd796b5af52a80896 | C++ | CannyLab/tsne-cuda | /src/include/util/random_utils.h | UTF-8 | 1,204 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* @brief Utilities for handling random numbers
*
* @file random_utils.h
* @author David Chan
* @date 2018-04-04
* Copyright (c) 2018, Regents of the University of California
*/
#ifndef SRC_INCLUDE_UTIL_RANDOM_UTILS_H_
#define SRC_INCLUDE_UTIL_RANDOM_UTILS_H_
#include "include/common.h"
#include "include/u... | true |
181a9c59725c54882f086535b7524a7ef9882450 | C++ | cualquiercosa327/Wii-U-Firmware-Emulator | /src/hardware/pi.cpp | UTF-8 | 3,232 | 2.59375 | 3 | [
"MIT"
] | permissive |
#include "hardware/pi.h"
#include "hardware.h"
#include "physicalmemory.h"
WGController::WGController(PhysicalMemory *physmem) {
this->physmem = physmem;
}
void WGController::reset() {
base = 0;
top = 0;
ptr = 0;
threshold = 0;
index = 0;
}
uint32_t WGController::read(uint32_t addr) {
swi... | true |
cf2c5a9e4ab29b8dcb41f88f2668146a4a6183bc | C++ | rabispedro/SFML | /Space Invaders++/code/LevelManager.h | UTF-8 | 1,015 | 2.734375 | 3 | [
"MIT"
] | permissive | #pragma once
#include<SFML/Graphics.hpp>
#include<vector>
#include<string>
#include"GameObject.h"
#include"GameObjectSharer.h"
using namespace std;
using namespace sf;
class LevelManager : public GameObjectSharer{
private:
vector<GameObject> m_GameObjects;
const string WORLD_FOLDER = "../world";
const string S... | true |
e6f06ada2966a3109adbb103e577237b0ce8d257 | C++ | vinothsid/vino-cache | /Cache.cpp | UTF-8 | 27,279 | 2.875 | 3 | [] | no_license | #include <iostream>
//#include<limits>
#include "limits.h"
#include "stdlib.h"
#include <fstream>
#include <sstream>
#include "string.h"
#include <iomanip>
//#define DEBUG 0
#define VICTIM_NONE 0
#define VICTIM_REPLACE 1
#define VICTIM_WB 2
#define CACHE_MISS 0
#define CACHE_HIT 1
using namespace std;
typedef unsign... | true |
370fff0baf6eb0c78621ab61b0a6faa98cc031de | C++ | naprelsky/ame.example | /NaucaFile/Coefficient.cpp | UTF-8 | 1,084 | 3.03125 | 3 | [] | no_license | #include "stdafx.h"
#include "Coefficient.h"
Coefficient::Coefficient(double min, double max, double freq)
{
secondsPass = 0;
value = 0;
threadWorking = false;
aborted = false;
minValue = min;
maxValue = max;
frequency = freq;
std::thread valueThread(&Coefficient::ChangeValueThread, this);
... | true |
c59e519e41044de65fa70f512dff16582f046399 | C++ | theSquaredError/Algorithms | /backtracking/N-queens.cpp | UTF-8 | 1,194 | 3.296875 | 3 | [] | no_license | /*
https://www.geeksforgeeks.org/n-queen-problem-backtracking-3/
*/
#include <iostream>
#include <vector>
using namespace std;
void printBoard(int n, int board[][20]){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<board[i][j]<<" ";
}
cout<<endl;
}
}
bool canPlace(int board[][20], int n, int x, int ... | true |
b90ebe3e0ee783fccc0fdf92fdf6f7666e9d7173 | C++ | KevenGe/LeetCode-Solutions | /problemset/945. 使数组唯一的最小增量/solution.cpp | UTF-8 | 1,168 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
// class Solution
// {
// public:
// int minIncrementForUnique(vector<int> &A)
// {
// sort(A.begin(), A.end());
// int stand = INT_MIN;
// int ans = 0;
// for (int i = 0; i < A.s... | true |
78389baa02940a871058dfcc3c08fa7eb73ab035 | C++ | C-B0T/FirmwarePropulsion2017 | /HardwareAbstraction/inc/GPIO.hpp | UTF-8 | 3,642 | 3.078125 | 3 | [] | no_license | /**
* @file GPIO.hpp
* @author Kevin WYSOCKI
* @date 8 nov. 2016
* @brief GPIO Abstraction Class
*/
#ifndef INC_GPIO_HPP_
#define INC_GPIO_HPP_
#include "stm32f4xx.h"
#include "Event.hpp"
/*----------------------------------------------------------------------------*/
/* Definitions ... | true |
99b0e4d8cfe0130e7b40a22c9019f12845282aef | C++ | Polandr/DE_algo | /DE/src/parameters.cpp | UTF-8 | 1,476 | 2.890625 | 3 | [] | no_license | #include <parameters.h>
// Parameters for algorithm:
int Parameters::population_size = 1;
int Parameters::problem_dimension = 1;
Stop_condition Parameters::stop_condition = Iter_num;
int Parameters::max_iter_num = 1;
double Parameters::max_evolution_time = 0;
int Parameters::n_change_iter_num = 1;
Fitness_type Parame... | true |
df017c8c7dadd3652e636de14393f70e10619581 | C++ | yashparmar15/Cpp-Codes | /Repeated_String_Match.cpp | UTF-8 | 2,734 | 3.734375 | 4 | [] | no_license | /*Given two strings A and B, find the minimum number of times A has to be repeated such that B becomes a substring of the repeated A. If B cannot be a substring of A no matter how many times it is repeated, return -1.
Example 1:
Input: A = "abcd", B = "cdabcdab"
Output: 3
Explanation: After repeating A three times,
... | true |
92e616ceab709851df0c3bd034da7ea31bced1aa | C++ | darienmiller88/Snake | /SnakeHead.cpp | UTF-8 | 2,026 | 3.5 | 4 | [] | no_license | #include "SnakeHead.h"
SnakeHead::SnakeHead(char snakeChar, int initX, int initY) : SnakeSegment(snakeChar, initX, initY), xSpeed(0), ySpeed(0){
}
void SnakeHead::update() {
xPrevious = x;
yPrevious = y;
//the x and y of the snakehead will change in accordance to an x and y speed value. So if the x spee... | true |
8424dc2646712b6985ebae2009c41eb22c89b6ba | C++ | liadeliyahu11/LiadnRaz | /LiadnRaz/checkValid.cpp | UTF-8 | 338 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<string>
#include "valid.h"
using namespace std;
void main()
{
Valid check;
string username = "Admin";
string password = "Aa231";
cout << "username is correct ?" << check.isUsernameValid(username) << endl;
cout << "password is correct ?" << check.isPasswordValid(password) << endl;
syste... | true |
3ed4350769ca800b7f1ad7d030ab7629c186277f | C++ | LuckPsyduck/Data-Structure-Example | /数据结构-C/Other/Example&矩阵的压缩存储.cpp | GB18030 | 1,050 | 3.015625 | 3 | [] | no_license | // ѹ洢.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include"Matrix.h"
int main()
{
TSMtrix A, B, C;
printf("A: ");
CreateSMatrix(A);
PrintSMatrix(A);
CopySMatrix(A, B);
printf("ɾAƾB:\n");
PrintSMatrix(B);
DestroySMatrix(B);
printf("پB: \n");
PrintSMatrix(B);
printf("B2:(AУͬУзֱΪ%d,%d)\n", A.mu, A.nu);
CreateSMatr... | true |
c2c615a065b4eedb0760973752db5096fd46f22d | C++ | Yandren/Pet | /Scrap/Log.h | UTF-8 | 563 | 2.609375 | 3 | [] | no_license | #ifndef LOG_H
#define LOG_H
#include <Windows.h>
#include "MemManager.h"
#include <fstream>
const int LOG_APP=1;
const int LOG_CLIENT=2;
const int LOG_SERVER=4;
const int LOG_USER=8;
#define MAX_LOG_STRINGS 256
class CLog
{
protected:
CLog();
std::ofstream appLog;
std::ofstream clientLog;
std::ofstream serv... | true |