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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51df85aaffd6e34c05f59ae0e6275e3cfaa7a4fd | C++ | wrongway88/RemoteMouse | /src/framework/MainLoop.cpp | UTF-8 | 320 | 2.640625 | 3 | [] | no_license | #include "MainLoop.h"
MainLoop::MainLoop(BaseApplication* baseApplication):
m_application(baseApplication)
{}
MainLoop::~MainLoop()
{}
void MainLoop::run()
{
bool run = true;
m_application.setup();
while(run)
{
m_application.update();
run = m_application.getKeepRunning();
}
m_application.shutdown();
} | true |
4ce224ccc4099e5f6fd8da5a8fbff25b2354c0c4 | C++ | King00s/OJ100 | /快速排序.cpp | GB18030 | 956 | 3.296875 | 3 | [] | no_license | #include<bits/stdc++.h>
void swap(int& a, int& b) {
int t = b;
b = a;
a = t;
}
void quicksort(int a[], int start, int end){
if(end>start){
// ѡһΪ
int part=rand()%(end-start)+start;
int divide=a[part];
//
swap(a[start], a[part]);
int i = start;
int j = i+1;
whi... | true |
568af684d423ceaeb5cf0a94d3eaf85d396982d7 | C++ | Ilgrim/PandaSDL | /src/ai/behaviour_tree/nodes/combiners.h | UTF-8 | 1,057 | 2.65625 | 3 | [
"MIT"
] | permissive | #ifndef __pandasdl_behaviourtree_combiners_h__
#define __pandasdl_behaviourtree_combiners_h__
#include "base.h"
namespace PandaSDL::BehaviourTree
{
/*
Run all children, waiting on each to complete, regardless of their success
*/
class Combiner : public BehaviourTreeNode
{
public:
... | true |
4013dd23138f2f517a207adbf0a9d376d552cd23 | C++ | ixan29/MathSolver | /Utils.cpp | UTF-8 | 8,775 | 3.125 | 3 | [] | no_license | #include "Utils.h"
#include "ConstFunction.h"
#include "VarFunction.h"
#include "SumFunction.h"
#include "MulFunction.h"
#include "DivFunction.h"
#include "PowFunction.h"
#include "LogFunction.h"
#include "SinFunction.h"
#include "CosFunction.h"
#include "TanFunction.h"
#include "MatrixFunction.h"
#include <cstring>
... | true |
e0250e03d524b13b43a4c4259b6206e0dde881bb | C++ | ovieira/pavement | /projects/pavement/src/Canvas.cpp | UTF-8 | 4,356 | 2.765625 | 3 | [] | no_license | #include "Canvas.h"
Canvas::Canvas() {
_camera = new Camera(glm::vec3(0.0 , 5.0, 5.0), glm::vec3(0.0, 0.0, 0.0), glm::vec3(0.0, 1.0, 0.0), new Camera::Perspective(30.0f, 1.0f, 2.0f, 20.0f));
_linesNr = 40;
_interval = 0.25f;
generateGrid();
}
Canvas::~Canvas() {
}
void Canvas::generateGrid() {
glm::vec4 startV... | true |
5416547f2fcddb3862b1d98d344e55648e2b0d5f | C++ | midorae/LastSubString | /main.cpp | UTF-8 | 998 | 3.390625 | 3 | [] | no_license | //
// main.cpp
// LastSubstring
//
// Created by 이창기 on 2016. 11. 21..
// Copyright © 2016년 이창기. All rights reserved.
//
#include <iostream>
using namespace std;
string lastSubstring(string s);
int main(int argc, const char * argv[])
{
string str;
string lastSubstr;
cout << "Input Your Str... | true |
f2b625b0945b4e5c5e88ff0fb67c0a389bd07b72 | C++ | VillaJuan/VillalpandoJuan_40107 | /Hmwk/Assignment 2/Gaddis_8thEd_Ch3_Prob1_MPG/main.cpp | UTF-8 | 1,393 | 3.390625 | 3 | [] | no_license | /*
* File: main.cpp
* Author: Juan Villalpando
* Created on January 12, 2016, 1:02 PM
* Purpose: Write a program that calculates a car’s gas mileage. The program should ask the user
to enter the number of gallons of gas the car can hold and the number of miles it can
be driven on a full tank. It should then dis... | true |
44d3f05790b0ac1d69aeb428a652a45970a2e7f0 | C++ | kaustubh-pandey/Competitive-Programming | /CodeChef/SSEC-2/prime.cpp | UTF-8 | 1,656 | 2.71875 | 3 | [] | no_license | #include<bits/stdc++.h>
#define ll long long
#define xll __int128
#define fo(i,n) for(int i=0;i<n;i++)
#define rfo(i,n) for(int i=n-1;i>=0;i--)
#define Fo(i,q,n) for(int i=q;i<n;i++)
#define rFo(i,q,n) for(int i=n-1;i>=q;i--)
#define fO(i,n,k) for(int i=0;i<n;i+=k)
#define FO(i,q,n,k) for(int i=q;i<n;i+=k)
#define zero... | true |
73defa2f1073ee276254c9800a37d32b67f286dc | C++ | thejesusbr/GPU-Color2Gray | /image_io.cpp | UTF-8 | 4,435 | 2.953125 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <map>
#include "images.h"
//return variables for fscanf and fread to keep the compiler happy
static int ret = 0;
static size_t bytesRead = 0;
sven::rgb *readPPM(const char *filename, int *cols, int *rows, int * colors)
{
using sven::rgb;
char tag[40];
rgb *image;
FI... | true |
9b80356106019ba5bdc6cc4b4e1eb8b8406d5532 | C++ | natalielisha1/Reversi-c- | /Reversi/src/server/src/JoinCommand.cpp | UTF-8 | 1,188 | 2.828125 | 3 | [] | no_license | /***************************************
* Student Name: Ofek Segal and Natalie Elisha
* Student ID: 315638288, 209475458
* Exercise Name: Ex7
**************************************/
#include "JoinCommand.h"
using namespace std;
/***************************************
* Function Name: joinCommand (Constructor)... | true |
442b42b1ea295ad6f9dceb00cc3e4fdfdebbed19 | C++ | flowerfx/ColorLockPuzzle | /cocos2D/Lib/XFlatformCorePackage/WCP/src/WindowsCorePackage.Shared/SecureStorageManager/ISingleton.h | UTF-8 | 677 | 2.96875 | 3 | [] | no_license | #pragma once
namespace WCPToolkit
{
template<typename T>
class ISingleton
{
protected:
inline explicit ISingleton<T>(){}
inline ISingleton(const ISingleton&){}
inline ISingleton& operator=(const ISingleton&){}
virtual ~ISingleton(){}
public:
static void CreateInstance()
{
if (ms_pInstance == nullpt... | true |
d51ea578911adc375cf439cc1624927cd30f6805 | C++ | QuteSaltyFish/singleLinkList | /singleLinkList/main.cpp | UTF-8 | 4,773 | 3.65625 | 4 | [] | no_license | //
// main.cpp
// singleLinkList
//
// Created by Mingke Wang on 2018/9/30.
// Copyright © 2018年 Mingke Wang. All rights reserved.
//
#include <iostream>
#include <list>
using namespace std;
template <class elemType>
class sLinkList:public list<elemType>
{
template <class T> friend sLinkList<T> operator+(c... | true |
21fe5f68102b22a9b2972448a58d0f32b28a88d1 | C++ | Susuo/rtilabs | /files/asobiba/filer/SolvablePathWeb.cpp | SHIFT_JIS | 2,083 | 3.0625 | 3 | [] | no_license | // SolvablePathWeb.cpp: SolvablePathWeb NX̃Cve[V
//
//////////////////////////////////////////////////////////////////////
#include "comm.h"
#include "SolvablePathWeb.h"
#include "SolvablePathSpecialFolder.h"
#include "MultiString.h"
//////////////////////////////////////////////////////////////////////
// \z/
//////... | true |
987867f38160e06e2dd8067cc864a5d9fecc04fc | C++ | LuckyDmitry/devtools-course-practice | /modules/polygon_area/test/test_polygon.cpp | UTF-8 | 3,152 | 3.15625 | 3 | [
"CC-BY-4.0"
] | permissive | // Copyright 2020 Loogin Mikhail
#include <gtest/gtest.h>
#include <utility>
#include <vector>
#include "include/polygon_engine.h"
using Point = polygon_engine::Point;
using Polygon = polygon_engine::Polygon;
/*
1. throw_in_isConnectedness_when_tops_count_less_3
2. throw_in_getPerimeter_when_tops_count_less... | true |
25aa08d5e96c124e5a8f5af6aff24bd6a58e95f6 | C++ | karlnapf/shogun | /src/shogun/lib/SGStringList.h | UTF-8 | 2,105 | 2.84375 | 3 | [
"BSD-3-Clause",
"DOC",
"GPL-3.0-only"
] | permissive | /*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Soeren Sonnenburg, Sergey Lisitsyn, Thoralf Klein, Yuyu Zhang,
* Bjoern Esser
*/
#ifndef __SGSTRINGLIST_H__
#define __SGSTRINGLIST_H__
#include <shogun/lib/config.h>
#include <shogun/lib/common.h>
#include <sh... | true |
460fc42b8ee1cfcab2c893aadfb591794db853d4 | C++ | danielmevi/DMV_References | /scheduler_one_thread_experiment/Experiment_PImpl.cpp | UTF-8 | 856 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <functional>
bool foo1(int, double){
std::cout << __PRETTY_FUNCTION__ << '\n';
return true;
}
bool foo2(int, int){
std::cout << __PRETTY_FUNCTION__ << '\n';
return false;
}
template <class T>
struct Event {
Event(T callback) : callback_{reinterpret_cast<void*>(call... | true |
af0718013e04fd1547aadbb46322f03118157328 | C++ | SOPT-ALPPO/ALPPO-4z7l | /Implementation/BOJ 3190.cpp | UTF-8 | 1,134 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int n, k, L;
int board[101][101] = { 0, };
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
struct pos{
int x, y;
};
int main()
{
cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false);
cin >> n >> k;
int a, b;
for (int i... | true |
9e41be90b13158feb49d9fd76b65b299ecd5f77e | C++ | ya-ming/boost-asio | /tutorial/13-daytime-async-TCP-UDP-server.cpp | UTF-8 | 7,386 | 3.0625 | 3 | [] | no_license | #include <ctime>
#include <iostream>
#include <string>
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/asio.hpp>
#include <boost/enable_shared_from_this.hpp>
using boost::asio::ip::tcp;
using boost::asio::ip::udp;
std::string make_daytime_string()
{
... | true |
c61b3564a736c9ffcb02872cb2cbf8b983c98ec4 | C++ | SoMa-Project/vision | /thirdparty/GeometricTools/WildMagic5/LibCore/DataTypes/Wm5Tuple.h | UTF-8 | 1,601 | 2.59375 | 3 | [
"BSD-2-Clause-Views"
] | permissive | // Geometric Tools, LLC
// Copyright (c) 1998-2014
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.3 (2012/03/09)
#ifndef WM5TUPLE_H
#define WM5TUPLE_H
#include "Wm5C... | true |
8b0cad4b70f42f01e03a76809af965b7487abf10 | C++ | simply-software/Aquanaut | /Aqua/observation.h | UTF-8 | 1,437 | 3.03125 | 3 | [] | no_license | #pragma once
#include <algorithm>
#include <string>
#include "convert_from_string.h"
#include "datetime.h"
#include "parse_csv_record.h"
namespace aqua {
struct observation final {
using temperature_t = double;
observation() = default;
observation(const observation&) = default;
... | true |
dbd1a5e9d9d833479eae57278b649f0a85b0c2d3 | C++ | lighingyang/OS | /进程管理.cpp | UTF-8 | 6,597 | 2.921875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
/*
描述:可允许进程最大数量
*/
const int maxn = 10010;
/*
描述:实际到来进程数量
*/
int n;
/*
描述:进程的声明
*/
struct process;
/*
描述:进程PCB的声明
*/
struct PCB;
/*
功能:就绪队列
*/
queue<int> q1;
/*
功能:阻塞队列
*/
queue<int> q2;
/*
功能:进程PCB
*/
struct PCB{
int id;//进程id
int cls;//进程等级
int come;//进程到来时间
... | true |
821dfcd18e6f915084b2090d58de0c78f0c355b0 | C++ | SeanCST/Algorithm_Problems | /LeetCode/069_x的平方根.cpp | UTF-8 | 850 | 3.40625 | 3 | [] | no_license |
class Solution {
public:
int mySqrt(int x) {
if(x <= 1) {
return x;
}
int min = 0, max = x;
while(max > min + 1) {
int m = (max + min) / 2;
if(x / m < m) {
max = m;
} else {
min = m;
... | true |
43ae528a4a938f54ab17754024225423a0974fab | C++ | Tonyvitamin/Algorithm_HW3 | /algo_hw3.hpp | UTF-8 | 1,795 | 3.25 | 3 | [] | no_license | // change this to your id
static const char* student_id = "0416001";
// do not edit prototype
void LCS(int *, int*, int*);
// X,Y are input strings, C is answer string
//
// data structure :
// length of array X is m+1, length of array Y is n+1, length of array C is m+n
// X[0] = m+1, Y[0] = n+1,
// all ... | true |
925f678eb31c07be8cfc56970b49016a54b5c3dd | C++ | orestescm76/IGVProyecto20 | /src/igvFuenteLuz.cpp | ISO-8859-3 | 3,651 | 2.640625 | 3 | [
"MIT"
] | permissive | #include "igvFuenteLuz.h"
// Metodos constructores
igvFuenteLuz::igvFuenteLuz()
{
}
igvFuenteLuz::igvFuenteLuz(const unsigned int _idLuz,
const igvPunto3D & _posicion,
const igvColor & cAmb, const igvColor & cDif, const igvColor & cEsp,
const double a0, const double a1, c... | true |
5635ff7e955258254fd3eb026a5c3797dec63afd | C++ | trustee-wallet/djinni-react-native | /support-lib/cpp/JavascriptObjectImpl.hpp | UTF-8 | 1,155 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | #include "JavascriptObject.hpp"
#include "JavascriptType.hpp"
class JavascriptObjectImpl : public JavascriptObject {
public:
JavascriptObjectImpl(const JavascriptObjectImpl& other);
JavascriptObjectImpl(std::nullptr_t);
JavascriptObjectImpl(bool value);
JavascriptObjectImpl(double value);
Javascri... | true |
61e008a5c4cace42dfce49ad200cf3d71d6b865d | C++ | alvas/ms_interview_100 | /leetcode/UglyNumber.cpp | UTF-8 | 847 | 3.71875 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Solution {
public:
bool isUgly(int num) {
if (num <= 0)
{
return false;
}
else if (num == 1 || num == 2 || num == 3 || num == 5)
{
return true;
}
while (num != 1)
{
i... | true |
f456221efd9578e5ccbe456cb4fe5776390c96e7 | C++ | ruslashev/vxr | /pixeldrawer.hpp | UTF-8 | 401 | 2.796875 | 3 | [] | no_license | #ifndef PIXELDRAWER_HPP
#define PIXELDRAWER_HPP
#include <SDL2/SDL.h>
#include <memory>
const int WindowWidth = 800, WindowHeight = 600;
class PixelDrawer
{
private:
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *texture;
Uint32 pixelData[WindowWidth*WindowHeight];
public:
PixelDrawer();
~PixelDrawe... | true |
e6b2d9d0fb00f570601ff259f755895a9ef54639 | C++ | jaswantcoder/CodingNotes | /MasteringCompetitiveProgrammingQuestions/DIVSUBS.cpp | UTF-8 | 1,030 | 2.609375 | 3 | [] | no_license | //Divisible Subset - Page 45
//https://www.codechef.com/status/DIVSUBS
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000000
typedef long long ll;
typedef unsigned long long ull;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t--)
{
... | true |
54b09f9c8b382c607f84b6e7ad5b03a52a653023 | C++ | histat/dc-nx | /sdlshim/common/tcpstuff.cpp | UTF-8 | 5,246 | 2.53125 | 3 | [] | no_license |
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <memory.h>
#include <time.h>
#include <fcntl.h>
#include "tcpstuff.h"
#include "tcpstuff.fdh"
#define uchar uint8_t
struct sockaddr_in sain;
int senddata(uint32_t sock, const uint8_t *packet, int len)
{
return send(sock, packet, len, 0);
}
int ... | true |
e44906d6c2f188abdfc87041885f757e5cde1ae8 | C++ | spacechase0/AndroidPartyGame | /gameserver/src/net/prelogin/LoginPacket.cpp | UTF-8 | 707 | 2.578125 | 3 | [] | no_license | #include "net/prelogin/LoginPacket.hpp"
#include "net/Buffer.hpp"
#include "net/PacketId.hpp"
namespace net
{
namespace prelogin
{
LoginPacket::LoginPacket()
: LoginPacket( "", "" )
{
}
LoginPacket::LoginPacket( const std::string& user, const std::string& pas... | true |
ab730c82780c1b98cbb56cf73aa79f8de28a6e2a | C++ | kn33hit/Coursework | /GL_backup/341/proj/proj4/LinearProbing.cpp | UTF-8 | 4,173 | 3.4375 | 3 | [] | no_license | /**************************************************************
* File: LinearProbing.cpp
* Project: CMSC 341 - Project 4
* Author : Neh Patel
* Date : 16-November-2014 ... | true |
72835d491f1ad943810e0a5591971fca59c853e6 | C++ | Tigrouzen/UnrealEngine-4 | /Engine/Source/Runtime/Renderer/Private/CustomDepthRendering.h | UTF-8 | 1,224 | 2.640625 | 3 | [] | no_license | // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
CustomDepthRendering.h: CustomDepth rendering implementation.
=============================================================================*/
#pragma once
/**
* Set of distor... | true |
b218365043997056a8882762a5e64e90bedd1be2 | C++ | jochenklein/tempest | /lib/mtl/mtl/fromtorange.h | UTF-8 | 1,364 | 3.421875 | 3 | [
"Apache-2.0"
] | permissive | #include <iterator>
#include <memory>
namespace mtl
{
template <typename range_type>
class range : public std::iterator<std::bidirectional_iterator_tag, range_type>
{
public:
range(range_type f, range_type l) : first_(f), last_(l), curr_(f)
{
}
range begin()
{
return{ first_, last_, first_ };
}
... | true |
62bcacb071327c615af87aca6a96134b85cbbd0e | C++ | neophytos-sk/phigita-star | /lib/ttext/ttext_v1/src/cluster/common.cpp | UTF-8 | 2,972 | 2.90625 | 3 | [
"TCL"
] | permissive | #include "common.h"
bool getLines(string filename,vector<string>* lines)
{
lines->clear();
FILE * f = fopen(filename.c_str(),"r");
if (f)
{
while (!feof(f))
{
string line("");
char ch = 'a';
while (ch != '\n')
{
char ch = (char) fgetc(f);
if (ch != EOF)
{
if (ch == '\n... | true |
55b1fd0ae74b3507bc036e00bfcd595e8a2f9753 | C++ | lobcsysinfi/Design-Pattern-Project | /586ProjectNew/state.cpp | UTF-8 | 1,699 | 2.625 | 3 | [] | no_license | //state.cpp
//implement methods in state.h
#include "state.h"
#include "MDA_EFSM.h"
#include <iostream>
void idle::card(){ //card() method
attempts=0;
operations->store_pin1();
operations->store_balance1();
operations->prompt_for_PIN1();
}
void check_pin::IncorrectPin(int max)... | true |
e27651d3e691fd32399f45882daaf75ee56d6d4b | C++ | ThewyRogue99/OS-Dev | /src/kernel/io/io.cpp | UTF-8 | 1,054 | 3.171875 | 3 | [] | no_license | #include "io.h"
namespace IO
{
unsigned char port_byte_in(unsigned short port)
{
// A handy C wrapper function that reads a byte from the specified port
// "=a" ( result ) means : put AL register in variable RESULT when finished
// "d" ( port ) means : load EDX with port
... | true |
15a915358249db4586c7a9db6c3f1cfef42bc7dc | C++ | cosmicray001/Online_judge_Solutions | /uri/1097.cpp | UTF-8 | 230 | 2.640625 | 3 | [
"MIT"
] | permissive | #include<stdio.h>
int main()
{
int i, j, x, c;
for(i = 1, j = 7; i <= 9; i += 2, j += 2)
{
for(x = j, c = 0; c < 3; x--, c++)
{
printf("I=%d J=%d\n", i, x);
}
}
return 0;
}
| true |
a32995662e0e146ef1bed8ef3f847b398624047f | C++ | DEYASHINI/Contact_Book_Simulation | /demo.cpp | UTF-8 | 4,426 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include<ctime>
#include "demo.h"
using namespace std;
void printMessage()
{
cout<<"//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////"<<endl;
cout<<"///////////////////////////////////////////////////////////////////... | true |
53fe43af9e092fa92a1ece7b84cd2ffa76997856 | C++ | Romamart/system-programming | /Task_9/src/project/Task_4/Matrix.hpp | UTF-8 | 3,448 | 3.390625 | 3 | [] | no_license | //
// Created by roman on 15.11.2019.
//
#pragma once
#include <iostream>
#include <vector>
#include "Matrix.h"
#include <math.h>
template <class T> Matrix<T>::Matrix() {Mat = {};}
template<class T> Matrix<T>::Matrix(std::vector<T> vector) {
Mat = vector;
}
template <class T> void Matrix<T>::set(std::vector<T... | true |
4b4627e6f726cf137221b5876a3c057c93d6b26e | C++ | Sockke/MyData | /Linux/TCPIP/socket/udpsocket.h | UTF-8 | 1,354 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
using namespace std;
class UdpSocket {
public:
UdpSocket()
: _sockfd(-1)
{}
bool u_socket() {
_sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (_sockfd < 0) {
return... | true |
9d5ff069fb02c2dbac550e54c2820436df0e0ec2 | C++ | mockk/mockk | /modules/mockk-agent-android/external/slicer/export/slicer/arrayview.h | UTF-8 | 1,342 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | true |
1a68f46ed23662498b6da0a2882c5cb8ac0dc698 | C++ | dokgo/Melnikova | /src/fourth/fourthLab.cpp | UTF-8 | 506 | 2.984375 | 3 | [] | no_license | //
// Created by dokgo on 26.04.17.
//
#include <vector>
#include "Animals.h"
#include "SeaAnimals.h"
using std::vector;
int main() {
/*vector<Animals *> vector1 = {new SeaAnimals("fish", "joe", 2), new Animals(), new SeaAnimals("star", "patric", 5)};
for (Animals *a : vector1) {
a->say();
}*/
... | true |
72356880a0920146b730ccc9223d05d6daa2e04c | C++ | sharatsachin/Competitive-Programming-Solutions | /Leetcode/MaxIncreasetoKeepCitySkyline.cpp | UTF-8 | 537 | 2.515625 | 3 | [] | no_license | class Solution {
public:
int maxIncreaseKeepingSkyline(vector<vector<int>>& grid) {
int n = grid.size();
vector<int> mxr(n,0), mxc(n,0);
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++){
mxr[i] = max(mxr[i],grid[i][j]);
mxc[j] = max(mxc[j],grid[i][j]);
... | true |
82775fa3d4094e8a05b10ee919ac0f34c2016d97 | C++ | STRyu-Liu/homework | /list5-11/list5-11/list511.cpp | UTF-8 | 566 | 2.71875 | 3 | [] | no_license | // list511.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:4996)
#define NUMBER 5
#include<stdio.h>
int main(void) {
int i;
int tensu[NUMBER];
int max, min;
printf("输入%d人的分数\n",NUMBER);
for (i = 0; i < NUMBER;i++) {
printf("NO.%d:",i+1);
scanf("%d",&tensu[i]... | true |
7f8f22f83497fca9403ca5550eb2701df354cab4 | C++ | velazqua/competitive-programming | /online-judges/Project-Euler/PE96/PE96.cpp | UTF-8 | 4,673 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <set>
#include <fstream>
#define DEBUG 0
using namespace std;
struct Cell {
int n;
set<int> p;
Cell (int n_, set<int> p_) : n(n_), p(p_) {}
};
typedef vector< vector<Cell> > State;
vector<pair<int,int> > rowDeleter(State &cells, int i, int val) {
vector< pair<... | true |
fc42ac52742128b3243fe9749f013370370fe7ab | C++ | noshluk2/ITeachStuff-CPP-for-Beginners-to-Beyond | /Section_2_OOP_ Code Organizing/2_classes_constructors.cpp | UTF-8 | 956 | 3.6875 | 4 | [
"MIT"
] | permissive | /*
- Purpose :
Exploring Classes with Constructors
- Understand :
Constructors
Multi-Constructor
Written by Muhammad Luqman
MIT License
*/
//Explaination :
//The Result class has multiple constructors
// by input we differentiate them
#include <cstdio>
struct Resu... | true |
0d455ad2ac013e2300ea17d6ffc25d771deac127 | C++ | crazysnail/XServer | /source/include/connector.h | GB18030 | 1,607 | 2.578125 | 3 | [] | no_license | // ,from muduo
#ifndef _zxero_network_connector_h_
#define _zxero_network_connector_h_
#include "types.h"
#include "inet_address.h"
#include "date_time.h"
#include "tcp_socket.h"
#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
namespace zxero
{
namespace ne... | true |
c519f8d265383304a6d85d4ab8c20b758481a4e3 | C++ | starsep/jnp1-zadanie2 | /maptel.cc | UTF-8 | 2,964 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <unordered_map>
#include <map>
#include <set>
#include <cctype>
#include "cmaptel"
#ifdef __cplusplus
namespace jnp1 {
#endif
typedef unsigned long ul;
static ul lastId = 0;
static std::map<ul, std::unordered_map<std::string, std::string> > maptel;
static void debug(co... | true |
681225726007d18f2153c82e511d540577526a75 | C++ | cyhbrilliant/hdu_oj.rc | /2043.cpp | UTF-8 | 1,188 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
int main() {
int M;
while (cin >> M) {
getchar();
for (int i = 0; i < M; i++) {
char S[51];
cin.getline(S, 50);
bool is = true;
int num = 0;
for (int j = 0; S[j] != '\0'; j++){
num++;
}
if (num < 8 || num > 16){
is =false;... | true |
35c5eaa5ca3cbf735f5a6214a845d53ed49112ce | C++ | divyaagarwal24/coderspree | /Android/AnjumanHasan_AnjumanHasan_2024cse1157_2/Patterns/Pattern20.cpp | UTF-8 | 420 | 2.65625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int n,i,j;
cin >> n;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(j==n-1||j==0)
{
cout << "*\t";
}
else if(i==j&&i>=(n-1)/2)
{
cout << "*\t";
}
else if(i+j==(n-1)&&i>=(n-1)/2)
{
... | true |
86b7e7e35ee48cba0854868ba9fe3b6d49e0310e | C++ | Nikhilbhateja22/Love-Babbar-450 | /06_binary_trees/29_maximum_sum_of_nodes_in_BT_such_that_no_2_are_adjacent.cpp | UTF-8 | 4,115 | 3.828125 | 4 | [] | no_license | /*
link: https://www.geeksforgeeks.org/maximum-sum-nodes-binary-tree-no-two-adjacent/
*/
// ----------------------------------------------------------------------------------------------------------------------- //
/*
using map
TC: O(N^2)
*/
// C++ program to find maximum sum from a subset of
// nodes ... | true |
a51dca73f902fb8907dabbfbd9f19075c96cd56c | C++ | jackgoddard/hepObjects | /MCBlock.cc | UTF-8 | 2,120 | 2.609375 | 3 | [] | no_license | #define MCBLOCK_CXX
#include "MCBlock.h"
#include <iostream>
#include <vector>
using std::cout;
using std::endl;
MCBlock::MCBlock(){
m_n = -1;
m_pt = 0.0;
m_m = 0.0;
m_eta= 0.0;
m_phi= 0.0;
m_charge = 0;
m_status =0;
m_barcode = 0;
m_pdgid = 0;
}
MCBlock::~MCBlock(){}
int MCBlock::N() ... | true |
0a3f1003a66319edf8686bcbb6de8b183f7e8bd0 | C++ | xdinos/Cocoa | /CocoaEngine/cpp/cocoa/renderer/Camera.cpp | UTF-8 | 2,740 | 2.578125 | 3 | [
"MIT"
] | permissive | #include "cocoa/renderer/Camera.h"
#include "cocoa/core/Application.h"
#include "cocoa/events/Input.h"
namespace Cocoa {
Camera::Camera(glm::vec3& position) {
this->m_Transform = Transform(position, glm::vec3(1.0f), glm::vec3(0.0f));
this->m_CameraForward = glm::vec3();
this->m_CameraUp = g... | true |
9be37b2b25368d4ba3b18aefd4801fac80f4f49e | C++ | SokoloiD/made-cpp-2020-hw | /chuck_allocator/MemChunk.h | UTF-8 | 471 | 2.578125 | 3 | [] | no_license | //
// Created by asokolov on 17.10.2020.
//
#ifndef MEM_ALLOCATOR_MEMCHUNK_H
#define MEM_ALLOCATOR_MEMCHUNK_H
#include <cstddef>
#include <cstdint>
class MemChunk {
public:
MemChunk(const size_t size, MemChunk *prev);
~MemChunk();
MemChunk *getPrev();
size_t getFreeMem();
uint8_t *allocMem(size_... | true |
47a3e7093220af4b2795c2541c30537f59b27756 | C++ | yimingli718/CSE335_CanadaExperience | /CanadianExperience/Knife.h | UTF-8 | 1,033 | 2.671875 | 3 | [] | no_license | /**
* \file Knife.h
*
* \author Yiming Li
*
* \brief Implement a knife for sparty
*/
#pragma once
#include "ImageDrawable.h"
#include "AnimChannelPoint.h"
/**
* \brief Implemnet the knife for sparty
*/
class CKnife :
public CImageDrawable
{
public:
CKnife(const std::wstring &name, const std::wstring &file... | true |
0a618b648c6ad9a93bd0ef35d1e39406413dbaa4 | C++ | tobiasschulz/call-qt | /src/model-abstract.h | UTF-8 | 1,610 | 2.578125 | 3 | [] | no_license | #ifndef MODEL_ABSTRACT_H
#define MODEL_ABSTRACT_H
#include <QObject>
#include <QPointer>
#include <QAbstractItemModel>
#include "contact.h"
namespace Model
{
class Abstract: public QAbstractItemModel, public ID
{
Q_OBJECT
public:
explicit Abstract(Abstract* parentmodel, QObject* parent = 0);
virtual QString... | true |
7300f75a3bf2c6739207e8d94a307334bbf64602 | C++ | coconutpie/COP1334 | /projects/2d-arrays/main.cpp | UTF-8 | 1,089 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <time.h>
#include <fstream>
#include <string>
using namespace std;
const int STUDENTS = 3;
const int ASSIGNMENTS = 4;
const int LOW = 70, HIGH = 100;
int cop1334[STUDENTS][ASSIGNMENTS], total = 0;
void
seed_database() {
for (int i = 0; i < STUDENTS; i++)
{
for (int ... | true |
13f614994ac5a9cfacb2c82562d6f064d94fcde1 | C++ | lirui233/C-Primer_vs2017 | /C++Primer_vs2017/10.36.cpp | UTF-8 | 271 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <iterator>
#include <list>
#include <algorithm>
using namespace std;
int main(void)
{
list<int> lst{ 1,2,3,0,5,4,1,0,1 };
auto iter = find(lst.crbegin(), lst.crend(), 0);
cout << *iter << endl;
//cout <<
system("pause");
return 0;
} | true |
425457bd8c74d989c889465af0c5f8af8bad3a86 | C++ | SRomero85/Globant-Bootcamp-TP3 | /TP3/TP3/max_min.cpp | UTF-8 | 1,360 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <limits>
int mainmaxmin() {
int val = 0;
std::cout << "\nEl valor Maximo de un 'int' es: " << std::numeric_limits<int>::max() << std::endl;
std::cout << "El valor Minimo de un 'int' es: " << std::numeric_limits<int>::min() << std::endl;
std::cout << "El valor Maximo de un ... | true |
86aed1ca2b4f0c6365e0e21a3dccbc5dc29e84cd | C++ | 94rain/openFlights | /algorithm/BFS.h | UTF-8 | 724 | 3.0625 | 3 | [] | no_license | #pragma once
#include <queue>
#include <unordered_map>
#include "../OpenFlight.h"
using std::queue;
using std::vector;
class BFS{
public:
/**
* get the path of all visited airports during BFS
* @param graph the OpenFlight graph for BFS traversal
* @return {vector<Airport>}
... | true |
d9c9d9c9efb0b4fdc52e00d81665fb34e4be9c7c | C++ | zaliasc/hust-lab | /c++/lab/3.cpp | UTF-8 | 11,373 | 3.515625 | 4 | [
"MIT"
] | permissive | //D:/learn/c++/c++_experiment/U201714480_3
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
class STACK
{
int *const elems; //申请内存用于存放栈的元素
const int max; //栈能存放的最大元素个数
int pos; //栈实际已有元素个数,栈空时pos=0;
public:
STACK() : elems(nullptr), max(0... | true |
ec9bad745626a92f98f8abff704130ea94063f21 | C++ | AK2001/Video-management-application | /Management Application/vectordata.cpp | UTF-8 | 1,434 | 3.25 | 3 | [] | no_license | //vectordata.cpp
#include <iomanip>
#include "vectordata.h"
void VectorVideoData::populate(string filename){
ifstream infile;
VideoData anItemdata;
infile.open(filename.c_str());
while(infile){
infile >> anItemdata;
data.push_back(anItemdata);
}
}
bool VectorVideoData::exis... | true |
04cff9aaa96fb9c741b6e013f1e09f1dd09e4ac9 | C++ | ravitejamajeti/Artificial-Intelligence | /Assignment_2/shc.cpp | UTF-8 | 3,604 | 3.078125 | 3 | [] | no_license | #include<iostream>
using namespace std;
void GeneratePosition(int n, int *ran) {
int i = 0, flag = 0;
while (i < n) {
ran[i] = rand() % n;
/*for (int j = 0; j < i; j++) {
if(ran[i] == ran[j]) {
flag = 1;
}
... | true |
4bf907e789bd6154868ae5b91d51ac31e4decd0e | C++ | RuiGuedes/PROG1617_T2 | /Trabalho 2/src/Company.h | UTF-8 | 1,027 | 2.921875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include "Line.h"
#include "Driver.h"
#include "Bus.h"
using namespace std;
class Company{
friend void info_bus(Company &SR);
friend void BusWithoutDriver(Company &SR);
friend void atribuir_trabalho(Company &SR);
private:
st... | true |
94b112a60a69b2e18e2ca50a10b8f6db475244f2 | C++ | stilda/Audio-Visualizer | /Sequence/Converters/ConverterBreakOn3bitsNumbers.cpp | UTF-8 | 957 | 2.59375 | 3 | [] | no_license | #include "ConverterBreakOn3bitsNumbers.h"
#include <vector>
#include "..\StorageCursor.h"
#include "..\Storage.h"
#include <cassert>
float conv_to_bit( const float v )
{
return v < 0.0f ? 0.0f : 1.0f;
}
void ConverterBreakOn3bitsNumbers::process()
{
auto ostor = out_stor<Storage<float>*>(0);
auto ist... | true |
e3a984d1e0ce558d306e7bcf22e4e8b82667b192 | C++ | Matheuss26/traffic-light-search-heuristic | /tests/test_graph.cpp | UTF-8 | 3,357 | 2.984375 | 3 | [] | no_license | #include "assert.h"
#include "traffic_graph.h"
#define NUMBER_OF_VERTICES 8
#define EDGE1 {7, 5}
#define EDGE1_WEIGHT 6
#define EDGE2 {5, 2}
#define EDGE2_WEIGHT 10
#define EDGE3 {5, 4}
#define EDGE3_WEIGHT 4
#define CYCLE 20
#define TIMING_7 16
#define TIMING_5 8
#define TIMING_2 4
#define TIMING_4 7
using namespace... | true |
da56177b3d304acd11cbfd1e9537119c21543e39 | C++ | lnarolski/mearm-stm32f429i | /Middlewares/ST/touchgfx/framework/include/touchgfx/containers/Container.hpp | UTF-8 | 6,415 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
******************************************************************************
* This file is part of the TouchGFX 4.15.0 distribution.
*
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Libert... | true |
45281bb48fa6fae6f50be16151777d805d34e46d | C++ | amarsgithub/Sorting-Algorithms | /SimpleTimer.cpp | UTF-8 | 460 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include "SimpleTimer.h"
using namespace std;
SimpleTimer::SimpleTimer()
{
// Get the current time
start = highResClock::now();
}
SimpleTimer::SimpleTimer(string name)
{
// Get the current time
this->name = name;
start = highResClock::now();
}
SimpleTimer::~SimpleTimer()
{
... | true |
692409b3892b9a9f8cd1f2a24277d0d78128ed4f | C++ | xxsytriskxx/Pokemon-SwSh-Seed-Generator | /SeedGenerator/Source/Fields/Gender.cpp | UTF-8 | 1,730 | 3.1875 | 3 | [] | no_license |
#include <map>
#include "Gender.h"
namespace SeedGenerator{
std::string to_string(GenderRatio ratio){
switch (ratio){
case GenderRatio::MALE:
return "100% Male";
case GenderRatio::MALE_88:
return "88% Male";
case GenderRatio::MALE_75:
return "75% Male";
case GenderRatio::E... | true |
0631ad9c2d8cda840876df5a8b60205ca73d32ad | C++ | classygroup/sems | /core/sip/ssl_settings.h | UTF-8 | 2,794 | 2.578125 | 3 | [] | no_license | #pragma once
#include <vector>
#include <map>
#include <string>
using std::vector;
using std::map;
using std::string;
struct settings
{
std::string certificate;
std::string certificate_key;
std::vector<std::string> ca_list;
virtual ~settings();
bool checkCertificateAndKey(const char *interface_n... | true |
99490d47b2eece27d654eb2030bfd481de8b2d69 | C++ | masumr/problem_solve | /code/392.cpp | UTF-8 | 1,206 | 2.609375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll>convert(string a)
{
stringstream ss(a);
vector<ll>v;
ll num;
while(ss>>num)v.push_back(num);
return v;
}
int main()
{
string a;
int i;
while(1)
{
getline(cin,a);
vector<ll>v=convert(a);
... | true |
2fc247a38d0755d39f796f256f92ec79f739db6f | C++ | TadashiHiramatsu/nkGame_11 | /nkEngine/nkEngine/_Graphics/3DObject/Model/ModelData/nkMeshNode.h | SHIFT_JIS | 2,018 | 3.0625 | 3 | [] | no_license | /**
* bVm[hNX̒`.
*/
#pragma once
#include"nkNode.h"
namespace nkEngine
{
class Material;
/**
* bVm[hNX.
*/
class MeshNode : public INode
{
public:
/**
* _obt@\.
*/
struct VertexBufferS
{
Vector4 Pos = Vector4(0.0f, 0.0f, 0.0f, 1.0f); //!< _W.
Vector2 Tex = Vector2::Zero; //!< UVW.
Vector... | true |
5f593c6df95de6d602a85acfc0f96328c211ccf3 | C++ | mandome/TVS-Device-SDK | /Linux SDK/samples/sample_recv/testrecv.cpp | UTF-8 | 3,897 | 2.71875 | 3 | [] | no_license | /**
* @file
* @author kangrong
* @date 2017/8/28
* @brief 示例代码:设备接收手机指令进行配网
* @version 0.1.0
* @note
*/
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <cstdlib>
#include <sstream>
#include "aisdk_common_api.h"
#include "aisdk_account_online.h"
#include "aisdk_recv.h"
us... | true |
2c329b597a65df8a42864436ad2f8495714023d9 | C++ | grandmaster789/scimitar | /scimitar/util/typemap.inl | UTF-8 | 1,433 | 3.265625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "typemap.h"
#include "algorithm.h"
namespace scimitar::util {
template <typename T>
void TypeMap::insert(T* ptr) {
std::type_index key(typeid(T));
if (!contains(m_Keys, key)) {
m_Keys .push_back(key);
m_Values.push_back(ptr);
}
else
throw std::runtime_error("Cannot store mul... | true |
d4fcdfbe810307fd08ea2cffc384ba2339c58942 | C++ | chaudhariyash10/Algorithms | /Dyanamic Programming/Knapsack/Coin Change count Minimum number of coins Required.cpp | UTF-8 | 835 | 2.75 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int minimumNumberOfCoinsRequired(int coins[], int n, int sum)
{
int dp[n + 1][sum + 1];
for (int i = 0; i < sum + 1; i++)
dp[0][i] = INT_MAX - 1;
for (int i = 1; i < n + 1; i++)
dp[i][0] = 0;
for (int i = 0; i < sum + 1; i++)
if (... | true |
b7b2225332013cd465eb082caa7b537378f80e3c | C++ | taceroc/Herr | /Estudio/1.cpp | UTF-8 | 1,123 | 3.5625 | 4 | [] | no_license | #include <cstdio>
#include <math.h>
double f(double x, double a, double b, double c);
int main(void)
{
double a = 1e-17;
double b = -1e17;
double c = 1e17;
double x;
double x1; double x2; double x11; double x22;
if(a!=0)
{
x11 = b+(sqrt(pow(b,2)-4*a*c));
x1 = (-2*c)/x11;
x22 =... | true |
71be19bbbb5bf2527403157773d07b3b044620aa | C++ | heowoohyuk/OOP | /termproject/block.cpp | UHC | 1,767 | 3.1875 | 3 | [] | no_license | #include "block.h"
//
block::block(int color) {
this->color = color;
this->set_location(2, 0);
}
//
block::~block() {
this->color = 0;
}
//
int block::get_color() {
return this->color;
}
// xǥ
int block::get_x() {
return this->x;
}
// yǥ
int block::get_y() {
return this->y;
}
// 츸
void block::set_grou... | true |
487718b6dc5bf878872ccb3fc4a0c9411fd16f75 | C++ | roddehugo/utprofiler | /dao/CursusDAO.cpp | UTF-8 | 11,876 | 2.796875 | 3 | [] | no_license | #include "dao/CursusDAO.h"
#include "dao/CategorieDAO.h"
#include <QDebug>
QMap<int, Cursus *> CursusDAO::findAll(){
try{
QSqlQuery query(Connexion::getInstance()->getDataBase());
if (!query.exec("SELECT * FROM cursus;")){
throw UTProfilerException("La requète a échoué : " + query.lastQ... | true |
ac2abf2af9dccf924dbf339d442a20181fd51c2e | C++ | PhantomFS/Alexis-Coding-Ellis-2019 | /cpp/T1A03-Loop-Alexis.cpp | UTF-8 | 883 | 3.046875 | 3 | [
"MIT"
] | permissive | #define NAME "Player"
#include <stdio.h>
int * triangle(int num){
int * temp;
int * triangle1 [num];
for (int i = 0; i < num; i++) {
triangle1[i] = &(triangle1[i][i+1]);
for (int j = 0; j < i+1; j++) {
if (j == 0 || j == i) {
triangle1[i][j... | true |
1431968817a2c1bae0f7cfdb62512a7a9e7e85f1 | C++ | myunpe/fireattack | /Classes/GameEffect.h | UTF-8 | 1,241 | 2.609375 | 3 | [
"MIT"
] | permissive | //
// GameEffect.h
// Tetris
//
// Created by Yoshida Mitsunobu on 2014/07/20.
//
//
#ifndef __Tetris__GameEffect__
#define __Tetris__GameEffect__
#include "cocos2d.h"
/**
* ゲームのいろいろなエフェクトを管理する
* このクラスで行われるエフェクトが再生されている間は操作不可になる
*/
USING_NS_CC;
class GameEffect : public Sprite {
public:
GameEffect(void);
... | true |
ac3cd8118b85e7ae0bc06463ccde65f408dd3ffe | C++ | xhw994/LeetCode | /LeetCode/LeetCode201_250/203_Remove_Linked_List_Elements.cpp | UTF-8 | 476 | 2.640625 | 3 | [] | no_license | #include "../..//LeetCodeCpp/LeetCode201_250.h"
#include "../..//LeetCodeCpp/Common.h"
using namespace std;
using namespace LeetCode;
ListNode* LeetCode::LeetCode201_250::removeElements(ListNode* head, int val) {
if (!head) return nullptr;
ListNode* p = nullptr, *c = head;
while (c) {
if (c->val =... | true |
e541ca5b5adca2d76bf7ab36b7f52c1e78b5490e | C++ | MarkHCole/CSC-228 | /Q3 Linked.cpp | UTF-8 | 2,909 | 3.625 | 4 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <time.h>
#include <ctime>
#include <ratio>
#include <chrono>
using namespace std;
// implementing the dynamic List ADT using Linked List
class Node {
private:
int data;
Node* nextNodePtr;
public:
Node() {}
void setData(int d) {
data = d;
}
int getData() ... | true |
89970479ea6a3a36d69c601b4700c71d193aa00b | C++ | TeamTurtleF14/CS113TurtleGame | /include/LayoutGen.hpp | UTF-8 | 2,346 | 3.421875 | 3 | [] | no_license | /*
* LayoutGen.hpp
* Header file for the Layout Generator
* Creates room objects, attaches rooms properly when directed.
*/
#ifndef _LAYOUTGEN_HPP_
#define _LAYOUTGEN_HPP_
#include "Room.hpp"
#include <vector>
#include <utility> // std::pair, std::make_pair
class LayoutGen {
public:
int NumRooms; // # of rooms ... | true |
de7def603a190a715e4d3c476c097c85e5c7b5a4 | C++ | bryan-pakulski/emulators | /chip8/src/cpu/cpu.cpp | UTF-8 | 2,017 | 3.046875 | 3 | [
"MIT"
] | permissive | #include "cpu.hpp"
#include <vector>
#include <fstream>
cpu::cpu(memoryc8* m, display* g) {
mem = m;
gfx = g;
op_lookup = new opcodes();
drawFlag = true;
clearScreen = true;
I = 0;
PC = 0x200;
op = 0;
sp = 0;
}
cpu::~cpu() {
delete op_lookup;
}
/**
* Resets the keypad array to 0
*/
void cpu::clearKeyPad(... | true |
0dc1822cd0919854d72878813616bc03ac54dde5 | C++ | ggonnella/gfaviz | /src/gfa/alignment.cpp | UTF-8 | 2,175 | 3.09375 | 3 | [
"ISC",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include "gfa/alignment.h"
GfaAlignment::GfaAlignment() {
is_set = false;
lengths[0] = 0;
lengths[1] = 0;
}
GfaAlignment::~GfaAlignment() {
//if (cigar)
//free(cigar);
}
void GfaAlignment::createFromCigarString(char *str, unsigned long len) {
unsigned long idx;
bool char_found = false;
bool digit_fo... | true |
f4da52caca6adf9c027c596d0a821400d084d78d | C++ | TenFifteen/SummerCamp | /lbc_lintcode/445-cosine-similarity.cc | UTF-8 | 777 | 3.578125 | 4 | [] | no_license | /*
题目:28 % Cosine Similarity new 容易
题目大意:
给定两个向量,求其cos角度
解题思路:
根据公式直接算
遇到的问题:
没有问题。
*/
class Solution {
public:
/**
* @param A: An integer array.
* @param B: An integer array.
* @return: Cosine similarity.
*/
double cosineSimilarity(vector<int> A, vector<int> B) {
// write your co... | true |
e8620a602a54dd97f73c20e2aeefa2d7cf03d569 | C++ | sycinf/ArchSyn | /archsyn_regression/spmv/test_spmv.cpp | UTF-8 | 1,455 | 3.078125 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#define DIM 50
#define SPARSITY 2
float spmv( float* y, int* ptr, float* valArray, int* indArray, float* xvec, int dim);
float spmv_sw(float* y, int* ptr, float* valArray, int* indArray, float* xvec, int dim)
{
int kbegin = 0;
float rtVal = 0.0;
for(int s=0; s<dim; s++)
{
i... | true |
b588de67aff03c968a92aff6117ecb702597d458 | C++ | JohanJacobs/Sorting-Algorithms | /src/demo.cpp | UTF-8 | 2,163 | 3.40625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <algorithm>
#include "Helpers/Timer.h"
//sorting algorithms
#include "Sort/BubbleSort.h"
#include "Sort/SelectionSort.h"
#include "Sort/InsertionSort.h"
#include "Sort/ShellSort.h"
//data files from https://www.coursera.org/learn/alg... | true |
3487f5a5d8c857613a8fbf9b61eb614585fcd328 | C++ | vesoft-inc/nebula | /src/common/base/test/EitherOrTest.cpp | UTF-8 | 9,811 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | /* Copyright (c) 2018 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*/
#include <gtest/gtest.h>
#include "common/base/Base.h"
#include "common/base/EitherOr.h"
namespace nebula {
TEST(EitherOr, ConstructFromDefault) {
{
EitherOr<bool, std::string> result;
A... | true |
e81e3a89b646b47c1a7b4d7762640524795a0c4a | C++ | PathwayAnalysisPlatform/ProteoformNetworks | /src/Cpp/base/bits.h | UTF-8 | 10,919 | 3 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #ifndef BASE_BITS_H
#define BASE_BITS_H
#include "functional.h"
#include "intrinsic.h"
#include <cstddef>
#include <type_traits>
namespace base {
/*template<typename T>
struct word_type;
template<typename T>
using word_type_t = typename word_type<T>::type;
template<typename T> requires std::is_integ... | true |
00525edde742b2d79b3a79cbc43b1cbda051ef5b | C++ | Vahan92/balanced_binare_search_tree | /src/tree.cpp | UTF-8 | 7,523 | 3.59375 | 4 | [] | no_license | #include "node.hpp"
#include "tree.hpp"
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
using namespace std;
Tree::Tree() : root(NULL), parent(NULL) {}
Node* Tree::newNode(int data)
{
Node* temp = new Node;
temp -> value = data;
temp -> left = NULL;
temp ... | true |
19776ff691bf13807cf88531d2db9fef2e9ec5d4 | C++ | stephmackenz/avalon | /common/sgx_workload/workload/workload_processor.h | UTF-8 | 3,873 | 2.5625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT",
"Zlib",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-unknown-license-reference",
"CC-BY-4.0"
] | permissive | /* Copyright 2018 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... | true |
c75499cb971c8b05e93ef7e0bd42897ba1b423d9 | C++ | code-11/Pandora-Effect | /source.h | UTF-8 | 1,835 | 3.015625 | 3 | [] | no_license | #include <unordered_map>
using namespace std;
const int sizex=48;
const int sizey=24;
typedef unordered_map<char,int> Point;
Point matrix[sizex][sizey];
Point chrome;
class Source
{
public:
Source(int X, int Y, char Type, int Decay_rate, int str);//nondefault constructor
Source();
int eval();
//int... | true |
6fb14cf49232f9c7b803b2b73055586f6b944cf7 | C++ | LiZhenhuan1019/lzhlib | /include/lzhlib/utility/optional.hpp | UTF-8 | 798 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef LZHLIB_UTILITY_OPTIONAL_HPP
#define LZHLIB_UTILITY_OPTIONAL_HPP
#include <exception>
#include "lzhlib/lzhlib_conf.hpp"
#include "lzhlib/utility/utility_conf.hpp"
namespace lzhlib
{
struct nullopt_t
{
enum class construct
{
token
};
explicit constexpr nullopt_... | true |
2a2d079a012233ec3d571ae89351afb186caab9b | C++ | alexandraback/datacollection | /solutions_5640146288377856_0/C++/pr0gramm3r/a.cpp | UTF-8 | 515 | 2.578125 | 3 | [] | no_license | //in the name of god!
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <fstream>
using namespace std;
#define pb push_back
#define x first
#define y second
#define mk make_pair
ifstream fin("1.in");
ofstream fout("1.out");
int T,r,c,... | true |
29e3e2d32e4b0a66a502a189f9a6778c7f1ca39d | C++ | BizaoDeBizancio/POO2017.2Monael | /poo11048216/Pratica/pratica4/Complexos/Complexos.cpp | UTF-8 | 3,244 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
class Complexo{
private:
int real;
int imaginario;
public:
Complexo();
Complexo(int, int);
void setReal(int);
int getReal();
void setImaginario(int);
... | true |
eec7200946ef0ece94384b93cacf8c2d081adfb8 | C++ | AirChen/autodiff | /autodiff/tests/MatrixTest.cpp | UTF-8 | 2,217 | 3.484375 | 3 | [
"MIT"
] | permissive | //
// MatrixTest.cpp
// tests
//
// Created by AirChen on 2021/3/22.
//
#include "MatrixTest.hpp"
#include "gtest/gtest.h"
#include <eigen3/Eigen/Dense>
// The fixture for testing class Foo.
class MatrixTest : public ::testing::Test {
protected:
MatrixTest() {
// You can do set-up work for each test here... | true |
6ab297e008cf80af1bc42f9db9600d39d02627f7 | C++ | chth2116/web-dev-index-page | /scss/class/SLL.cpp | UTF-8 | 1,014 | 3.859375 | 4 | [
"MIT"
] | permissive | //implement whats defined in header
#include <iostream>
#include "SLL.h"
using namespace std;
//default constructor
SLL::SLL(){
}
//constructor that takes an int
SLL::SLL(int nodeID){
//create head of list
head = new Node;
head -> next = NULL;
head ->id = nodeID;
}
SLL::~SLL(){
//free the memory ... | true |
f0b52aa1727fa40454176ca4a41e62a6432d3558 | C++ | zhongxuanS/- | /Piece.cpp | UTF-8 | 2,399 | 3.234375 | 3 | [] | no_license | #include "Piece.h"
#include <algorithm>
Piece::Piece(int pieceId, int pieceRotaion, COLORREF pieceColor, const POINT* apt, int numPoints)
:color_(pieceColor), id_(pieceId), rotaion_(pieceRotaion),
numPoints_(numPoints),width_(0),height_(0), body_(NULL)
{
//因为旋转后的图形左下角并不在坐标原点,所以要做平移操作
POINT leftBottom = apt[0];
f... | true |
131d401d2c777414889abaa67388ad2c42c1a6a7 | C++ | OsipovDmitry/Trash | /core/src/textnode.cpp | UTF-8 | 1,725 | 2.75 | 3 | [] | no_license | #include <core/textnode.h>
#include "textnodeprivate.h"
namespace trash
{
namespace core
{
TextNode::TextNode(const std::string& text_, TextNodeAlignment alignX, TextNodeAlignment alignY, const glm::vec4& color_, float lineSpacing_)
: DrawableNode(new TextNodePrivate(*this))
{
auto& tnPrivate = m();
tnPr... | true |