text
stringlengths
8
6.88M
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "Durante.h" IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, Durante, "Durante" ); DEFINE_LOG_CATEGORY(LogDurante)
#include <iostream> #include <string> using namespace std; int main(int argc, const char *argv[]) { char no_null[] = {'A','B'}; string str(no_null,10); cout << str << endl << "Size:" << str.size() << endl << "Capacity:" << str.capacity() << endl; string &ref = str.erase(2,8); cout << str << endl <<...
#include<bits/stdc++.h> using namespace std; int as[1000000], save[1000000]; main() { int n; while(cin>>n) { int i, p=0, dis; for(i=1; i<=n; i++) { cin>>as[i]; if(i!=1 && as[i]<as[i-1]) { p++; dis = i; } ...
// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX #include <Eigen/Array> using namespace std; using namespace Eigen; #ifndef REPEAT #define REPEAT 10000 #endif #ifndef SCALAR #define SCALAR float #endif int main(int argc, char *argv[]) { typedef Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> ...
/** * Copyright (c) 2013, Timothy Stack * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of condi...
/* * application_cache_common.h * * Created on: Nov 16, 2009 * Author: hmolland */ #ifndef APPLICATION_CACHE_COMMON_H_ #define APPLICATION_CACHE_COMMON_H_ #define MANIFEST_FILENAME UNI_L("manifest.mst") #define APPLICATION_CACHE_XML_FILE_NAME UNI_L("cache_groups.xml") #define CACHE_FOLDER_NAME_LENGTH (32)...
// // Created by dylan on 26-5-2020. // #ifndef CPSE2_GRAPHICAL_USER_INTERFACE_HPP #define CPSE2_GRAPHICAL_USER_INTERFACE_HPP #include <vector> #include <SFML/Graphics.hpp> #include "game_interface.hpp" #include "board_builder.hpp" #include "game_logic.hpp" class graphical_user_interface : public game...
#include "Map.h" // Defines template Map<Key, Value> #include "Employee.h" // Defines class Employee #include "BookInfo.h" #include <iostream> using namespace std; int main() { typedef unsigned int ID; // Identification number of Employee Map<ID, Employee> database; // Database of employees database....
// kumaran_14 #include <bits/stdc++.h> using namespace std; #define f first #define s second #define p push #define mp make_pair #define pb push_back #define eb emplace_back #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) #d...
#include <cassert> #include "Population.hpp" Population::Population() { assert(Conf::MAX_POP > Conf::INITIAL_INFECTIONS); infection_history.reserve(Conf::SIM_HOURS); humans.reserve(Conf::MAX_POP); Human * h; for(uint32_t i = 0; i< Conf::MAX_POP;i++) { h = new Human(); humans.push_back(h); h->setWaypoint(sf...
#include <stdio.h> void top_up_100(int *cost, int x){ *cost += x; } int main(){ int a = 10; top_up_100(&a, 100); printf("%d\n", a); }
#ifndef PORT_SYNFIRE_HELPERS_H #define PORT_SYNFIRE_HELPERS_H #include <stdlib.h> #include <iostream> #include <string> struct SynfireParameters { SynfireParameters(); SynfireParameters(int argc, char *argv[]); void SetDefaults(); int network_size; bool stats_on; // bool LOAD = false; //1 me...
#ifndef __BASE_PROCESS_H__ #define __BASE_PROCESS_H__ #include <string> #include "CDLSocketHandler.h" #include "Packet.h" #define _NOTUSED(V) ((void) V) class BaseProcess; typedef struct Context { int netfd; unsigned int seq; char status; PacketHeader msgHeader; BaseProcess *process; CDLSoc...
#pragma once namespace rasutil { /// Thunks a member function pointer into a normal functor /// Specifically, converts it into an empty functor with an operator() that /// takes a T* as its first argument. template<class F> struct thunk_func; /// Implementation specialization of thunk_func<F> template<...
/*Implementation of thread pool module.*/ #include "cc/shared/thread_pool.h" #include "cc/shared/thread_wrapper.h" #include <unistd.h> namespace cc_shared { ThreadPool::ThreadPool(int num_threads) : threads_(new(std::nothrow) ThreadWrapper [num_threads]), num_threads_(num_threads), wake_count_(0), ...
// Created on: 1994-02-16 // Created by: Remi LEQUETTE // Copyright (c) 1994-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU ...
#ifndef INC_PARTICLE_RENDERER_H #define INC_PARTICLE_RENDERER_H //C++ Headers #include<memory> #include<vector> //Third Party Headers #include<gl/glew.h> #include<glm/glm.hpp> #include"shader.h" #include"texture2D.h" namespace shady_engine { class particles_renderer { private: std::shared_ptr<shader>...
#ifndef BASE_DESCRIPTOR_H #define BASE_DESCRIPTOR_H #include <sc2api\sc2_api.h> #include <vector> using namespace sc2; class BaseDescriptor { public: Point3D position_center; //Position of the center of the base, ie where the command center should be placed. std::vector<const Unit*> minerals; // M...
#include <assert.h> #include <stdlib.h> #include <iostream> #include <unistd.h> #include <libgen.h> #include <reactor/net/Connector.h> #include <reactor/net/EventLoop.h> #include <reactor/net/InetAddress.h> using namespace reactor::net; EventLoop loop; void on_connected(int fd) { std::cout << fd << " connected\n"; ...
#include <iostream> #include <cstdio> using namespace std; int main() { int a[5][5], i, j, k, x, y, count = 0, temp; for(i=0;i<5;i++) { for(j=0;j<5;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<5;i++) { for(j=0;j<5;j++) { if(a[i][j]==1) { if(i==2 && j==2) printf("%d",co...
#include <DHT.h> #define DHTPIN 2 #define DHTTYPE DHT22 DHT dht(DHTPIN, DHTTYPE); float h; float t; void setup(){ Serial.begin(9600); dht.begin(); } void loop(){ h=dht.readHumidity(); t=dht.readTemperature(); Serial.println(h); Serial.println(t); //Serial.println(); delay(1000); ...
/** * @file main.cc * @author Gerbrand De Laender * @date 18/12/2020 * @version 1.0 * * @brief E091103, Master thesis, software testing * * @section DESCRIPTION * * Uses IP that applies gain to an incoming AXI stream. Makes use of DMA to * stream data from the main memory to the IP core. * ...
// // Created by cirkul on 27.11.2020. // #ifndef UNTITLED3_PLANT_H #define UNTITLED3_PLANT_H #include "Creature.h" class Plant : public Creature { //ready Plant(Playground& pg, int i, int j) : Creature(pg, i, j) { this->lifeDuration = 3; this->id = plant; this->name = tree; } ...
#include"head_info.h" #include<stack> int fibonacci(int n) { if(n==0 || n==1) return 1; else return fibonacci(n-1) + fibonacci(n-2); } int fibonacci_norecursion(int n) { std::stack<int> st; st.push(n); int sum=0; while( !st.empty() ) { int cur = st.top(); st.pop(); if( cur==0 || cur==1 ) ++sum; ...
#include <bits/stdc++.h> using namespace std; struct tNode{ int data; tNode *left; tNode *right; tNode(int x):data(x),left(NULL),right(NULL){} }; class Solution{ public: //1.递归方式 int k_level_nodes(tNode *root,int k){ if(!root || k < 1){ return 0; } if(k == 1...
#include<iostream> #include<vector> #include<algorithm> #include<unordered_set> #include<unordered_map> #include<set> using namespace std; class Solution { public: int longestSubstring(string s, int k) { //基本思想:暴力超时 if(s.size()<k) return 0; int len=0; for(int i=0;i<=s.size()-k;i++) ...
#ifndef __CCrystalEditView_INL_INCLUDED #define __CCrystalEditView_INL_INCLUDED #include "CCrystalEditView.h" CE_INLINE BOOL CCrystalEditView::GetOverwriteMode() const { return m_bOvrMode; } CE_INLINE void CCrystalEditView::SetOverwriteMode(BOOL bOvrMode /*= TRUE*/) { m_bOvrMode = bOvrMode; } CE_IN...
#ifndef APPLICATION_DATABASECONNECTOR_H #define APPLICATION_DATABASECONNECTOR_H #include <cstdint> #include <iostream> #include <vector> #include <utility> #include <bsoncxx/json.hpp> #include <mongocxx/client.hpp> #include <mongocxx/stdx.hpp> #include <mongocxx/uri.hpp> #include <mongocxx/instance.hpp> #include <bson...
#include "../interface.h" namespace exception { obj_ptr CreateTitleBackground(); rule_ptr CreateDeathMatch(int time); rule_ptr CreateTeamFortress(float core_life); rule_ptr CreateHorde(int wave); gobj_ptr CreateGameOver(); gobj_ptr CreateStageResult(int bosstime, int hit, float score); void PutSmall...
#include <iostream> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ctime> #include <math.h> using namespace std; int main(int argc, char **argv) { // int tendance = -5; int tendance; //int pression = 1030; int altitude = 151.5; int zambretti_coefficient; int stock_pression; ...
#include "App.hpp" #include <HTStack/Response/Response.hpp> #include <HTStack/HTTPUtils/MIMEType.hpp> #include <fstream> #include <iostream> App::App (HTStack::Server & server, std::map <std::string, std::string> & settings) : HTStack::App (server, settings) {}; void App::handleRequest (HTStack::Request & request) ...
#include <downloader.h> #include <clientversion.h> #include <init.h> #include <logging.h> #include <util/system.h> #include <util/miniunz.h> #define CURL_STATICLIB #include <curl/curl.h> #include <openssl/ssl.h> /* Downloader functions for bootstrapping and updating client software * This xferinfo_data contains a...
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: s; c-basic-offset: 2 -*- ** ** Copyright (C) 2012 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #include "../includes/ipcconfig.h" #include "../includes/ipcimpl.h"...
// set this to the hardware serial port you wish to use #define HWSERIAL Serial1 int led = 13; int en485 = 2; #define DEBUT_TRAME '<' #define FIN_TRAME '>' String ReceivedString = ""; extern String Subs[]; char inByte; String cmd=""; void setup() { Serial.begin(115200); HWSERIAL.begin(115200); pinMode(led, OUT...
/* * RF Demo Saboteur * * Receives switchType, reverses it, and sends it back. * So when receiving group on, it will send a unit off back. * * Transmitter: digital pin 11 * Receiver: digital pin 2 */ #include <NewRemoteReceiver.h> #include <NewRemoteTransmitter.h> void setup() { Serial.begin(115200...
#pragma once #include <glad/glad.h> #include <fstream> #include <sstream> #include <iostream> #include <glm/gtc/matrix_transform.hpp> class Shader { public: Shader()=default; ~Shader()=default; unsigned int ID; Shader(const GLchar* vertexPath, const GLchar* fragmentPath); void use(); // uniform tools function ...
#pragma once #include "ZeroAnimation.h" #include "ZeroSprite.h" #include "Enemy.h" #include "PlayerCharacter.h" class Slime : public Enemy { private: int boomDistance; int slimeCondition; pair<float, float> boomTimer; pair<float, float> popTimer; void PlayMoveSound(); public: Slime(); enum CONDITION { ...
//Space Complexity: O(1) //Time Complexity: O(3^n), where n is the length of the array. //Time Limit exceeded on leetcode. class Solution { private: int helper(vector<vector<int>>& costs, int min, int row, int lastColor){ if(row == costs.size()){ return min; } int case1 = INT_M...
#include <iostream> using namespace std; int main() { int n,y,mo(0),a[366]={0},day,one(0),two(0),three(0),four(0),five(0),six(0),seven(0); cin>>n; for(int i=1900;i<1900+n;i++) { if ((i%100!=0&&i%4==0)||i%400==0) {y=366; for(int j=0;j<y;j++){ a[j]=(j+mo)%7+1;...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*- ** ** Copyright (C) 1995-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** ** Espen Sand */ #include "core/pch.h...
#include "integral.h" using namespace std; int main(int argc, char **argv){ if(argc!=3){ cout<<"Usage: <Histogram filename 1> <Histogram filename 2>"<<endl; return 1; } shape_distribution distribution1(argv[1]); shape_distribution distribution2(argv[2]); //shape_distribution dist...
// Created on: 2001-01-06 // Created by: OCC Team // Copyright (c) 2001-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as publ...
#ifndef REDBLACKTREE_H #define REDBLACKTREE_H #include <iostream> enum Color {RED,BLACK}; template <class Item> struct TreeNode{ Item item; Color color; struct TreeNode* left; struct TreeNode* right; struct TreeNode* parent; TreeNode():left(NULL),right(NULL),parent(NULL),color(BLACK){} Tr...
#if (!defined __SQLWUI_UIEXTHYPERLINKBUTTON_H) #define __SQLWUI_UIEXTHYPERLINKBUTTON_H #include "Prof-UIS.h" #if (!defined __EXT_MFC_DEF_H) #include <ExtMfcDef.h> #endif #if _MSC_VER > 1000 #pragma once #endif ////////////////////////////////////////////////////////////////////////////// // CUIExtHyperLinkButton c...
// // Persona.h // Tarea3Ejercicio3 // // Created by Daniel on 07/10/14. // Copyright (c) 2014 Gotomo. All rights reserved. // #ifndef __Tarea3Ejercicio3__Persona__ #define __Tarea3Ejercicio3__Persona__ #include <iostream> class Persona{ private: std::string nombre, apellido; int edad; public: P...
#include <nan.h> #include <string> #include "webp/encode.h" #include "webp/decode.h" #include "./dec/pngdec.h" #include "./dec/jpegdec.h" #include "./dec/imageio_util.h" #include "./encode_worker.hpp" #include "./errors_msg.h" #include "./util.hpp" NAN_METHOD(N_WebPGetFeatures) { if (info.Length() != 1) { ...
#include "precompile.h" #include <string> #include <cstdio> #include "libop/op.h" #include "parser.h" #include "exception.h" #include "io.h" using namespace kwik; int main(int argc, char** argv) { std::vector<std::string> args {argv, argv + argc}; if (args.size() < 2) { op::printf("Usage: {} <file>...
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #define ui unsigned int #define ull unsigned long long #define us unsigned long long #pragma GCC optimize("03") using namespace std; ui cur = 0; ui a, b; inline ui nextRand24() { cur = cur * a + b; return cur >> 8; } inline ui next...
/* * BOW.hpp * * Created on: 2017年4月16日 * Author: lcy */ #ifndef BOW_HPP_ #define BOW_HPP_ #include <opencv2/opencv.hpp> #include <opencv2/xfeatures2d.hpp> class BowFeature { public: BowFeature() {}; ~BowFeature() {}; void FormVisualWords(int clusterCount, cv::Mat &allFeatures);//allFeatrues means a si...
#include "poligono.h" poligono::poligono(int l , const vector<punto*>& p):lati(l){ pt = copia(p); } unsigned int poligono::getlati() const { return lati; } vector<punto*> poligono::getpoint() const { return copia(pt); //ritorno la copia dei puntatori a punto } //massimo tre controlli : visto che uti...
#include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; struct Node{ int key; Node *prev, *next; }; Node *nil; void Init(){ nil = (Node *)malloc(sizeof(Node)); nil -> prev = nil; nil -> next = nil; return; } void Insert(int insert_key){ // 挿入するノード宣言してキーの値を入れる ...
#include <cstdio> #include <algorithm> using namespace std; int arr[805][805]; int out[805]; int final[805]; int main(void) { int cases; scanf("%d", &cases); for (int c = 0; c < cases; ++c) { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { scanf("%d...
// https://oj.leetcode.com/problems/combinations/ class Solution { void find_combine(vector<vector<int> > &ret, vector<int> &oneline, int begin, int n, int k) { if (k == 0) { ret.push_back(oneline); return; } for (int i = begin; i <= n - k + 1; i++) { ...
#include "gizmo_painter.h" #include <iostream> namespace wimgui { void gizmo_painter::clear() { } void gizmo_painter::gl_paint(view3d& view) { ImRect canvas = view.get_content_rectangle(); gl_program::state gl_state; gl_state.save_current_state(); gl_state.activate_imgui_defaults(); ImVec2 viewport_position ...
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; #define tests int t; cin >> t; while(t--) #define vll vector<ll> #define vi vector<int> #define pb push_back using namespace std; template <typename T> istream& operator >> (istream& i, vector<T>& v) { for(T& j : v) i >> j; return i; } v...
#ifndef UI_ACTION_INSTANTACTIONS_REMOVESELF_H_ #define UI_ACTION_INSTANTACTIONS_REMOVESELF_H_ #pragma once namespace ui { class UILIB_API RemoveSelf : public InstantAction { public: static RemoveSelf* Create(); virtual void Update(float time) override; virtual RemoveSelf* Reverse() const override; virtua...
/** * Copyright 2015 ViajeFacil * pelVector.hpp * ----------------------------------- * PEL - UEM - 2014/2015 Academic Year * ----------------------------------- * v4.0 - May 19, 2015 */ #ifndef PEL_Vector_HPP_INCLUDED #define PEL_Vector_HPP_INCLUDED #include <cstddef> #include <string> #include <initial...
#include "src/Physics/CollisionModel.h" namespace Physics { //衝突モデル //球 Sphere::Sphere() {} Sphere::Sphere(const Math::Vector3& pos, float rds) : mPos(pos), mRds(rds) {} Sphere::Sphere(const Sphere& a) : mPos(a.mPos), mRds(a.mRds) {} Sphere::~Sphere() {} Sphere& Sphere::operator=(const Sphere& a) { mPos ...
// // Created by Алексей Ячменьков on 04.11.2020. // #ifndef CALCUTE_TOKEN_H #define CALCUTE_TOKEN_H #include <iostream> #include <cmath> #include "std_lib_facilities.h" using namespace std; struct Token { char kind; // what kind of token double value; // for numbers: a value string name; Token (char ...
// Copyright (c) 2007-2019 Hartmut Kaiser // Copyright (c) 2011 Bryce Lelbach // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #pragma once #include <pika/config/def...
#include "texture.h" #include <glad/glad.h> #include <iostream> Texture::Texture(int width, int height, bool allocate) : twidth(width), theight(height), allocated(allocate) { if (allocated) buffer = new uint8_t[width * height * 4]; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, textu...
#include "ros/ros.h" #include <iostream> #include "std_msgs/Float64.h" #include <math.h> #define GOAL 0.0 #define OFFSET 0.003 #define VEL 0.6 #define AVER_NUM 3 class camera_motor_command { public: ros::NodeHandle nh; double position_x; double position_y; double orientation_x; double vel3; d...
// // Created by ali-masa on 3/18/20. // #ifndef THE_STATE_OF_THE_ART_LINKED_LIST_ULTIMATE_LINKED_LIST_H #define THE_STATE_OF_THE_ART_LINKED_LIST_ULTIMATE_LINKED_LIST_H #include <cstddef> #include "../PlatformIndependentConcurrency/mutex.h" #include "../PlatformIndependentConcurrency/concurrency_abstract_factory.h" #...
#include "Map.h" #include <QDebug> #include <QString> #ifdef Q_OS_ANDROID #include <QAndroidJniObject> #endif #include <QDesktopServices> #include <QUrl> namespace wpp { namespace qt { Map *Map::singleton = 0; Map &Map::getInstance() { if ( singleton == 0 ) { static Map singletonInstance; singleton = &singl...
#ifndef __CTRLEXECACT_H #define __CTRLEXECACT_H #include "ViewExecAct.h" #include "ModelExecAct.h" #include "CtrlBrowser.h" #include "CtrlActBrowser.h" #include "CtrlPropPg.h" #include "CtrlBrowserRO.h" namespace wh { //--------------------------------------------------------------------------- //--------------------...
#include <vector> #include <string> #include <iostream> #include <fstream> #include <sstream> #include <list> #include <algorithm> #include <sstream> #include <set> #include <cmath> #include <map> #include <stack> #include <queue> #include <cstdio> #include <cstdlib> #include <cstring> #include <numeric> #include <bits...
#include <iostream> #include <cmath> using namespace std; int main() { int N; long long ans=0; cin>>N; for(int i=1;i<=sqrt(N);i++) { ans=ans+N/i-(i-1); } cout<<ans<<endl; return 0; }
/*************************************************************************** * Copyright (C) 2009 by Dario Freddi * * drf@chakra-project.org * * * * This pr...
#ifndef _OPTIONPAY_H__ #define _OPTIONPAY_H__ /* Payoff of the option */ #include <iostream> #include <vector> //#include "BinomialTree.h" class Payoff { protected: double strike; //strike price bool call; // if call, be true //double S0; // public: //Payoff(double stike_, double call_):strike(strike_), c...
// Copyright (c) 2017 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special ...
#pragma once /* Animation is an abstraction that defines the ways an animation can be interacted with. It is a collection of the points on a texture that defines each index a sprite starts at on that texture, regardless of the size of the texture */ class Vector2i; class Animation { public: Anima...
#ifndef ATTACK_H_ #define ATTACK_H_ #include <string> #include <vector> #include <iostream> using namespace std; class Attack{ private: string object; string status; string print; public: string getObject(); void setObject(string); string getStatus(); void setStatus(string); string getPrint(); void setPr...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #ifndef ICONUTILS_H #define ICONUTILS_H #include "adjunct/deskt...
#include "MeMCore.h" MeUltrasonicSensor kAndur(PORT_3); MeDCMotor motorParem(M1); MeDCMotor motorVasak(M2); uint8_t motorSpeed = 100; void setup() { Serial.begin(9600); } void loop() { float kaugus = kAndur.distanceCm(); Serial.print("Kaugus: "); Serial.print(kaugus ); Serial.println(" cm"); delay(100...
#include <bits/stdc++.h> using namespace std; #define TESTC "" #define PROBLEM "11235" #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) #define MAX 100000 int table[MAX*4]; int number[MAX+5]; int Left[MAX+5]; int Right[MAX+5]; int ans; void build_tree(int Tree[MAX*4],int Need[MAX] ,int L,int R,int seat...
#include <iostream> using namespace std; int factorial(int x) { if(x==0){ cout<<"x ="<<x<<" at "<<&x<<endl; return 1; }else { cout<<"x ="<<x<<" at "<<&x<<endl; return x*factorial(x-1); } } int main() { factorial(5); // Các biến x cách nhau 48 byte // Kích t...
#ifndef EITHER_HPP #define EITHER_HPP #include <functional> #include <variant> template <typename Left, typename Right> class Either { public: Either() = default; Either(const Left& val) : val(val) { } Either(const Right& val) : val(val) { } Either(const std::variant<std::monostate, Left, Right>& v...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2000-2011 Opera Software ASA. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** ** Yngve Pettersen ** */ // Url_cm.cpp // URL Cookie Management...
#pragma once template <typename T> void swap(T *a, T *b); template <typename T> void bubble_sort(T *list, int size); template <typename T> void selection_sort(T *list, int size); template <typename T> void insertion_sort(T *list, int size); template <typename> void merge_sort(T *list, int size); #include "functio...
#include "Shader.h" #include <cassert> #include <fstream> #include <glad/glad.h> static void checkShaderError(int shader, int flag, bool isProgram, const std::string& errorMessage); static std::string loadShader(const std::string& fileName); Shader::Shader() { m_programID = glCreateProgram(); if (m_programID == 0...
#include "screen.h" #include <stdio.h> #include <cstring> namespace pawstef { Screen::Screen() : window(NULL), renderer(NULL), texture(NULL), buffer1(NULL), buffer2(NULL) { } bool Screen::init() { if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { return false; } window = SDL_CreateWindo...
// Q. Variable sized array // https://www.hackerrank.com/challenges/variable-sized-arrays/problem #include<iostream> #include<vector> using namespace std; int main() { vector< vector<unsigned int> > arr; unsigned int n, q, i, j, k, num; cin>>n>>q; for(i=0; i<n; i++) { vector<unsigned int> t...
/* XMRig * Copyright 2010 Jeff Garzik <jgarzik@pobox.com> * Copyright 2012-2014 pooler <pooler@litecoinpool.org> * Copyright 2014 Lucas Jones <https://github.com/lucasjones> * Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> * Copyright 2016 Jay D Dee <jayddee246@gmail.com> * C...
/********************************************************** // // Wih (Wireless Interface Hockey) // // airhockey.cpp (ゲームのメインクラス) // // Copyright (C) 2007, // Masayuki Morita, Kazuki Hamada, Tatsuya Mori, // All Rights Reserved. **********************************************************/ #include <t...
// Print the prime factorisation of number #include <iostream> using namespace std; int main() { int n,c; cin>>n; for(int i=2;i<n;i++) { if(n%i==0) { c=1; for(int j=2;j<i/2;j++) { if(i%j==0) c=0; } if(c==1)...
#include "Light.h" Light::Light() { _iRed = 0; _iGreen = 0; _iBlue = 0; } Light::Light(float r, float g, float b) { _iRed = r; _iGreen = g; _iBlue = b; } Light::Light(float x) { _iRed = _iBlue = _iGreen = x; } float Light::GetRedIntensity() { return _iRed; } void Light::SetRedIntensity(const float r) { _i...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2010 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #include "core/pch.h" #ifdef SKIN_SUPPORT #include "modules/ski...
#include "aes256.h" #include "encrypt_commons.h" #include <iostream> int main (int argc, char * argv[]) { if (argc != 4) { printf("Usage: %s <filepath to object to cipher> <password path> <out_path>\n", argv[0]); exit(1); } using namespace Cipher; std::string pass; loadfile_into_st...
#include <iostream> #include <stdlib.h> #include <sstream> #include <stdio.h> using namespace std; #include "soft.h" soft* my_obj = nullptr; int main() { int command_1; int memory; string str; char name[20]; char extension[20]; int size; char date[20]; char time[20]; soft* copy_obj = null...
/*Assume that the value of a = 1, b = 2, c = 3, ... , z = 26. You are given a numeric string S. Write a program to return the list of all possible codes that can be generated from the given string. Note : The order of codes are not important. And input string does not contain 0s. Input format : A numeric string Constra...
#ifndef TREEFACE_VISUAL_OBJECT_GUTS_H #define TREEFACE_VISUAL_OBJECT_GUTS_H #include "treeface/scene/VisualObject.h" #include "treeface/scene/SceneGraphMaterial.h" #include "treeface/scene/guts/Utils.h" #include "treeface/gl/VertexArray.h" namespace treeface { struct VisualObject::Impl { Impl(Geometry* geom, Sce...
#include "trackingvideo.h" #include "ui_trackingvideo.h" #include "MatToQImage.h" #include "facetracking.h" #include "QProgressBar" #include <QGraphicsDropShadowEffect> void Worker::doWork(){ //referencia https://stackoverflow.com/questions/35673201/qt-5-update-qprogressbar-during-qthread-work-via-signal/35673612 ...
#include "Producer.h" #include "Utils.h" #include <unistd.h> #include <iostream> #include <string> using namespace std; // Producer class which encapsulates the functionalities // of a producer, such as produce random numbers and write // to the pipe. // The constructor receives an array of references to the // pipe ...
// 2 The Edge - Team 8: Liam Hall, Dan Powell, Louis Mills, Mo Patel, Ethan Gangotra, Hencraft, keasibanda #pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "Pickup.generated.h" class ATwoTheEdgeCharacter; UCLASS() class TWOTHEEDGE_API APickup : public AActor { GENERATED_BODY() publi...
#pragma once #include <unordered_map> #include <memory> template <typename Resource> class ResourceManager { std::unordered_map<std::string, std::shared_ptr<Resource>> resources; public: inline void add(std::string&& key, std::shared_ptr<Resource>&& res) { resources[key] = res; } inline void remove(std::string&& ...
#include "menu-1.h" #include "jeu.h" void menu1(SDL_Surface *ecran) { /// On cree l'ensemble des surfaces n�cessaires SDL_Surface* menu; SDL_Surface* buttonPlay; SDL_Surface* buttonHelp; SDL_Surface* buttonClose; menu = IMG_Load("images/menu-1.jpg") ; buttonPlay = IMG_Load("i...
#include "CQEnum_Pch.hpp" #include "CQEnum.hpp" namespace CQSL { namespace CQEnum { void CQEnumInfo::ParseFrom(InputSrc& srcFile) { // Check the main file info stuff, so File= first srcFile.bCheckNextId("File", "Expected the File= block to be first in the file", true, true); // We have to see the version...
#include "Races.h" class cArmyManager { private: typedef MapPair std::pair<int,cArmy> std::map<MapPair> mArmies; int mLastID; public: cArmyManager() : mLastID(0) {} cArmy& GetNewArmy(eRace aOwner, int aWeak, int aStrong){} void DisbandArmy(int aArmyID){} cArmy& GetArmyByID(int aArmyID){mArmies.} }; cla...
#include<stdio.h> #include<conio.h> #include<string.h> using namespace std; int main() { FILE *fp1,*fp2; fp1 = fopen("trial.txt","r"); fp2 = fopen("trial1.txt","w"); char str[80]; char str1[80]; while(fgets(str,80,fp1)!=NULL) { fputs(str,stdo...
/* ID: stevenh6 TASK: milk2 LANG: C++ */ #include <iostream> #include <fstream> #include <string> #include <algorithm> using namespace std; struct Time { int start, end; }; bool comp(Time l, Time r) { return l.start < r.start; } int main() { ofstream fout ("milk2.out"); ifstream fin ("milk2.in"); int n; ...