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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
79fe7a5e761c74fcbfdc610889e0710d1884134f | C++ | ihuei801/leetcode | /MyLeetCode/Leetcode/Spiral Matrix.cpp | UTF-8 | 2,562 | 3.375 | 3 | [] | no_license | //O(mn)
class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> sol;
int rows = matrix.size();
int cols = rows? matrix[0].size() : 0;
int left = 0;
int right = matrix[0].size() - 1;
int up = 0;
int down = matrix.size() - 1;
... | true |
aefb16bd7ae7b955a356634a323aaa857eb3298d | C++ | JFishLover/Algorithms | /Dynamic_Prog_Optimal_BST/Dynamic_Prog_Optimal_BST/optimal_BST.cpp | UTF-8 | 1,009 | 3.140625 | 3 | [] | no_license | #include<iostream>
#include<stdlib.h>
using namespace std;
void optimal_BST(float p[],float q[],int length,float e[][100],float w[][100],int root[][100]){
for(int i=1;i<=length+1;++i){
e[i][i-1]=q[i-1];
w[i][i-1]=q[i-1];
}
//这个三重循环跟矩阵乘法链很像,分别是长度,起点和分割点
for(int l=1;l<=length;++l){
for(int i=1;i<=length-l+1;+... | true |
373cc96616a1a69bb1d78184d66c91f76e11b092 | C++ | ReiKishida/KishidaStudio_Front_Line | /プロジェクト/マスター版プロジェクト/source.ver.0.1/scene3DBill.h | SHIFT_JIS | 2,742 | 2.609375 | 3 | [] | no_license | //=============================================================================
//
// 3Dr{[hIuWFNg [scene3DBill.h]
// Author : Ishida Takuto
//
//=============================================================================
#ifndef _SCENE3DBILL_H_
#define _SCENE3DBILL_H_
#include "scene.h"
//*************************... | true |
ac1526cfc6d4159ac940dbb32ba0b6a5919a1db5 | C++ | zerominh/Caro | /src/connect.h | UTF-8 | 2,328 | 2.6875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <vector>
#include "window.h"
#include "text.h"
#include "utils.h"
#include <ctime>
#include <cmath>
enum End{
hoaco, player1, player2
};
enum Checker{
O = -1, _ = 0, X = 1
};
enum Mode {
playerVsPlayerMode, playerVsCompterMode
};
struct Cell{
int row = -1;
int column =... | true |
f7a8f402639c73a997389b25a9fb6330b43347db | C++ | nznaza/SIM800L | /examples/GPRS_SMSread/GPRS_SMSread.ino | UTF-8 | 1,615 | 2.84375 | 3 | [
"MIT"
] | permissive | /*
GPRS SMS Read
This sketch is used to test seeeduino GPRS_Shield's reading SMS
function.To make it work, you should insert SIM card
to Seeeduino GPRS Shield,enjoy it!
There are two methods to read SMS:
1. GPRS_LoopHandle.ino -> in order to recieve "+CMTI: "SM""
may be you need to send this command to you... | true |
29f04f977bf7e5490cb1a0f22cbbbc2882491db5 | C++ | cmbruns/opencmbcv | /cppsrc/include/geom2d.hpp | UTF-8 | 9,202 | 3.40625 | 3 | [] | no_license | #ifndef CMBCV_GEOM2D_HPP_
#define CMBCV_GEOM2D_HPP_
#include <cassert>
#include <iostream>
// These classes are intended to be wrapped using boost.python,
// with an efficient C++ API and a nearly syntactically identical python API
namespace cmbcv {
// "floats" in python are C++ doubles. So use double.
typ... | true |
8bc628deec77f44cac206b967979354b4e71b8b6 | C++ | logosky/cpp | /mysql/mysql_pool.h | UTF-8 | 2,663 | 2.609375 | 3 | [] | no_license | #ifndef __MYSQL_POOL_H__
#define __MYSQL_POOL_H__
#include "mysql_comm.h"
#include "mysql_interface.h"
#include "mysql_connect.h"
#include <list>
#include <boost/thread.hpp>
#pragma once
namespace demo
{
namespace mysql
{
enum DBType
{
dbt_MySQL,
dbt_MSSQL
};
class MysqlPool
{
public:
MysqlPool(DBTy... | true |
17d5515bbc019e639976bf0c01b2e14339e3a83c | C++ | BielskiGrzegorz/GraMUD | /GameManager.cpp | UTF-8 | 1,612 | 2.671875 | 3 | [] | no_license | #include "GameManager.h"
#include <conio.h>
#include <Windows.h>
#include <iostream>
#include "Npc.h"
using namespace std;
void gotoxy(int x, int y)
{
COORD cord;
cord.X = x;
cord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cord);
}
void GameManager::wczytajMape(string s)
{
ifstream wczyt(s);... | true |
bd24e0231e2d276116bce5d685261ab8429eea5c | C++ | lyonb96/Noble | /Source/Core/Texture2D.h | UTF-8 | 802 | 2.953125 | 3 | [] | no_license | #pragma once
#include "Asset.h"
#include <bgfx/bgfx.h>
namespace Noble
{
/**
* 2D Texture assets
*/
class Texture2D : public Asset
{
public:
/**
* Default constructor
*/
Texture2D();
/**
* Returns the corresponding asset type for 2D textures
*/
virtual const AssetType GetType() const o... | true |
eeea88d6e3aefe00de4180ccaebe180029197faa | C++ | ugurcan-sonmez-95/HackerRank | /Algorithms/Strings/HackerRank_in_a_String/main.cpp | UTF-8 | 775 | 3.359375 | 3 | [
"MIT"
] | permissive | // HackerRank_in_a_String! - Solution
#include <iostream>
void hackerrankInString(int query_count, std::string &s) {
std::cin >> query_count;
while (query_count) {
std::cin >> s;
const std::string s1 = "hackerrank";
int count{}, temp{};
for (int i{}; i < s1.size(); i++) {
... | true |
b2e5a783cae81f0890c5097fb0659991ccf3f43d | C++ | chx2502/LeetCode | /LeetCode_1871/main.cpp | UTF-8 | 1,801 | 3.484375 | 3 | [] | no_license | /*
给你一个下标从 0 开始的二进制字符串 s 和两个整数 minJump 和 maxJump 。一开始,你在下标 0 处,且该位置的值一定为 '0' 。当同时满足如下条件时,你可以从下标 i 移动到下标 j 处:
i + minJump <= j <= min(i + maxJump, s.length - 1) 且
s[j] == '0'.
如果你可以到达 s 的下标 s.length - 1 处,请你返回 true ,否则返回 false 。
输入:s = "011010", minJump = 2, maxJump = 3
输出:true
解释:
第一步,从下标 0 移动到下标 3 。
第二步,从下标 3 移动到下标 ... | true |
98a76eac8684f71e72bd41000e5363144c13e261 | C++ | lajthabalazs/arduino | /projects/rgb_led_stripe/rgb_led_stripe.ino | UTF-8 | 1,418 | 3.234375 | 3 | [] | no_license | int r = 0;
int g = 0;
int b = 0;
int RED_PIN = 11;
int GREEN_PIN = 9;
int BLUE_PIN = 10;
String message;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
}
// the loop routine runs over an... | true |
b5fbcccc5157a02b4b56ea71a94834a48d1f5f49 | C++ | syncopika/learningCpp | /sdl2projects/fishing/headers/Character.hh | UTF-8 | 1,070 | 3.25 | 3 | [] | no_license | #ifndef CHARACTER_H
#define CHARACTER_H
// Character class header file
#include "GameObject.hh"
// Character extends GameObject
class Character : public GameObject{
private:
// keep a vector to hold the textures corresponding to the left and right
// walking sprites of the character
// each step will alt... | true |
7986e7fa7756df335ca374f31630fdeb9a7f5add | C++ | brownd1978/FastSim | /TrkEnv/TrkVolumeHandle.hh | UTF-8 | 1,511 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | //--------------------------------------------------------------------------
// File and Version Information:
// $Id: TrkVolumeHandle.hh 103 2010-01-15 12:12:27Z stroili $
//
// Description: TrkVolumeHandle
// Small class to keep track of TrkVolumes
//
// Environment:
// Software developed for the BaBar Volume a... | true |
e0c60463a1deac9c5e4ec6c2862ce1465d6abcca | C++ | helloojj/JustinJohnson-CSCI20-Spr2017 | /lab26/lab26.cpp | UTF-8 | 2,294 | 4.34375 | 4 | [] | no_license | /* Created By: justin johnson
* Created On: 3/9/2017
* This program will convert temputres from kelvin, celcius and Fahrenheit using objects and classS
*/
#include <iostream>
#include <string>
using namespace std;
class TemperatureConverter {
public:
void SetTempFromKelvin(double kelvinTemp);
void Se... | true |
9129879cdfe7dcce12480b8bd70a7ae2f8ec6a1d | C++ | EnriquePuyol/SAG-Engine | /UI_Performance.cpp | UTF-8 | 1,372 | 2.671875 | 3 | [
"MIT"
] | permissive | #include "UI_Performance.h"
#include "Application.h"
#include "ModuleWindow.h"
UI_Performance::UI_Performance(char* name) : UI(name)
{
active = false;
logMSIterator = 0;
logFPSIterator = 0;
lastFrameTime = SDL_GetTicks();
lastSecondTime = SDL_GetTicks();
fps_log = new float[50];
ms_log = new float[50];
}
U... | true |
9e6c75c15e8a63e871d8ed5da8908cab1ba86922 | C++ | KNWolf97/Personal-Work | /Old C++/Week3Homework/Week3Homework/Wolf_3_5.cpp | MacCentralEurope | 14,196 | 3.65625 | 4 | [] | no_license | /**************************************************************************************
* file name: Wolf_3_5
* programmer name: Kyle Wolf
* date created: 2/2/2018
* date of last revision:
* details of the revision:
* short description: User creates sets of ages and can perform operations on those sets
*********... | true |
23a0283d4a78eb500b8de58e57209e7ea72b8df8 | C++ | WeiMuYang/qtcreator-study-202104 | /03-qt-study-code/82-samp14_2TCP/TCPClient/mainwindow.h | UTF-8 | 1,200 | 2.5625 | 3 | [] | no_license | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTcpSocket>
#include <QLabel>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
private:
// 1. 用于创建tcp的socket套接字
QTcpSocket *tcpClient; //socket
// 2. 状态栏标签
QLabel *LabSocketState; ... | true |
03989e10d0fe8b0b378f3556cf087866d5d0aa62 | C++ | ojaster/first_project | /cpp_xcode/FIrst_Project/FIrst_Project/df.cpp | UTF-8 | 829 | 2.96875 | 3 | [] | no_license | ////
//// df.cpp
//// FIrst_Project
////
//// Created by Данил on 18/05/2019.
//// Copyright © 2019 Daniil. All rights reserved.
////
//
//#include <stdio.h>
//#include <iostream>
//using namespace std;
//string funktion(string & c);
//string funktion2();
//int main(){
//
// string c;
//
// string b="ba";... | true |
ede53749174f7503f6063ee46c72d7fd8aaca42c | C++ | theDude823/Sorting-Visualization | /card.h | UTF-8 | 1,088 | 2.75 | 3 | [] | no_license | #pragma once
#include "screenSize.h"
#include <SFML/Graphics.hpp>
#include <sstream>
using namespace sf;
class Card {
private:
Vector2f m_Position;
Sprite m_Sprite;
Texture m_Texture;
Text m_number;
std::stringstream m_protoNumber;
Font font;
float m_Speed = 1000, m_R = 0, m_Cx, m_Cy;
... | true |
1c239cfaafe59c36b790d2c41e4e32a291c168c5 | C++ | Gid32/ProteinFolding | /core/ant.cpp | UTF-8 | 405 | 2.5625 | 3 | [] | no_license | #include "ant.h"
#include <QTime>
Ant::Ant()
{
}
void Ant::setCount(int count)
{
count_ = count;
}
void Ant::run()
{
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
for (int i = 0; i < count_; ++i)
{
Convolution *convolution = ConvolutionFactory::getFactory()->getConvolution(... | true |
0c7317c6462b81d7f178852354c69e06de1137ef | C++ | emilybyhuang/Stock-Statement-Generator | /src/updateAct.cpp | UTF-8 | 1,803 | 3.03125 | 3 | [] | no_license | #include <nlohmann/json.hpp>
#include <stock.h>
#include <boost/algorithm/string.hpp>
#include <typeinfo>
#include <updateAct.h>
#include <iomanip>
bool updateAct(std::vector<stock>& mystocks, string action, string ticker, string shares, string price){
//cout << "update size" << mystocks.size();
if(action == ... | true |
2de3b6afa112d9dd6ad05ac75d60f0b0335c0f65 | C++ | Stephhh-Lee/Leetcode | /526-Beautiful_Arrangement.cpp | UTF-8 | 2,618 | 3.015625 | 3 | [] | no_license | class Solution {
public:
int countArrangement(int N) {
int ans = 0;
vector<int> v(N+1, 0);
helper(N, v, 1, ans);
return ans;
}
void helper(int n, vector<int>& v, int pos, int& ans){
if(pos > n){
ans++;
return;
}
for... | true |
9d3bf09fafa20477b160953702641c84f6e54226 | C++ | Aapoorva/codeDemos | /CPP/graph_dfs.cpp | UTF-8 | 2,678 | 3.5 | 4 | [] | no_license | #include "iostream"
#include "vector"
#include "stack"
#include "list"
using namespace std;
int findVertex(vector< list<int> > graph, int vertex){
int currIndx = 0;
for (vector<list <int> >::iterator i = graph.begin(); i != graph.end(); ++i, currIndx++)
{
if((*i).front() == vertex){
return currIndx;
}
}
... | true |
0167da092fe719dbc789ce290acc92904e1e9b60 | C++ | astappiev/NURE | /1st-course/AlgSD/lab_2/C/main.cpp | UTF-8 | 627 | 3.515625 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
#include <stack>
using namespace std;
int obr(char simb)
{
switch (simb) {
case ')': simb='('; break;
case ']': simb='['; break;
case '}': simb='{'; break;
}
return simb;
}
int main()
{
stack <char> st;
string str;
cin>>str;
int size=str.s... | true |
a40c8cfe7920b01df12773ac0d6254e6270a762e | C++ | huangyt/MyProjects | /PPTVForWin8/ppbox_1.2.0/src/p2p/server_mod/index_server_data_migration/stdafx.cpp | GB18030 | 1,095 | 2.515625 | 3 | [] | no_license | // stdafx.cpp : ֻļԴļ
// p2pvideo.pch ΪԤͷ
// stdafx.obj ԤϢ
#include "stdafx.h"
// TODO: STDAFX.H
// κĸͷļڴļ
namespace framework
{
string w2b(const wstring& _src)
{
int nBufSize = ::WideCharToMultiByte(GetACP(), 0, _src.c_str(),-1, NULL, 0, 0, FALSE);
char *szBuf = new char[nBufSize + 1];
::WideCharToMulti... | true |
db82c522037e7ff89549d293fc10fa8899ddd76d | C++ | ChengFujia/C-project | /CSP(C++)/201703_3.cpp | GB18030 | 4,101 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
#define MOST_LENGTH 10
//
string handle_heading(string line)
{
int num = 48; //0ascii룬֣棨+=ַ֣+=ַ
int length = line.size();
string result = "<h";
for(int i=0;i<length;i++)
{
if(line[i]=='#') //ͷ#
num++;
else if(line[i]==' '... | true |
f8c6e196cb517662399044c1b52d14c125870926 | C++ | snowflip/training | /cplusplus/cc.cpp | UTF-8 | 231 | 2.84375 | 3 | [] | no_license | #include <stdio.h>
class A
{
public:
virtual int test();
virtual double test2();
int test3();
protected:
double test4();
private:
int a, b, c;
};
int main()
{
int a = sizeof(A);
printf("a is %d\n", a);
}
| true |
9b9ff174706220ab3047717a6bd2530c346b540a | C++ | edderick/advent-of-code-2019 | /day-02/part-1.cpp | UTF-8 | 924 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[]) {
int value;
vector<int> values;
while (cin >> value) {
values.push_back(value);
cin.ignore();
}
values[1] = 12;
values[2] = 2;
int pc = 0;
while (true) {
for (const... | true |
26072c157ecd8c44d99f4325271b78446485e8bf | C++ | saheel1115/szz | /src/lang_model/generate_entropy_data/code/isolate_lines/ngram.h | UTF-8 | 2,388 | 2.921875 | 3 | [
"MIT"
] | permissive | #ifndef __NGRAM_H__
#define __NGRAM_H__
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <ctime>
#include <math.h>
#include "utility.h"
using namespace std;
class Word
{
public:
Word()
{
m_prob = 0.0;
}
Word(const string& token, const float prob)
{
... | true |
8384e2de205d4c2e21441548790fd758fa6f9db7 | C++ | c2290445045/Admir | /学生管理系统/Management.h | GB18030 | 663 | 2.5625 | 3 | [] | no_license | #pragma once
#include<vector>
#include<string>
#include"Student.h"
class Management
{
public:
void ADD(Student);//ѧ
void Delete(string);//ɾѧ
void Update(string, int, int);//³ɼ
bool Fuzzy_Serach(string);//ģ
bool Search(string);
void Sort_student();//
double Pass_rate(int);//ϸ
double AVG(int);//ƽɼ
double AVG();/... | true |
8a5ed698b6c8e054f27e40467ed7263a3643e07c | C++ | gogo40/clever | /modules/std/core/array.cc | UTF-8 | 6,489 | 2.890625 | 3 | [
"MIT"
] | permissive | /**
* Clever programming language
* Copyright (c) Clever Team
*
* This file is distributed under the MIT license. See LICENSE for details.
*/
#include "core/value.h"
#include "core/vm.h"
#include "modules/std/core/array.h"
#include "modules/std/core/function.h"
namespace clever {
TypeObject* ArrayType::allocDat... | true |
cf6049eda2a400a03cda0e18b3930deb26f4a6f4 | C++ | JuliyaK/labs | /OOP 2/OOP 2/OOP 2.cpp | WINDOWS-1251 | 1,203 | 3.390625 | 3 | [] | no_license | // OOP 2.cpp: .
#include "stdafx.h"
#include "iostream"
using namespace std;
class monstr
{
private:
int health;
int fotce;
public:
monstr()
{
health = 0;
fotce = 0;
}
int getH() const
{
return health;
}
int getF() const
{
return fotce;
}
void setH(int count)
{
int p = count + fotce;
if (p... | true |
219f5eccf71ee0b736f4e322afd862d533fa01fb | C++ | Saurav-pixel/coding_practice | /decimalTobinary.cpp | UTF-8 | 438 | 3.09375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int decimalNumber;
long placeValue = 1;
long binaryNumber = 0;
cout<<"Enter any decimal number "<<endl;
cin>>decimalNumber;
while(decimalNumber != 0){
int remainder = decimalNumber % 2;
binaryNumber = binaryNumber + placeValue * remai... | true |
a9bdb7b549c34c6e9f746de9db8adc9146c10d02 | C++ | fancidev/euler | /src/p36.cpp | UTF-8 | 1,567 | 3.359375 | 3 | [
"MIT"
] | permissive | #include <algorithm>
#include <array>
#include <cstdint>
#include <iostream>
#include "euler/digits.hpp"
#include "euler.h"
BEGIN_PROBLEM(36, solve_problem_36)
PROBLEM_TITLE("Find palindromic numbers in both base 10 and base 2")
PROBLEM_ANSWER("872187")
PROBLEM_DIFFICULTY(1)
PROBLEM_FUN_LEVEL(1)
PROBLEM_TIME... | true |
0e6607f0cb54e76c42fba4bd38f28738dcd8cf02 | C++ | imatesiu/Converter | /Progetto1/messaggi/pacchettopresentazione.h | ISO-8859-13 | 1,590 | 2.796875 | 3 | [] | no_license | #pragma once
#include "utility.h"
/*Utilizzo questa classe per rappresentare le informazioni contenute nel pacchetto Presentazione che l'ATS riceve dal ATO
nel messaggio di Presentazione, sono presenti anche i metodi per serializzare e deserializzare il contenuto della classe*/
/*----------------------------------... | true |
615dfe729eb9b3c27eda0a12cd53b8eda77e1a1e | C++ | sherief/rapidyaml | /src/c4/yml/std/vector.hpp | UTF-8 | 1,275 | 2.640625 | 3 | [
"MIT"
] | permissive | #ifndef _C4_YML_STD_VECTOR_HPP_
#define _C4_YML_STD_VECTOR_HPP_
#include "../node.hpp"
#include <vector>
namespace std {
template< class V, class Alloc >
void write(c4::yml::NodeRef *n, std::vector< V, Alloc > const& vec)
{
*n |= c4::yml::SEQ;
for(auto const& v : vec)
{
n->append_child() << v;
... | true |
d2919db4f9e026c63590336b88e8515b5d101d09 | C++ | douglascraigschmidt/CPlusPlus | /expression-tree/commands/User_Command.cpp | UTF-8 | 759 | 2.734375 | 3 | [] | no_license | /* -*- C++ -*- */
#ifndef _USER_COMMAND_CPP
#define _USER_COMMAND_CPP
#include "commands/User_Command.h"
#include "User_Command_Impl.h"
User_Command::User_Command (User_Command_Impl *impl)
: command_impl_ (impl)
{
}
User_Command::User_Command (const User_Command &rhs)
= default;
User_Command &
User_Command::opera... | true |
bd0ae5c3dfec199032ccf89ce3d725b3b1832448 | C++ | akshayaggarwal/DS-Algorithms | /cpp/angrychildren.cpp | UTF-8 | 1,390 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string.h>
//#include <conio.h>
using namespace std;
void sort(char arr[100])
{
int i,j;
char temp,var;
for(i=0;arr[i]!='\0';i++)
{
var = arr[i];
for(j=i+1;arr[j]!='\0';j++)
{
if(arr[j] < var)
{
var = arr[j];
temp = arr[j];
arr[j] = arr... | true |
edd548205be1fcc0209af68b10d6860a7b11ad26 | C++ | o-o-overflow/dc2021q-rick-public | /service/src/Vector.cpp | UTF-8 | 1,190 | 3 | 3 | [] | no_license | #include "Vector.h"
Vector::Vector() {
}
void Vector::setCoord(float x, float y, float z) {
coord[0]=x;
coord[1]=y;
coord[2]=z;
}
void Vector::setCoord(Vector vector) {
coord[0]=vector.coord[0];
coord[1]=vector.coord[1];
coord[2]=vector.coord[2];
}
Vector Vector::crossProduct(Vector u, Vect... | true |
d6a0b1bf22eda18ff970e554f015e52892025453 | C++ | jmfb/unit-test | /IFactory.h | UTF-8 | 2,049 | 3.171875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <typeinfo>
#include <functional>
#include <memory>
#include <sstream>
#include "TestException.h"
#include "TypeName.h"
#include "Mock.h"
namespace UnitTest
{
// IFactory interface injection interface. This interface merges the type generic
// virtual functions of DoRegister and DoResolve with t... | true |
511995c50fe3e959e79cd73e8b9645db2efd5dae | C++ | ruippeixotog/codeforces | /src/948/D.cpp | UTF-8 | 1,356 | 3.0625 | 3 | [] | no_license | #include <algorithm>
#include <cstdio>
#include <vector>
#define MAXN 300000
#define MAXD 30
using namespace std;
vector<int> toBinDigits(int k, int digits = MAXD) {
vector<int> res;
while(digits--) {
res.push_back(k % 2);
k /= 2;
}
reverse(res.begin(), res.end());
return res;
}
struct Trie {
in... | true |
86b4e72a7539cdf6c4ac6ce7b82d98c6536eee14 | C++ | potato179/BOJSolution | /02444/2444.cpp | UTF-8 | 402 | 2.734375 | 3 | [] | no_license | #include <stdio.h>
int main(){
int input, i, j;
scanf("%d", &input);
for(i = 1; i <= input; i++){
for(j = input-i; j > 0; j--) printf(" ");
for(j = 0; j < 2*i-1; j++) printf("*");
printf("\n");
}
for(i = input-1; i > 0; i--){
for(j = input-i; j > 0; j--) printf("... | true |
25341769788fad910fd39377c74c282e3c3a37df | C++ | MemoryDealer/Cornea | /Inventory.hpp | UTF-8 | 1,156 | 2.8125 | 3 | [] | no_license | //================================================//
#ifndef __INVENTORY_HPP__
#define __INVENTORY_HPP__
//================================================//
#include "Weapon.hpp"
//================================================//
class Inventory
{
public:
Inventory(void);
~Inventory(void);
enum{
MAGIC_CUB... | true |
5cdbe3a7d423c417fe72b40ecf234c72937f078b | C++ | Yasin-cxh/Algorithm-learning | /面试题65:不用加减乘除做加法/不用加减乘除做加法.cpp | UTF-8 | 624 | 3.734375 | 4 | [] | no_license | //题目
//写一个函数,求两个整数之和,要求在函数体内不得使用 “+”、“-”、“*”、“/” 四则运算符号。
//思路:使用二进制
//步骤:1.不考虑进位相加(相 或)
//2.计算进位(相与)
//3.相加以上两个结果
//4.重复上述计算,直到进位==0
class Solution {
public:
int add(int a, int b) {
unsigned int num1 =a, num2 = b;
unsigned int sum,carry =0;
do{
sum = num1^num2;
carry ... | true |
31cb257ceb3e6bf9eec5f343d6532157e1708558 | C++ | iprafols/cross_correlations | /src/astro_object_dataset.cpp | UTF-8 | 3,446 | 2.734375 | 3 | [
"MIT"
] | permissive | /**
astro_object_dataset.cpp
Purpose: This files contains the body for the functions defined in astro_object_dataset.h
@author Ignasi Pérez-Ràfols
@version 1.0 08/08/2014
*/
#include "astro_object_dataset.h"
std::vector<AstroObject> AstroObjectDataset::list(int plate_number) const{
/**
EXPLANATION:
... | true |
4b4a8552347d2659448f9ac302757fcd00c1ac44 | C++ | the6tsense/LED-Cube-Software | /SingleColourEffects/gameoflifeeffect.cpp | UTF-8 | 4,458 | 3.140625 | 3 | [] | no_license | #include "gameoflifeeffect.h"
GameOfLifeEffect::GameOfLifeEffect(QString name)
{
setKey(name);
setTime(300);
}
void GameOfLifeEffect::calc(int status)
{
if(status == 0)
{
clearCube();
for(int i = 0; i < 0.2 * pow(getCubeSize(), 3); i++)
{
int x = rand() % getCubeSiz... | true |
4a5cc4fc6d1e4c2e07e46a993f06f4acf6727644 | C++ | amyrhzhao/CooEngine | /Framework/AI/Inc/DecisionModule.h | UTF-8 | 2,488 | 3 | 3 | [
"MIT"
] | permissive | #ifndef INCLUDED_COOENGINE_AI_DECISIONMODULE_H
#define INCLUDED_COOENGINE_AI_DECISIONMODULE_H
#include "Goal.h"
#include "GoalComposite.h"
#include "Strategy.h"
namespace Coo::AI
{
template <typename AgentType>
class DecisionModule
{
public:
typedef Goal<AgentType> GoalType;
typedef Strategy<AgentT... | true |
5bd00286e55a1ecd00bfb96ff79c715379d06703 | C++ | amanraj-iit/DSA_Uplift_Project | /Assignments/Solutions/Sonakshi Mishra/Assignment 4/Problem_4.cpp | UTF-8 | 456 | 3.015625 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std; //reverse words in a given string
int main()
{
string s1,s2;
int i,j,l1;
getline(cin, s1);
l1=s1.length();
for(i=l1-1;i>0;)
{
for(j=0;j<l1;j++)
{
s2[j]=s1[i];... | true |
788701f5a514db028345435783552a60437ac0e6 | C++ | guivmc/PokemonTest | /CodeBlocksWithSFMLProjects/State.h | UTF-8 | 839 | 3.125 | 3 | [] | no_license | #ifndef STATE_H_INCLUDED
#define STATE_H_INCLUDED
#include <vector>
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
class State
{
public:
virtual void init()=0;
virtual void cleanup()=0;
//Pushing and popping states causes pausing/resuming.
virtual void pa... | true |
06a6807029af1dd0863d17a3960ba5cf6c65cce0 | C++ | Gachiman/parallel_programming_course | /modules/task_3/bederdinov_d_quicksort_batcher_task3_tbb/main.cpp | UTF-8 | 8,367 | 3.0625 | 3 | [] | no_license | // Copyright 2019 Bederdinov Daniil
#define klength 50000000
#include <ctime>
#include <iomanip>
#include <iostream>
#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
#include "tbb/task.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/tbb.h"
void shuffle(int* array, int size) {
srand((unsigned int)... | true |
2e84d1cda6659a2f11b28b70dcb7dbd98f35c201 | C++ | CraftingGamerTom/Programming-with-Data-Structures | /Homework01 - object/testTwoDArray.h | UTF-8 | 2,866 | 2.953125 | 3 | [] | no_license | /*
* File: %<%NAME%>%.%<%EXTENSION%>%
* Author: %<%USER%>%
*
* Created on %<%DATE%>%, %<%TIME%>%
*
* This file uses the CxxTest library <TestSuite> to create test cases
* for a students project. For full cxxtest documentation see the userguide
* located in your C:\MinGW\cxxtest\doc or visit:
* http://cxx... | true |
eb7b4708082d86042c12cfa6e7b144cace7c1fd6 | C++ | emreharman/Cpp | /Proje1/b191210049_odev_1/b191210049_odev_1.cpp | ISO-8859-9 | 2,386 | 2.953125 | 3 | [] | no_license | /****************************************************************************
**
** RENC ADI.......: Emre Harman
** RENC NUMARASI..: b191210049
** DERS GRUBU........: B1
****************************************************************************/
#includ... | true |
a0f0ba3747a5e068f3b9a2744fcf0f8027f695b0 | C++ | guangkuan/C--Primer-5th | /Chapter17/test17.05/Sales_data.h | UTF-8 | 2,017 | 3.375 | 3 | [] | no_license | #ifndef SALES_DATA_H_INCLUDED
#define SALES_DATA_H_INCLUDED
#include <string>
#include <iostream>
class Sales_data
{
friend Sales_data operator+(const Sales_data& lhs, const Sales_data& rhs);
friend std::ostream& operator<<(std::ostream& os, const Sales_data& s);
friend std::istream& operator>>(std::istrea... | true |
d4a353132bf0f6cde517c9bf99c81b4917f12fb1 | C++ | Memotech-Bill/CamTest | /PictWnd.cpp | UTF-8 | 2,766 | 2.65625 | 3 | [
"BSD-2-Clause"
] | permissive | // PictWnd.cpp - A window for displaying the video picture.
#include <stdio.h>
#include <wx/dc.h>
#include "PictWnd.h"
BEGIN_EVENT_TABLE(PictWnd, wxPanel)
EVT_SIZE(PictWnd::OnSize)
END_EVENT_TABLE()
/*** PictWnd ***************************************************
Constructor.
Inputs:
parent = ... | true |
ccfdac68c550808ce7d21d5875b2e4a930735ede | C++ | LongerZrLong/cs107-FinalProject | /OffPiste/core/tests/src/test_integration.cpp | UTF-8 | 10,175 | 2.984375 | 3 | [
"MIT"
] | permissive | /* googletest header files */
#include "gtest/gtest.h"
/* source / header files */
#include "BinaryOperator.hpp"
#include "Function.cpp"
#include "Function.hpp"
#include "Node.cpp"
#include "Node.hpp"
#include "UnaryOperator.hpp"
#include "Variable.hpp"
#include "test_vars.h"
// add an AD shortcut for brevity
using n... | true |
d441dde7b230d284c40ee4e2b920fb382380c834 | C++ | WangYang-wy/LeetCode | /C++/455. Assign Cookies.cpp | UTF-8 | 669 | 2.59375 | 3 | [
"MIT"
] | permissive | //
// Created by 王阳 on 2018/5/13.
//
#include "header.h"
class Solution {
public:
int findContentChildren(vector<int> &g, vector<int> &s) {
// 先排序。
sort(g.begin(), g.end());
sort(s.begin(), s.end());
int g_index = 0;
int s_index = 0;
int g_length = int(g.size());
... | true |
ac7289d5fc97334bb72c74831e1b6df65332ba4d | C++ | abeflood/ColorBasedBallSorter | /CCamera.cpp | UTF-8 | 2,468 | 2.828125 | 3 | [] | no_license | //#include "stdafx.h"
#include "CCamera.h"
#include <vector>
#define PASS_AREA 10000
//intialize camera
CCamera::CCamera()
{
cam.open(0);
}
//check if there is blue ball waiting to be sorted
bool CCamera::blue_check()
{
bool test = false;
cam >> intial;
//convert image to HSV then convert to binary image based ... | true |
9d932140a98a7443941e6f95f1e254db7577a716 | C++ | realmelan/leetcode | /solutions/leetcode/canTransform.cpp | UTF-8 | 2,094 | 3.046875 | 3 | [] | no_license | // canTransform.cpp
// leetcode
//
// Created by Song Ding on 9/5/18.
// Copyright © 2018 Song Ding. All rights reserved.
//
#include "common.h"
using namespace std;
namespace canTransform {
class Solution {
public:
/**
* Relative order of L/R will not change. Also, 'R' can only move
* rightward, and '... | true |
7359ecd31cf713eecb1174d6f821c643dc7da379 | C++ | AloysiusParedes/CS-341-Project-2 | /Review.h | UTF-8 | 520 | 2.9375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
using namespace std;
class Review {
private:
//private members
int MovieID, UserID, Rating, numRating;
string ReviewDate;
public:
//constructor prototype
Review(int mid, int uid, int rating);
//accessor prototypes
int getMovieID();
int getUs... | true |
69a07d27c72b4eff1dcf169bc7fb1f73fe1c6e7c | C++ | bobby-mohanty/CodeForces | /800/1220A.cpp | UTF-8 | 304 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
char a[n];
cin>>a;
int b[2] = {0};
for(int i=0; i<n; i++)
{
if(a[i] == 'z')
b[0]++;
if(a[i] == 'n')
b[1]++;
}
while(b[1]>0)
{
cout<<1<<" ";
b[1]--;
}
while(b[0]>0)
{
cout<<0<<" ";
b[0]--;
}
return 0;
} | true |
5321c5e3225a201f002b1f20c7f179299f232236 | C++ | dagong996/Coding | /leetcode/179largest-number.cc | UTF-8 | 1,683 | 3.140625 | 3 | [] | no_license | #include <limits.h>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
class Solution {
public:
static bool compare(int a, int b) {
if (a == b) return false;
string nums1 = to_string(a) + to_string(b);
string n... | true |
b064797830d747d43b9ff481efea4c33adf285ad | C++ | Auburn-University-COMP-3000/assignment-1-kje0011 | /Assignment_1/q5.cpp | UTF-8 | 446 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main() {
// constants and variables
int celsius = 100;
int fahrenheit;
int count;
// calculations
while (celsius != fahrenheit)
{
fahrenheit = 32 + 9.0/5.0 * celsius;
celsius--;
}
/... | true |
29e705657ab0925c1179587d889563df6af87512 | C++ | scipianus/Algorithm-contests | /CodeForces/CodeForces Round #264 Div 2/A/A.cpp | UTF-8 | 322 | 2.625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int n, S, sol = -1;
int main()
{
int i, x, y;
std::ios_base::sync_with_stdio(false);
cin >> n >> S;
for(i = 1; i <= n; ++i)
{
cin >> x >> y;
if(y > 0 && x < S)
sol = max(sol, 100 - y);
if(y == 0 && x <= S)
sol = max(sol, 0);
}
cout << sol << "\n";
return 0;
... | true |
5bc346571975284703fd2d18475f1161704f7d3c | C++ | SopoSh/Company-Employees | /Ass4.cpp | UTF-8 | 2,148 | 3.890625 | 4 | [] | no_license | // Ass4.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
/*--------------------------------------------------------------------------
Driver program to process a list of pointers to employee objects.
------------------------------------------------------------------... | true |
90865289e1168d8342b2f2df1914371ea363b8c9 | C++ | mehr-licht/codepile | /stack/infix-to-postfix.cpp | UTF-8 | 1,496 | 4.15625 | 4 | [] | no_license | /* Convert the given expression from infix to postfix */
#include <iostream>
#include <string>
#include <stack>
#include <cctype>
using namespace std;
string infixToPostfix(string exp);
bool isOperand(char ch);
int precedence(char ch);
int main(void) {
string exp("((a+b-c)*d/e)+f*(g+h)");
cout << infixToPos... | true |
e122e637fc1c257f44471558cade662bcc49b10e | C++ | manet-sih/manet_gzrp | /RoutingTable.cc | UTF-8 | 8,138 | 2.765625 | 3 | [] | no_license | #include "RoutingTable.h"
RoutingTable::RoutingTable(){}
void RoutingTable::addEvent(ns3::Ipv4Address addr,ns3::EventId id){
auto itr = eventTable.find(addr);
if(itr==eventTable.end()){
eventTable[addr] = id;
}else{
itr->second = id;
}
}
void RoutingTable::addRouteEntry(RoutingTableEntry& entry){
rTable[entry.... | true |
a6a301b20a2093a28bbb58958cc5a00494ad9820 | C++ | imclab/EveMiner | /EVETest/EVETest.cpp | UTF-8 | 17,183 | 2.546875 | 3 | [] | no_license | #include "stdafx.h"
#include "IO.h"
#include "OpenCV.h"
#include "Timer.h"
#include "Util.h"
BOOL CALLBACK FindEveWindowProc(HWND hwnd, LPARAM lParam);
bool selectRightClickMenu(string firstAction);
bool selectRightClickMenu(string firstAction, string secondAction);
bool undock();
void depositOre();
bool approachAnd... | true |
650bb3902b9def788682d93287a4be47d4c1a7d0 | C++ | JinRLuo/vjudge_Summertraining | /最小生成树/b.cpp | GB18030 | 1,800 | 3.1875 | 3 | [] | no_license | /*
ʡ̡ͨĿʹȫʡκׯ䶼ʵֹ·ͨһֱӵĹ·ֻҪܼͨ·ɴTɣֵõ·ͳƱг·ķãԼõ·ǷѾͨ״̬дȫʡͨҪͳɱ
Input
ɲÿĵ1иׯĿN ( 1< N < 100 ) N(N-1)/2 жӦׯ·ijɱ״̬ÿи4ֱׯıţ1ŵNׯ·ijɱԼ״̬1ʾѽ0ʾδ
NΪ0ʱ
Output
ÿռһУȫʡͨҪͳɱ
Sample Input
3
1 2 1 0
1 3 2 0
2 3 4 0
3
1 2 1 0
1 3 2 0
2 3 4 1
3
1 2 1 0
1 3 2 1
2 3 4 1
0
Sample Output
3
1
0
*/
#include <bits/stdc++.h>
using namespace std;
... | true |
80da5457a9ae89a525e871e7ec6c9caca2fab837 | C++ | ahmetserefoglu/Stirngstructorneklercpp | /struct4.cpp | UTF-8 | 695 | 2.734375 | 3 | [] | no_license | #include<iostream>
using namespace std;
struct ogrenci
{
char ad[20],soyad[20];
int vize,final;
};
int main()
{
int ort;
ogrenci x[]={"muhammet","mastar",60,80,"ali","akil",90,80,"arif","serat",40,50};
for(int i=0;i<3;i++)
{
ort=x[i].vize*0.3+x[i].final*0.7;
if(ort>60)
{
... | true |
efff77c970e2c6a5cd14840cdf6977cf86147aad | C++ | xiaoqiang0/leetcode | /minimum-path-sum.cc | UTF-8 | 1,610 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
class Solution {
public:
int minPathSum(vector<vector<int> > &grid) {
int m = grid.size();
int n;
if (m == 0) return 0;
n = grid[0].size();
if (n ==... | true |
9d48e002edd784f688c0c29eba5aa598d7232d6f | C++ | rolandhartanto/Competitive-Programming | /TLX_Toki_Learning/kelas_pembelajaran_pemrograman/pemrograman_dasar/ch14_Rekursi/kasur_rusak.cpp | UTF-8 | 531 | 3.234375 | 3 | [] | no_license | //Kasur Rusak
//Author : Roland Hartanto
#include<bits/stdc++.h>
using namespace std;
bool cekPalindrom(string X){
if(X.length()==1){
return true;
}else if(X.length()==2){
if(X[0] == X[1]){
return true;
}else{
return false;
}
}
else if(X.length()>2){
if(X[0] == X[X.length()-1]){
X.erase(0,1);
... | true |
865b5638710c78d55088c2f9526e56ab0cedbc18 | C++ | hakkelt/paszuj_beadando | /tamas.cpp | UTF-8 | 16,254 | 2.59375 | 3 | [] | no_license | #include "paszuj.h"
#include <set>
#include <cmath>
using namespace std;
/*
Azért használok iterátorokat és nem magukat a konténereket, mert így módosítani tudom őket (ok, erre még
egy pointer is jó lenne), és ki tudom törölni abból a listából, amiben vannak (na, ehhez kell az iterátor!).
Eltárolom, hogy ... | true |
c7181d771648c3be1fb1744b68374ebbe036b42c | C++ | arunjain9988/CP | /spoj_main74/main.cpp | UTF-8 | 3,029 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h> // This will work only for g++ compiler.
#define loop(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define floop(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define rloop(i, l, r) for (int i = (int)(l); i >= (int)(r); --i)
//short hand for usual tokens
#define pb push_back
#d... | true |
669d681399f97959f8f704d220ae0c734727bcd9 | C++ | m5stack/M5Stack | /examples/Advanced/WIFI/WiFiTCP/WiFiTCP.ino | UTF-8 | 3,819 | 2.703125 | 3 | [
"MIT"
] | permissive | /*
*******************************************************************************
* Copyright (c) 2023 by M5Stack
* Equipped with M5Core sample source code
* 配套 M5Core 示例源代码
* Visit for more information: https://docs.m5stack.com/en/core/gray
* 获取更多资料请访问: https://docs.m5stack.... | true |
de378b3a9669df45cca1b29454a37b921623e0ad | C++ | mikebessuille/Simulation | /SFMLGame/Unit.h | UTF-8 | 2,872 | 3 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
#include <memory>
#include "PlayerUnit.h"
// Keep this outside the class, so that the ShapeList class (factory) can refer to it.
struct UnitDefaults
{
const float default_size;
const sf::Color default_colour;
const unsigned int default_healthGain; // how much health is gai... | true |
7da20fcf71a9ad3796f88327d303494a387fd321 | C++ | WuShuo94/uci_cs222p | /cs222p/src/rbf/rbfm.cc | UTF-8 | 31,543 | 2.859375 | 3 | [] | no_license |
#include "rbfm.h"
RecordBasedFileManager* RecordBasedFileManager::_rbf_manager = 0;
RecordBasedFileManager* RecordBasedFileManager::instance()
{
if(!_rbf_manager)
_rbf_manager = new RecordBasedFileManager();
return _rbf_manager;
}
RecordBasedFileManager::RecordBasedFileManager()
{
pfm = PagedFileM... | true |
d24ce80af972ba1062b96d2d6cf63aadfe6c0bd5 | C++ | Insanious/Lua-compiler | /Environment.cc | UTF-8 | 981 | 3.28125 | 3 | [] | no_license | #include "Environment.h"
#include "Nodes.h"
Environment::Environment() {}
Environment::~Environment() {}
Expression* Environment::read(Expression* variable)
{
if (exists(variable))
{
std::string name = "";
variable->evaluate(name);
return variables[name];
}
return nullptr;
}
void Environment::write(Exp... | true |
a362c38f99655e821d8b13952440941c2ceaa2f4 | C++ | jusseb/artemis | /software/BeagleBone/beaglebone/source/tests/pycubed_test.cpp | UTF-8 | 4,367 | 2.546875 | 3 | [
"MIT"
] | permissive |
#include <iostream>
#include <fstream>
#include <iomanip>
#include "device/temp_sensors.h"
#include "support/configCosmos.h"
#include "device/PyCubed.h"
using namespace std;
using namespace cubesat;
PyCubed *pycubed;
bool shutdown_received = false;
void Shutdown();
int main(int argc, char ** argv) {
int ua... | true |
7d1a6db02e3237db5041726fd1c498046112aaa5 | C++ | yagisumi/ruby-gdiplus | /ext/gdiplus/gdip_utils.h | UTF-8 | 2,079 | 2.515625 | 3 | [
"MIT"
] | permissive | /*
* gdip_utils.h
* Copyright (c) 2017 Yagi Sumiya
* Released under the MIT License.
*/
static inline int
_RB_RANGE_P(VALUE v)
{
return RB_TEST(rb_obj_is_kind_of(v, rb_cRange));
}
static inline float
NUM2SINGLE(VALUE num)
{
return static_cast<float>(NUM2DBL(num));
}
static inline VALUE
SINGLE2NUM(float... | true |
9ddacf81f275b361f52e930cd8edce5209d6fb12 | C++ | frankencode/fluxkit | /core/src/exceptions.h | UTF-8 | 5,140 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* Copyright (C) 2007-2015 Frank Mertens.
*
* Use of this source is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#ifndef FLUX_EXCEPTIONS_H
#define FLUX_EXCEPTIONS_H
/** \file exceptions
* \brief Common exception classes
*/
#include <errno.h>
#include <flux/Exception>
name... | true |
24cf4b581be0be8bdaff5c302e346f33bd452687 | C++ | cestrell/ExtendedEuclidean | /extended_euclid.cpp | UTF-8 | 2,756 | 3.484375 | 3 | [] | no_license | // Carlos Estrella
#include <iostream>
#include <gmp.h>
#include <gmpxx.h>
#include <ctime>
using std::cout;
void generateRandomNumbers(mpz_t &num1, mpz_t &num2) {
// Generate random state
gmp_randstate_t state;
unsigned long seed = time(NULL);
gmp_randinit_default(state);
gmp_randseed_ui(state, seed);
// Gen... | true |
b3097a886de0763405f6a8cb946885ee6a24fd83 | C++ | andrea-acampora/IoT-Smart-Dam | /src/dam_remotehydrometer/TrackingTask.cpp | UTF-8 | 494 | 2.796875 | 3 | [] | no_license | #include "TrackingTask.h"
TrackingTask::TrackingTask(Hydrometer* hydrometer, WaterLevel* waterLevel){
this->hydrometer = hydrometer;
this->waterLevel = waterLevel;
}
void TrackingTask::init(int period){
Task::init(period);
state = ON;
}
void TrackingTask::tick(){
switch (state)
{
cas... | true |
93042d235261441f0dcfdd133010ab6e16dcefd7 | C++ | yeungbri/eau2 | /src/network/queue.h | UTF-8 | 1,767 | 3.4375 | 3 | [] | no_license | /*
* Code is referenced from CS4500 lecture, authored by Prof. Jan Vitek.
*/
// lang::Cpp
#pragma once
#include <vector>
#include <map>
#include "thread.h"
#include "message.h"
/**
* FIFO queue of messages with atomic push and pop
* author: vitekj@me.com
*/
class MessageQueue
{
public:
std::vector<std::shared... | true |
f8b2ea323ad74f14012e68c759910d015674f497 | C++ | Ayushaps1/coding | /c++/built_tree_from_preorder_and_inorder.cpp | UTF-8 | 1,227 | 3.59375 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct node{
int data;
node* left;
node* right;
node(int val){
data=val;
left=NULL;
right=NULL;
}
};
int search(int inorder[],int start,int end,int curr){
for(int i=start;i<=end;i++){
if(inorder[i]==curr){
... | true |
112cf0d402f6105a4acaebf42e00cdd473ce8bc7 | C++ | forspy/share | /2018-7-21 strcpy_test.cpp | WINDOWS-1252 | 219 | 2.84375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
char name[20] = "hello";
char cpName[10];//С
//strcpy(cpName, name);
strncpy(cpName, name, 2);
cpName[2] = '\0';
cout << cpName << endl;
} | true |
5df02ba0a570835b7a2275379adcb76f4f4392f1 | C++ | Mouleeswaran/Moulees | /power of 2 or not.cpp | UTF-8 | 457 | 3.59375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class PowerofTwo
{
public:
PowerofTwo(int num)
{
int count;
if(num==0)
{
cout<<"Numbwr is zero";
}
else
while(num!=1)
{
count=0;
if(num%2==0)
{
num=num/2;
count=1;
}
else
{
cout<<"NO";
break;
... | true |
d422d856e70cefc23fbe7f2ab4c41a60d72d5a7b | C++ | Nayaco/OpenGLBoilerplate | /Core/Utility/Random.cpp | UTF-8 | 903 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "Random.hpp"
namespace randomx {
static std::random_device _rand_dev;
float random(float lower_bound, float upper_bound) {
std::mt19937 _mt(_rand_dev());
std::uniform_real_distribution<float> _gen(0.0f, 1.0f);
return _gen(_mt) * (upper_bound - lower_bound) + lower_bound;
}
imap1d rand(int __len... | true |
0467ccb6985ffc30f512b91f882d4993d23397f2 | C++ | migashko/faslib-sandbox | /debris/fas/serialization/json/ser/serialize_integer.hpp | UTF-8 | 1,272 | 2.9375 | 3 | [] | no_license | #ifndef FAS_SERIALIZATION_JSON_SERIALIZER_SERIALIZE_INTEGER_HPP
#define FAS_SERIALIZATION_JSON_SERIALIZER_SERIALIZE_INTEGER_HPP
namespace fas { namespace json{
template<typename T>
struct is_signed_integer
{
enum { value = T(-1) < T(1) };
static inline bool less_zero(T v)
{
return value && (v < 0);
}
};... | true |
612c26c090e7f0ec80546ac731cffe41f3a01f31 | C++ | kkabdol/Cocos_DotPictures | /DotPictures/Classes/Picture.cpp | UTF-8 | 2,540 | 2.546875 | 3 | [] | no_license | //
// Picture.cpp
// DotPictures
//
// Created by Seonghyeon Choe on 1/2/13.
//
//
#include "Picture.h"
using namespace cocos2d;
const unsigned int kMaxSegment = 7;
static Picture s_sharedPicture;
static bool s_bFirstRun = true;
Picture* Picture::sharedPicture(void)
{
if (s_bFirstRun)
{
s_sharedPicture.ini... | true |
cad4a50f7d20109c22c86fdd0247ded708c376b1 | C++ | saurav-chandra/cpp_test | /assgmnt/4.cpp | UTF-8 | 2,137 | 4.21875 | 4 | [] | no_license | /*
4. Write a C program that uses stack operations to convert a given infix expression into its postfix
Equivalent, Implement the stack using an array.
*/
#include<bits/stdc++.h>
using namespace std;
#define MAX 15
class Stack
{
private:
int top;
public:
void push(char x);
... | true |
9bedc22064ddb3e1e6b9ee8b755ba96de3aaeb00 | C++ | sergey-pashaev/practice | /cpp/hackerrank/src/arrays-left-rotation.cpp | UTF-8 | 1,346 | 4.25 | 4 | [] | no_license | // arrays: left rotation
// A left rotation operation on an array shifts each of the array's
// elements 1 unit to the left. For example, if 2 left rotations are
// performed on array [1, 2, 3, 4, 5], then the array would become [3,
// 4, 5, 1, 2].
// Given an array a of n integers and a number, d, perform d left
// ... | true |
e2ab67799eee41e430813a1a3f296ce24a0c3f47 | C++ | romulorafas/pds2_si_ufmg_2019_01 | /Lab 02.04 - Palíndromo/listaencadeada.h | UTF-8 | 1,458 | 3.5 | 4 | [] | no_license | #ifndef LISTAENCADEADA_H_
#define LISTAENCADEADA_H_
struct node_t
{
int elemento;
node_t *proximo;
node_t *anterior;
};
class ListaEncadeada
{
private:
node_t *_inicio_lista;
node_t *_fim_lista;
int _total_elementos;
public:
// *CONSTRUTOR
ListaEncadeada();
// *DESTRUTOR
~ListaEncadeada();
// *MÉTODO... | true |
8b9630b6980cc3e1a2a1db494ee6513211c862c8 | C++ | matthewjmiller1/rpc-transport-tests | /src/rt_client_server/transport.cc | UTF-8 | 946 | 2.703125 | 3 | [
"MIT"
] | permissive | /* First, so it stays self-compiling */
#include "transport.hpp"
#include <sstream>
#include <iostream>
#include <iomanip>
namespace rt {
RcvFn Server::_rcvFn = nullptr;
const uint8_t *
DataBuf::cStrToAddr(const char *cStr)
{
return reinterpret_cast<const uint8_t *>(cStr);
}
std::string
DataBuf::bytesToHex(con... | true |
25a8d37f4fe9e05aa9f2e9b81e17dcb2342bf445 | C++ | vi3tkhi3m/cecs-282 | /Prog6 - MegaWar/Player.cpp | UTF-8 | 476 | 2.984375 | 3 | [] | no_license | #include "Player.h"
Player::Player(const int id)
{
this->id = id;
}
int Player::getId()
{
return id;
}
double Player::getFierceness()
{
double temp = 0.0;
for (auto& it : getPile()) {
temp += it.getValue();
}
if (getPile().empty())
return temp;
return temp / getPileSize();
}
int Player::getAmountOfBa... | true |
7b30bf5930fe83000ad28e3de66c7bf15a180722 | C++ | xiaohaowudi/DesignPatterSampleCode | /Iterator/Iterator.cpp | UTF-8 | 396 | 2.625 | 3 | [] | no_license | #include "Iterator.h"
IIterator* CAggregate::get_iterator() {
return new CIterator(this);
}
void CIterator::first() {
m_index = 0;
}
void CIterator::next() {
if (m_index < m_aggregate_ptr->m_data_set.size()) {
m_index++;
}
}
bool CIterator::is_done() {
return m_index == m_aggregate_ptr->m_data_set.size();
}
... | true |
9b13512e421d1f9d48aa061110847ef3c88c2f76 | C++ | rajobasu/IOI-Prep | /POI/Seafaring.cpp | UTF-8 | 1,995 | 2.6875 | 3 | [] | no_license | /*
SOLUTION : do a dijkstra from each node and get the shortest even and odd length paths. Check parity with given d.
*/
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <queue>
#include <deque>
#include <iomanip>
#include <cmath>
#i... | true |
e3fc0cdb41d53a38b97eba6c31df0a973af04484 | C++ | MarcelFagundes/algoritmos-Cpp | /Final/code/finding_the_running_median.cpp | UTF-8 | 6,147 | 3.3125 | 3 | [] | no_license | //Source code do curso Algoritmos com C++ por Fabio Galuppo
//Ministrado em 2021 na Agit - https://www.agit.com.br/cursoalgoritmos.php
//Fabio Galuppo - http://member.acm.org/~fabiogaluppo - fabiogaluppo@acm.org
//Maio 2021
//Problem extract from here: https://www.hackerrank.com/challenges/find-the-running-median/p... | true |
71f10e0ebc23a9e525c17aafa4aa15180518be2d | C++ | biprodas/OJ-Solutions | /UVa/11461 - Square Numbers.cpp | UTF-8 | 381 | 2.796875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int ar[100005];
bool isSquare(int n){
int sq = sqrt(n);
return sq*sq==n;
}
void pre(){
for(int i=1;i<100005;i++){
ar[i]=ar[i-1];
if(isSquare(i)) ar[i]++;
}
}
int main(){
pre();
int a, b;
while(scanf("%d %d", &a, &b)){
if... | true |
141903755aec124406615c76280963e0e0d00e2e | C++ | yurkiss/LogParserCpp | /BaseParsingStrategy.h | UTF-8 | 1,731 | 2.78125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: BaseParsingStrategy.h
* Author: yrid
*
* Created on October 6, 2015, 12:16 PM
*/
#ifndef BASEPARSINGS... | true |