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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6f91ed28b0e95b3260c72cc1b02529f5ec528d75 | C++ | Xewar313/Wizardly | /Project1/Barrier.cpp | UTF-8 | 434 | 2.671875 | 3 | [] | no_license | #include "Barrier.h"
#include "Board.h"
#include "Projectile.h"
#include "BarrierEntity.h"
Barrier::Barrier()
{
avaliable = false;
cooldown = 100;
weaponColor = Color(230, 230, 0);
minCooldown = 50;
}
void Barrier::attack(Board& board, Entity& src)
{
if (board.getTime() - src.getLastShootTime() >= std::max(coold... | true |
98ac09e70357cb27c2c5ea88497ab317d6308955 | C++ | ishubhoshaha/Programming-Interview | /Backtracking/sudoku.cpp | UTF-8 | 2,776 | 3.375 | 3 | [] | no_license | /*
*Find empty cell
* If there are no empty cells, return true, problem solved.
* For every empty cell try digit from 1 to 9
* a) If the cell is safe for digit at grid[row][col]
* grid[row][col]=number and recursively try and fill in rest of the grid
* b) If recursion successful, return true
* c) Else... | true |
ac254a411400c958a77e91f5ce7420e5b6310db4 | C++ | zgjstudy/DataStructures | /common/hashsim.cpp | UTF-8 | 2,111 | 3.375 | 3 | [] | no_license | // From the software distribution accompanying the textbook
// "A Practical Introduction to Data Structures and Algorithm Analysis,
// Third Edition (C++)" by Clifford A. Shaffer.
// Source code Copyright (C) 2007-2011 by Clifford A. Shaffer.
#include "book.h"
int main(int argc, char** argv)
{
if (argc != 3)
{
co... | true |
e0efdd74db0d857f80864156b57b3fb713b69bf1 | C++ | lgc13/LucasCosta_portfolio | /c++/practice/intermediate_examples(assignments)/hamming_sort_on_files.cpp | UTF-8 | 7,147 | 4 | 4 | [] | no_license | /* Assignment 8 for COP 3014. Created by Lucas Costa */
/* "Cheesecake assignment" */
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
/* Prototypes */
string OpenAndCheckFile(ifstream &file); //passing in a copy (with &)
int CountLines(ifstre... | true |
3ebe0ced008bea0c2f0d37ef680da0a710a74b45 | C++ | anagorko/zpk2015 | /grupa3/alebilas/pd2/kol.cpp | UTF-8 | 291 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
double r;
double pole;
double obwod;
cin >> r;
pole = M_PI * pow(r,2);
obwod = 2 * M_PI * r;
cout << setprecision(3) << fixed << pole << endl;
cout << setprecision(3) << fixed << obwod << endl;
}
| true |
1d12613b9ea83e01bbf9b097ca7b383bf70e6ee9 | C++ | Stephenhua/CPP | /interview_Code/Code/Dp-18-LeetCode-offer-42-maxSubArray.cc | UTF-8 | 2,009 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string.h>
using namespace std;
/*
面试题42. 连续子数组的最大和
输入一个整型数组,数组里有正数也有负数。数组中的一个或连续多个整数组成一个子数组。求所有子数组的和的最大值。
要求时间复杂度为O(n)。
示例1:
输入: nums = [-2,1,-3,4,-1,2,1,-5,4]
输出: 6
解释: 连续子数组 [4,-1,2,1] 的和最大,为 6。
提示:
1 <= ar... | true |
4970c850dfd06326e05e68e95745e1bd6fa3736f | C++ | austinschneider/schneider_PHYS401 | /HW05/3/main.cc | UTF-8 | 678 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <fstream>
#include "../Pre/integrate.h"
template <class T>
T I(T x) {
return 1/(((T)1.0)+x);
}
int main() {
double I_actual = 0.6931471805599453094172321;
double epsilon = 0.0000000001;
double I_result = 0;
double error = 0;
std::cout << std::endl;
std::fstre... | true |
e5a331144de292718810656b412b06d8862fee82 | C++ | serg-bloim/srvmgr | /this_call.cpp | UTF-8 | 770 | 2.515625 | 3 | [] | no_license | int __declspec(naked) __stdcall this_call_impl()
{
__asm
{
pop eax // pop esp
pop eax // pop eax from the wrapper
pop edx // pop method ptr
pop ecx // pop this
push eax // restore esp from call to the wrapper
jmp edx // jump to the ... | true |
fdbcc975701331e9adf27118f6ac0675d3c41118 | C++ | aNamelessMan/ChatServer | /include/server/model/usermodel.hpp | UTF-8 | 377 | 2.546875 | 3 | [] | no_license | #ifndef UERMODEL_H
#define UERMODEL_H
#include "user.hpp"
// User表的数据操作类
class UserModel{
public:
// User表的插入方法
bool insert(User &user);
// 根据用户id查询用户信息
User query(int id);
// 更新用户的状态信息
bool updateState(User &user);
// 重置用户的状态信息
void resetState();
};
#endif | true |
35a9d29cdd794e29964701b2b816ab81aaeb8bd3 | C++ | dgouyette/arduino | /Blink4Attiny85/Blink4Attiny85.ino | UTF-8 | 701 | 3.078125 | 3 | [] | no_license | #include <VirtualWire.h> // On inclue la librairie VirtualWire
int led = 0;
char *msg = "0"; // Tableau qui contient notre message
void setup() {
pinMode(led, OUTPUT);
vw_setup(2400); // Initialisation de la librairie VirtualWire à 2400 bauds (maximum de mon module)
vw_set_tx_pin(3); // On indi... | true |
2e124b29e4593cb102130e67127ca923811d830b | C++ | t-po/ECE-ProjetGit | /classSB.cpp | ISO-8859-1 | 6,143 | 2.765625 | 3 | [] | no_license | #include "classSB.h"
#include "interfaceSB.h"
/// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Methodes et constructeurs de Astre
Astre::Astre()
{
system("cls");
double _x,_y;
std::cout<<"Saisir le nom de l'astre : ";
std::ci... | true |
a3dedc5ea52ce1eda9ed3a77eb4a8abc4e4ebce4 | C++ | 1468362286/Algorithm | /CodeForces/919A/14276639_AC_30ms_12kB.cpp | UTF-8 | 359 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
const double inf=0x3f3f3f3f;
double min(double a,double b){return a>b?b:a;}
int main()
{
// freopen("in.txt","r",stdin);
int n,m;
while(cin>>n>>m)
{
double a,b;
double ans=inf;
for(int i = 0 ; i < n ; i++)
{
cin>>a>>b;
ans=min(ans,a/b);
}
p... | true |
45ffa7ab687e31b6e5b5caf4b3a8ae449c467637 | C++ | hydrogen602/Research1 | /state.cpp | UTF-8 | 7,821 | 2.984375 | 3 | [] | no_license | #include <vector>
#include <iostream>
#include <cstdio>
#include <cmath>
#include "state.h"
#include "data/vector3.h"
#define square(x) ((x) * (x))
State::State(double hVal, double maxXArg, double maxYArg, double kArg, double dragCoeff): h{hVal}, maxX{maxXArg}, maxY{maxYArg}, k{kArg}, drag{dragCoeff} {
std::cout ... | true |
82133105a967089db94176edb321b0a4de0374ad | C++ | LichProject/RecastManaged | /Recast/CompactCell.cpp | UTF-8 | 1,049 | 2.53125 | 3 | [] | no_license | #include "../Unmanaged/Recast/Recast.h"
#include "CompactCell.h"
RecastManaged::Recast::CompactCell::CompactCell(rcCompactCell* cell, bool* destructWithMe)
{
this->_cell = cell;
this->_destructWithMe = destructWithMe;
this->_disposed = false;
}
RecastManaged::Recast::CompactCell::~CompactCell()
{
this->!CompactCe... | true |
eca26d324e04d2e70fbd46239cf5abfdf3987076 | C++ | girishprb/Sorting | /BubbleSort.cpp | UTF-8 | 452 | 2.90625 | 3 | [] | no_license | /*
* BubbleSort.cpp
*
* Created on: Apr 13, 2014
* Author: Girish Prabhu
*/
#include <stdlib.h>
#include <iostream>
#include "BubbleSort.h"
using namespace std;
//Default constructor
BubbleSort::BubbleSort()
{
}
BubbleSort::BubbleSort(int size):SortingBase(size)
{
}
BubbleSort::~BubbleSort()
{
}
vo... | true |
feb5af4a5114e19471988e62b220a17c328dfcad | C++ | MichaelTiernan/qvge | /src/3rdParty/ogdf-2020/src/ogdf/fileformats/GEXF.cpp | UTF-8 | 2,127 | 2.765625 | 3 | [
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"GPL-3.0-only",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"EPL-1.0",
"LicenseRef-scancode-generic-exception",
"GPL-1.0-or-later",
"BSL-1.0",
"LGPL-2.0-only",
"BSD-2-Clause"
] | permissive | /** \file
* \brief Implementation of GEXF string conversion functions.
*
* \author Łukasz Hanuszczak
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
*
* \par
* Copyright (C)<br>
* See README.md in the OGDF root directory for details.
*
* \par
* This program is free softwar... | true |
ee91abaf49d013ffca1d9eec545492a64cc6e8bc | C++ | jasoncustodio/Coursework | /Coursework/C++/Programming Systems/HW2/main.cpp | UTF-8 | 2,986 | 3.765625 | 4 | [] | no_license | /*
Program: Adventure Map
Author: Jason Custodio
Class: CS202
Date: 05/07/2014
Description: This program simulates a math riddle game
There will be a menu class that acts as an interface
Menu has a roster and has a map
A player... | true |
d818d14992e40a0402ba205a8ae89694b860120d | C++ | morris821028/hw-HikaruNoGo | /source/TArandom_modify/MCTS.h | UTF-8 | 5,319 | 2.609375 | 3 | [] | no_license | #include "board.h"
#include <vector>
using namespace std;
struct Node {
// record data
int games, wins;
float UCB, sum, sqsum;
mBoard board;
int game_length, turn;
vector<Node*> son;
vector<int> move;
Node *parent;
Node() {
son = vector<Node*>(), move = vector<int>();
games = wins = 0;
UCB = 0.f;
pare... | true |
731e0eabf6836f7a24338356387b45feb2621ddb | C++ | tamaskenez/advent-of-code | /2016/d24.cpp | UTF-8 | 2,707 | 2.640625 | 3 | [] | no_license | #include "common.h"
int solve(AI2 start, AI2 end, const VS& board, const int H, const int W)
{
vector<AI2> front, next_front;
set<AI2> visited;
front.PB(start);
visited.insert(start);
int steps = 0;
for (;; ++steps) {
next_front.clear();
assert(!front.empty());
for (cons... | true |
aa3d482fa53c075b63cb13bbc593525daddb5f2a | C++ | luuuyi/MyPractise_1 | /dp_solve_maximium_ascend_subset.cpp | UTF-8 | 704 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n;
while(cin>>n){
vector<int> datas(n,0);
for(int i=0;i<n;i++) cin >> datas[i];
vector<int> dp(n+1,0);dp[1] = 1;
int max_v = 0x80000000;
f... | true |
e7c1a09e8a3d28000ab00e901fa3e1301ad578a8 | C++ | shahed-shd/Online-Judge-Solutions | /GeeksforGeeks-Practice/Medium/Full/Sum of Subarrays.cpp | UTF-8 | 663 | 2.71875 | 3 | [] | no_license | // ==================================================
// Problem : Sum of Subarrays
// Run time : 0.087 sec.
// Language : C++11
// ==================================================
#include <cstdio>
using namespace std;
typedef long long LL;
const LL MOD = 1e9+7;
int main()
{
int t;
scanf... | true |
b699815f894177a2d960af1878c408703c59cb09 | C++ | adityanjr/code-DS-ALGO | /InterviewBit/Linked Lists/add_two_numbers_as_lists.cpp | UTF-8 | 1,454 | 3.34375 | 3 | [
"MIT"
] | permissive | // https://www.interviewbit.com/problems/add-two-numbers-as-lists/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
int findLen(ListNode* A) {
int c = 0;
while(A!=NULL) {
c++;
A = A->n... | true |
22c751fc271ea6dca216049eb9fd1a30be1a50d2 | C++ | hirano567/XLCTextEx | /XLCTextEx/PLib/PGClass.h | SHIFT_JIS | 5,449 | 2.59375 | 3 | [
"MS-PL"
] | permissive | // XLCTextEx_1.0x : PLib
// PGClass.h
//
#pragma once
NS_PLIB_BEGIN
//======================================================================
// PCStrBuffer : p̃obt@ǗNX
//======================================================================
#define BUFFER_SIZE_DEFAULT 256
#define BUFFER_SIZE_MAX_DEFAULT INT_MAX
#... | true |
05a588ca87696374b4287b500a1af5d9b4bd37f9 | C++ | SPReddy224/C-Advance | /submission-c++-arif/17th.cpp | UTF-8 | 300 | 2.859375 | 3 | [] | no_license | /*#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int num;
cout << "Enter a number : " << endl;
cin >> num;
if (num % 2 == 0)
cout << " the given number is even number" << endl;
else
cout << " the given number is odd number" << endl;
system("pause");
return 0;
}*/ | true |
a59d65d4bec3ad4769ed048c27409c4d11d14438 | C++ | MARI0sGitHub/MAZE_WTIH_FILE_I-O | /game.cpp | UHC | 5,593 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <time.h>
#include <conio.h>
using namespace std;
struct _Position { //ǥ ϱ ü
int x;
int y;
};
typedef _Position P; //ü Ī ü P Īμ ϴ.
typedef _Position* PP;//ü !! Ī ü PP Īμ ϴ.
/*
0.
1.
2.
3.
*/
//̷θ ϱ Լ̴.
void runMiro(char maze[21][21],... | true |
1936209d0da552e3ad8c620eca9b0f2c11f05518 | C++ | chiragrathi24/compilationcode1212 | /Basic Calculator.cpp | UTF-8 | 276 | 3.6875 | 4 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int a, b, sum;
cout<<"This is a basic calculator program"<<endl;
cout<<"Enter the two numbers to find their sum:"<<endl;
cin>>a>>b;
sum=a+b;
cout<<"The sum of the two numbers is:"<<sum<<endl;
return 0;
}
| true |
5152ad64e3f41c4afe50e2a1a36ff18de951e3b6 | C++ | mitchdowd/native | /src/core/common/conditionvariable.cpp | UTF-8 | 629 | 2.78125 | 3 | [
"MIT"
] | permissive | // Local Dependencies
#include "../include/conditionvariable.h"
namespace native
{
ConditionVariable::ConditionVariable(ILockable& lock) : _waiters(0), _lock(lock), _waitCount(0)
{
}
ConditionVariable::~ConditionVariable()
{
}
void ConditionVariable::wait()
{
Atomic::increment(_waitCount);
_lock.release(... | true |
d7e3ceec641beb6d645c6994df671f3b7576ff44 | C++ | BITERP/PinkRabbitMQ | /src/amqpcpp/libboostasio.h | UTF-8 | 19,772 | 2.546875 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | /**
* LibBoostAsio.h
*
* Implementation for the AMQP::TcpHandler for boost::asio. You can use this class
* instead of a AMQP::TcpHandler class, just pass the boost asio service to the
* constructor and you're all set. See tests/libboostasio.cpp for example.
*
* Watch out: this class was not implemented o... | true |
c6d2cf5a6ab6f53c937441d3491549cb3f1c2166 | C++ | pawREP/ZHM5A_TraceSink | /src/FileLogger.cpp | UTF-8 | 979 | 2.984375 | 3 | [
"MIT"
] | permissive | #include "FileLogger.h"
#include <filesystem>
std::filesystem::path FileLogger::getLogFile() const {
const auto logDir = std::filesystem::current_path() / "TraceSink/";
if (!std::filesystem::exists(logDir))
std::filesystem::create_directory(logDir);
int id = 0;
std::filesystem::path logFilePa... | true |
1ca23a2fadfa380bcf9d54c363425eca8a551e1f | C++ | makisto/AVS | /АВС/avs.cpp | UTF-8 | 1,171 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include <intrin.h>
#include <sys/time.h>
struct timeval tv1,tv2,dtv;
struct timezone tz;
void time_start()
{
gettimeofday(&tv1, &tz);
}
long time_stop()
{
gettimeofday(&tv2, &tz);
dtv.tv_sec= tv2.tv_sec -tv1.tv_sec;
dtv.tv_usec=tv2.tv_usec-tv1.tv_usec;
if(dtv.tv_us... | true |
1b32d2fa0621baaba35ef9b959d00f36473a4c74 | C++ | kolhammer/Psybrus | /Engine/Source/Shared/System/SysFence.h | UTF-8 | 808 | 2.625 | 3 | [] | no_license | /**************************************************************************
*
* File: SysFence.h
* Author: Neil Richardson
* Ver/Date: 15/12/11
* Description:
* Fence for synchronisation of jobs.
*
*
*
*
**************************************************************************/
#ifndef __SYSFENCE_H__
#define _... | true |
57be5ae2f8064fab7ac5766786392afff067ca3e | C++ | dylan-meiners/gps | /cpp/guidance.cpp | UTF-8 | 15,646 | 2.625 | 3 | [
"MIT"
] | permissive | #include "guidance.h"
extern FILE* fp;
extern bool executing;
GPRMC_STRUCT GPRMC;
Waypoint** waypoints = (Waypoint**)malloc(NUM_INITIAL_WAYPOINT * sizeof(Waypoint*)); //array of Waypoint pointers
Waypoint** next_open = waypoints; //pointer to next open slot
Waypoint** last_waypoint_slot = waypoints + NUM_INITIAL_WAY... | true |
6a22464afc4edcdb815fa6e822427f79d21fbf39 | C++ | Liuguanli/ModelReuse | /include/PGM.h | UTF-8 | 1,177 | 2.578125 | 3 | [] | no_license | #ifndef PGM_
#define PGM_
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include "pgm_index.hpp"
#include "pgm_index_dynamic.hpp"
template<int error>
class PGMX
{
public:
DynamicPGMIndex<uint64_t, uint64_t, PGMIndex<uint64_t, error>> pgm_;
void build(const std::vector<uint64_t... | true |
ad5634443c0fc2d849dea82794e50b2fb11ce55d | C++ | xlCh/leetcode | /A 228 Summary Ranges.cpp | UTF-8 | 617 | 3.5 | 4 | [] | no_license | //https://leetcode.com/problems/summary-ranges/
//输出一串数字的范围,例如给出[0,1,2,4,5,7],返回["0->2","4->5","7"]
vector<string> summaryRanges(vector<int>& nums) {
int i = 0;
vector<string> rangeV;
while(i<nums.size()) {
int start = i;
stringstream s;
while(i != nums.size(... | true |
40d7c4dd78a7c7f0013a276bbc6913a5c448f4f0 | C++ | Twice22/acceleratedcpp | /Chapter7/chapter7.3/chapter7.3/xreftable.cpp | UTF-8 | 1,241 | 3.25 | 3 | [] | no_license | #include "stdafx.h"
#include "xreftable.h"
#include "split.h"
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
// find all the lines that refer to each word in the input
map<string, vector<int> > xref(istream& in, vector<string> find_words(const string&)... | true |
aec62eed82b9b4718c626d39bc8bc40585a190cb | C++ | strange-hawk/data_structure_algorithms | /linkedlist/middle_linked_list.cpp | UTF-8 | 895 | 3.703125 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct Node
{
int key;
Node *next;
Node(int key){
this->key = key;
this->next = NULL;
}
};
// naive solution
void printNode(Node *head){
if(head==NULL){
cout<<'empty'<<endl;
return;
}
int count =0;
Node *count_node... | true |
c1cba60ef26298bf78d0dbbfc52bd023c32e75df | C++ | My-Cpp-projects/Tetris-SDL-v1.2 | /Tetris SDL v1.2/src/model/Figure.cpp | UTF-8 | 590 | 2.90625 | 3 | [] | no_license |
#include "../../include/factory/FigureFactory.h"
tetris::Figure::Figure(int** figureMatrix, FigureType type)
: mType(type)
{
for (int i = 0; i < FIGURE_WIDTH; ++i)
{
for (int j = 0; j < FIGURE_HEIGHT; ++j)
{
mFigureMatrix[i][j] = figureMatrix[i][j];
}
}
}
void tetris::Figure::setCoordinates(int x, int... | true |
612d14274e447bd028c1e31b4e4c8988642f51a4 | C++ | AhriHaran/Unity | /Game_Girls_AutoChess_2019_06_04/Lib/TimeManager.cpp | UTF-8 | 582 | 2.59375 | 3 | [
"Unlicense"
] | permissive | #include "TimeManager.h"
namespace JEngine
{
TimeManager::TimeManager()
{
m_bUseFPS = false;
m_nFPS = 30;
m_dwLastTime = GetTickCount();
m_dwCurTime = GetTickCount();
}
TimeManager::~TimeManager()
{
}
void TimeManager::init(bool useFPS, int FPS)
{
m_bUseFPS = useFPS;
m_nFPS = FPS;
}
bool Ti... | true |
986cad37c5b26cc87b17c3ec2177d6a14687311a | C++ | Milswanca/OpenGL_FINAL | /OpenGL/Engine/Source/Public/Core/InputSystem.h | UTF-8 | 1,097 | 2.6875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Actor.h"
#include "DataTypes.h"
#define NUM_KEYS 256
class InputSystem : public Actor
{
public:
InputSystem(const ObjectInitData& _OI);
public:
virtual void PostUpdate(const float _deltaTime) override;
bool IsKeyJustPressed(unsigned char _key) const;
bool IsKeyJustReleased(unsigned char _... | true |
fff4d02902ac8cc519c181a64a786b60126b01cc | C++ | Dishu5588/liverpool | /student data using static data member.cpp | UTF-8 | 494 | 3.59375 | 4 | [] | no_license | #include<iostream>
using namespace std;
class student
{
public:
int roll;
string name;
static int addno;
student(string n)
{
addno++;
roll=addno;
name=n;
}
void display()
{
cout<<" name "<<name<<endl<<" roll "<<roll<<endl;
}
};
int student::addno=0;
int main()
{
stu... | true |
e68b07a1fe94a1703f531aea40eb55008b1c7173 | C++ | plzrobbob/CSE461_FileSystem | /CSE461Labs/Sdisk.h | UTF-8 | 1,996 | 3.640625 | 4 | [] | no_license | /*
Cameron Maclean
CSUSB
November 11th, 2019
lab3/4
*/
#ifndef SDISK_H
#define SDISK_H
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
class Sdisk
{
public:
Sdisk(string _diskname, int _numberofblocks, int _blocksize);
int getblock(int blocknumber, string& buffer);
int putblo... | true |
271423ea2ce15fe82121b345ad3a3a26809fe00b | C++ | ibas2020/Programming-Labs | /Practice_07.09/Task_1/main.cpp | UTF-8 | 1,093 | 3.625 | 4 | [] | no_license | // Задача 1. Даны 2 перменные, ввод с клавиатуры, Поменять местами значения переменных 2-мя способами
// 1) с использованием вспомогательной перменной. 2) без использований вспомогательных переменных
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cout << "Введите значения a и b: "; ... | true |
33885f7984210a050818c0e3025cb7aba97e1483 | C++ | fbdp1202/AlgorithmParty | /BOJ/2000/2553.cpp | UTF-8 | 562 | 2.75 | 3 | [] | no_license | // baekjoon 2553 yechan
#include <cstdio>
#include <algorithm>
using namespace std;
int N;
int main()
{
scanf("%d", &N);
int ret = 1;
int count2 = 0, count5 = 0;
int tmp;
for (int i=1; i<=N; i++) {
tmp = i;
while (tmp % 10 == 0) tmp /= 10;
while (tmp % 2 == 0) tmp /= 2, count2++;
while (tmp % 5 == 0) tmp... | true |
59314631a2f76628847134aaddb546ba6b2dffb7 | C++ | huhumeng/algorithm | /leetcode/371.两整数之和.cpp | UTF-8 | 967 | 3.40625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=371 lang=cpp
*
* [371] 两整数之和
*
* https://leetcode-cn.com/problems/sum-of-two-integers/description/
*
* algorithms
* Easy (51.62%)
* Total Accepted: 13.8K
* Total Submissions: 26.7K
* Testcase Example: '1\n2'
*
* 不使用运算符 + 和 - ,计算两整数 a 、b 之和。
*
* 示例 1:
... | true |
960fdc8b6a6bae26afa4cddf6b35ac1e593dd834 | C++ | refatmonjur/CSC212 | /p1/deque.cpp | UTF-8 | 3,300 | 3.578125 | 4 | [] | no_license | /* This is the implementation file for the deque, where you will define how the
* abstract functionality (described in the header file interface) is going to
* be accomplished in terms of explicit sequences of C++ statements. */
#include "deque.h"
#include <stdio.h>
#include <cassert>
/* NOTE:
* We will use the fo... | true |
40bcf6ebb7cf0e71c080372066b0e26b39e8f09b | C++ | ruguangyou/ossu-cs | /Core CS/core theory/Data Structure and Algorithm/problem set/TSP/tsp_3.cpp | UTF-8 | 2,411 | 2.765625 | 3 | [] | no_license | #include <cstdio>
// #include "vector.h"
using namespace std;
#define DEFAULT_CAPACITY 10
template <typename T> class Vector {
protected:
int _size; int _capacity; T* _elem;
void expand() {
if (_size < _capacity) return;
if (_capacity < DEFAULT_CAPACITY) _capacity = DEFAULT_CAPACITY;
T* oldElem = ... | true |
80243002792e4bc6a69ff392ba565af3d50832d1 | C++ | MrFreelax/Projet-A1-groupe-6 | /Module 1 et 2/coeur/coeur.ino | UTF-8 | 2,684 | 2.84375 | 3 | [] | no_license | #include "param.h"
#include "coeur.h"
#include "cardio.h"
int tpsDer; //On inclut une variable globale prennant le dernier temps calculé du pouls
void setup()
{
tpsDer = millis(); //On donne le temps depuis lequelle a démaré l'arduino à la variable globale
f... | true |
d625e9c2e1feec0222e9267dfd800852688ff862 | C++ | jwnwilson/nw_game | /NSGame/NSGame/BasicInput.cpp | UTF-8 | 3,185 | 2.671875 | 3 | [] | no_license | #include "StdAfx.h"
#include "BasicInput.h"
#define BUFFER_SIZE 16
BasicInput::BasicInput(void)
{
key=&keys[0];
mouse=&mouse_state;
m_diObject=NULL;
m_diKeyboardDevice=NULL;
m_diMouse=NULL;
}
BasicInput::BasicInput(HINSTANCE hInstance,HWND hWnd)
{
initalise(hInstance,hWnd);
key=&keys[0];
}
BasicInput::~BasicI... | true |
16ca786c3b674e6559a14cff900cbd9750c8fe29 | C++ | sue-chun/OOP345 | /Workshops/OOP345lab4/Notifications.cpp | UTF-8 | 1,780 | 2.890625 | 3 | [] | no_license | // Name: Sue Ming Chun
// Seneca Student ID: 032343154
// Seneca email: smchun@myseneca.ca
// Date of completion:
//
// I confirm that the contents of this file is created by me,
// with the exception of the parts provided to me by my professor.
#include <iostream>
//#include <fstream>
#include "Notifications.h"
#inc... | true |
225bd23cd1a16b659d52e930c9a840e5a873d849 | C++ | tonycao/CodeSnippets | /C-CPP/Algorithm/RandomNumber.h | UTF-8 | 540 | 2.953125 | 3 | [] | no_license | // RandomNumber.h
const unsigned long maxshort = 65535L;
const unsigned long multiplier = 1194211693L;
const unsigned long adder = 12345L;
#ifndef RANDOMNUMBER_H
#define RANDOMNUMBER_H
class RandomNumber{
private:
// 当前种子
unsigned long randSeed;
public:
// 构造函数,默认值0表示由系统自动产生种子
RandomNumber(unsigne... | true |
0a3035ed5f91f50a9dc4267b61ec30e0617fe5b8 | C++ | pvgupta24/Advanced-Data-Structures | /Heaps/includes/BinaryHeap.h | UTF-8 | 2,157 | 3.546875 | 4 | [
"MIT"
] | permissive | #ifndef _BINARY_HEAP
#define _BINARY_HEAP
#include "Heap.h"
template <class T>
class BinaryHeap : public virtual Heap<T>
{
public:
T *data;
BinaryHeap()
{
data = new T[MAX_NODE_COUNT];
}
~BinaryHeap()
{
delete data;
}
void min_heapify(int i)
{
int l = 2 ... | true |
86839179a9fa6c6a7a58b118ef60b28c41fb404d | C++ | amsraman/Competitive_Programming | /Facebook Hacker Cup/2021/Qualification Round/A1.cpp | UTF-8 | 868 | 2.78125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int t, n;
string s;
bool vowel(char c) {
return (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
}
int main() {
freopen("consistency_chapter_1_input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
cin >> t;
for(int _ = 1; _ <= t; _+... | true |
c642dfbae7509d1ac0de5cdc7982f972432838cf | C++ | dmkz/competitive-programming | /codeforces.com/Codeforces Ladder 1500-1599 (extra)/0486A.cpp | UTF-8 | 383 | 2.78125 | 3 | [] | no_license | /*
Problem: 486A. Calculating Function
Solution: implementation, math, O(1)
Author: Dmitry Kozyrev, github: dmkz, e-mail: dmkozyrev@rambler.ru
*/
#include <iostream>
#include <string>
#include <algorithm>
typedef long long ll;
int main() {
ll n; std::cin >> n;
if (n % 2 == 0) {
st... | true |
9d03c02b65a6b1187dc273c2635f560bed5606f2 | C++ | Evildea/DinosaurGame | /TheGame/T2.h | UTF-8 | 936 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Renderer2D.h"
#include "Global.h"
#include <math.h>
#include "V2.h"
#include "M3.h"
// The function of the T2 (Target Vector2) is to provide a target in 2D space to look towards or travel towards.
// This is primarily used to ensure that head of the dinosaur rotates smoothly between targets.
cl... | true |
bbcbe87db46871dab6a02dab03b6ef997e777de8 | C++ | geniusthomas3/practice | /unitsoft/triangle/main.cpp | UTF-8 | 1,639 | 2.65625 | 3 | [] | no_license | #include <stdio.h>
int n;
int arr[100][2];
int max=0;
int main(){
freopen("triangles.in","r",stdin);
freopen("triangles.out","w",stdout);
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d",&arr[i][0],&arr[i][1]);
}
int tmp;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
... | true |
034ea6a8ab03c6f13326ca34ee87d7dbbd962c9f | C++ | ninegrafh/perulangan | /materi_4_latihan_1_arif_sidik_permana.cpp | UTF-8 | 508 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int i=1,j=1;
for (int i=1;i<5;i++)
{
cout << "menjalankan perulangan dengan for, nilai i = " <<i<< endl;
}
while(i<5)
{
cout << "Perulangan dengan While, nilai i = " <<i<< endl;
i=... | true |
40c55c396f409bf1f2663acb4deffadcab6cffa8 | C++ | GreenApple-jsy/Algorithm | /조교의 성적 매기기.cpp | UTF-8 | 1,242 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int T, N, K;
cin >> T;
for (int i = 1; i <= T; ++i) {
vector <pair <int, int> > score; // <총점, 학생 번호>
cin >> N >> K;
for (int j = 1; j <= N; ++j) {
int mid, fin, work;
cin >> mid >> fin >> work;
score.push_ba... | true |
15e1aad9364b7ee2c66e7295674f2c66aa9493f9 | C++ | alyssais/RadixEngine | /source/env/LegacyEnvironment.cpp | UTF-8 | 1,463 | 2.921875 | 3 | [
"Zlib"
] | permissive | #include <radix/env/LegacyEnvironment.hpp>
#include <iostream>
#include <radix/core/file/Path.hpp>
#include <radix/env/Util.hpp>
#include <radix/env/OperatingSystem.hpp>
namespace radix {
Config LegacyEnvironment::config;
std::string LegacyEnvironment::dataDir = "";
void LegacyEnvironment::Init() {
if (dataDir.... | true |
cac11105b38d4c7500ef7875887977da89483db8 | C++ | rider0004/Exam2_rider0004 | /pracex2_3.cpp | UTF-8 | 524 | 3.171875 | 3 | [] | no_license | #include<iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
char alphabet[8][8];
void showAlphabet();
void randomAlphabet();
int main(){
srand(time(0));
randomAlphabet();
showAlphabet();
}
void showAlphabet(){
for(int i = 0; i < 8; i++){
for(int j = 0; j < 8; j++){
cout << alphabet[i][j] <<... | true |
77379072312f1d183a19731be36ed5f12344842c | C++ | Meantint/Programmers | /Lv3/풍선 터트리기.cpp | UTF-8 | 1,388 | 3.140625 | 3 | [] | no_license | #include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int solution(vector<int> a)
{
int answer = 2;
vector<int> left(a.size());
vector<int> right(a.size());
left[0] = a[0];
right.back() = a.back();
for (int i = 1; i < left.size(); ++i... | true |
a6fd7199695efc1a9794eb48e756a3e7ad45fa6c | C++ | the-night-wing/SP-2 | /rgr/PTOC/ARRAY.H | UTF-8 | 13,926 | 2.875 | 3 | [] | no_license | #ifndef __ARRAY_H__
#define __ARRAY_H__
#ifdef __cplusplus
#define BETWEEN(down, value, up) \
(unsigned(value) - down <= unsigned(up - down))
template<class Type>
class var_conf_array;
template<class Type>
class var_conf_matrix;
template<class Type>
class conf_array {
protected:
integer... | true |
52d7b183807887eb274a42c81204a2bf666f8a29 | C++ | Demorro/AMG_Teaching_Repo | /AMG Teaching/Camera.h | UTF-8 | 1,738 | 2.78125 | 3 | [] | no_license | #pragma once
#include "SFML\Graphics.hpp"
#include <iostream>
#include <sstream>
#include "Assets.h"
#include "pugixml.hpp"
#include "VectorMath.h"
#define DEBUG_CAMERA false
class Camera
{
public:
Camera(void);
Camera(sf::RenderWindow &window,sf::Vector2f startPositionOffset);
~Camera(void);
//You can pass in n... | true |
aa49732ec84b1c2fce29b087a3f9c4dda997f358 | C++ | casper-h/Interview | /LeetCode/Medium/1249.cpp | UTF-8 | 1,008 | 3.828125 | 4 | [] | no_license | /*
* 1249. Minimum Remove to Make Valid Parentheses
*/
#include <iostream>
#include <string>
#include <stack>
using std::string;
using std::stack;
class Solution {
public:
string minRemoveToMakeValid(string s) {
// This is similar to checking parentheses in general
stack<int> invalid;
for ... | true |
0f37ef39d66d6a26578a15a28082f7fd43509e4d | C++ | Azrrael-exe/sda-poo | /lib/circular/include/circular.h | UTF-8 | 386 | 2.8125 | 3 | [
"MIT"
] | permissive | #ifndef CIRCULAR
#define CIRCULAR
class CircularBuffer {
protected:
int in_index;
int out_index;
int* list;
int size;
int free_slots;
public:
CircularBuffer(){};
CircularBuffer(int size);
bool add(int value);
int remove();
int inIndex();
int outIndex();
int freeSlots();
... | true |
4043e60617a3e8ad38b68e3697b7ca07bda8425d | C++ | Hayden-Allen/COGA | /src/coga/util/indexed_list.h | UTF-8 | 2,197 | 3.03125 | 3 | [] | no_license | #pragma once
#include "pch.h"
#include "typed.h"
#include "functions.h"
namespace coga
{
template<typename T, typename RETURN = size_t, typename ADD = const T&, typename REMOVE = const RETURN&>
class indexed_list : public typed<T>
{
public:
typedef RETURN handle;
indexed_list(size_t count, const T& placeholde... | true |
06e000d430f43dd68703b437dcb1ad551fe7959e | C++ | DoubleQ0726/TinyServer | /src/config.cpp | UTF-8 | 3,168 | 2.796875 | 3 | [] | no_license | #include "config.h"
#include "env.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
namespace TinyServer
{
static Ref<Logger> logger = TINY_LOG_NAME("system");
Ref<ConfigVarBase> Config::LookupBase(const std::string& name)
{
RWMutexType::ReadLockGuard lock(GetMutex());
auto iter = GetDatats... | true |
a2142683b9d10acd7a052c62e0c7f9a2ce88bd3b | C++ | gjbex/Scientific-C-plus-plus | /source-code/DesignPatterns/StrategyPattern/automaton_runner.cpp | UTF-8 | 1,269 | 3.109375 | 3 | [
"CC-BY-4.0"
] | permissive | #include "automaton_runner.h"
AutomatonRunner::AutomatonRunner(uint8_t rule_nr) {
for (uint8_t i = 0; i < rules.size(); ++i) {
rules[i] = rule_nr % 2;
rule_nr /= 2;
}
}
Automaton AutomatonRunner::next_generation(const Automaton& automaton) {
uint8_t idx;
size_t nr_cells {automaton.size... | true |
22ad5672e98e12ab17b5101fcb1473d53deb2c65 | C++ | harshu175/DS-algos-using-cpp | /Array1/FirstLast.cpp | UTF-8 | 953 | 3.3125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int FirstInd(int arr[],int n,int d){
int f = -1;
int low = 0;
int high = n-1;
while(low<=high){
int mid = (low+high)/2;
if(d>arr[mid]){
low = mid+1;
}
else if(d<arr[mid]){
high = mid-1;
}
els... | true |
1da330446ec74a6882e3ff3074bc385ac70cf386 | C++ | Jabalov/Algorithms-And-DS-Implementations | /UCSD/C1/week2_algorithmic_warmup/2_last_digit_of_fibonacci_number/fibonacci_last_digit.cpp | UTF-8 | 789 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
long long get_fibonacci_last_digit_naive(long long n)
{
if (n <= 1)
return n;
long long previous = 0;
long long current = 1;
for (long long i = 0; i < n - 1; ++i)
{
long long tmp_previous = previous;
previous = cu... | true |
06ca35f2ff99db17e829b9dbc1b167635ea3da87 | C++ | cmariemarty/Galaga | /EnemyShip.h | UTF-8 | 4,867 | 2.90625 | 3 | [] | no_license | /*
* Author: PlayersX (Claire Williams, Lizette Martinez,
Christina Martinez, Taylor Robinett)
* Assignment Title: Galaga_Project
* Assignment Description: This program is a recreation of the
* vintage shooter, Galaga.
* Due Date: 4/25/2018
* Date Created: 4/7/2018
* Date Last Modified... | true |
b96c04012a9be676e7546f31ee52e66980cd75ca | C++ | MadRoboticist/Arduino | /SerialBridge/SerialBridge.ino | UTF-8 | 221 | 2.65625 | 3 | [] | no_license |
#define BAUD 230400
#define PORT Serial1
void setup() {
Serial.begin(BAUD);
PORT.begin(BAUD);
}
void loop() {
if(Serial.available()) PORT.write(Serial.read());
if(PORT.available()) Serial.write(PORT.read());
}
| true |
d8c23f0a38bff61b672e43e515dd0f5cf1971084 | C++ | zouwx2cs/JianZhiOffer | /Solutions/054.字符流中第一个不重复的字符/Solution2.cpp | UTF-8 | 678 | 2.984375 | 3 | [] | no_license | class Solution
{
private:
int cnts[128] = {0, } ;
int posFrist[128] = {0, } ;
int pos = 1 ;
public:
//Insert one char from stringstream
void Insert(char ch)
{
if (cnts[ch]++ == 0)
posFrist[ch] = pos ;
++pos ;
}
//return the first appearence once char in c... | true |
44b9dfd0957ea73bf481fd4094bfbc54104b349b | C++ | wintel2014/LinuxProgram | /Compile_Link/wrap_symbol/malloc.cpp | UTF-8 | 1,022 | 2.65625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
/*
--wrap=symbol
Use a wrapper function for symbol. Any undefined reference to symbol will be resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be resolved to symbol.
This can be used to provide a wrapper for a system function. The wrapper fu... | true |
ac539d66b5fd2a275bad5452d2e10072daafd181 | C++ | JiaqiJin/Cplusplus_Project | /Project/Project/Multithread/lock_guard.cpp | UTF-8 | 3,275 | 3.484375 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <thread>
#include <mutex>
using namespace std;
/*
Mutex
lock unlock
lock_guard template = lock_guard 构造函数里执行了mutex::lock(); 析造函数里执行了 mutex::unlock lock_guard 不灵活
死锁deadlock = 是俩个锁头也就是俩个互斥量(mutex)才能产生,俩个线... | true |
ff38d98a9603d9e9b3d796127b0b4d891a607355 | C++ | Lawrencemm/LM-Engine | /lmng/include/lmng/name.h | UTF-8 | 633 | 2.640625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <string>
#include <entt/entt.hpp>
namespace lmng
{
struct name
{
std::string string;
};
inline std::string get_name(entt::registry const ®istry, entt::entity entity)
{
auto name_component = registry.try_get<name>(entity);
return name_component ? name_component->string
... | true |
173492bf8acdfc0fcb0bb16a8ece332b51a3219b | C++ | yvxiang/POJ | /1936.cpp | UTF-8 | 475 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *q,*p,*r;
bool check(char ch,char *dst)
{
while(*dst) {
if(*dst==ch) {
r=dst+1;
return true;
}
dst++;
}
return false;
}
int main()
{
char s[100002],t[100002];
p=s;
q=t;
while(scanf("%s%s",s,t)!=EOF) {
p=s;
q=t;
r=q;
bool flag=tru... | true |
5d582fb0a5facf05b2e7c76cd39abe33e66ebc90 | C++ | AnthonyZhai/STL_Customed | /List/List_Dynamic.cpp | UTF-8 | 1,989 | 3.609375 | 4 | [] | no_license | #include "List_Dynamic.h"
#include <cassert>
using namespace std;
template <class T>
List_Dynamic<T>::List_Dynamic(int maxSize):size(0),capacity(maxSize)
{
List_Array=new(nothrow) T[maxSize];
assert(List_Array!=0);
}
template <class T>
List_Dynamic<T>::List_Dynamic(const List_Dynamic<T>& right)
:size(right.size),cap... | true |
ad3dd580e02ea723f9922303c23ef32c91810cf2 | C++ | Pawel0/Sortowania | /main.cpp | UTF-8 | 3,855 | 3.125 | 3 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <time.h>
#include <unistd.h>
using namespace std;
void rysuj( int tab[], int size )
{
for( int i = 0; i < size; i++ )
{
cout<<tab[i]<<" ";
}
cout<<endl;
}
void Bombelkowe( int tab[], int size )
{
for( int i = 0; i < size; i++ )
{
for( int j ... | true |
0301214fc838149205468529e4f0a8a61d8cf216 | C++ | AustinHerman95/AGameAboutNothing | /enemy.h | UTF-8 | 634 | 2.578125 | 3 | [] | no_license | #pragma once
#include <SFML\Graphics.hpp>
#include "animate.h"
#include "player.h"
#include <cmath>
class Enemy: public Animate
{
public:
Enemy();
Enemy(const std::string &name, sf::Vector2i dimensions, sf::Vector2f mPosition);
void path(sf::FloatRect* pMoveBox, sf::Clock* clock);
int findPlayer(sf::FloatRect* pM... | true |
f93d96d0167cf9d6ee332e2703dde02c5351c892 | C++ | shh1473/Sunrin_Engine_2019 | /Direct3D_11/Sunrin_Engine_D3D11/Engine/SR_GameScene.h | UTF-8 | 2,412 | 2.578125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "SR_Entity.h"
#include "SR_UI.h"
#include "SR_UpdateExecutor.h"
#include "SR_RenderExecutor.h"
#include "SR_ResourceGenerator.h"
namespace SunrinEngine
{
class SR_GameScene : public SR_NonCopyable
{
public:
explicit SR_GameScene(const std::wstring & name);
virtual ~SR_GameScene();
vir... | true |
97caa13a3e05462873f49fae88c60c101187fbc7 | C++ | krayong/Data-Structures-and-Algorithms | /BinaryTree/check_mirror.cpp | UTF-8 | 3,655 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | #include <bits/stdc++.h>
using namespace std;
/*************************************************************************************************************
*
* Link : https://practice.geeksforgeeks.org/problems/check-mirror-in-n-ary-tree/0
* Description:
Given two ... | true |
e1f91db692f726a6048bd8d02ceb398572338ff7 | C++ | spiderxm/Competitive-Coding | /DataStructures/Linked list/remove_kth_node_from_end.cpp | UTF-8 | 1,202 | 3.515625 | 4 | [] | no_license | //
// Created by Mrigank Anand on 05/09/20.
//
#include<iostream>
#define ll long long
using namespace std;
class node {
public:
node *next;
ll data;
node(ll d) {
data = d;
next = NULL;
}
};
void insertion_at_tail(node *&head, int d) {
if (head == NULL) {
head = new node... | true |
653d4fc725622d21b6c7323753bf79c118b50665 | C++ | shanodis/Beakout-Arkanoid-SFML-2.x | /Arkanoid SFML/src/Blocks.h | UTF-8 | 484 | 2.546875 | 3 | [] | no_license | #include "Engine.h"
class Blocks
{
protected:
unsigned int totalBlocks;
float blockX, blockY;
Texture blockTextureBlue, blockTextureYellow, blockTextureGreen;
private:
Vector2f middleScreen;
private:
void Level1();
void Level2();
void Level3();
void onlineLevel();
public:
Sprite **blockSprite;
Sprite **ve... | true |
51ea9942a62b101925e97df0be52067356c678ee | C++ | GriciuGriger/rzutUkosny | /Cialo.cpp | UTF-8 | 1,847 | 3.125 | 3 | [] | no_license | #include "Cialo.h"
#include <iostream>
#include <iomanip>
#include <windows.h>
#include <math.h>
#define g 9.81
Cialo::Cialo(std::string name)
{
this->name = name;
this->w_predkosci = new WektorPredkosci(0.0, 0.0, 0.0);
this->w_polozenia = new Wektor(0.0, 0.0, 0.0);
}
void Cialo::nadajPredkosc(Wektor *wp... | true |
e336a04f3245735e14546410a9f078e2e78859ac | C++ | Ceyword/ssdb | /src/proc_queue.cpp | UTF-8 | 1,878 | 2.53125 | 3 | [] | no_license | /* queue */
static int proc_qsize(Server *serv, Link *link, const Request &req, Response *resp){
if(req.size() < 2){
resp->push_back("client_error");
}else{
int64_t ret = serv->ssdb->qsize(req[1]);
if(ret == -1){
resp->push_back("error");
}else{
char buf[20];
sprintf(buf, "%" PRIu64 "", ret);
res... | true |
046ad04e8151c95ec50098a908d15682fe2b7e24 | C++ | wjddlsy/Algorithm | /Baekjoon/baek_11969_BreedCounting/main.cpp | UTF-8 | 709 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N, Q;
cin>>N>>Q;
vector<int> one(N+1, 0), two(N+1, 0), three(N+1, 0);
for(int i=1; i<=N; ++i){
int a; cin>>a;
if(a==1)
one[i]=1;
e... | true |
2b2225f5ef8813b4a9468d871819e79fead679d1 | C++ | Arnknee/ArduinoPong | /ArduinoPong/graphics.h | UTF-8 | 367 | 2.75 | 3 | [] | no_license | #ifndef GRAPHICS_H
#define GRAPHICS_H
#include <SDL.h>
class Graphics
{
public:
Graphics(int screenwidth, int screenheigth);
~Graphics();
void flip();
void clear();
SDL_Renderer * getRenderer();
int getScreenHeigth();
int getScreenWidth();
private:
SDL_Window* _window = NULL;
SDL_Renderer* _renderer = NU... | true |
9b7e462d78bd5af2056a6db548cffee33e3facb6 | C++ | mrlous2789/Project | /ProjectDibenaySDL/Province.cpp | UTF-8 | 1,791 | 2.609375 | 3 | [] | no_license | #include "Province.h"
namespace Mer
{
Province::Province()
{
provinceBorders = SDL_CreateRGBSurface(0, 1920, 1080, 32, 0, 0, 0, 0);
pixels = (Uint32*)provinceBorders->pixels;
format = provinceBorders->format;
}
Province::Province(std::string id, Uint8 red, Uint8 green, Uint8 blue, int screenWidth, int screenH... | true |
60d4fed9fb25dbe94000d21c08dce84c0fcffaed | C++ | SurimYuk/Algorithm | /_BAEKJOON/11652_카드.cpp | UTF-8 | 555 | 2.6875 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
map<long long, int> m;
map<long long, int>::iterator it;
int main(void) {
int n;
long long num;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> num;
m[num]++;
}
int max = -1;
long long maxNum = -1;
... | true |
3ab6156d51882e301789c2ec8a6c4079664fdc36 | C++ | DanyYanev/SchoolDiary | /functions/add_to_file.cpp | UTF-8 | 804 | 2.9375 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<fstream>
#include"../headers/student.h"
using namespace std;
void addToFile(string fname){
Employee s;
ofstream ofs;
ofs.open(fname.c_str(), ios_base::app);
while(1){
cout << "Enter name: ";
string name = "";
cin >> name;
if(!name.compare("none")){
... | true |
c7180213942bf1a4fc35ec2b161f0137a847d164 | C++ | Darthron/Algorithms | /Problems/Educational Round 1/6.cpp | UTF-8 | 3,490 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <vector>
const double INF = 1 << 30;
struct Line
{
// y = a * x + b;
double a;
double b;
double& x = a;
double& y = b;
Line(double p,
double q)
: a(p),
b(q)
{
}
Line()
{
}
};
struct Segment
{
Line line;
... | true |
5937df275fc614e806118c3ad0d01a4a67e334d5 | C++ | bhupkas/Backup | /programs/codes/codeforces/practice/190d2_2.cpp | UTF-8 | 570 | 2.875 | 3 | [] | no_license |
#include <stdio.h>
#include <math.h>
int main()
{
int x1,y1,r1,x2,y2,r2;
while (scanf("%d%d%d%d%d%d",&x1,&y1,&r1,&x2,&y2,&r2)==6)
{
int delta1=(r2+r1)*(r2+r1);
int delta2=(r2-r1)*(r2-r1);
int delta3=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
if (delta3>=delta1)
{
... | true |
3f0a5909af13f831c6b794f50e2f22b2d5f9b8cb | C++ | Hyeongho/Academic_Materials | /C++ 5주차/과제 해설/Number.h | UTF-8 | 252 | 2.765625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <algorithm>
using namespace std;
class Number
{
int size;
float *arr;
public:
Number();
Number(int _size);
~Number();
void SetArr();
void Print();
float Max();
float Min();
float Average();
}; | true |
8cc9b4c4360afa40da887661aa775e1ac16ac305 | C++ | happyj/e4c | /tests/generation-tests/widgetsmm/Property.cpp | UTF-8 | 904 | 2.5625 | 3 | [] | no_license |
#include "Property.hpp"
#include <widgetsmm/WidgetsmmPackage.hpp>
using namespace widgetsmm;
/*PROTECTED REGION ID(widgetsmm::Property include) START*/
/*PROTECTED REGION END*/
Property::Property() :
m_name(),
m_value()
{
/*PROTECTED REGION ID(Property constructor) START*/
/*PROTECTED REGION END*/
}... | true |
d048ad06f27d211e480a6dc96dc58cfa43cddad7 | C++ | Marc--Olivier/presentations | /cpp_in_brussels_2017-05-16/boost_graph_library/code/src/tests/testGraph.cpp | UTF-8 | 1,944 | 3.453125 | 3 | [] | no_license | #include <catch.hpp>
#include "Graph.hpp"
#include "tests/utils.hpp"
namespace test {
SCENARIO("create graph", "[boost::adjacency_list]") {
GIVEN("an empty graph G") {
Graph g;
WHEN("add 5 vertices and 5 edges to G") {
buildGraph(g);
THEN("G has 5 vertices and 5 edges")... | true |
fd36903a848dfa576331f53def5d4515b90fb5d1 | C++ | novikov-ilia-softdev/thinking_cpp | /tom_1/chapter_15/26/ostack.h | UTF-8 | 594 | 3.375 | 3 | [] | no_license | #ifndef OSTACK_H
#define OSTACK_H
class Object{
public:
virtual ~Object() = 0;
};
inline Object::~Object() {}
class Stack{
public:
Stack() : head_( 0) {}
~Stack()
{
while( head_)
{
delete pop();
}
}
void push( Object* dat)
{
head_ = new Link( dat, head_);
}
Object* pop()
{
if( !head_)
ret... | true |
1f2c1ef8ef4b204cd1bc8906c54d5df912b653fd | C++ | pallavigudipati/deluminator | /Project-Euler/lcm.cpp | UTF-8 | 356 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
main() {
unordered_set<int> fac2 = 0;
int fac3 = 0;
int fac5 = 0;
int fac7 = 0;
int fac11 = 0;
int fac13 = 0;
int fac17 = 0;
int fac19 = 0;
for (int i = 11; i <= 20; ++i) {
}
}
11
12 - 2 2 3
13
14 - 2 7
15 - 3 5
16 - 2... | true |
8fa0da73e7ad9b7327010e013c8ef5574b6dbda5 | C++ | OfficerGrag/testingOut | /stats/stats.cpp | UTF-8 | 1,473 | 3.625 | 4 | [] | no_license |
#include <iostream>
#include <vector>
float calcMean(std::vector<int> & numbers, std::vector<float> & probs, int number) {
float value{};
for (int i = 0; i < number; i++) {
value += (numbers[i] * probs[i]);
}
return value;
}
void expectedMeanDisRand() {
std::cout << "How many numbers? ";
... | true |
959baaa457d14c5a5c3b8685cc330e1763159929 | C++ | AvansTi/TMTI-DATC-Voorbeelden | /Week6/AsyncExample/ClassA.h | UTF-8 | 430 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | #pragma once
class BaseClass {
public:
BaseClass() {
data = new int[100];
}
~BaseClass() {
if (data != nullptr) {
delete[] data; data = nullptr;
}
}
BaseClass(const BaseClass&) {
if (data != nullptr) {
}
}
virtual void DoSomething() = 0;
private:
int* data;
};
class ClassB : public BaseCl... | true |
37d7092d5b3178171228ba781723e9ba562857fb | C++ | rtlessly/RTL_Motors | /Test/StepperMotor4_RunToPosition_Test/StepperMotor4_RunToPosition_Test.ino | UTF-8 | 1,404 | 2.671875 | 3 | [] | no_license | //
// Shows how to run AccelStepper in the simplest,
// fixed speed mode with no accelerations
/// \author Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2009 Mike McCauley
// $Id: ConstantSpeed.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
#define DEBUG 1
#include <Debug.h>
#include <StepperMotor_4.h>
Step... | true |