text
stringlengths
8
6.88M
#include "Utf8Ini.h" #include <stdio.h> static void testSerialisation(Utf8Ini & settings) { std::string data1 = settings.Serialize(); printf("serialized:\n%s\n\n", data1.c_str()); int errorLine = 0; settings.Deserialize(data1, errorLine); std::string data2 = settings.Serialize().c_str(); printf...
/*************************************************************************** Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 2010-2020 DADI ORISTAR TECHNOLOGY DEVELOPMENT(BEIJING)CO.,LTD FileName: RTCPSRPacket.cpp Description: implement a compound RTCP packet including SR,SD...
#include "hardware.h" namespace environment { hardware::hardware(boost::shared_ptr<controller> const & c) : robo_(c) { } hardware::~hardware() { } //must exported to python //sensors double hardware::ray_distance(double x, double y, double z) const { return robo_->ray_traverse(vector3(x, y, z)); } double har...
#include <iostream> using namespace std; int main(void) { int a, b; cout << "Input two numbers:" << endl; cin >> a >> b; if (1./a == 1./b) cout << "Results are equal" << endl; else cout << "Results are NOT equal" << endl; system("pause"); return 0; }
#include "pathTable.cxx"
#include <cstdio> #include <iostream> #include <algorithm> #include <map> #include <set> using namespace std; int T; const int MAX_T = 20; int n[MAX_T]; const int MAX_N = 1000; char s[MAX_T][MAX_N][MAX_N]; void read_T(); void read(); void solve(int t); int main(){ read_T(); for(int t=0; t < T; t++){ read(...
#ifndef _TNA_TASKING_TASK_H_ #define _TNA_TASKING_TASK_H_ value namespace tna { typedef void(*task_function_t)(void *arg); struct task_t { /** * @brief Pointer to the function that executed the task */ task_function_t p_fp; /** * @brief Pointer to the argument data that will be passed to the...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include <algorithm> #include <cmath> #include <functional> #include <ATen/ATen.h> #include <ATen/Typ...
#include <stdio.h> #include <iostream> #include <string> #include "board.h" #include "point.h" bool checkGameState(Board brd1,Board brd2, Board brd3) { bool ret = false; int tab1[9]; int tab2[9]; int tab3[9]; memcpy(tab1,brd1.getTableContent(),sizeof(tab1)); memcpy(tab2,brd2.getTableContent(),sizeof(tab2)); memc...
#ifndef TEXT_HPP #define TEXT_HPP #include <SFML\Graphics.hpp> #include <vector> #include <iostream> #include "ResourceManager.hpp" #include "SceneNode.hpp" #include "Constants.hpp" class Text : public SceneNode { public: Text( const sf::Font& font ); virtual void updateCurrent( sf::Time dt, sf::View& view ); ...
#include "demo.hpp" int step = 0; int step_direction = 1; QueueHandle_t demo_task_queue; void fire_demo_step() { double roll_k = 0.05; double rads = step * 2.0 * PI / 360.0; storage.pitch = 20.0 * cos(rads + PI / 4.0); storage.roll = 30 * sin(rads); storage.heading = storage.heading - storage.roll * roll_k ...
/* Title: Interpreter Description: To interperet buffer input and perform appropriate actions given specific parameters. Usage: soon... */ #include <cstdlib> #include <iostream> #include <cstring> /* bool interpreter(char* input) { char* token = strtok(input, " "); if (strcmp(token, "exit") { } } */ c...
/* implement a singleton which can die and can be re_created. */ #include <iostream> class singleton { singleton() = default; static singleton const * instance; public: singleton(singleton const &) = delete; singleton & operator=(singleton const &) = delete; static singleton const * get_instanc...
//cpp #include "tic_tac_toe.h" TicTacToe::TicTacToe() { } bool TicTacToe::game_over() { if (check_column_win() || check_row_win() || check_diagonal_win()) { set_winner(); return true; } else if (check_board_full()) { winner = "C"; return true; } return false; } void TicTacToe::start_game(string player...
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define MAX 10 int factorial(int); int multiply(int, int [], int); int main() { int n,m,c,unq1,unq2,FinalLocation; scanf("%d %d %d",&n,&m,&c); if((n<11 && m<11) && (c<n && c<m) ){ unq1= n-c; unq2= m-c; FinalLoca...
/*========================================================================= Program: Visualization Toolkit Module: QVTKRenderWindowAdapter.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This sof...
#include <string> #include <unordered_map> using namespace std; class Solution { public: bool judgeCircle(string moves) { unordered_map<char, int> umap; for (auto c : moves) ++umap[c]; return (umap['U'] == umap['D']) && (umap['L'] == umap['R']); } };
// 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::Devices::Usb { struct IUsbBulkInEndpointDescriptor; struct IUsbBulkInPipe; struct IUsbBulkOutEndpointDescriptor; struct IUsbBulkOutPipe...
/******************************************* *** Dateiname: Kameraschien.ino ******************************************** *** Zweck: Steuerung eines Positioniersystem *** mittels einer Bluetooth-Applikation *** Erstellt: 19.10.2016 ****************************************** *** Geändert: 07.11.2016 ***********...
#include "Macro.h" #include <string> #include "cocoa/CCObject.h" #include <cocoa/CCGeometry.h> #include <sprite_nodes/CCSprite.h> #include "GameSkill.h" #include "TypeDefine.h" #include <vector> #ifndef __GAMESPRITE_H__ #define __GAMESPRITE_H__ using std::vector; namespace cocos2d { class CCSpriteBatchN...
/* * Perro.h * * Created on: Feb 19, 2013 * Author: j2deme */ #include <iostream> using namespace std; #ifndef PERRO_H_ #define PERRO_H_ class Perro { public: Perro(); Perro(string, string); virtual ~Perro(); void ladrar(); const string& getColor() const; void setColor(const string& color); double ...
// // Created by k on 12.04.18. // #ifndef EXERCISE03_EDGE_H #define EXERCISE03_EDGE_H class Node; class Edge { public: Edge(Node *v, Node *w, int wt = 0, bool d = false); Edge(bool isDirected, int weight, Node **endpoint); bool isDirected; int weight; Node *endpoint[2]; }; #endif //EXERCI...
#include<omp.h> #include <iostream> #include "map.h" using namespace std; int main() { long long a[20]; for (int i = 1;i < 20;i++) { a[i] = i; } long long*B = map(a, 20, f); for (int i = 1;i < 20;i++) cout << B[i] << endl; system("pause"); return 0; }
#include "common\Singularity.Common.h" namespace Singularity { IMPLEMENT_OBJECT_TYPE(Singularity, IDelegate, Singularity::Object); }
#include <windows.h> #include <GL/glut.h> GLsizei ancho, alto; float r = 0.0; float g = 0.0; float b = 0.0; void init() { glClearColor (1.0, 1.0, 1.0, 1.0); glColor3f(1.0, 0.0, 0.0); } void myReshape(GLsizei w, GLsizei h){ glMatrixMode(GL_PROJECTION); glLoadIdentity(); if(w<...
//rotate one by one clockwise #include<iostream> void rotate(int a[],int len,int d){ int temp=0; for(int i=0;i<d;i++){ temp=a[0]; for (int j=1;j<len;j++){ a[j-1]=a[j]; } a[len-1]=temp; } } int main(){ int n=5; int a[]={2,3,4,5,6}; int d=4; rotate(a,n,d); for(int i=0;i<5;i++){ std::cout<<a[i]<<"\n"; ...
// Convert this program to C++ // change to C++ io // change to one line comments // change defines of constants to const // change array to vector<> // inline any short function // #include<iostream> #include<vector> using namespace std; const int N = 40; inline void sum(int &s,vector<int> d){ for(int i=0;i<d.size();...
// // Recorder - a GPS logger app for Windows Mobile // Copyright (C) 2006-2019 Michael Fink // /// \file BacklightManager.cpp Backlight manager // #include "StdAfx.h" #include "BacklightManager.hpp" #ifdef _WIN32_WCE #include <pm.h> #endif CBacklightManager::CBacklightManager(EBacklightLevel enBacklightLevel) throw()...
// -*- C++ -*- // // Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory, // Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC // // This file is part of FreePOOMA. // // FreePOOMA is free software; you can redistribute it and/or modify it // under the terms of the Expat license. // // This progr...
// -*- C++ -*- // // Copyright (C) 1998, 1999, 2000, 2002 Los Alamos National Laboratory, // Copyright (C) 1998, 1999, 2000, 2002 CodeSourcery, LLC // // This file is part of FreePOOMA. // // FreePOOMA is free software; you can redistribute it and/or modify it // under the terms of the Expat license. // // This progr...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "../base.h" #include "Windows.Devices.I2c.0.h" #include "Windows.Devices.I2c.Provider.0.h" #include "Windows.Foundation.0.h" #include "Windows.Foundation.1.h" WINRT_EXPORT namespace w...
#include "mpi_centralized_barrier.h" //#include "mpi.h" // this line is for local implementation #include "/usr/lib/openmpi/include/mpi.h" #include <stdio.h> Mpi_Centralized_Barrier::Mpi_Centralized_Barrier(bool* sense, int *pnum){ local_sense = true; *sense = true; num_processors = *pnum; } void Mpi_Centralized_B...
/*********************************************************************** created: Tue Feb 17 2009 author: Paul D Turner *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2013 Pa...
/*************************************************************************** matrix.cpp - description ------------------- begin : Tue Jul 24 2002 copyright : (C) 2002 by Marco Bubke email : marco@bubke.de ****...
// 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::System::Profile { struct IAnalyticsInfoStatics; struct IAnalyticsVersionInfo; struct IEducationSettingsStatics; struct IHardwareIdentif...
#include "CScrollable.h" #include "CBaseEngine.h" CScrollable::CScrollable(const vec2d& pos, const vec2d& size): CGuiPanel(pos, size), _panel(new CStencilPanel(vec2d(0,0), size-vec2d(20., 0.))), _bar(new CScrollBar(vec2d(getW()-20., 0), vec2d(20., getH()))) { _bar->addListener(makeCListenerMemberFn(S...
#pragma once #include <landstalker-lib/patches/game_patch.hpp> #include <landstalker-lib/model/map.hpp> /** * This patch removes all music inside the game, while leaving all of the SFX / jingles intact. * This was requested by players with *lots* of hours on the game who wanted to play with their own music in the ...
#include<iostream> #include<vector> #include<algorithm> using namespace std; void PrintVector(vector<int> ve); int main() { vector<int> vec1;//创建一个空的vector vector<int> vec2(vec1);//创建一个vector,并用vec1初始化vec2 vector<int> vec3(10);//创建一个有n个数据的vector vector<int> vec4(10,0);//创建含有10个数据的vector,并全初始化为0 // vec4.~vector...
#include <bits/stdc++.h> #include <conio.h> using namespace std; int hcf(int, int); int lcm(int, int); int main() { int a, b; cin>>a>>b; } int hcf(int a, int b) { }
/** * Copyright (C) 2017 Alibaba Group Holding Limited. All Rights Reserved. * * * 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 * * ...
class MainForm:public Form { TextBox* txtFilePath; TextBox* txtFileNumber; public: void Button1_Click() { string filePath = txtFilePath->getText(); int number = atoi(txtFileNumber->getText().c_str()); FileSplitter splitter(filePath,number); splitter.split(); } };
#ifndef NOTEITEM_H #define NOTEITEM_H #include "node.hpp" #include <QDialog> class Filter; class FilterNode : public Node { public: FilterNode(const QString &name, HandleItem::MapType outputType, Filter *filter, QGraphicsItem *parent = 0); ~FilterNode(); enum { Type = UserType + 2 }; virtual int type()...
#ifndef USECOUNT_H #define USECOUNT_H #include "../instructions/register.h" #include <map> #include <iostream> #include <string> using namespace std; typedef map<string, int> RegCount; typedef RegCount::iterator RegCountit; /** * A UseCounter counts the number of times a register is used within the code. * This ...
#include "Decompressor.h" Decompressor::Decompressor() { nextBunchOfBits = 0; nextBitsCount = 0; } int Decompressor::readBits(int howMany) { while(nextBitsCount < howMany) { int byte = decompressNextByte(); nextBunchOfBits |= ull(byte) << nextBitsCount; nextBitsCount += 8; } int ret = int(nextBunchOfBits &...
#include "tinyxml2.h"; #include <string>; #include <iostream>; using namespace tinyxml2; XMLDocument& CreateDocument(); void SaveXML(XMLDocument& XMLDoc, const std::string filename); void WriteIntXML(XMLDocument& XMLDoc); void WriteStringXML(XMLDocument& XMLDoc); void ReadXML(const std::string filename); int main() ...
#include "stdafx.h" #include "ScriptOMAll.h" #include "StudioSyntaxParser.h" #include "SCISyntaxParser.h" #include "ParserActions.h" #include "Operators.h" #include "OperatorTables.h" #include "format.h" #ifdef ENABLE_FOREACH #include "ScriptMakerHelper.h" #endif #ifdef ENABLE_GETPOLY #include "Polygon.h" #include "App...
#include <whiskey/AST/FieldTag.hpp> #include <ostream> namespace whiskey { namespace { FieldTagInfo fieldTagInfos[] { FieldTagInfo("Children", 0), // List_Children FieldTagInfo("TemplateEvalArgs", 0), // TypeSymbol_TemplateEvalArgs FieldTagInfo("Arg", 0), // TypeAccessUnary_Arg FieldTagInfo("Args", 0), // Type...
#pragma once #include "stdafx.h" //#include "Playingfield.h" #include "Inventory.h" class Playingfield; class InputController { public: static InputController& Instance() { static InputController mInstance; return mInstance; } InputController(); ~InputController(); void CheckInput(); void setPlayingField(P...
#include <sstream> #include "barra_indicadora.h" #include "../recursos.h" using namespace App_Graficos; Barra_indicadora::Barra_indicadora(int x, int y, int vmax, int vact, const std::string& pnombre) :caja(DLibH::Herramientas_SDL::nuevo_sdl_rect(x, y, W, H), R, G, B), txt_nombre(DLibV::Gestor_superficies::obtener(...
#ifndef D3DUTIL_H #define D3DUTIL_H #if defined(DEBUG) || defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include <crtdbg.h>//1.使用_PRTn的宏显示调试信息 2.侦测内存泄漏用_CrtSetDbgFlag函数(本例是用这个) #endif #include <d3dx11.h> #include "d3dx11Effect.h" #include <xnamath.h> #include <dxerr.h> #include <cassert> #include <ctime> #include <algori...
// This file is subject to the terms and conditions defined in 'LICENSE' in the source code package #ifndef JACTORIO_INCLUDE_DATA_CEREAL_SUPPORT_DECIMAL_H #define JACTORIO_INCLUDE_DATA_CEREAL_SUPPORT_DECIMAL_H #pragma once #include "core/data_type.h" #include "data/cereal/serialize.h" namespace cereal { CEREAL_L...
#include <bits/stdc++.h> using namespace std; const int MAX_INT = std::numeric_limits<int>::max(); const int MIN_INT = std::numeric_limits<int>::min(); const int INF = 1000000000; const int NEG_INF = -1000000000; #define max(a,b)(a>b?a:b) #define min(a,b)(a<b?a:b) #define MEM(arr,val)memset(arr,val, sizeof arr) #defi...
/* * example showing how to use events * This simplyfied example may seem pointless * Events realy shines when building a gui were each widget cant be modified all the time to suit each usecase */ #include <DList.h> // events depends on this module #include <mgui.h> // pulls in the event module // define recever clas...
#include <bits/stdc++.h> using namespace std; int solve(vector<vector<int>> mat, int k) { priority_queue<int, vector<int>, greater<int>> q; for (int i = 0; i < mat.size(); i++) { for (int j = 0; j < mat[0].size(); j++) q.push(mat[i][j]); } k -= 1; while (k--) q.pop();...
/* * UAE - The Un*x Amiga Emulator * * transparent archive handling * * 2007 Toni Wilen */ #include "sysconfig.h" #include "sysdeps.h" #ifdef _WIN32 #include <windows.h> #include "win32.h" #endif #include "options.h" #include "zfile.h" #include "archivers/zip/unzip.h" #include "archivers/dms/pfile.h" #include "c...
/* 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...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "../base.h" #include "Windows.Globalization.NumberFormatting.0.h" #include "Windows.Foundation.1.h" #include "Windows.Foundation.Collections.1.h" WINRT_EXPORT namespace winrt { names...
#ifndef NEW_PROJECT_2_PLAYER_HPP #define NEW_PROJECT_2_PLAYER_HPP #include <vector> #include "definitions.hpp" #include "soldier.hpp" #include "mistborn.hpp" #include "misting.hpp" class Player { public: Player(); ~Player() = default; void clear_beings_vector(); // get short int get_hp() const...
#include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <GLUT/glut.h> #include <iostream> using namespace std; #include "application.h" extern Application *getApp(); Application *app = 0; void keyboardDownFunc( unsigned char key, int x, int y ) { app -> onKeyboardDown(key); } void keyboardUpFunc(unsigned cha...
#include <iostream> #include "module.h" using namespace std; int main() { setlocale(LC_ALL, "Russian"); int n; cout << "Введите размерность массива: "; cin >> n; // размер массива int *ptrarray = new int[n]; // выделение памяти для дим.массива dinamic_array(n, ptrarray); cout << " " << endl; print_dinami...
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "mtree.h" void InitializeTree(Tree * ptree) { ptree->root = NULL; ptree->treecount = 0; } //是否树为空 bool IsTreeEmpty(const Tree * ptree) { if (ptree->treecount == 0) return true; return false; } //是否树为满 bool IsTreeFull(const Tree * ptree) { if...
// Complete the findMergeNode function below. /* * For your reference: * * SinglyLinkedListNode { * int data; * SinglyLinkedListNode* next; * }; * */ int findMergeNode(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) { SinglyLinkedListNode* itr1 = head1; SinglyLinkedListNode* itr2 =...
#pragma once #ifndef MUSICPLAYER_H #define MUSICPLAYER_H #include <string> #include <QWidget> #include <QMediaPlayer> #include <QMediaPlaylist> #include <QPushButton> #include <QToolButton> #include <QLabel> #include <QSlider> #include <QStyle> #include <QBoxLayout> #include <QGridLayout> #include "PlaylistElementG...
#include "qartnetreply.h" QArtNetReply::QArtNetReply(QObject *parent) : QObject(parent) { // Fill with defaults memset(&m_reply, 0, sizeof(artnet_reply_t)); memcpy(m_reply.id, ARTNET_STRING, ARTNET_STRING_SIZE); m_reply.opCode = htols(ARTNET_REPLY); m_reply.port = htols(ARTNET_UDP_PORT); m...
#include "SFML/Graphics.hpp" #include "Engine/RiDGame.h" #include "Engine/ConfigurationLoader.h" int main() { RiD::RiDGame window(RiD::ConfigurationLoader::getIntData("video settings", "screenWidth"), RiD::ConfigurationLoader::getIntData("video settings", "screenHeight"), RiD::ConfigurationLoader::getStringData("v...
// 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.Devices.Pwm.Provider.3.h" #include "internal/Windows.Foundation.3.h" #include "internal/Windows.Devices.Pwm.3.h" #include "Windo...
#ifndef ESCADA_H #define ESCADA_H #include "Obstaculo.h" class Escada : public Obstaculo { protected: int direction; public: Escada(); virtual ~Escada(); void Set_obst(float pos_x, float pos_y, BITMAP* buffer, BITMAP* bmp); void Print(); private:...
#include "PlayerMesh.h" #include <fstream> #include <sstream> #include <iostream> #include <glm/ext.hpp> #include <assimp/scene.h> #include <assimp/postprocess.h> PlayerMesh::PlayerMesh(vector<Vertex> vertices, vector<GLuint> indices, unordered_map<std::uint32_t, vector<Texture>> texturesMap, MaterialNoTex materialNo...
#include <Arduino.h> #define MAX_SIZE 16 // c character to encrypt, i lowest key value, j highest key value uint8_t charEncrypt(int c, int i, int j){ uint8_t osec = j; uint8_t sec = osec<<4; uint8_t one_res = (sec | i); uint8_t one_enc = one_res + c; return one_enc; } uint8_t charDecrypt(int c, int i, in...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <conio.h> using namespace std; bool MatchFirstChar(const string &str) //谓词函数 { return 'S' == str[0];} int main(){ const int VECTOR_SIZE=8; string names[]={"She","Sells","Sea","Shells","by","the","Sea","Shores"}; //产...
// Including necessary libraries #include "Dice.h" #include <iostream> #include <cstdlib> #include <ctime> using namespace std; // Constructor Dice::Dice() { // Initializes totalRolls container; totalRolls = new int(0); // Initializes value and valuePercentage value = new int[6]; valuePercentage = new double[...
#ifdef _WIN32 #include <windows.h> #include "../Core/VLogger.h" struct STestAsset { int n = 123; STestAsset() { printf("%s\n", __FUNCTION__); } ~STestAsset() { printf("%s\n", __FUNCTION__); } void Print() { printf("%s %d\n", __FUNCTION__, n); } }; struct SGameObject { STestAsset* Asset = nullptr; vo...
#include <iostream> #include <vector> using namespace std; #include "solution.h" int main() { vector<int> chips1 = {1, 2, 3}; vector<int> chips2 = {2, 2, 2, 3, 3}; Solution sol; cout << sol.minCostToMoveChips(chips1) << endl; cout << sol.minCostToMoveChips(chips2) << endl; return 0; }
#include "Ship.hpp" Ship::Ship( Type type, ResourceManager< Texture::ID, sf::Texture >& textureManager ) : m_type( type ) , m_sprite( textureManager.getResource( toTextureID( type ) ) ) , m_laserSystem( 25 ) , m_prevPosition( 0.0f, 0.0f ) , m_rect() , m_health( 0 ) , m_alive( true ) { sf::FloatRect bounds = m_...
/*********************************************************************** created: 30/5/2013 author: Timotei Dolean *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2013 Paul D ...
/* * Localization.hpp * * Created on: 2018/12/28 * Author: 裕汰 */ #ifndef LOCALIZATION_LOCALIZATION_HPP_ #define LOCALIZATION_LOCALIZATION_HPP_ #include <RazarIMU/MPU9250.hpp> #include "CAN/CAN.hpp" #include "encoder/RotaryEncoder.hpp" #define Xencoder 0 #define Yencoder 1 class Localization //自己位置の情報が詰まったクラ...
/* Sample Battleship AI in C++ BattleshipAI.h */ #ifndef BATTLESHIP_AI #define BATTLESHIP_AI #include <iostream> #include <fstream> #include <string> #include <sstream> #include <vector> #include "GameBoard.h" using namespace std; class BattleshipAI { private: //GameBoard op_field; //GameBoard my_field; enum...
#include <bits/stdc++.h> using namespace std; #define ll long long const uint32_t MOD = 4294967291; const uint32_t BASE = 53; void print(vector<string> &t) { for (const string &s : t) { cout << s << " "; } cout << "\n"; } class hashSet { uint32_t cnt; uint32_t sz; vector<list<pair<s...
#include "Screens.hpp" #define SCREEN_HEIGHT 240 #define SCREEN_WIDTH 320 Screens::Screens(QWidget * p) { parent = p; const char * const vlc_args[] = { "--extraintf=logger", "--verbose=2", "--no-audio" }; screen[LEFT]=new QFrame(parent); ...
#include "Global.h" #include <QCoreApplication> #include <QApplication> #include <QFileInfo> #include <QDir> QString Global::Authority = "2"; QString Global::DisplayName = QString(); QString Global::Database = "bookdata"; QString Global::Hostname = "localhost"; QString Global::Username = "root"; QString Global::Pas...
// Binary Search Tree ADT // Created by A. Student // Modified by: Maksym Sagadin #ifndef _BINARY_SEARCH_TREE #define _BINARY_SEARCH_TREE #include <iostream> #include "BinaryTree.h" template<class ItemType> class BinarySearchTree : public BinaryTree<ItemType> { private: // internal insert node: insert newNode in...
#include <iostream> using namespace std; // Function that converts decimal to binary void decToBinary(int n) { // Size of an integer is assumed to be 8 bits for (int i = 7; i >= 0; i--) { int k = n >> i; if (k & 1) cout << "1"; else cout << "0"; } ...
#include<iostream> #include<string> using namespace std; void func() { string num1, num2; while (cin >> num1 && cin >> num2) { int sum = 0; for (int i = 0;i < num1.length();i++) { for (int j = 0;j < num2.length();j++) { sum += (num1[i] - '0') * (num2[j] - '0'); } } cout << sum << endl; } } int ma...
#pragma once #include <iostream> #include <string> class Logger { inline static void show(const std::string& msg) { std::cout << msg << "\n"; } public: inline static void error(const std::string& msg) { show("ERR: " + msg); } inline static void info(const std::string& msg) { ...
#include "stdafx.h" #include "Point.h" int Point::size() const { return 2; } const double & Point::operator[](int index) const { if (index == 0) { return m_x; } if (index == 1) { return m_y; } } const double & Point::distance(Point & other) const { auto d_x = std::pow((this->m_x - other.m_x), 2); auto d_...
#include"head.h" int seqsearch(int data[], int length, int obj) { int i = 0; while (i < length && data[i] != obj) i++; // 主要耗时在条件判断上。 i = (i < length) ? i : -1; // 如果没有发现待查元素,返回-1. return i; } int seqsearch_2(int data[], int length, int obj) { int i = 0; int* new_data = new int[length+1];...
#include <bits/stdc++.h> using namespace std; struct Edge { int v, cost[2]; }; int N, M, source, des, shortest[2]; //source表示起点,des表示终点,shortest存储最短路径的长度(下标为0)和最快路径的时间(下标为1) vector<Edge> graph[505]; //图的邻接表 int dis[505], past[505], num[505]; //存储到各点的最短距离、各点的父节点、还有一个辅助数组num,求最短路径时存储时间,求最快路径时存储当前路径上结点个数...
#ifndef _TNA_ENGINE_VIEWPORT_H_ #define _TNA_ENGINE_VIEWPORT_H_ #include <furious/components.h> #include "../math/vector.h" namespace tna { struct viewport_t { FURIOUS_COMPONENT(viewport_t); uint32_t m_width = 900; uint32_t m_height = 1440; float m_near = 0.1f; float m_far ...
#include <bits/stdc++.h> using namespace std; const int MAX_INT = std::numeric_limits<int>::max(); const int MIN_INT = std::numeric_limits<int>::min(); const int INF = 1000000000; const int NEG_INF = -1000000000; #define max(a,b)(a>b?a:b) #define min(a,b)(a<b?a:b) #define MEM(arr,val)memset(arr,val, sizeof arr) #defi...
class Solution { public: int hammingDistance(int x, int y) { 布赖恩·克尼根算法,简而言之就是:一个数和这个数减1进行相与,结果就是消去最右边的1.这样一步步消去,看能消几次,代表有几个1. int distance = 0; int res = x ^ y; // 先进行异或,得到不同位置为1的数 while (res) { // 计算1的个数,用算法 res &= (res - 1); distance++; } re...
#include "_aimbot.h" cAimbot g_Aimbot; Vector cAimbot::vCalcBoneOffset( int iIndex ) { int boneTarger = 0; float screenDist = 1000.f; Vector vBoneOrigin , vBoneScreen , vF , vR , vU , vOut; vOut = Vector( 0 , 0 , 0 ); AngleVectors( g_Player[iIndex].EyeAngles , vF , vR , vU ); IClientEntity* Ent = g_Player[iIn...
#ifndef LTUI_DATA_H #define LTUI_DATA_H #include "../src/ledger_entry_file_repository.hpp" #endif
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "Windows.UI.Xaml.Resources.1.h" WINRT_EXPORT namespace winrt { namespace Windows::UI::Xaml::Resources { struct ICustomXamlResourceLoader : Windows::Foundation::IInspectable, ...
#include "IndexedFaceSet.hpp" #include <cassert> #include <iostream> // VRML'97 // // IndexedFaceSet { // eventIn MFInt32 set_colorIndex // eventIn MFInt32 set_coordIndex // eventIn MFInt32 set_normalIndex // eventIn MFInt32 set_texCoordIndex // exposedField SFNode colo...
#include "include/ray.h" #include "include/plane.h" #include "include/tuple.h" #include "include/transform.h" #include "gtest/gtest.h" class PlaneFixture : public ::testing::Test { protected: virtual void SetUp() { ray = new raytracer::Ray(); xs = new std::vector<raytracer::Intersection>(); ...
#include <iostream> #include <utility> int main() { std::pair<char, int> pair{ 'A', 123 }; std::cout << pair.first << '\n' << pair.second << '\n' << std::get<0>(pair) << '\n' << std::get<1>(pair) << '\n'; return 0; }
// Created by yuanzhongji on 2013/08 #ifndef _TIP_DIALOG_H__ #define _TIP_DIALOG_H__ #include "cocos2d.h" #include "LBLibraryBase.h" #include "LBModalDialogLayer.h" #include "WJLayerJson1x.h" using namespace cocos2d; using namespace std; class TipDialog; typedef std::function<void (TipDialog *dialog)> TipClickCall...
// This file has been generated by Py++. #ifndef NamedAreaIterator_hpp__pyplusplus_wrapper #define NamedAreaIterator_hpp__pyplusplus_wrapper void register_NamedAreaIterator_class(); #endif//NamedAreaIterator_hpp__pyplusplus_wrapper
/*========================================================================= Program: ShapeWorks: Particle-based Shape Correspondence & Visualization Module: $RCSfile: CS6350.h,v $ Date: $Date: 2014/03/24 01:17:40 $ Version: $Revision: 1.2 $ Author: $Author: shireen $ Copyright (c) 2009 Scien...
// For more information visit: http://wiki.openpilot.org/display/Doc/Serial+Bluetooth+Telemetry #include <SoftwareSerial.h> // --- START CONFIGURATION --- char* name = "BT_Turnigy_Beetle"; // Name for Bluetooth Device. (alphanumeric, 20 char max, no spaces) int pin = 1234; // P...