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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1109bc1224dfa27c54160766022ccdfb4b66e85c | C++ | johnBuffer/ZombieV | /src/System/SoundPlayer.cpp | UTF-8 | 1,101 | 2.859375 | 3 | [] | no_license | #include "System/SoundPlayer.hpp"
std::vector<SoundHandler> SoundPlayer::_buffers;
void SoundHandler::update()
{
livingSounds.remove_if( [](sf::Sound& s){return s.getStatus() == sf::Sound::Stopped;} );
}
size_t SoundPlayer::registerSound(const std::string& filename, size_t maxSounds)
{
_buffers.push_back(Sou... | true |
a62e1ed5f202f571f449db31cd2b6902dd777b7a | C++ | AdrianNostromo/CodeSamples | /CPP_Joc_Windows_Android/SH_Client_Win_Cpp_Cmake/App/src/base/view/debug/entryUser/DebugEntryUser.cpp | UTF-8 | 2,434 | 2.609375 | 3 | [] | no_license | #include "DebugEntryUser.h"
#include "../entry/IDebugEntry.h"
#include <base/util/StringUtil.h>
using namespace base;
DebugEntryUser::DebugEntryUser(IDebugEntry* debugEntry)
: debugEntry(debugEntry)
{
//void
}
bool DebugEntryUser::getIsConnected() {
return debugEntry != nullptr ? true : false;
}
void DebugEntryU... | true |
c29c791a6b8ffec945df6334d713b45cb36e0bc1 | C++ | jmh045000/utd_cs6378 | /hw3/Socket.h | UTF-8 | 1,459 | 3.421875 | 3 | [] | no_license | #ifndef __SOCKET_H__
#define __SOCKET_H__
#include <stdint.h>
#include <iostream>
#include <sstream>
#include <string>
class ClosedException : public std::exception {};
//simple wrapper around BSD tcp sockets
// basic idea is to write the code to deal with opening/closing sockets once
class Socket
{
protected:
... | true |
e99193f42822956ae344b6d9a8ce5dcb060e51ff | C++ | ayush-105192219/c-test-code | /current/main.cpp | UTF-8 | 920 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
void fun1(int n)
{ switch(n){
case 1: std::cout<<"one";
break;
case 2: cout<<"two";
break;
case 3: cout<<"three";
break;
... | true |
d21b4b20d67a8a9a9b0b02c413ca8a52cd57a0df | C++ | codeshef/datastructure-and-algorithm | /Algorithm/GreedyAlgorithm/Egyptian.cpp | UTF-8 | 564 | 3.5 | 4 | [] | no_license | // Egyptian form using greedy algorithm
#include<iostream>
using namespace std;
void printEgyptian(int nr,int dr)
{
if(dr==0 || nr==0)
{ return;
}
if(dr%nr ==0)
{
cout<<"1/"<<dr/nr;
return;
}
if(nr%dr==0)
{ cout<<nr/dr;
return;
}
if(nr > dr)
{ cout<<nr/dr<<"+";
printEgyptian(nr%dr,dr);... | true |
045451457fbcd45dcdbbea30929b91c944f05dae | C++ | fernandezeric/acmudec | /DanielOrtega/Semestre1-2017/Hechos/11507.cpp | UTF-8 | 1,582 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
while(1){
cin >> n;
if (n ==0)
break;
string pos1,a;
pos1= "+x";
for( int i = 0; i <n-1; i++ ){
cin >> a;
if(!pos1.compare("+x")){
if(!a.compare("+y"))
pos1="+y";
else if(!a.compare("-y"))
... | true |
b9d7f1ae7309becb4d1129b255fcfbc5c3547a36 | C++ | eindacor/fractal_generator | /screencap.cpp | UTF-8 | 17,331 | 2.578125 | 3 | [] | no_license | #include "screencap.h"
string paddedValue(unsigned int value, unsigned short total_digits)
{
string padded_number;
for (int i = 0; i < total_digits; i++)
{
padded_number += std::to_string(value % 10);
value /= 10;
}
std::reverse(padded_number.begin(), padded_number.end());
return padded_number;
}
bool sav... | true |
7d7ccc2507088f1bc59be1a6f7f85f1bf2c652d4 | C++ | chhavibansal/CodeAsylum_cpp | /Batch_2_june/LIS.cpp | UTF-8 | 574 | 3.15625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int LongestincreasingSubsequence(int *arr, int n ){
int dp[n] ={0};
for(int i = 0 ; i < n ; i++)
dp[i] = 1;
int maxAns = 1 ;
for(int i = 1 ; i < n ; i++){
for(int j = 0 ; j < i ; j++){
if(arr[i] > arr[j]){
dp[i] =... | true |
7df67d97682185534131c6155ca353130a15d6ab | C++ | utmi-2014/utmi-soft2 | /140512/labmember4.h | UTF-8 | 296 | 2.890625 | 3 | [
"MIT"
] | permissive | class LabMember {
protected:
char name[32];
public:
LabMember() {}
LabMember(char* _name) {
strcpy(name, _name);
}
~LabMember() {
}
char* SetName(char* _name) {
sprintf(name, "Mr. %s", _name);
}
char* GetName() {
return name;
}
virtual void PrintInfo() {};
}; | true |
a7823bc7995870533ecfa7c48d8dc5e5d1604ba8 | C++ | poiqwe12/Pamsi_sortowanie | /Nagłówek.h | UTF-8 | 648 | 3.09375 | 3 | [] | no_license | #pragma once
#ifndef _nazwa_pliku_
#define _nazwa_pliku_
#include <iostream>
template<typename Typ,int Wymiar>
class Dane
{
Typ tab[Wymiar];
public:
const Typ& operator [] (unsigned int index)const
{
if (index < Wymiar) return tab[index];
exit(EXIT_FAILURE);
}
void Inicjuj_losowo();
};
t... | true |
0ee0fd3c3939f095a2677a69c97e12b7f38d764e | C++ | shanmo/google-hash-code-2021 | /practice/solution/utils.h | UTF-8 | 2,203 | 3.328125 | 3 | [
"MIT"
] | permissive | #ifndef UTILS_H
#define UTILS_H
#include <exception>
#include <string>
#include <iostream>
#include <vector>
#include <fstream>
#include <unordered_map>
#include "pizza_delivery.h"
PizzaDelivery parse_input(const std::string& filename)
{
std::ifstream ifs(filename);
if (!ifs.is_open())
{
throw... | true |
6a95b181e5096fd75a7aef4ed85f47462e6732bc | C++ | OscarSandell/Wordchain | /kattis.h | UTF-8 | 5,027 | 3.390625 | 3 | [] | no_license | #pragma once
#include <vector>
#include <string>
#include <sstream>
#include <functional> // std::hash
using std::vector;
using std::string;
typedef unsigned char byte;
/**
* Fil med hjälpfunktioner för att hantera tecknen å, ä, ö och é korrekt i C++, vilket krävs för en
* accepterad lösning i Kattis.
*
* I C++ ... | true |
85b21a69d9ce83466eb7a6cfdce39da9eb9b5e4b | C++ | faxinwang/cppNotes | /containters/data structure/myList/DLList.hpp | GB18030 | 2,274 | 3.546875 | 4 | [] | no_license |
#ifndef DLList_h
#define DLList_h
#include"../myColl/Coll.hpp"
#include"../myExp/myExp.hpp"
/*˫ʵ*/
template<class T>
class DLList:public Coll<T>{
private:
struct Node{
T data;
Node *prev,*next;
Node():prev(0),next(0){}
Node(const T& x,Node* pre=0,Node* nxt=0):data(x),prev(pre),next(nxt){}
};
Node ... | true |
dbff2619517ec9d226dfd19ddd1eadb9ace2a13e | C++ | kssenii/ClickHouse | /dbms/src/Storages/StorageInput.cpp | UTF-8 | 1,966 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #include <Storages/StorageInput.h>
#include <Storages/IStorage.h>
#include <Interpreters/Context.h>
#include <DataStreams/IBlockInputStream.h>
#include <memory>
namespace DB
{
namespace ErrorCodes
{
extern const int INVALID_USAGE_OF_INPUT;
}
StorageInput::StorageInput(const String & table_name_, const Columns... | true |
0484a609a3a983cad227a7fb5a7ba984a76d79da | C++ | BrianGoga/School | /Networking/CPE400.cpp | UTF-8 | 4,811 | 3.234375 | 3 | [] | no_license | ////////////////////////////
// CPE 400 //
// Brian Goga //
// Battery Life of //
// Sensor nodes //
////////////////////////////
//Header Files
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <queue>
#include <string>
#include <time.h>
#include <vector>
... | true |
3ee9c2de10a6f932d270a6886b9c12c2c8ceb710 | C++ | gbrlas/AVSP | /CodeJamCrawler/dataset/13_3721_85.cpp | UTF-8 | 1,256 | 2.828125 | 3 | [] | no_license | #include <stdio.h>
// google code jam 2013, qualification round, problem B
// israel leiva - april 13th
int main(void){
int T, tc = 0, N, M, i, j, k, min;
int lawn[100][100];
short pattern;
scanf("%d\n", &T);
while(T){
tc++;
scanf("%d %d\n", &N, &M);
printf("Case #%d: ", tc);
min = 100;
// re... | true |
45fd3a70f636a5b60dae88e51c1cd5de700eea42 | C++ | IrwinYauri/clases-c- | /punteroValor.cpp | UTF-8 | 220 | 2.953125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int a=5,b=2;
int *p=&a; //p aputna a 'a'
p=&b;//p apunta a 'b'
*p=3;//asignamos valor a casilla de memoria donde apunta p
cout<<b<<endl;
}
| true |
78a0fadbffc96615f3aae76479c0813cede14c64 | C++ | cok1/SeboApp | /SeboApp/DAO/ManagerActeur.h | UTF-8 | 2,652 | 2.9375 | 3 | [] | no_license | #pragma once
#include <vector>
#include "Entity\Acteur.h"
#include "Tools\Connexion.h"
#include <qsqlquery.h>
#include <qvariant.h>
#include <memory>
class ManagerActeur
{
public:
/// <summary>
/// Destructeur par défaut
/// </summary>
~ManagerActeur();
/// <summary>
/// Cette fonction permet de récupérer un ve... | true |
266bf6e552cdb6a095cd5cbb8f58184e6aa54d3d | C++ | nontokozo/Tut2 | /Tut2/Fraction.h | UTF-8 | 1,354 | 3.203125 | 3 | [] | no_license |
#ifndef FRACTION_H
#define FRACTION_H
//***********************DEFINITION OF CLASS FRACTION*************************//
class Fraction
{
public:
Fraction(); // default constructor function header
Fraction(int, int); // non default constructor function header
void reduce(); // reduce fraction function header
vo... | true |
efba6b067dee92c8dead6c947d2bc0f3ab71ffc4 | C++ | Garanyan/msu_cpp_spring_2017 | /Bezsudnova/Army/Army.h | UTF-8 | 1,578 | 3.171875 | 3 | [] | no_license | #pragma once
struct Army
{
std::vector<std::unique_ptr<Unit>> infantry_;
std::vector<std::unique_ptr<Unit>> archer_;
std::vector<std::unique_ptr<Unit>> horseman_;
void save(std::ostream& out) const
{
out << "Infantry - " << infantry_.size() << '\n';
out << "Archer - " << archer_.siz... | true |
183a814b6a911c2e79c2d8e800fad62a3e0e9c5d | C++ | ImbaCow/OOD | /lab05/command/command/CResizeImageCommand.cpp | UTF-8 | 564 | 2.875 | 3 | [] | no_license | #include "pch.h"
#include "CResizeImageCommand.h"
CResizeImageCommand::CResizeImageCommand(int& widthContainer, int& heightContainer, int newWidth, int newHeight)
: m_widthHeightContainer(widthContainer, heightContainer)
, m_nextWidthHeight(newWidth, newHeight)
{
}
void CResizeImageCommand::DoExecute()
{
SwapPairs... | true |
e0416762d79a69b88ae42570d0032bab504bbae7 | C++ | wangtss/leetcodePractice | /source/92ReverseLinkedListII.cpp | UTF-8 | 504 | 2.890625 | 3 | [] | no_license | ListNode* reverseBetween(ListNode* head, int m, int n) {
if (head == NULL || head->next == NULL || m == n) return head;
ListNode *dummy = new ListNode(0), *pre, *post;
dummy->next = head;
pre = dummy;
int count = 1;
while (count != m) {
pre = pre->next;
count++;
}
post = pre;
while (count++ != n) post = po... | true |
a109b4d0f949670d7edaefef97c7350053230a34 | C++ | 3l-d1abl0/DS-Algo | /cpp/practise/selection_algorithm.cpp | UTF-8 | 1,180 | 3.140625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define MAX 7
int A[MAX] = {12, 3, 5, 7, 4, 19, 26};
int N = sizeof(A)/sizeof(A[0]);
int partitions(int low,int high)
{
int p=low,r=high,x=A[r],i=p-1;
for(int j=p;j<=r-1;j++)
{
if (A[j]<=x)
{
i=i+1;
s... | true |
194982bee8085a37d8570c42f8f3531d2379afd5 | C++ | Ravenm/DataStruct3013 | /infixPostfix/infixPostfix/infixScanner.cpp | UTF-8 | 3,379 | 3.46875 | 3 | [] | no_license | #include "infixScanner.h"
infixScanner::infixScanner()
{
}
infixScanner::~infixScanner()
{
}
//<summary>Scan a string for numbers and operators
//to create a postfix string</summary>
//<param name=none></param>
//<returns></returns>
void infixScanner::Scan()
{
std::stack<std::string> operators;
std::stack<int> p... | true |
96f2a861b45d99a3809a12e90779948d4472f4a7 | C++ | VictorDubois/KrabiRobotique | /scarabi/Scarabi.cpp | UTF-8 | 2,133 | 2.640625 | 3 | [] | no_license | #include "Scarabi.h"
Scarabi* Scarabi::_singleton = 0;
Scarabi* Scarabi::singleton()
{
if (_singleton==0)
_singleton = new Scarabi();
return _singleton;
}
Scarabi::Scarabi() : color(colorBlue), timerMatchStarted(0), isRunning(false)
{
Serial.println("Skarabi created !");
Serial.println("... | true |
4804d14e4240f5fc947bde1660db79ecf34f0108 | C++ | JKurtAnderson/CPP-Projects | /Sorting/algorithms/SelectionSort.h | UTF-8 | 928 | 3.109375 | 3 | [] | no_license | //
// Created by Jason on 12/8/2019.
//
#ifndef SORTING_SELECTIONSORT_H
#define SORTING_SELECTIONSORT_H
#include <cstddef>
#include <iostream>
#include "Arrays.h"
template <class T>
static void selectionSort(T* array, size_t length){
#if defined(DEBUGGING) && (DEBUGGING == 1)
printArray(array, leng... | true |
50d9ec99cffc887015ab60e626b8933541954d12 | C++ | luisg122/cpp_programming_projects | /C++/Gaussian1.cc | UTF-8 | 5,881 | 3.59375 | 4 | [] | no_license | #include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;
class Gaussian{
private:
int a,b;
public :
Gaussian(int nx,int ny):a(nx),b(ny){} //in-class initializer constructor
Gaussian():Gaussian(0,0){}
//default consturctor with delegating constructor
Gaussian(const G... | true |
8e97694a13fdf0f0e0c48eaba51b31647bb6748d | C++ | Jamxscape/LearnCPlusPlus | /3/3/21.cpp | UTF-8 | 367 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | //
// 21.cpp
// 3
//
// Created by 马元 on 2016/12/24.
// Copyright © 2016年 MaYuan. All rights reserved.
//
#include<iostream>
#include <cmath>
using namespace std;
int main21()
{
int n=0,h;
cin>>h;
for(int i=2;i<=sqrt(h);i++)
if(h%i==0) n=1;
if(n==0)cout<<h<<"是素数"<<endl;
else cout<<h<<"不是素... | true |
2addafec78876e82e68a1886769f0d577f96174e | C++ | fenixlin/leetcode | /c++/pb008.cpp | UTF-8 | 1,618 | 3.078125 | 3 | [] | no_license | // Brute force, O(n)
#include <string>
#include <gtest/gtest.h>
using namespace std;
class Solution {
public:
int myAtoi(string str) {
int sign = 1;
int ans = 0;
string::iterator i = str.begin();
while (*i==' ' && i!=str.end()) i++;
if (*i=='-') { sign = -1; i++; }... | true |
26d7ec8ef4cbe698d86731f0083419f4b5593b35 | C++ | tyhenry/dt_openframeworks_2018 | /week12/06_mesh_texture/src/ofApp.cpp | UTF-8 | 4,806 | 2.53125 | 3 | [] | no_license | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
earthImg.load("earth_texture.jpg");
sphere.set(200,3);
sphere.mapTexCoordsFromTexture(earthImg.getTexture());
gui.setup();
gui.add( bLight.set("lighting", true));
gui.add( bFa... | true |
ba68f899974352d619062c735db04b9352a20d01 | C++ | teddyort/NumberDisplay | /NumberDisplay.cpp | UTF-8 | 686 | 3.21875 | 3 | [] | no_license | #include "Arduino.h"
#include "NumberDisplay.h"
NumberDisplay::NumberDisplay(const int pins[]){
//Setup all the pins as outputs
_pins = pins;
int i;
for(i=0;i<8;i++){
pinMode(pins[i], OUTPUT);
}
}
void NumberDisplay::output(int num) {
//Map Numbers to Bytes (using hexadecimal to keep it short)
/... | true |
5fd8db46e395893d876b6ed7e1b1c1b2931e8f79 | C++ | DFRobot/DFRobot_L218 | /example/DFRobot_L218_Tracker/DFRobot_L218_Tracker.ino | UTF-8 | 3,223 | 2.78125 | 3 | [] | no_license | /*
* File : DFRobot_L218_Tracker.ino
* Power : L218 powered by 3.7V lithium battery
* Brief : This example use L218 as a tracker
* Press the button when the net light blinks L218 start
* After initialization is completed it will print longitude (Positive numbers for East and Negative nu... | true |
ca1266577b1ec7f4b0ef8e9c035428855572af24 | C++ | ankurdcruz/Smart-Search-Dictionary | /Class12th_C++_Project.cpp | UTF-8 | 19,518 | 2.671875 | 3 | [] | no_license | #include<fstream.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
class data
{
char word[15],mean[50],syn[15],ant[15];
public:
void input()
{
gotoxy(4,13);
cout<<"Enter Word:";
cin>>word;
gotoxy(4,14);
cout<<"Enter meaning:";
cin>>mean;
... | true |
4410d9ec153168efda72e8ad5404032ac55665c6 | C++ | 15831944/Fdo_SuperMap | /源代码/CAD PlugIn/UGC的封装/SMCTest/SMCTest.cpp | GB18030 | 8,127 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive |
#include "SMCTest.h"
int main()
{
/* SMCWorkspace workspace;
SMCDataSource* pDataSource = new SMCDataSource ;
SMCDatasetVector* pDataset = new SMCDatasetVector;
//! Թռ
_tstring strWorkspaceName(_T("C:\\TestDS\\World.sxw"));
// std::string strWorkspaceName("D:\\World.sxw");
bool bOpen = workspace.Open(strWor... | true |
a50e4bba5ac056b6367c620e6139645c0683e6e8 | C++ | luoguanghao/PAT | /patAdv/patA80.cpp | UTF-8 | 1,923 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct manType{
int id;
int rank;
int GE,GI;
double tG;
vector<int> choice;
};
bool cmp(manType a, manType b){
if(a.tG!=b.tG) return a.tG>b.tG;
return a.GE>b.GE;
}
int main(){
int n,m,k;
vector<int> quota, passList[105];
vector... | true |
60d152004d1c94d35a4acdd112a101824047bc85 | C++ | nstbayless/gyoa | /include/gyoa/World.h | UTF-8 | 3,087 | 2.859375 | 3 | [] | no_license | /*
* World.h
*
* Created on: Aug 9, 2015
* Author: n
*/
#ifndef BACKEND_MODEL_WORLD_H_
#define BACKEND_MODEL_WORLD_H_
#include <map>
#include <string>
#include "Room.h"
struct git_repository;
namespace gyoa {
namespace model {
//! Model root. contains list of rooms.
struct world_t {
//! name of the g... | true |
0193059e1f8a332182c26e0c3f08009f88452fb9 | C++ | lbel/icsc2018 | /linked_list/main.cxx | UTF-8 | 2,396 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | #include <ctime>
#include <functional>
#include <iostream>
#include <vector>
#include "linked_list.h"
using std::cout;
using std::endl;
void time(std::function<void()> function, const char* label)
{
const std::clock_t start = std::clock();
function();
const std::clock_t end = std::clock();
cout << "T... | true |
97d2fdc6e3633f1b979d7b34b96c7ea8eb1abeaa | C++ | Hengle/isogrid-houdini-sop | /isogrid/isogrid/src/WB_CubeGridExporter.cpp | UTF-8 | 4,803 | 2.703125 | 3 | [] | no_license | #include "WB_CubeGridExporter.h"
#include <fstream>
#include <sstream>
void WB_CubeGridExporter::exportMesh(const std::string &path, double cx, double cy, double cz, int I, int J, int K,
double dx, double dy, double dz, const std::vector<bool> &values, int li, int ui,
... | true |
022f6af8ed6284c80f478a984e342437904fadd0 | C++ | wangzhen11aaa/CPlusPlus_Primer | /chapter8/exercise5.cpp | UTF-8 | 569 | 3.390625 | 3 | [] | no_license | //
// Created by wangzhen on 20/02/2017.
//
#include <iostream>
template <typename T>
T largest(const T arr[]);
const int knum = 5;
int main(void)
{
int iarr[knum] = {3, 10, 2, 20, 100};
double darr[knum] = {-100.0, 2.0, 4.0, 256.0, 1024.0};
std::cout << "iarr max is " << largest(iarr) << std::endl;
... | true |
9b580f6719d6ce8f66e49d49fae0fd3289c8f02d | C++ | oliriley/PhantomController | /SensAble/GHOST/v4.0/include/gstBasicTransformMatrix.h | UTF-8 | 13,348 | 2.9375 | 3 | [] | no_license | //
// File:gstBasicTransformMatrix.h
//
// Copyright (C) 2000 SensAble Technologies, Inc.
// All rights reserved.
//
//
//
// Provides basic functionality of a 4x4 transform matrix.
//
#ifndef GST_BASIC_TRANFORM_MATRIX
#define GST_BASIC_TRANFORM_MATRIX
#include <gstGenericMatrix.h>
#include <gstBasic.h>
#include <gst... | true |
c171cf0f8947b229b2a643ec0a30e6e7c938e192 | C++ | IgnisRain/Game-Programming-CS3113 | /Platformer+Sound/Entity.cpp | UTF-8 | 3,091 | 2.875 | 3 | [] | no_license | #include "Entity.h"
Entity::Entity(float x, float y, float rotation, GLuint textureID, float width, float height)
: x(x), y(y), rotation(rotation), textureID(textureID), width(width), height(height) {
velocityX = 0.0f;
velocityY = 0.0f;
accelerationX = 0.0f;
accelerationY = 0.0f;
frictionX = 2.0f;
frictionY = 2... | true |
f86834fe8e250dadaac813d7c49ca00b335d4c04 | C++ | WadieAC/C-CODES | /18_POO_02/7. Estaticos/Estatico.h | UTF-8 | 321 | 3.078125 | 3 | [] | no_license | #include<iostream>
using namespace std;
class Estatico{
private:
static int contador; //Declaracion de un atributo static
public:
Estatico(){
contador++;
}
int getContador(){
return contador;
}
static int sumar(int n1,int n2){
int suma = n1+n2;
return suma;
}
};
... | true |
1c01fa32c26b63662396449b8907b033845e3c49 | C++ | zzo30802/design_pattern_Cpp | /src/SOLID/04_Interface_Segregation_Principle.cpp | UTF-8 | 3,215 | 3.015625 | 3 | [] | no_license | // 介面隔離原則 Interface Segregation Principle (ISP)
// https://medium.com/@f40507777/%E4%BB%8B%E9%9D%A2%E9%9A%94%E9%9B%A2%E5%8E%9F%E5%89%87-interface-segregation-principle-isp-6854c5b3b42c
/*
理念核心:
1. 不應該強迫用戶去依賴他們未使用的辦法
2. 最小化類別與類別之間的介面
遇到的問題:
1. 避免介面太多
2. 並非全部的方法都會使用到
3. 繼承後空實作
沒遵守DIP可能造成情況:
1. 繼承或抽象類別 : 多餘的... | true |
b1b458c7bfd1ff16d700ff1e88fd60750a251826 | C++ | ca2/app2018 | /appseed/aura/aura/aura/aura_console_window.h | UTF-8 | 2,538 | 2.546875 | 3 | [] | no_license | #pragma once
void RedirectIOToConsole();
class std_out_buffer:
virtual public ::file::file
{
public:
std_out_buffer() {}
virtual ~std_out_buffer() {}
void write(const void * lpBuf,memory_size_t nCount);
};
//class console_ostream:
// virtual public ::file::plain_text_stream
//{
//public:
//
// ... | true |
c58550d6f216df5f86c079c10792ac0c2a2031e7 | C++ | techtronics/Cleaver2 | /src/gui/Application/Data/DataManager.cpp | UTF-8 | 6,718 | 2.8125 | 3 | [
"MIT"
] | permissive | #include "DataManager.h"
#include <QMessageBox>
#include <Cleaver/InverseField.h>
#include <Cleaver/AbstractScalarField.h>
DataManager::DataManager()
{
}
void DataManager::addMesh(cleaver::TetMesh *mesh)
{
m_meshes.push_back(mesh);
emit dataChanged();
emit dataAdded();
emit meshAdded();
emit me... | true |
9f3197ba3c1ffd61bd978c9a2fc4a9dc19fbe341 | C++ | FOSSBOSS/Learning-OpenCV-3_examples | /examples/chapter2/example2_9.cpp | UTF-8 | 1,367 | 2.96875 | 3 | [] | no_license | //Examples 2-8, 2-9,, are extended version of example 2.7
//Getting, and setting pixels
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char ** argv){
Mat img_rgb, img_gray, img_cny, img_pyr0, img_pyr1;
img_rgb=imread(argv[1]); //get an image
int x=1... | true |
afa0329e587012b88a3dca95c6fe646bf8a66c34 | C++ | Patrick-Gemmell/ICS3U-Assignement4-CPP | /package.cpp | UTF-8 | 2,008 | 3.59375 | 4 | [] | no_license | // Copyright (c) 2019 Patrick Gemmell All rights reserved.
//
// Created by: Patrick Gemmell
// Created on: September 2019
// This Program sees if a package can be processed
#include <iostream>
#include <cstdlib>
#include <string>
int main() {
// This function sees if a package can be processed
// variables a... | true |
14f17f2f96a8f6cda19e277af0792e26a86a82b5 | C++ | Charleo85/uvaicpc | /code/2006/routing.cpp | UTF-8 | 4,840 | 3.265625 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
// several constraints, defined by the problem statements
const int MaxN = 100;
const int Max = 1000;
// dis[x][y] is the shortest path from x to y, tr[] is the segment tree, used
// for getting the smallest answer and book-keeping when answer is updated,
// ans[x][y] means there are at least this ... | true |
7dfbef2fa2d88080685dbbd2493bf028dc032a50 | C++ | Masters-Akt/CS_codes | /leetcode_sol/1315-Sum_Of_Nodes_With_Even-Valued_Grandparent.cpp | UTF-8 | 1,835 | 3.625 | 4 | [] | no_license | //Method 1
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) ... | true |
b4c1bb1dd2bd37e7193dc797b16205c040475b56 | C++ | cyro809/tep-trabalhos | /transportationsystem.cpp | UTF-8 | 3,292 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <utility>
#include <fstream>
#include <sstream>
#include <map>
#include <queue>
#include <functional>
using namespace std;
vector<pair<pair<int,int>, double> > mapping;
vector<pair<int,int> > co... | true |
07ae3bf6ccf099a6e41af2cea7162cb86e4be4f9 | C++ | Pieloaf/dijkstras-algorithm-cpp | /source/dijkstra.cpp | UTF-8 | 3,420 | 3.1875 | 3 | [] | no_license | #include "../header/dijkstra.hpp"
Node* closestNode(map<Node*, int>* dist, vector<Node*>* unvisited) {
//initialising closest node to the first in list of unvisted nodes
pair<Node*, int> min = *dist->find(unvisited->at(0));
//comapring current closest node with each unvisited nodes and updating as needed... | true |
943dff7ac848750e55c09669b27c7f6ca5549a2e | C++ | BryanWheeler/ucd-csci2312-pa5 | /Agent.cpp | UTF-8 | 1,557 | 2.921875 | 3 | [] | no_license |
#include "Agent.h"
#include "Resource.h"
const double Gaming::Agent::AGENT_FATIGUE_RATE = 0.3;
void Gaming::Agent::age() {
if(this->__energy <= 0.000001){
this->__energy = 0.0;
this->finish();
}
else {
this->__energy -= AGENT_FATIGUE_RATE;
}
}
//No Default constructor so hig... | true |
60a747c7ff35296f6e63da32eca873cabb1298a2 | C++ | WarfareCode/mixr | /include/mixr/instruments/dials/AnalogDial.hpp | UTF-8 | 2,608 | 2.671875 | 3 | [] | no_license |
#ifndef __mixr_instruments_AnalogDial_HPP__
#define __mixr_instruments_AnalogDial_HPP__
#include "mixr/instruments/Instrument.hpp"
namespace mixr {
namespace base { class Boolean; class Integer; class Number; }
namespace instruments {
//---------------------------------------------------------------------... | true |
96c194b0f13544c1c9177f9b13f5849d960e19c5 | C++ | BebeShen/NCKU_Course-Competitive-Programming-2021 | /HW4/longest naps/newl.cpp | UTF-8 | 1,457 | 2.640625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int s;
int test_case = 1;
while(cin>>s){
vector<bool>schedule_empty(481,true);
schedule_empty[480] = false;
for(int i=0;i<s;++i){
int h1,h2,m1,m2;
... | true |
f397ed8d923a1eb1f1ef3d85ba77832ab3891c86 | C++ | lorderikstark0/codechef | /beginner/flow010.cpp | UTF-8 | 569 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define forit(it,a) for(_typeof(a.begin()) it =a.begin();it!=a.end();it++)
#define mp make_apir
using namespace std;
string ship(char c){
string s;
if(c=='B'|| c=='b'){
s= "BattleShip";
}
else if(c=='C'|| c=='c'){
s= "Crui... | true |
b2300414f422a164e3a29143756b5ac20f3e0589 | C++ | spockwangs/wsd | /test/url_test.cc | UTF-8 | 10,740 | 2.671875 | 3 | [] | no_license | #include "url.h"
#include "gtest/gtest.h"
#define NMEM(array) (sizeof(array) / sizeof(array[0]))
struct UrlCase {
const char *input;
bool is_valid;
const char *scheme;
const char *username;
const char *password;
const char *host;
int port;
const char *path;
const char *query;
... | true |
aa5a0ca27828c1894d488028515d0c1089dfa43b | C++ | AlexKreu/MCMC | /Rand.h | UTF-8 | 1,575 | 2.78125 | 3 | [] | no_license | #ifndef RAND_H
#define RAND_H
#include <Eigen/Dense>
#include <boost/random/uniform_real.hpp>
#include <boost/random/variate_generator.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/normal_distribution.hpp>
static const Eigen::VectorXd zero_vec = Eigen::VectorXd::Zero(1);
static const Eigen:... | true |
f4835ff7a03bdc4d3a7f712a28a0b1a609917c24 | C++ | vaidasuope/Cplus_08_10_2020 | /pamoka_su _funkcija.cpp | UTF-8 | 2,132 | 2.59375 | 3 | [] | no_license | #include <iostream>
using namespace std;
void kiekis (string txt, int &kiek);
void ivedimas(string txt, int kiek, int Z[]); //funkcijos prototipas - funkcija kiekimas ir ivedimui pazymiu su masyvu. Skirtingose funkcijose galim naudoti tuos pacius vardus
void isvedimas (string txt, int kiek, int Z[]);
int main()
{
in... | true |
2e5350827d3c2f03600439a464c8acff219e99ab | C++ | ShelbyKS/AlgorithmsTP | /Module2/Algr_DZ2_4/main.cpp | UTF-8 | 5,868 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <cassert>
template <class T>
struct Node {
T key;
int height;
int count;
Node* left;
Node* right;
Node() {}
Node(T key) : key(key), height(1), count(1), left(nullptr), right(nullptr) {}
~Node() {}
Node(const Node& other): key(other.key), height(other.he... | true |
d3b0612c923649ecbe264087172620bf87125e4d | C++ | v0idkr4ft/algo.vga | /HINTS/BOXGEN.CPP | WINDOWS-1252 | 1,228 | 3.15625 | 3 | [] | no_license | //
// Title : Text box generator
// File : BOXGEN.CPP
// Author : Caglios
// Date : 25-04-97
//
// This procedure generates a box, given the co-ordinates in the procedure
// call. This proc. is stand-alone, it can be cut directly from this file
// and placed into your own program.
//
// Nothing special ... | true |
bdb441b4da0c31cb33c0bb3ef49a2c7a9ca104f4 | C++ | pleomaxmouse/orange | /shared/Vector3F.cpp | UTF-8 | 3,566 | 3.46875 | 3 | [] | no_license | #include <Vector3F.h>
#include <math.h>
Vector3F::Vector3F()
{
x = y = z = 0.f;
}
Vector3F::Vector3F(const float& vx, const float& vy, const float& vz)
{
x = vx;
y = vy;
z = vz;
}
Vector3F::Vector3F(const float* p)
{
x = p[0];
y = p[1];
z = p[2];
}
Vector3F::Vector3F(float* p)
{
... | true |
a8563ccac963c675a0dbd8761cd4b617c64d7f1b | C++ | lawinse/AlgorithmExercises | /leetcode/solutions/222.count-complete-tree-nodes/count-complete-tree-nodes.cpp | UTF-8 | 573 | 3.140625 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
typedef TreeNode Node;
public:
int countNodes(TreeNode* root) {
if (!root) return 0;
No... | true |
480326ada32b0878dd354fb30d7549821dd28e2f | C++ | Grubbly/CPP-To-PostScript-Library-Refactored | /include/Polygon.h | UTF-8 | 1,251 | 2.703125 | 3 | [] | no_license | /*-------------------------------------------------------
| CS 372: Software Construction |
| Project 2: C++ To PostScript Library |
| Date: 3/20/18 |
| File: polygon.h |
| Written By: Collin Lasley &... | true |
3e6eb94f68f29d7a1ec34784357b05a956ec68fe | C++ | rtvt123/bluster_cache | /server/log.cpp | UTF-8 | 1,389 | 2.6875 | 3 | [] | no_license | #include "log.h"
std::ostringstream & Log::get(log_types level) {
LVL_REPORTING = (log_types)LOG_TYPE;
msg_lvl = level;
auto now = std::chrono::system_clock::now();
auto in_time_t = std::chrono::system_clock::to_time_t(now);
os << "- " << std::put_time(std::localtime(&in_time_t), "%Y-%m-%d %X");
os << " " ... | true |
61eadf87fe9b8bdb36ea212ce31c9f0fbe2797d1 | C++ | lehmamic/gameprogcpp | /Chapter12/SkeletalMeshComponent.h | UTF-8 | 1,125 | 2.75 | 3 | [] | no_license | //
// SkeletalMeshComponent.hpp
// Game-mac
//
// Created by Michael Lehmann on 27.01.21.
// Copyright © 2021 Sanjay Madhav. All rights reserved.
//
#ifndef SkeletalMeshComponent_hpp
#define SkeletalMeshComponent_hpp
#include "MeshComponent.h"
#include "MatrixPalette.h"
class SkeletalMeshComponent : public MeshC... | true |
46f4691828b3f78043e8ecc96561fd319369117c | C++ | xymostech/abxy | /abxy/Formatter.cpp | UTF-8 | 470 | 2.953125 | 3 | [] | no_license | #include <abxy/Formatter.hpp>
Formatter &Formatter::operator<<(std::shared_ptr<IFormat> insert) {
formatters.push_back(insert);
return *this;
}
Formatter &Formatter::operator<<(const Formatter &formatter) {
for (auto f : formatter.formatters) {
*this << f;
}
return *this;
}
void Formatter::Clear() {
formatte... | true |
52512bb2bcbdc8f05fd87dbb7b7f2033c0ba20bf | C++ | ankurrai1/cpp-programs | /sum_without_+opreator.cpp | UTF-8 | 146 | 2.59375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int a,b,sum;
a=10;
b=20;
sum=-(-a-b);
cout<<"sum is: "<<sum<<endl;
return 0;
}
| true |
0ce004eba4e5a410d311e0bd57ca768e85690751 | C++ | Jayant-saksham/Coding-blocks-FAANG-course | /Array and Strings/5sunnyBuildings.cpp | UTF-8 | 525 | 2.921875 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
cout<<"Enter n : ";
cin>>n;
int A[n];
for(int i=0;i<n;i++){
cin>>A[i];
}
int maxHeight = 0;
int count = 0;
vector<int>v;
for(int i=0;i<n;i++){
if(A[i]>=maxHeight){
count++;
... | true |
00389ab921c920687b21dae6b8c53a0bd6209303 | C++ | SrMrBurchick/Might-of-the-King | /TheGame/army.hpp | UTF-8 | 1,679 | 3.015625 | 3 | [] | no_license | #ifndef ARMY_HPP
#define ARMY_HPP
#define ARMY_COUNT 6
#include<Windows.h>
#include"Soldier.hpp"
class Army
{
public:
Army(int _count, int _mcount)
: a_count(_count), a_max_count(_mcount)
{
for (int i = 0; i < ARMY_COUNT; i++)
a_army[i] = 0;
}
~Army() = default;
//--------------Getters----... | true |
466b3299c2fcdefb3bbbb312cb43615ae23fed7c | C++ | 0niel/clipboard-writer | /clipboard_writer/source/cwriter/writer.cpp | WINDOWS-1252 | 4,729 | 2.578125 | 3 | [] | no_license | #include "writer.h"
#include <vector>
#include "../../converters.h"
using namespace std;
void cWriter::PressKeyB(char mK)
{
HKL kbl = GetKeyboardLayout(0);
INPUT ip;
ip.type = INPUT_KEYBOARD;
ip.ki.time = 0;
ip.ki.dwFlags = KEYEVENTF_UNICODE;
if ((int)mK < 65 && (int)mK>90) //for lowercase
{
i... | true |
529039603ae4cae5211da6eea5b2829fcb8a6fe1 | C++ | olderor/speed-test | /temp/main.cpp | UTF-8 | 6,993 | 3 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <vector>
#include <ctime>
#include <iomanip>
using namespace std;
typedef unsigned long long ull;
int foo_vector(vector<int> v) {
return 0;
}
int foo_int(ull v) {
return 0;
}
int foo_address_vector(vector<int> &v) {
return 0;
}
int foo_address_int(ull &... | true |
5b33bc2e6f8071c7ef8b29b60492355121558d4f | C++ | 0josephb/RPG-Player-Class | /ogre.cpp | UTF-8 | 1,515 | 2.59375 | 3 | [] | no_license | // Joseph Brown
// Program 3
// Ogre implementation
#include <string>
#include <iostream>
#include "gamespace.h"
#include "voc.h"
#include "dice.h"
#include "wpn.h"
#include "ogre.h"
using namespace std;
using namespace GameSpace;
const string Ogre::RACE = "OGRE";
const int Ogre::ABILITY_ADJ[6] = {8, 15, 6, 7, 21, 1... | true |
3add77b11767149afa040530d0f772bd43afc2b8 | C++ | vikeshkhanna/codechef | /practice/medium/Flipping Coins/binary.cpp | UTF-8 | 1,456 | 2.890625 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<fstream>
#include<cmath>
#define FILE "input.txt"
#define MAX 100000
#define FOR(i,n) for(int i=0;i<n;i++)
typedef unsigned int uint;
typedef unsigned short sint;
typedef unsigned long lint;
using namespace std;
/*
* @autho... | true |
c1a35e8e3f613692981646434dd179f0729dc856 | C++ | davemar-bbc/libadm | /include/adm/detail/named_option_helper.hpp | UTF-8 | 523 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <memory>
#include <functional>
#include <type_traits>
namespace adm {
namespace detail {
template <typename Element>
inline void setNamedOptionHelper(Element&& /*element*/) {}
template <typename Element, typename T, typename... Parameters>
void setNamedOptionHelper(Element&& ... | true |
17ac40634e90a153ecc0d2c9339ca174d66d18cd | C++ | isliulin/MobileCArm | /Common/Include/CArmVT.h | UTF-8 | 7,141 | 2.578125 | 3 | [] | no_license | #pragma once
#include "IViewingTool.h"
#include "CArmCommon.h"
#define _CArmImgVT 0 //!< 图像处理工具类型
#define _CArmBright_Origin 1.0 //!< 原始图像明亮度
#define _CArmBright_MinValue 0.0 //!< 明亮度最小值(最暗)
#define _CArmBright_MaxValue 4.0 //!< 明亮度最大值(最亮)
#define _CArmContrast_Origin ... | true |
0b669db94a39515f830fa2c5ca6897521a1fbfd3 | C++ | ppzzyy11/codes | /AVLTree.cpp | UTF-8 | 6,194 | 3.71875 | 4 | [] | no_license | /*
* AVL Tree | Self Balanced Tree
*
* So many tiny tests passed
*
*/
#include <iostream>
#include <vector>
#include <unordered_map>
#include <climits>
#include <algorithm>
using namespace std;
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& ts)
{
for(auto t:ts)
{
cout<<t<<' ';
}
//co... | true |
9a184f2271730f2ca8c87e4364da4f6bb61f8923 | C++ | tannuchoudhary/Data-structure-and-Algorithms | /LINKED_LIST/linkedlist.cpp | UTF-8 | 9,389 | 3.5 | 4 | [] | no_license |
//--------------- DON'T TOUCH, IT WORKS-------------------------------------
//--------------------------------------------------------------------------
//----------------------------------------------------------------------... | true |
41830c3dc0cc10e852ae910121aa17193583f023 | C++ | iamjatin08/DATA-STRUCTURES | /hashmaps/mapUSE.cpp | UTF-8 | 655 | 3.234375 | 3 | [] | no_license | #include<iostream>
#include<unordered_map>
#include<string>
using namespace std;
int main(int argc, char const *argv[])
{
unordered_map<string,int> ourmap;
//insert
pair<string,int> p("abc",1);
ourmap.insert(p);
ourmap["def"] = 2;
// find or access
cout<<ourmap["abc"]<<endl;
cout<<our... | true |
fe842d81e152215ef75eb173700a0e73d9527812 | C++ | ArchiGn98/LTC-CPP-Student | /constrexpr-if.h | UTF-8 | 356 | 3.546875 | 4 | [] | no_license | #pragma once
#include <type_traits>
#include <vector>
template<typename T>
class Addable
{
T val;
public:
Addable(T v) : val(v) {}
template<typename U>
T Add(U x) const
{
if constexpr (std::is_same_v<T, std::vector<U>>)
{
auto copy(val);
for (auto& n : copy)
{
n += x;
}
return copy;
}
e... | true |
ff0782428792c0fb9f27eb5baaa131d63ae144cd | C++ | wpineda21/PED0319-WRMH-00019618 | /Ejemplos/EX-02.cpp | UTF-8 | 3,691 | 3.90625 | 4 | [] | no_license | /*
Ejemplo de pila utilizando punteros y typedef
Programa para almacenar datos para la creacion de un correo electronico
*/
#include <iostream>
using namespace std;
// Declaracion de estructura que contendra la informacion requerida
struct email{
string mail, fullname, country, postalCode, phone;
... | true |
0470683ab7a4b6497ea70444eb550a0be7378347 | C++ | ArcSung/ON_THE_ROAD | /arduino/attiny_IRTest2/attiny_IRTest2.ino | UTF-8 | 1,804 | 2.703125 | 3 | [] | no_license | #include <SoftwareSerial.h>
#include <MeetAndroid.h>
int LEDpin = 4;
int Threshold = 200;
const byte IRPIN = 1;
float p[3];
int i = 0;
int Temp = 200;
SoftwareSerial mySerial(0,1); // 設定對應bt的 rx 與 tx 接腳
MeetAndroid meetAndroid(mySerial);
//MeetAndroid meetAndroid(0, 1, 9600);
void setup()
{
// use the baud ra... | true |
3decc9a839f959be77436cf0f47d5572c6289231 | C++ | devthedevil/Competetive_programming | /coding_ninja/backtracking/rat_in_maz1.cpp | UTF-8 | 1,123 | 2.859375 | 3 | [] | no_license | #include<iostream>
using namespace std;
#include<bits/stdc++.h>
using namespace std;
int board[20][20];
void maz(int maze[][20],int n,int row,int col)
{
if(row==n-1 && col==n-1)
{
board[row][col]=1;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
cout<<board[i][j]<<" ... | true |
8683aa856d206bae0e554b288f094d330beb3c37 | C++ | ThereWillBeOneDaypyf/Summer_SolveSet | /codeforces/cf_911_e.cpp | UTF-8 | 1,284 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
const int N = 1e6;
int a[N];
int vis[N];
int main()
{
int n, k;
while (cin >> n >> k)
{
int Max = 0;
memset(vis, 0, sizeof(vis));
for (int i = 1; i <= k; i++)
{
cin >> a[i];
Max = max(a[i], Max);
}
int cur = 1;
stack<int> st;
for (int i = 1; i <= k... | true |
6b0ebb10496b96b29af552df9e434352b1d2e2e8 | C++ | felipedmz/cExperiments | /bubble_sort_recursivo.cpp | UTF-8 | 725 | 3.453125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
int bubble_rec(int busca, int vetor[],int tamanho){
if (busca==vetor[tamanho])
return 1;
else if(tamanho==0)
return 0;
return bubble_rec(busca,vetor,tamanho-1);
}
int main(){
int v[5],b;
printf("Complete o vetor[5] com valores inteiros\n");
... | true |
f2db3c06a2332491711a972499dab6d550c1c314 | C++ | nugusha/ProjectEuler-HackerRank | /Project Euler #18 Maximum path sum I.cpp | UTF-8 | 717 | 2.515625 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int a[20][20];
int d[20][20];
int n;
int solve(){
int ret=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)d[i][j]=0;
for(int i=1;i<=n;i++)
for(int j=1;j<... | true |
800bd603b3b4ae355d4434331c63a6f76c34497c | C++ | mstniy/cerius | /bootloader/common/port_io.cpp | UTF-8 | 985 | 3.015625 | 3 | [
"MIT"
] | permissive | #include "port_io.h"
BYTE PortIO::InB(WORD port)
{
// A handy C wrapper function that reads a byte from the specified port
// "=a" (result) means: put AL register in variable RESULT when finished
// "d" (port) means: load EDX with port
BYTE result;
__asm__("in %%dx, %%al" : "=a" (result) : "d" (port));
... | true |
07a7da194646f5c640408c2290336e4ebbf2f384 | C++ | carloshd86/IA_BehaviorTree | /steering/obstacleAvoidanceSteering.cpp | UTF-8 | 2,955 | 2.515625 | 3 | [] | no_license | #include <stdafx.h>
#include "obstacleAvoidanceSteering.h"
ObstacleAvoidanceSteering::ObstacleAvoidanceSteering(GameEntity& entity) :
mEntity (entity),
mAcceleration (0.f, 0.f),
mIsNearVector (0.f, 0.f),
mDistanceToObstacle (0.f, 0.f),
mCollisionCheck (0.f, 0.f),
mCollidingObstacle ... | true |
2fba88f9670e8e68debc9e1c9ae333d48031cd8e | C++ | entao1128/read-lammpstrj | /main.cpp | UTF-8 | 743 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <vector>
using namespace std;
#include "lammpstrj.h"
#define PI 3.141592654
#define PI2 6.2831853071
int read_lammpstrj(const char*, const int, const int) ;
int main( const int argc, const char* argv[] ) {
if ( argc < 2 ) {
... | true |
e46900d808f475e406b4e8dd6a5ef24610378ca6 | C++ | EganChin/PAT-Advanced-Level | /Others/1101 Quick Sort(25).cpp | UTF-8 | 2,988 | 3.765625 | 4 | [] | no_license | /*
1101 Quick Sort (25 分)
There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its left and those larger than the pivot to its right. Given N distinct positive integers after a ru... | true |
c8b672a177e2aa994034dd7cf7d7a1a6693db013 | C++ | caszhang/BackendDevelopmentEnvironment | /base/dsalgo/gcc_4_1_plus/lock_free_queue.cc | UTF-8 | 3,197 | 3 | 3 | [] | no_license | // Author: zhangguoqiang01 <80176975@qq.com>
// Fixed size, lock-free, support multithreaded, circular queue
// especially suitable for one producer and mutiple consumer
// if one producer, Single_Push and Single_Pop is better
// otherwise, use Multi_Func
#include <stdio.h>
#include <sched.h>
#include "lock_free_que... | true |
f9f4b9a0840a1ff25615dffbd825e7dabdae0a81 | C++ | stdstring/leetcode | /Algorithms/Tasks.1001.1500/1054.DistantBarcodes/solution.cpp | UTF-8 | 1,723 | 3.3125 | 3 | [
"MIT"
] | permissive | #include <queue>
#include <utility>
#include <vector>
#include "gtest/gtest.h"
namespace
{
class Solution
{
public:
[[nodiscard]] std::vector<int> rearrangeBarcodes(std::vector<int> const &barcodes) const
{
std::unordered_map<int, size_t> valuesCount;
for (int barcode : barcodes)
... | true |
5f28e9017d2c318ce63085ed6adf0a1c098d74e3 | C++ | sumonmd/Algorithm | /Pascal_Pattern.cpp | UTF-8 | 613 | 3.109375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int pascal[53][53];
void pascal_pattern()
{
pascal[0][0]=1;
pascal[1][0]=1;
pascal[1][1]=1;
int j;
for(int i = 2;i<53;i++){
pascal[i][0]=1;
for(j=1;j<53;j++){
pascal[i][j]=pascal[i-1][j]+pascal[i-1][j-1];
}
pas... | true |
2875c588958463446cb95eec6d247b90730490e6 | C++ | Nordaj/LilEngie | /LilEngie/Core/src/Graphics/ShaderReader.cpp | UTF-8 | 717 | 3.34375 | 3 | [
"MIT"
] | permissive | #include <string>
#include <fstream>
#include "ShaderReader.h"
void ShaderReader::ReadShader(std::string *vertex, std::string *surface, std::string path)
{
//Create ifstream
std::ifstream file = std::ifstream(path);
//Use to keep track
int currentType = 0; //0=undef, 1=vert, 2=surf
//Go through stream
std::st... | true |
628950660722f17e8b4e1f494eba776e9b28c937 | C++ | Lurgypai/Runny | /Walkie/SquareShape.h | UTF-8 | 414 | 2.796875 | 3 | [] | no_license | #pragma once
#include "MSF.h"
class SquareShape : public msf::Shape {
public:
SquareShape(float left_, float top_, float width, float height);
~SquareShape();
void setTop(float top);
void setLeft(float left);
void setWidth(float width);
void setHeight(float height);
sf::FloatRect getBoundingBox() const overri... | true |
0a78c11c722bc91a345819ef5a372fa916c0a0af | C++ | greenfox-zerda-sparta/nmate91 | /week_04/11-11/src/JukeBox.cpp | UTF-8 | 1,992 | 3.140625 | 3 | [] | no_license | #include "JukeBox.h"
JukeBox::JukeBox() : songs() {
songs.songs = NULL;
}
void JukeBox::add_song(Song& song) {
if (&song != NULL) {
songs.push_song(song);
}
}
void JukeBox::rate_song(Song& song, double value) {
if (song.get_genre() == "Rock" && value <= 5 && value >= 2) {
song.set_rating(value);
}
... | true |
87559a47495bec90d4a7a353553e07418c261c33 | C++ | peteward44/raytracer | /source/SDL/Exception.h | UTF-8 | 936 | 2.84375 | 3 | [
"MIT"
] | permissive |
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include <string>
#include <exception>
namespace SDL
{
class Exception : public std::exception
{
private:
std::string message;
public:
Exception()
{}
virtual ~Exception() throw()
{}
Exception(const std::string& message)
: message(message)
{
}
in... | true |
9006f27f3af4388d9dba0401bd97c4abd27565de | C++ | FedeGB/7559-TP1 | /src/Utils.cpp | UTF-8 | 1,163 | 3.21875 | 3 | [] | no_license | //
// Created by fedenote on 9/25/16.
//
#include "Utils.h"
#include <sys/types.h>
#include <unistd.h>
int getRandomInt(int min, int max){
srand(getpid());
return rand()%(max-min + 1) + min;
}
void trim(std::string &str) {
const std::string whitespace = " \t";
const auto strBegin = str.find_first_not... | true |
99ac8c26e88afb0884e468ab8f8d698c1eee1a23 | C++ | AMatrix/AMatrix | /test/test_matrix_assign.cpp | UTF-8 | 4,338 | 2.96875 | 3 | [
"MIT"
] | permissive | #include "amatrix.h"
#include "checks.h"
template <std::size_t TSize1, std::size_t TSize2>
int TestZeroMatrixAssign() {
AMatrix::Matrix<double, TSize1, TSize2> a_matrix;
a_matrix = AMatrix::ZeroMatrix<double>(TSize1, TSize2);
for (std::size_t i = 0; i < a_matrix.size1(); i++)
for (std::size_t j = ... | true |
5589e9162063c29144b1ed60c8a7004d61259696 | C++ | TankMermaid/GraphAligner | /CommonUtils.cpp | UTF-8 | 3,198 | 2.703125 | 3 | [] | no_license | #include "CommonUtils.h"
#include "stream.hpp"
namespace CommonUtils
{
void mergeGraphs(vg::Graph& graph, const vg::Graph& part)
{
for (size_t i = 0; i < part.node_size(); i++)
{
auto node = graph.add_node();
node->set_id(part.node(i).id());
node->set_sequence(part.node(i).sequence());
... | true |
d0694534e107722e58e1ebb4eb73b29fd2e7a0b3 | C++ | theawless/sr-lib | /base/inc/codebook.h | UTF-8 | 1,058 | 2.859375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vector>
#include "feature.h"
struct Codebook
{
public:
std::vector<Feature> centroids;
/// Return whether empty.
bool empty() const;
/// Find the buckets where the features lie in codebook.
std::vector<int> observations(const std::vector<Feature> &features) const;
/// Operators for lo... | true |