text
stringlengths
8
6.88M
/**************************************************** * RoseBin :: Binary Analysis for ROSE * Author : tps * Date : 6Jun07 * Decription : Interface for analysis to compare * Source Tree with Binary Tree ****************************************************/ #ifndef __RoseBin_ASTAttribute__ #define __...
#include "nfa.h" #include "util.h" namespace wcc::regex { void nfa_node::add(NodeArrayElement e) { if (unlikely(rank == NFA_MAX_RANK)) panic("nfa rank excedded"); edges[rank] = e; ++rank; } nfa_node* nfa_node::add(KeyType s) { if (unlikely(rank == NFA_MAX_RANK)) panic("nfa rank excedded"); nfa_nod...
/******************************************************************************* * Cristian Alexandrescu * * 2163013577ba2bc237f22b3f4d006856 * * 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ...
#pragma once #include <string> #include <stdexcept> namespace EngineLayer { //C# TO C++ CONVERTER NOTE: The following .NET attribute has no direct equivalent in native C++: //ORIGINAL LINE: [Serializable] public class MetaMorpheusException : Exception class MetaMorpheusException : public std::runtime_er...
// Name: Anurag // Roll no: 1601CS05 #include <bits/stdc++.h> using namespace std; int main() { freopen("test.txt", "r", stdin); int frames; while (cin >> frames) { int n = 0, h; vector<int> arr; int hits = 0; int pageFault = 0; int ans[100][100] = {0}, current[100]; int time[100] = {0}; while (...
#include <Servo.h> #include <ESP8266WiFi.h> #include <ESP8266WiFiAP.h> #include <ESP8266WiFiGeneric.h> #include <ESP8266WiFiMulti.h> #include <ESP8266WiFiScan.h> #include <ESP8266WiFiSTA.h> #include <ESP8266WiFiType.h> #include <WiFiClient.h> #include <WiFiClientSecure.h> #include <WiFiServer.h> #include <WiFiUdp.h> Se...
#include <cstdio> #include <cstdlib> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <cstring> #include <string> void send_to_client(int &client, char* msg, FILE* log) { char buffer[1024] = {}; fprintf(stdout, "[192.168.1.64] %s\n", msg); fprintf(log, "[192.168.1.64] %s\n", m...
#include "TestAPLCON.h" #include "plot/root_draw.h" #include "utils/combinatorics.h" #include "base/std_ext/math.h" #include <APLCON.hpp> #include <string> #include <vector> #include <numeric> #include <functional> #include <iomanip> using namespace std; using namespace ant; using namespace ant::analysis; using nam...
#ifndef __QUADTREE_H__ #define __QUADTREE_H__ #include <vector> #include "Shape.hpp" using std::vector; enum Node { NW = 0, NE, SW, SE, NodeCount }; #define GROW_OBJECTS 50 class Quadtree { public: Quadtree(); Quadtree(double left, double right, double top, double down, unsigned int numObjectsToGrow =...
#ifndef MATH_H #define MATH_H struct D3DXMATRIX; namespace kyrbos { typedef D3DXMATRIX* Matrix; } #endif
#include"Food.h" Food::Food(int _x, int _y) :Cell(_x, _y) { assert(_x > 0 && _x < MAX_HEIGHT - 1); assert(_y > 0 && _y < MAX_WIDTH - 1); type = '*'; } bool Food::can_pass_through() { return true; }
//  Created by Frank M. Carrano and Timothy M. Henry. //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey. /** A class of nodes for an array-based binary tree. Listing 16-1. @file TreeNode.h */ #ifndef TREE_NODE_ #define TREE_NODE_ template<class ItemType> class TreeNode { private: ItemType item; ...
#include <iostream> using namespace std; void main() { int price[3] = { 500,400,300 }; int order,money; int a, b; cin >> order >> money; money = money - price[order-1]; a = money / 500; b = (money - a * 500) / 100; if (order == 1) cout << "Lemon Tea" << endl; else if (order == 2) cout << "Americano" ...
#include "Global.hpp" using namespace godot; Global* Global::g = nullptr; void Global::_register_methods() { register_method("_ready", &Global::_ready); return; } void Global::_init() { } void Global::_ready() { if (g == nullptr) { g = this; } m_loader = ResourceLoader::get_single...
#include <iostream> #include <stdio.h> #include <stdlib.h> using std::cout; using std::cin; using std::endl; int MAX(int f, int g){ int h; if(f>g){ h=f; } else { h=g; } return h; } int main(){ int a,b,c; cout << "Introduzca el valor de a: " <<endl; cin >> a; cout...
#pragma once #include <SFML/Graphics.hpp> #include <random> #include <ctime> #include <fstream> using namespace sf; #define WINDOW_WIDTH 1200.f #define WINDOW_HEIGHT 800.f #define BASE_GAME_SPEED_S 0.1f #define NUM_OF_SNAKES 7 #define MAX_FPS 50 #define LOOP(n)for(size_t i = 0;i<n;i++) ///DEBUG mod //#define DEBUG ...
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QtCore> #include <QtGui> #include <QtWidgets> #include <QNetworkAccessManager> #include <QNetworkReply> //#include <angelscript.h> #include "ui_mainwindow.h" #include "ArduManFX.h" #include "game.h" #define DEBUG_MESSAGE "%s: %d\n", __FILE__, __LINE__ ...
#include "..\Render\GPUProgram.h" #include "..\include\vector.h" #include "..\GLRender\opengl.h" GPUProgram::~GPUProgram() { } class gl_GPUProgram : public GPUProgram { public: gl_GPUProgram(const unsigned char versionGL[2]); virtual ~gl_GPUProgram() override { shutdown(); } virtual void shutdown(void) overr...
#ifndef TASKTHREAD_H #define TASKTHREAD_H #include "ActionType.h" #include <QObject> #include <QRunnable> namespace ModelData { class ModelDataBase; } namespace Plugins { class SelectTaskTransferData; } /** * @brief The CommitRunable class * * 任务上传执行类 * */ class CommitRunable : public QObject, public QRunnable ...
#pragma once #include "ClientCommand.h" #include "Game.h" #include "Player.h" #include <vector> #include <memory> class GameDivider { public: GameDivider(); void PassCommand(std::shared_ptr<ClientCommand> command); ~GameDivider(); private: std::vector<std::unique_ptr<Game>> waiting_games; std::vector<std::un...
#include "RobotMovingFunctions.h" void setup() { setIOpins(); // Funny dancing move. int i = 0; for (i = 0; i < 10; i++) { robotLeft(); delay(100); robotRight(); delay(100); } robotStop(); } void loop() { }
#pragma once #include "../debug.h" #include "../types.h" #include "allocator.h" #include <string.h> namespace lu { template<class T> struct IArray { // Abstract Methods virtual void resize(uint32_t newSize) = 0; virtual void finalize() {} IArray() : pBuffer(NULL), size(0), capacity(0) {} IArray(uint32_...
class Solution { public: string alienOrder(vector<string>& words) { unordered_set<char> chars; // store all chars in given words set<pair<char, char>> st; // store order pairs vector<int> indegree(128); // here assume first 128 ASCII queue<char> q; // to hold zero-indegree node, and ...
// iniciar // abrir porto série com taxa de transmissão de 9600 bps void setup(){ Serial.begin(9600); } // ligar sensor de escala de cinzentos a pino anaógico 5 // imprimir o valor através do porto série void loop(){ int valor; valor=analogRead(5); Serial.println(valor,DEC); delay...
#pragma once namespace GraphicsEngine { class GeometryGenerator { public: struct Vertex { Vertex() = default; Vertex(const DirectX::XMFLOAT3& position, const DirectX::XMFLOAT3& normal, const DirectX::XMFLOAT3& tangentU, const DirectX::XMFLOAT2& textureCoordinates); DirectX::XMFLOAT3 Position; D...
//************************************************************************** //** //** See jlquake.txt for copyright info. //** //** This program is free software; you can redistribute it and/or //** modify it under the terms of the GNU General Public License //** as published by the Free Software Foundation; either ...
#include "CommandsDistributor.h" CommandsDistributor::CommandsDistributor(QObject *parent) : QObject(parent) {} void CommandsDistributor::emitCommandReply(QNetworkReply *reply) const { emit commandReplyReceived(reply); }
#ifndef PLANE_H #define PLANE_H #include "kalman/ekfilter.hpp" class cPlaneEKF : public Kalman::EKFilter<double,1,false,true,false> { public: cPlaneEKF(); protected: void makeBaseA(); void makeBaseH(); void makeBaseV(); void makeBaseR(); void makeBaseW(); void makeBaseQ(); void makeA(); void makeH(); voi...
/* * autoShoot.cpp * * Created on: May 4, 2015 * Author: vandenrobotics */ #include "autoShoot.h" #include "ShooterOn.h" #include "ConveyorStopperOn.h" #include "Delay.h" AutoShoot::AutoShoot() { AddParallel(new ShooterOn()); AddSequential(new Delay()); AddSequential(new ConveyorStopperOn()); }
/*************************************************************************** Copyright (c) 2020 Philip Fortier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or...
// This file has been generated by Py++. #ifndef ConstBaseIterator_e78994bfd2b781a573fdd2cd7ca2ceae_hpp__pyplusplus_wrapper #define ConstBaseIterator_e78994bfd2b781a573fdd2cd7ca2ceae_hpp__pyplusplus_wrapper void register_ConstBaseIterator_e78994bfd2b781a573fdd2cd7ca2ceae_class(); #endif//ConstBaseIterator_e78994bfd2...
/*기본적으로 풀었다. * 오래걸려서 최적화를 시도하려했으나 * 그건 나중으로 미루겠다.` */ #include <stdio.h> #include <math.h> int n,lo,hi; int hi_lo; int array[10000001]; int main() { int c; scanf("%d",&c); for(int i=1;i<5000000+1;i++) { array[i]=1; } for(int i=5000000+1;i<10000000+1;i++) { array[i]=2; } for(int i=2;i<5000000+1;i++) {...
/* * Copyright 2016-2017 Flatiron Institute, Simons Foundation * * 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 ...
#include "packetparser.h" PacketParser::PacketParser() { // } PacketParser::~PacketParser() { // } void PacketParser::setCalibrationPacket(Packet zeroOffset) { m_zeroOffset = zeroOffset; } void PacketParser::setPacket(QString packet) { m_parsePacket(packet); } void PacketParser::setPacket(QByteArra...
// Copyright (c) 2015 University of Szeged. // Copyright (c) 2015 The Chromium Authors. // All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SPROCKET_BROWSER_UI_TAB_H #define SPROCKET_BROWSER_UI_TAB_H #include "ui/views/view.h" #inclu...
#include "sudoky.h" #include <graphics.h> char task[9][10], decision[9][9], test[9][10]; int vhod; int main() { int t=0; vhod=Menu(); if ((vhod>3)&&(vhod!=21)&&(vhod!=22)) t=workfile(vhod); if (vhod<=3) { closegraph(); system("PAUSE"); return 0; } if ((vhod==21)||(vhod==22)) check(); else play(); get...
#define TRIGGER A1 #define ECHO A0 int pinA = 2; int pinB = 3; int pinC = 4; int pinD = 5; int pinE = 6; int pinF = 7; int pinG = 8; int pinH = 0; int D1 = 12; int D2 = 11; int D3 = 10; int D4 = 9; 6 int numero, unidades, decenas, centenas, millar; const float sonido = 34300.0; void setup() { Serial.begin(9600); ...
// Fill out your copyright notice in the Description page of Project Settings. #include "./DamageBuffBaseComponent.h" UDamageBuffBaseComponent::UDamageBuffBaseComponent() { PrimaryComponentTick.bCanEverTick = false; } void UDamageBuffBaseComponent::BeginPlay() { } int UDamageBuffBaseComponent::ApplyDamage(const i...
#include<time.h> #include<stdlib.h> #include<iostream> #include<string.h> #include<fstream> #include"cardshow.h" #include"rank.h" #include"123.h" #include"doyouwant.h" #pragma once using namespace std; namespace miniprojectfirstassignment { using namespace System; using namespace System::ComponentModel...
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> using namespace std; int main() { int tc; cin>>tc; while(tc--) { int n,k; cin>>n; cin>>k; int vals[n]; for(int i=0;i<n;i++) cin>>vals[i]; bool arr[k+1][n+1]; for(int i=0;i<=n;i++) ...
/** * \file symbol_table.cpp * \date Jan 31, 2016 */ #include "pcsh/assert.hpp" #include "ir/nodes.hpp" #include "ir/symbol_table.hpp" #include <unordered_map> namespace pcsh { namespace symbol_table { struct variable_name_hash { inline size_t operator()(const ir::variable* v) const { ...
#ifndef APPLICATION_H_ #define APPLICATION_H_ #include <GL/glut.h> #include <time.h> class Window; class World; class Graph; class Painter; class Manager; class Application; class Application { public: enum Status { Idle, Draw, Drag, Save, Load, New, }; Application(); void init(); void run(); ...
// // Created by aleksandr on 15.04.2021. // #pragma once #include <list> #include <memory> #include <boost/property_tree/ptree.hpp> #include "Player.h" namespace logic { struct HandConfiguration { unsigned int button_pos; unsigned int small_blind_pos; unsigned int big_blind_pos; int small_blind_...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "base.h" WINRT_WARNING_PUSH #include "internal/Windows.Foundation.3.h" #include "internal/Windows.Storage.Streams.3.h" #include "internal/Windows.Devices.Custom.3.h" #include "Windows...
//! @file datafile.h //! @brief データ管理クラスの宣言 /** * LynxOPS * * Copyright (c) 2015 Nilpaca * * Licensed under the MIT License. * https://github.com/Nilpaca/LynxOPS/blob/master/LICENSE */ //-------------------------------------------------------------------------------- // // OpenXOPS // Copyright (c) 2014-2015,...
#include <bits/stdc++.h> #define ll long long using namespace std; typedef tuple<ll, ll, ll> tp; typedef pair<ll, ll> pr; const ll MOD = 1000000007; const ll INF = 1e18; template <typename T> void print(const T &t) { std::copy(t.cbegin(), t.cend(), std::ostream_iterator<typename T::value_type>(std::co...
#include "./ledger_account.hpp" #include <memory> namespace ltui { ledger_account::ledger_account(std::string val) : _val(std::move(val)) {} std::string ledger_account::to_string() const { return _val; } } // namespace ltui
// This is an independent project of an individual developer. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com #include "Vector2.h" #include "FuncSplit.h" #include <sstream> namespace MathsLib { // Static members initialization const Vector2 Vec...
// // Student.h // Homework6 // // Created by HeeCheol Kim on 2018. 10. 12.. // Copyright © 2018년 HeeCheol Kim. All rights reserved. // #pragma once #include <iostream> #include <string> using namespace std; class Student { public: Student() {} ~Student() {} void printInfo(int subjectCount); void i...
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. #include "GameSystem.h" #include "../Items/GSItemWeaponInfo.h" #include "../Items/IGSEquipment.h" #include "../Weapons/GSWeaponRanged.h" #include "../Weapons/GSWeaponEquipmentComponent.h" #include "../GSCharacter.h" //temp! #include "Net/UnrealNetwork.h" /...
#pragma once #include <SFML/Graphics.hpp> #include <string> #include <list> #include <unordered_map> #include <fstream> #include <iostream> #include <thread> #include <mutex> //Chrono null #include <unistd.h> #include "SoundHandler.hpp" #include "macro.h" #include "Case.hpp" #include "StringToVec.hpp" #include "Bo...
#include "Bird.h" #include <math.h> CBird::CBird() : m_Y(250), m_vY(0), m_rot(0), m_X(250) { m_tex = getShareHGE()->Texture_Load("res\\Images\\Birds.png"); m_animation = new hgeAnimation(m_tex,3,10,0,0,40,40); m_animation->SetHotSpot(20,20); m_animation->Play(); } CBird::~CBird() { delete m_animation; } void CB...
#include <semaphore.h> #include <time.h> class MutexLock { public: MutexLock(); ~MutexLock(); bool lock(long locktime , long waittime); bool lock(long locktime ); bool unlock(); int i ; protected: bool trylock(long locktime); bool tryunlock(); private: sem_t g_semaphore; long lock_time; long locktime; ...
#include<iostream> #include<algorithm> using namespace std; int main() { long long int arr[100000],arra[100000],i,j,n; cin>>n; for(i = 0;i < n;++i) cin>>arr[i]; for(i = 0;i < n;++i) arra[i] = 1; for(i = 1;i < n;++i) { for(j = 0;j < i;++j) { if (arr[i]...
#include <iostream> using namespace std; int First_BinarySearch(int arr[],int n,int element) { int start=0; int end=n-1; int pos=-1; while(start<=end){ int mid=start+(end-start)/2; if(arr[mid]==element){ pos=mid; end=mid-1; } else if...
#include <Script_Task.hpp> #include <Script_Component.hpp> #include <Scene.hpp> namespace engine { Script_Task::Script_Task(int priority, Scene & scene) : Task(priority) { _scene = &scene; } bool Script_Task::initialize() { set_script_components(); return true; } bool Script_Task...
#include "client.hpp" std::string getStringFromFile(std::string filename) { std::cout << "fetching string from file " << filename << "\n"; std::fstream fs; std::string dataString = ""; fs.open(filename, std::ios_base::in); if(fs.is_open()) { fs >> dataString; fs.close(); } ...
// // Created by 梁栋 on 2019-05-16. // #include <vector> #include <iostream> using namespace std; class Solution { public: vector<int> productExceptSelf(vector<int>& nums) { vector<int> l2r; vector<int> r2l; l2r.push_back(1); for(int i=1;i<nums.size();i++){ l2r.push_back(n...
#include <iostream> #include <string> #include <cmath> #include <vector> using namespace std; class Solution { public: string longestCommonPrefix(vector<string> &strs) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reused for each test case. ...
#ifndef _THREADSAFE_QUEUE_H_ #define _THREADSAFE_QUEUE_H_ //This file is from http://blog.csdn.net/liuxuejiang158blog/article/details/17301739 //Thanks to liuxuejiang #include <queue> #include <memory> #include <mutex> #include <condition_variable> template<typename T> class threadsafe_queue { private: ...
/* FRACTION TO RATIONAL NUMBER */ #include<iostream> using namespace std; int gcd(int a,int b) { if(a%b==0) return b; return gcd(b,a%b); } void rational(double n) { int a=1; while((n-(int)(n))>0.0000001) { //cout<<(n-(int)(n))<<endl; a=a*10; n=n*10; } int ...
#include<stdio.h> #include<malloc.h> #define MAX 1000 int findpairs(int [],int,int); int main(){ int arr[]={1,3,4,2,7,5,11,9,16}; int n=sizeof(arr)/sizeof(arr[0]); int sum=20; //printf("%d",sizeof(arr[0])); findpairs(arr,n,sum); return 0; } int findpairs(int arr[],int size,int sum){ bool bitmap[MAX]={0}; in...
#include "aps_extractor.h" /*runs aps_extractor on outputs from the ellipses_integrable chisquared function this can be compiled with make aps_extract_ellipse */ main(){ aps_extractor test; test.set_filename("aps_output/ellipse/fullAnalysis/ellipse_d5_c4_output.sav"); test.set_delta_chi(11.0); //test.set_cutoff(1...
// --------------------------------------------------------------------------- // ip.cpp // Image processing. // Filters are implemented using parallel processing and GDI+ library. // Based on MSDN documentation. // // author. ebarsall // // Remarks // On command line compile using: // cl.exe /DUNICODE /EHsc ip.cpp /...
/* 1到100之间的的奇数、奇数之和、奇数个数、平均数 1到100之间的的奇数最大值为99 如果要改为i<=100,则后面要改为if(i%2 == 1) */ #include <stdio.h> int main(void) { int i; int c=0;//个数一般用cnt表示 int sum = 0; float avg; for(i=0;i<=99;++i) { i=i+1; c=c+1;//++c sum=sum+i; printf("i=%d\n",i); } avg = 1.0*sum/c; printf("c=%d\n",c); prin...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once WINRT_EXPORT namespace winrt { namespace ABI::Windows::Phone::System::UserProfile::GameServices::Core { struct IGameService; struct IGameService2; struct IGameServicePropertyCollection; stru...
#include <TESTS/test_assertions.h> #include <TESTS/testcase.h> #include <CORE/UTIL/FILES/xml_parser.h> #include <CORE/VFS/vfs_file.h> using core::util::files::XmlNode; REGISTER_TEST_CASE(testParseTest) { vfs::ifstream ifile( vfs::Path("TESTS/CORE/UTIL/FILES/testdata/xml_parser_tests.xml")); TEST(testing::a...
Remove Duplicates from Sorted List Problem Description Given a sorted linked list, delete all duplicates such that each element appear only once. Problem Constraints 0 <= length of linked list <= 106 Input Format First argument is the head pointer of the linked list. Output Format Return the head pointer of t...
#pragma once #include<SFML/Graphics.hpp> using namespace sf; class Menu { Menu(); Menu() = delete; ~Menu() = default; void draw(RenderWindow& window); void MoveUp(); void MoveDown(); int GetPressedItem() { return selectedItemIndex; } private: int selectedItemIndex; Font font; Text menu[4]; };
#ifndef _DELEGATE_SP_H #define _DELEGATE_SP_H // DelegateSp.h // @see https://www.codeproject.com/Articles/5277036/Asynchronous-Multicast-Delegates-in-Modern-Cplusplus // David Lafreniere, Aug 2020. #include "Delegate.h" #include <memory> namespace DelegateLib { template <class C, class R> struct DelegateMemberSp; ...
#include<bits/stdc++.h> using namespace std; int main(){ int vet[100000], n; cin >> n; for(int i =0 ; i < n; i++) cin >> vet[i]; int perguntas = 100000; while(perguntas--){ int k; cin >> k; bool resposta = false; int esq = 0, dir = n-1, meio; while(esq <= dir){ meio = (esq+dir...
#pragma once #include "TVCreator.h" #include "utilites/Localizator.h" #include <ATLWIN.H> enum TVM { TVFM_CHILDLBUTTONDOWN=WM_USER, TVFM_DELETECHILD, TVFM_REPLACECHILD, TVFM_UPDATELAYOUT, TVFM_ARRANGEWINDOWS, TVFM_STARTDRAG, TVFM_ISINDRAGMODE, TVVM_GETCLASSPTR, TVVM_COPYCLIP, }; ...
/* @brief Files.cpp * This program get contents of the files and * save it in a variable and write content to * text files */ #include <bits/stdc++.h> using namespace std; extern map<int, int> tablePermutation; void obtainTable( string nameFile, string *valueofPhi ){ ifstream filetoOpen; string mes...
#include "RobotMovingFunctions.h" const int LIGHT_SENSOR_PIN = A0; const int EDGE_LIGHTING = 250; void robotForwardPWM() { digitalWrite( LEFT_MOTOR_PIN_1, LOW); analogWrite( LEFT_MOTOR_PIN_2, 150); digitalWrite( RIGHT_MOTOR_PIN_1, LOW); analogWrite( RIGHT_MOTOR_PIN_2, 150); } void setup() { setIOpins()...
#ifndef KNN_H #define KNN_H #pragma once #include <iostream> #include <fstream> #include <cstdio> using namespace std; class kNN { public: //Instructors kNN() { } kNN(int k) { this->k = k; TP = 0; TN = 0; FP = 0; FN = 0; } void clear() { free(map); } //Training void tr...
#include <bits/stdc++.h> #define ll long long const int L = 31 ; int x , s ; int main() { scanf("%d %d" , &x , &s) ; ll r = 1 ; for (int i = 0 ; i < L ; ++i) { int p1 = x & (1 << i) ? 1 : 0 , p2 = s & (1 << i) ? 1 : 0 ; if (p1) { if (p2) r <<= 1 ; else r = 0 ; } } if (x == s) --r ; printf("%lld...
#include <iostream> #include "../../include/cppoptlib/meta.h" #include "../../include/cppoptlib/problem.h" #include "../../include/cppoptlib/solver/bfgssolver.h" // to use CppNumericalSolvers just use the namespace "cppoptlib" namespace cppoptlib { // we define a new problem for optimizing the rosenbrock function // ...
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "MazeParams.h" #include "martian.h" int minIt(int [], int); int minRec1(int [], int); int minRec2(int [], int); double sqrtIt(double, double, double); double sqrtRec(double, double, double); int strCompare(char*, char*); ...
/*************************************************************************** Copyright (c) 2020 Philip Fortier This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or...
#include "RectangleEntity.h" RectangleEntity::RectangleEntity(sf::Color color, sf::Vector2f size, sf::Vector2f pos) : Entity("Rectangle", Tag::Rectangle, new sf::RectangleShape(size), color, pos ){} RectangleEntity::RectangleEntity(){} RectangleEntity::~RectangleEntity(){} void RectangleEntity::ReactToCollision(sf:...
#include "stdafx.h" #include "GameScene.h" void GameScene::Init() { } void GameScene::Release() { } void GameScene::Update() { } void GameScene::Render(HDC hdc) { }
#include <iostream> #include "../../include/cppoptlib/meta.h" #include "../../include/cppoptlib/problem.h" #include "../../include/cppoptlib/solver/bfgssolver.h" // nolintnextline using namespace cppoptlib; // we define a new problem for optimizing the Simple function // we use a templated-class rather than "auto"-la...
#include "Stack.h"" int main(int argc, char* argv[]) { Stack* stack = new Stack(); for (int i = 0; i < 10; i++) { stack->push(i); } stack->print(); getchar(); return 0; }
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <vector> #include <queue> #include <set> using namespace std; const int N = 1111; char w[N][N]; struct edge { edge(int a = 0, int b = 0, int c = 0) : end(a) , capacity(b) , back_edge(c) {} int e...
#pragma once #include "glmath.h" #include "Color.h" enum PrimitiveTypes { Primitive_Point, Primitive_Line, Primitive_Plane, Primitive_Cube, Primitive_Sphere, Primitive_Cylinder }; class Primitive { public: Primitive(); virtual void Render() const; virtual void InnerRender() const; void SetPos(float x, ...
/* Copyright (c) 2011 Andrew Wall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub...
/*************************************************************************** Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 2010-2020 DADI ORISTAR TECHNOLOGY DEVELOPMENT(BEIJING)CO.,LTD FileName: StrPtrLen.cpp Description: Implemention an class which encapsules the char string class with ...
#include <iostream> #include "Vecteur.hpp" #include "Matrice.hpp" #include "MatriceCarree.hpp" using namespace std; int main ( int argc, char ** argv ) { MatriceCarree m ( "matrice2.txt" ); cout << m << endl; cout << "Determinant: " << m.determinant () << endl; return 0; }
//===--- ArgumentSource.cpp - Latent value representation -----------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/L...
// stl算法操作普通数组 #include <iostream> #include <algorithm> int main() { int col[]={1,5,7,2,8}; std::sort(col,col+5); std::copy(col,col+5,std::ostream_iterator<int>(std::cout," ")); std::cin.get(); return 0; }
#include <string> using namespace std; class Solution { public: string addBinary(string a, string b) { auto iter_a = a.rbegin(); auto iter_b = b.rbegin(); string res; int carry = 0, sum = 0; while (iter_a != a.rend() || iter_b != b.rend()) { sum = carry; if (iter_a != a.rend()) { ...
/* * LightSource.cpp * */ #include "LightSource.h" namespace rt {} // namespace rt
#include "ToolBox.h" ToolBox::ToolBox() { } ToolBox::~ToolBox() { } GLuint ToolBox::CreateTexture(char const * Filename) { gli::texture Texture = gli::load(Filename); if (Texture.empty()) return 0; gli::gl GL(gli::gl::PROFILE_GL33); gli::gl::format const Format = GL.translate(Texture.format(), Texture.swizzle...
#include <IRremote.h> #define PIN_IR_SEND 5 #define PIN_IR_DETECT 6 #define PIN_RED_STATUS 9 #define PIN_GREEN_STATUS 10 #define PIN_BLUE_STATUS 11 boolean irSendStatus = false; boolean irDetectStatus = false; IRsend irsend; IRrecv irrecv(PIN_IR_DETECT); decode_results results; void red (int d = 50) { digitalWri...
#include "VendingMachine.h" std::shared_ptr<IDrink> VendingMachine::getDrink(const DrinkType &type) { auto factory = std::make_shared<Factory>(); return factory->create(type); }
#include "UPNPNATInternal.h" static bool parseUrl(const char* url,RakNet::RakString& host,unsigned short* port,RakNet::RakString& path) { RakNet::RakString strUrl=url; unsigned int pos1,pos2,pos3; pos1=(unsigned int)strUrl.Find("://"); if(pos1==RakNet::RakString::nPos) { return false; } pos1=po...
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. Redistribution and use in source and binary forms...
#include "Exploration.h" #include "../Game.h" #include "../map/Floor.h" #include "../map/ChestLootTable.h" #include <QRandomGenerator> #include <chrono> #include <QDebug> extern Game *game; Exploration::Exploration(QGraphicsView *parent) : QGraphicsSceneSized(parent) { int maxFloorsNbr = sizeof(this->renderedFl...
#pragma once #include <dsnutil/chrono/clock_type.hpp> #include <dsnutil/chrono/duration_types.hpp> #include <dsnutil/chrono/time_point.hpp> #include <dsnutil/chrono/duration.hpp>
#ifndef __CONTEXT__ #define __CONTEXT__ class Context{ //Maintain state if needed public: int height = 480; // for example int width = 640; // for example bool use_average = false; bool use_flip = false; bool use_invert = false; }; #endif