text
stringlengths
8
6.88M
#ifndef _TNA_TASKING_BARRIER_H #define _TNA_TASKING_BARRIER_H value #include "atomic_counter.h" #include <furious/furious.h> namespace tna { struct barrier_t : public furious::barrier_t { void wait(int32_t value); void reset(); atomic_counter_t m_counter; }; void barrier_init(barrier_t* barrier); voi...
/* The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, F(0) = 0, F(1) = 1 F(N) = F(N - 1) + F(N - 2), for N > 1. Given N, calculate F(N). Example 1: Input: 2 Output: 1 Explanatio...
#include "customer.h" Customer::Customer(int id, std::string lastName, std::string firstName) { this->customerID = id; this->lastName = lastName; this->firstName = firstName; } int Customer::getCustomerID() const { return customerID; } void Customer::setCustomerID(int newID) { customerID = newID; } std::string...
#include <iostream> #include <algorithm> #include <vector> #include <map> using namespace std; typedef pair<int, int> pii; bool compare(pair<string, int> A, pair<string, int> B) { return A.second > B.second; } bool compare2(pii A, pii B) { return A.first > B.first; } vector<int> solution(vector<string> genre...
/* 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...
#pragma once #include <cstring> #include <initializer_list> #include <tudocomp/util/conststr.hpp> namespace tdc { namespace meta { namespace ast { /// \brief Implements a predicate for accepting certain characters. /// /// This is meant to use by a parser to decide whether a read character belongs /// to a group of ...
#include <iostream> using namespace std; int main() { int a, b, c; char tmp; cin >> a >> tmp >> b >> tmp >> c; cout.fill('0'); cout.width(4); cout << a << "년 "; cout.width(2); cout << b << "월 "; cout.width(2); cout << c << "일" << endl; }
#include <iostream> using namespace std; int main (){ int score {}; cout << "Enter your score on the exam (0 - 100): "; cin >> score; char letterGrade {}; if (score >=0 && score <=100) { if (score >= 90) letterGrade = 'A'; else if (score >= 80) letterGrade = 'B'; else if (score >= 70) lett...
class PqResultImpl; typedef PqResultImpl DbResultImpl;
#ifndef GRAPH_HPP_ #define GRAPH_HPP_ #include <vector> #include <iostream> #include <limits> #include "path.hpp" class Graph { public: void load(const std::vector<std::vector<int>> &matrix); size_t size() { return edges_.size(); } Path& path() { return path_; } int& distance(size_t x, size_t y) ...
#include <iostream> #include <string> using namespace std; int main() { string str,prestr="",maxstr; int i=1,max=0; while (cin>>str){ if(str==prestr) { i++; if (i > max) { max = i; maxstr = str; } } else{ i=1; ...
#include <gtest/gtest.h> #include <string> #include <vector> extern bool DnsExtractAddressesFromAnswer(const std::string answer, std::vector<std::string> &dest); class DnsTest : public ::testing::Test { protected: virtual void SetUp() { } }; std::string JOIN(std::vector<std::string> &a, char delim) { std...
#pragma once #ifndef TILE_WIDGET_HPP #define TILE_WIDGET_HPP #include <QWidget> class TileWindow; class TileWidget : public QWidget { public: TileWidget ( QWidget* parent ); virtual ~TileWidget(); TileWindow* getCurrentWindow(); TileWindow* setWidget ( QWidget* widget, int x, int y); TileWindo...
#include <bits/stdc++.h> using namespace std; bool status[1000006]; int ans[1000004]; vector<int>prime; void siv(){ status[1]=1; status[0]=1; int M=1000000; for(int i=2;i<=M;i++){ if(status[i]==false){ prime.push_back(i); for(int j=2*i;j<=M;j=j+i){ sta...
/** * Universidad de La Laguna * Escuela Superior de Ingeniería y Tecnología * Grado en Ingeniería Informática * Diseño y Análisis de Algoritmos * * Algoritmos constructivos y búsquedas por entornos * * @author Ángel Tornero Hernández * @date 13 Abr 2021 * @file GRASP.cc * */ #include "../incl...
#include <iostream> #include "Heap.h" #include"HeapNode.h" using namespace std; template <typename T> HeapNode<T>::HeapNode(const T& data) { this->data = data; this->left = nullptr; this->right = nullptr; this->parent = nullptr; } template <typename T> Heap<T>::Heap(int capacity) { this->capacity = capacity; th...
#pragma once #include <string> #include <iostream> using namespace std; /*Summary: Methods: Encryption: Firstly controls special characters for ç, ğ, ı and ü then writes row and columns where is equal char in table. Decryption: Executes decrypted string two by two, finds char in the table according to row and...
//$Id$ //------------------------------------------------------------------------------ // GmatTime //------------------------------------------------------------------------------ // GMAT: General Mission Analysis Tool // // Author: Tuan Dang Nguyen // Created: 2014/07/15 /** * This...
int intersectPoint(Node* first, Node* second) { Node *head1=first,*head2=second; int n=0,m=0,d=0; while(first) { first=first->next; n++; } while(second) { second=second->next; m++; } first=head1; second=head2; d=abs(n-m); if(n>m) { ...
#include<stdio.h> int main() { int arr[5] = { 0 }; for (int i = 0; i < 5; i++) { printf("%d번 학생의 프C 성적 : ", i+1); scanf("%d", &arr[i]); } for (int i = 1; i < 5; i++) { if (arr[0] <= arr[i]) { arr[0] = arr[i]; } } printf("최고 점수 : %d", arr[0]); return 0; }
/* File: curved.cpp * Name: Paulo Lemus * Date: 2/15/2017 */ #include <iostream> #include <fstream> #include <vector> #include <cmath> #include "curved.h" float calcAverage(std::vector<float>& v){ // Take in an array and pass back the average of array float average = 0; for(int i = 0; i < v.size(); i+...
#include<cstdio> #include<iostream> #include<queue> using namespace std; struct stone { int pi,di; friend bool operator <(stone a, stone b) { if(a.di == b.di) return a.pi > b.pi; return a.di > b.di; } }a; int main() { int T,t; priority_queue<stone>q; cin >> T; ...
/********************************************************** * License: The MIT License * https://www.github.com/doc97/TxtAdv/blob/master/LICENSE **********************************************************/ #include "catch.hpp" #include "TxtParser.h" #include "LambdaExpression.h" namespace txt { TEST_CASE("TxtParser -...
/* SW Expert Academy 2382. [모의 SW 역량테스트] 미생물 격리 군집이 사라질 경우를 vector.erase로 했더니 테스트 케이스가 50개중 49개만 맞는다. 이유는 잘 모르겠다 ㅠㅠ */ #include <iostream> #include <algorithm> #include <vector> #include <math.h> #include <cstring> #define MAP_MAX 51 using namespace std; struct Crowd { int r, c, micro, dir; Crowd() {} ...
/** * 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 * * ...
/* * DepthProfilerProxy.hpp * * Created on: 6 Aug 2018 * Author: Thomas Maters * Email : thomasmaters@hotmail.com (TG.Maters@student.han.nl) */ #ifndef SRC_DEPTHPROFILERPROXY_HPP_ #define SRC_DEPTHPROFILERPROXY_HPP_ #include "../Communication/IOHandler.hpp" #include "../Communication/RequestR...
// // Emulator - Simple C64 emulator // Copyright (C) 2003-2016 Michael Fink // /// \file Machine.cpp C64 machine class // // includes #include "StdAfx.h" #include "Machine.hpp" #include "VICMemoryAdapter.hpp" #include "SIDMemoryAdapter.hpp" #include "CIAMemoryAdapter.hpp" using C64::Machine; Machine::Machine() :m_p...
// -*- 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...
#include <iostream> #include <array> using namespace std; bool isFull(int A[], int size) { return false; } void enqueue (int A[], int value) { int front = 0; int rear = 0; int size = A.size(); if(!isFull(A, size)){ if(front != 0 && rear == size - 1){ rear = -1; } } } int main() { int A[7]...
#ifndef CSTRING_HPP #define CSTRING_HPP char *strcpy(char *dst, const char *src); char *strncpy(char *dst, const char *src, int n); char *strcat(char *s, const char *ct); int strcmp(const char *cs,const char *ct); char *strchr(const char *cs, int c); char *strrchr(const char *cs, int c); int strspn(const char *cs,cons...
#ifndef _EXPLICIT_FDM_CONTCPN_H_ #define _EXPLICIT_FDM_CONTCPN_H_ #include "explicit_fdm.h" #include "derivatives.h" #include <vector> class ExplicitFDMContCpn: public ExplicitFDM { public: /* Constructors and destructor */ ExplicitFDMContCpn(); ExplicitFDMContCpn(double spot, double maturity, double barri...
#ifndef MATH_H #define MATH_H #include <algorithm> #include <cmath> extern const double PI; template <class T> inline T clamp(const T& val, const T& min, const T& max){ return std::min(max, std::max(min, val)); } template <class T> inline T saw(const T& value, const T& period, const T& amp){ retu...
// // Created by Alexey A. Ponomarev on 05.03.19. // #ifndef WEB_SERVER_TIME_H #define WEB_SERVER_TIME_H #include <iostream> class Time { public: static std::string AdvancedFormat(); private: static time_t rawtime_; static struct tm* timeinfo_; static char buffer_[80]; }; #endif //WEB_SERVER_TIME_H
/* * RobDuinoPinout.h * * Created on: 16. feb. 2017 * Author: david */ #ifndef ROBDUINO_H_ #define ROBDUINO_H_ // 0..7 //extern int D[8]; #define pD0 0 #define pD1 1 #define pD2 2 #define pD3 3 #define pD4 4 #define pD5 5 #define pD6 6 #define pD7 7 // 8..13 //extern int B[6]; #de...
/* *Polymorsiphm && Object pointer */ #include "iostream" using namespace std; class BC { public: int b; void display() { cout<<"\nBase Display"<<"\nB :- "<<b<<endl; } virtual void show() { cout<<"\nBase show"<<"\nB :- "<<b<<endl; } ...
#pragma once #include <string> #include <memory> #include <unordered_map> #include "gltools_Math.hpp" #include "gltools_Camera.hpp" namespace imog { class Shader { private: // Get a shared ptr to the shader from the global pool // by the concatenation of shaders paths static std::shared_ptr<Shader> getFromC...
// Copyright ⓒ 2020 Valentyn Bondarenko. All rights reserved. #include <StdAfx.hpp> #include <D3D11Render.hpp> #include <Error.hpp> #include <Log.hpp> namespace be::render { using be::utils::log::info; D3D11Render::D3D11Render() : clear_color{ 0.0f, 0.0f, 0.0f, 1.0f }, hwnd{...
#include <iostream> using namespace std; int main() { char num; cout << "문자형 입력(%%c) : "; cin >> num; cout << "문자로 출력(%%c) : " << num << endl; cout << "정수로 출력(%%c) : " << (int)(num - '0') << endl; return 0; }
#include<bits/stdc++.h> using namespace std; //https://www.geeksforgeeks.org/flatten-bst-to-sorted-list-increasing-order/ //Flatten BST to sorted list | Increasing order //Given a binary search tree, the task is to flatten it to a sorted list. Precisely, the value of each node must be lesser than the values of all t...
#include "ResourcesSystem.h" #include "PhysicsSystem.h" ResourcesSystem::ResourcesSystem(PhysicsSystem* physicsSystem) { this->ModelShader=new Shader("Game Resources/Shaders/ModelsVertexShader.glsl", "Game Resources/Shaders/ModelsFragmentShader.glsl"); this->lightingShader=new Shader("Game Resources/Shaders/LightVer...
// github.com/andy489 // https://leetcode.com/problems/kth-largest-element-in-an-array/ // Time: O(n) in expectation class Solution { public: int partition(vector<int> &nums, int l, int r) { int pivot = l + rand() % (r - l + 1); swap(nums[pivot], nums[r]); int i = l, j = l; for (; j...
#include "FS.h" #include "SD.h" #include "SPI.h" #include <Update.h> #include <BLEDevice.h> #include <BLEServer.h> #include <BLEUtils.h> #include <BLE2902.h> BLEServer *pServer = NULL; BLECharacteristic * pTxCharacteristic; BLECharacteristic * pOtaControlCharacteristic; bool deviceConnected = false; bool oldDevice...
/* This file is part of the Razor AHRS Firmware */ void output_sensors_text(char raw_or_calibrated) { // Serial.print("#A-"); Serial.print(raw_or_calibrated); Serial.print('='); // Serial.print(accel[0]); Serial.print(","); // Serial.print(accel[1]); Serial.print(","); // Serial.print(accel[2]); Serial.println(); ...
// 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.Data.Html.3.h" WINRT_EXPORT namespace winrt { namespace impl { template <typename D> struct produce<D, Windows::Data::Html::I...
//TabCtrlMouseLButtonDown.cpp //#include "Form.h" #include "TabCtrlMouseLButtonDown.h" #include "TabCtrl.h" #include "Note.h" #include "OtherNoteForm.h" #include "PageForm.h" #include "Page.h" #include "MemoForm.h" #include "Memo.h" #include "Caret.h" #include "SelectedBuffer.h" #include "Line.h" #include "HorizontalS...
#ifndef SPACEGENERATIONTEST_WRAPPER_H #define SPACEGENERATIONTEST_WRAPPER_H #define BOOST_BIND_NO_PLACEHOLDERS #include "Utilities/Definitions.h" #include "Utilities/DataSpaceConversion.h" #include "Utilities/CodeTimer.h" namespace UnitTesting { typedef typename CoordinateComponents::CartesianVolume<float> _type; t...
#include <stdlib.h> #include "stack.h" typedef struct NodeImplementation* Node; struct NodeImplementation { Node next; void* data; }; struct StackImplementation { Node head; int count; }; /** * Used to create a stack structure. * @return The newly created stack. */ Stack create_stack() { Stack ...
// // Compiler/AST/Type.h // // Brian T. Kelley <brian@briantkelley.com> // Copyright (c) 2007, 2008, 2011, 2012, 2014 Brian T. Kelley // // Chris Leahy <leahycm@gmail.com> // Copyright (c) 2007 Chris Leahy // // This software is licensed as described in the file LICENSE, which you should have received as part of this ...
#pragma once #ifndef _BAKA_VECTOR_ #define _BAKA_VECTOR_ #include <cmath> #ifndef M_PI #define M_PI (3.14159265358979323846264f) #endif class Vector2D { public: float x, y; Vector2D() { x = y = 0; } Vector2D(const float _x, const float _y) : x(_x), y(_y) { } ~Vector2D() { } ...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<bool> vb; typedef vector<vb> vvb; typedef set<int> si; typedef map<string, int> msi; typede...
/** * \file linebufistream.hpp * \date Feb 13, 2016 */ #ifndef PCSH_LINEBUFISTREAM_HPP #define PCSH_LINEBUFISTREAM_HPP #include <cstdlib> #include <string> #if defined(_WIN32) # define EOT_CHAR_DEF '\x26' # define EOT_CHAR_UNIX_DEF '\x04' #else # define EOT_CHAR_DEF '\x04' #endif namespace pcsh { namespa...
#include "CommonHeader.h" using namespace std; LivingObject::LivingObject(int aMaxHealth, Scene * apScene, std::string aName, Vector3 aPos, Vector3 aRot, Vector3 aScale, Mesh * apMesh, ShaderProgram * apShader, GLuint aTexture, vec2 aUVScale, vec2 aUVOffset, const char * aCameraName, unsigned int aDrawRenderOrder) : ...
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "Windows.Devices.Gpio.2.h" WINRT_EXPORT namespace winrt { namespace Windows::Devices::Gpio { struct WINRT_EBO GpioChangeCounter : Windows::Devices::Gpio::IGpioChangeCounter { ...
#ifndef TINYXML_INCLUDED #define TINYXML_INCLUDED #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4530) #pragma warning(disable:4786) #endif #include<ctype.h> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<assert.h> #if defined(_DEBUG)&&!defined(DEBUG) #define DEBUG #endif #ifdef TI...
// SingleList.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" int main() { SingleList<int> link; for (int i = 0; i < 10; i++) { link.insert(i, i); } cout << link.size() << endl; link.insert_head(1111); link.insert_last(2222); SingleList<int>::pointer ptr = link.getHead(); while (ptr != nullptr) { cout << p...
/* * Copyright (C) 2012-2016 Open Source Robotics 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 by a...
/* 1949. 등산로 조정 다시풀기 처음에 꼭대기를 찾기 위해 top 리스트를 queue로 구현했었는데, 각 테스트 케이스 마다 없애줄 때 한 번에 clear할 수 없다는 것을 깜빡했었다. 그래서 vector로 다시 바꿔주었는데, 이 부분을 까먹지 말도록 유의하자! */ #include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> using namespace std; typedef pair<int, int> pii; int T, N, K, an...
#include <cstdio> #include <cstring> void reverse(char str[], int len); int main() { char dict[13] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K'}; char str1[101], str2[101], str[202]; scanf("%s %s", str1, str2); int len1 = strlen(str1), len2 = strlen(str2); int n = 0; // reverse ...
/* --------------------------------------------------------------------------------- */ /* Esse programa foi usado para ler os canais e capturar a duração exata dos pulsos */ /* de ambos canais. Sendo o canal 01 para direção e o canal 02 para aceleração. */ /* Podendo ser implementado no código principal, por...
#include <TESTS/test_assertions.h> #include <TESTS/testcase.h> #include <CORE/MEMORY/memory.h> #include <CORE/types.h> using core::memory::allocAligned; using core::memory::freeAligned; using core::memory::isPow2; using core::memory::nextPow2; REGISTER_TEST_CASE(testPow2) { TEST(testing::assertTrue(isPow2((intptr_...
#include "Multiplex_Labeling_TMT_iTRAQ.h" #include "../EngineLayer/GlobalVariables.h" #include "../EngineLayer/CommonParameters.h" using namespace Chemistry; using namespace EngineLayer; using namespace MassSpectrometry; using namespace NUnit::Framework; using namespace Proteomics; using namespace Proteomics...
#include <vector> #include <map> using namespace std; // decision if n is prime or not // O(n^1/2) bool is_prime(int n){ for (int i=2; i*i<=n; i++){ if(n % i == 0) return false; } return n != 1; } // enumerate prime numbers // O(n^1/2) vector<int> divisor (int n){ vector<int> res; for (int i=1; i*i<=...
#include <ros/ros.h> #include <sensor_msgs/LaserScan.h> #include <sensor_msgs/PointCloud2.h> #include <sensor_msgs/point_cloud2_iterator.h> #include <math.h> class LaserChooser { public: LaserChooser() { //Topic you want to publish msg_pub_ = nh_.advertise<sensor_msgs::LaserScan>("scan", 1000); //To...
#include "NCK.h" #include "MCU.h" #include "..\MyLog.h" namespace Shim { namespace CNC { namespace NCK { namespace ADCAI { static double LoopTime_sec = (double)DEFAULT_LOOPTIME_MICROS / 1000000.0f; static unsigned __int32 numAxis = DEFAULT_NUM_AXIS; static double Acc_Time_sec = (dou...
#include "Header.h" void mergeSortStudents(Student* persons, int arraySize) { bool isAlright = false; while (isAlright != true) { isAlright = true; for (int i = 1; i < arraySize; ++i) { if (persons[i - 1].Grade < persons[i].Grade) { Student temp = persons[i]; persons[i] = persons[i - 1]; per...
#include "../include/Tester.h" Tester::Tester(std::string testFilePath, std::string verificationFilePath, Classificator* classificators[10]) : testFilePath(testFilePath), verificationFilePath(verificationFilePath), classificators(classificators) { //constructor a = new Matrix(testFilePath, 784); ...
#ifndef CLASEEWG #define CLASEEWG #include "Mybag.hh" #include <iostream> #include <vector> #include <queue> /*! * \brief Compare edges weights * * Is needed by priority_queue, to sort Edge objects in a correct order * */ class CompareEdges{ public: /*! * \brief Uses compareTo Edge member function to...
#include <iostream> #include <mathtoolbox/backtracking-line-search.hpp> #include <mathtoolbox/gradient-descent.hpp> using Eigen::VectorXd; void mathtoolbox::optimization::RunGradientDescent(const VectorXd& x_init, const std::function<d...
#include "wizhtmlreader.h" #include "share/wizmisc.h" #include <QDebug> const COLORREF CWizHtmlElemAttr::_clrInvalid = (COLORREF)0xFFFFFFFF; const unsigned short CWizHtmlElemAttr::_percentMax = USHRT_MAX; CWizHtmlElemAttr::CNamedColors CWizHtmlElemAttr::_namedColors; class CWizHtmlEntityResolver { pri...
#include "node.h" #include "headers.h" #include <Bits.h> stack<POINT> path; vector<vector<bool>> visit; vector<vector<bool>> close; const Map* loadedMap; struct compare { bool operator()(Node* p1, Node* p2) { return p1->getF() == p2->getF() ? p1->getG() > p2->getG() : p1->getF() > p2->getF(); } }; priority_que...
#ifndef __UTILS_H__ #define __UTILS_H__ #include <string> #define ENABLE_MY_POPEN 1 std::string get_exe_path(); bool file_exists(std::string sFilename); int make_directory(std::string sDirName); pid_t popen2(const char *command, int *infp, int *outfp); #ifdef ENABLE_MY_POPEN FIL...
#pragma once enum RStates { RS_DEFAULT, RS_LINE, RS_CCW, RS_NOCULL, RS_COUNT }; class RasterizerStateManager { public: RasterizerStateManager(void); ~RasterizerStateManager(void); bool ApplyState(RStates eState); ID3D11RasterizerState* GetState(RStates eState) { if (eState < RS_COUNT) return m_...
// github.com/andy489 #include <iostream> #include <vector> using namespace std; typedef vector<int> vi; #define sz(x) ((int)x.size()) #define F(i, k, n) for(int i=k;i<n;i++) void cs(vi &v) { int N = sz(v); int range = 100000; vi count(range, 0); F(i, 0, N) count[v[i]]++; F(i, 0, range - 1) count...
#include "BlendStateDescConstants.h" using namespace GraphicsEngine; D3D11_BLEND_DESC1 BlendStateDescConstants::Default() { D3D11_BLEND_DESC1 blendDesc; blendDesc.AlphaToCoverageEnable = false; blendDesc.IndependentBlendEnable = false; blendDesc.RenderTarget[0].BlendEnable = false; blendDesc.RenderTarget[0].Logi...
/* * -------------------------------------------------------------------------- * THE "BUY-ME-A-BEER LICENSE" (Revision 0.1): * <mattias@allbinary.se> wrote this code. As long as you retain this notice * you can do whatever you want with this stuff. If we meet some day, and you * think my work is worth it (or yo...
#include<stdio.h> #include<conio.h> void convert(int num,int base) { if(num==0) return; convert(num/base,base); printf("%d ",num%base); } void main() { //int num=0; //float n=0.0f; clrscr(); convert(31999,2); getch(); }
/*题目: 给你一个整数数组 num 。请你返回和为 奇数 的子数组数目。由于答案可能 会很大,请你将结果对 10^9 + 7 取余后返回*/ /*思路:两个计数器odd,even,初始化为0,判断前缀和为奇数的odd++ ,为偶数的even++ ,odd*even+odd即为和为奇数的子数组数目。*/ #include<stdio.h> int main() { int num[3] = {3,2,1}; int odd = 0; int even = 0; int result; int size = sizeof(num)/sizeof(num[0]); long lon...
#ifndef SQUARE_H #define SQUARE_H #include <QLabel> #include <QString> #include <map> typedef std::map<std::string, std::string> StyleMap; class Square : public QLabel { Q_OBJECT public: Square(QWidget* parent=nullptr, int _row=0, int _col=0); void set_color(int _color); int get_color() const; pri...
#ifndef __CLUCK2SESAME_PLATFORM_POWERMANAGEMENT_POWERMANAGEMENT_INC #define __CLUCK2SESAME_PLATFORM_POWERMANAGEMENT_POWERMANAGEMENT_INC #include "Platform.inc" radix decimal .module POWERMANAGEMENT POWER_FLAG_PREVENTSLEEP equ 0 POWER_FLAG_SLEEPING equ 1 #ifndef __CLUCK2SESAME_PLATFORM_POWERMANAGEMENT_INITIALI...
//Alumno.cpp #include "Alumno.h" ostream& operator<<(ostream& out, Alumno stu){ out << stu.id << " " << stu.nombre.c_str() << " " << stu.promedio << endl; return out; } istream& operator>>(istream& in, Alumno& stu){ in >> stu.id >> stu.nombre >> stu.promedio; return in; } Alumno::Alumno(int id = 0, ...
#include "header.h" #include <string> #include <iostream> #include <fstream> #include <sstream> #include "json.hpp" #include <stdio.h> using json = nlohmann::json; void output_fiber(SimulationStruct* sim, float *data, char* output) { ofstream myfile; myfile.open(output, ios::app); double scale1 = (double)0xFFFFFF...
#include <stdio.h> int main() { unsigned long long a = 10; printf("%d\n", sizeof(a)); return 0; }
/////////////////////////////////////////////////////////////////// //Copyright 2019-2020 Perekupenko Stanislav. All Rights Reserved.// //@Author Perekupenko Stanislav (stanislavperekupenko@gmail.com) // /////////////////////////////////////////////////////////////////// #include "CPP_FirstPersonCharacter.h" #include "...
///////////////////////////////////////////////////////////////////////////////////////////// // Copyright 2017 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 // /...
#pragma once #include <tudocomp/Compressor.hpp> #include <tudocomp/decompressors/WrapDecompressor.hpp> #include <tudocomp/Literal.hpp> namespace tdc { template<typename coder_t> class LiteralEncoder: public CompressorAndDecompressor { public: inline static Meta meta() { Meta m(Compressor::type_desc(), ...
// MIDI IN byte matrix_vert1; byte matrix_vert2; void midifeedback () { { // read the incoming byte: if (incomingByte==241){ // this message opens the editor upload mode openeditor= !openeditor; // apri o chiudi la ricezione del preset if (openeditor == 1) // se entri in ...
#ifndef KB_LDR_h #define KB_LDR_h #include <Arduino.h> #include <Wire.h> #define LDR_PIN 36 //#define high_light 0 //#define low_light 1 class KB_LDR { public: void begin(void); uint16_t mapLDR(); uint16_t mapLDRinvert(); uint16_t mapLDRlux(); float getLDR(); float adc_read(); void LuxSet...
#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...
int ledPin = 2; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); while (! Serial); Serial.println("Enter On to turn on the LED!"); } void loop(){ if (Serial.available()){ char ch = Serial.read(); if (ch == 'a'){ digitalWrite(ledPin, HIGH); Serial.println("You have turned on th...
/* * SPDX-FileCopyrightText: (C) 2019-2022 Matthias Fehring <mf@huessenbergnetz.de> * SPDX-License-Identifier: BSD-3-Clause */ #include "validatorcharnotallowed_p.h" using namespace Cutelyst; ValidatorCharNotAllowed::ValidatorCharNotAllowed(const QString &field, const QString &forbiddenChars, const ValidatorMessa...
// // ResourceManager.cpp // Boids // // Created by Yanjie Chen on 3/2/15. // // #include "ResourceManager.h" #include "../constant/BoidsConstant.h" #include "../Utils.h" #include "../ArmatureManager.h" #include "cocostudio/CocoStudio.h" #include "../data/PlayerInfo.h" #include "external/json/document.h" #include "...
/** * \file TowerDart.cpp * * \author PaulaRed */ #include "pch.h" #include "TowerDart.h" #include "ImageMap.h" #include "Game.h" #include "ProjectileDart.h" using namespace std; using namespace Gdiplus; /// Dart image ID const int DartID = 51; /// Pi const double Pi = 3.14159265358979323846; /// The dart's sp...
/* Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively. Note: You are not suppose to use the library's s...
/* * Myradius.h * * Created on: Aug 4, 2013 * Author: marchi */ #ifndef MYRADIUS_H_ #define MYRADIUS_H_ #include <vector> #include <string> #include <algorithm> #include <iostream> #include <fstream> #include <sstream> #include <iomanip> #include <sstream> #include <map> #include <cstdlib> #include "RadiiD...
#include<string> #include<cmath> #include "line.h" Line::Line(double x1,double y1, double x2, double y2): _x1{x1},_x2{x2},_y1{y1},_y2{y2} {}; std::string Line::to_string(){ std::string s="(" + std::to_string(_x1) + "," + std::to_string(_y1) + ")" + "-"+ "(" + std::to_string(_x2) + "," + std::to_string(_y2) + ")...
// binary insertion sort // _ ____ __ _ _ __ // (_/_(_(_(_)(__ / (_(_/_(_(_(_/__(/_/ (_ // /( .-/ .-/ // (_) (_/ (_/ #include "../_library_sort_.h" // Độ phức tạp: // Best: O(n) | Avarage: O(nlogn) | Worst: O(nlogn) | Memory: O(1) | St...
#include "Common.h" #include "Testing.h" #include "Server.h" #if defined ( FO_LINUX ) || defined ( FO_MAC ) # include <sys/stat.h> #endif #ifndef FO_TESTING int main( int argc, char** argv ) #else static int main_disabled( int argc, char** argv ) #endif { Thread::SetName( "ServerYoungDaemon" ); ...
#include "stdafx.h" #include "data/Syntaxer.h" #include "data/Syntaxer_impl.h" namespace filtering { ////////////////////////////////////////////////////////////////////////// void syntaxer::R() { // R = W (\n W)* // try { W(); R2(); } LogExceptionPath("R"); } void syntaxer::R2() { ...
unsigned long sendNTPpacket(IPAddress& address) { Serial.println("sending NTP packet..."); // set all bytes in the buffer to 0 memset(packetBuffer, 0, NTP_PACKET_SIZE); // Initialize values needed to form NTP request // (see URL above for details on the packets) packetBuffer[0] = 0b11100011; // LI, Versio...
class MainForm:public Form, public IProgrss { TextBox* txtFilePath; TextBox* txtFileNumber; ProgressBar *progressBar; public: void Button1_Click() { string filePath = txtFilePath->getText(); int number = atoi(txtFileNumber->getText().c_str()); ConsoleNotifier cn; ...