text stringlengths 8 6.88M |
|---|
#ifndef ORDER_H
#define ORDER_H
#include "Drink.h"
#include <iostream>
using namespace std;
class Order
{
public:
Order();
virtual ~Order();
friend istream& operator >>(istream& in, Drink drink);
friend ostream& operator <<(ostream& out, Drink drink);
protected:
privat... |
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
int ara[500009];
int again[500009];
int bapke(int n)
{
if(ara[n]==n)
return n;
else
bapke(ara[n]);
}
int main()
{
int n,m,i,A,B,t,maxi;
scanf("%d",&t);
while(t--){
scanf("%d %d",&n,&m);
maxi=-1;
... |
#include "audio\Singularity.Audio.h"
namespace Singularity
{
namespace Audio
{
#pragma region Constructors and Finalizers
AdaptiveParameter::AdaptiveParameter(String name, float min, float max) : m_pName(name), m_fMin(min), m_fMax(max), m_fCurrent(min)
{
}
AdaptiveParameter::~AdaptivePa... |
// shared project unit tests
// (c) 2020 Michael Fink
// https://github.com/vividos/OldStuff/
// Unit tests for shared project files
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define STRINGIFY2(x) #x
#define STRINGIFY(x) STRINGIFY2(x)
#define Assert(condition, text) \
if (!(condition)) \
{ \
... |
/*
프로그램 설명
1~10 까지 덧셈하여 출력
기존에 지니던 문제점 해결
*/
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
int _tmain(int argc, TCHAR* argv[])
{
STARTUPINFO si1 = { 0, };
STARTUPINFO si2 = { 0, };
PROCESS_INFORMATION pi1;
PROCESS_INFORMATION pi2;
DWORD return_val1;
DWORD return_val2;
TCHAR command1[] = _T("... |
//#include <stdio.h>
//#include <stdlib.h>
//
//int main()
//{
// printf("hello world\n");
// system("pause");
//}
//#include <stdio.h>
//#include <stdlib.h>
////void insertSort(int *num, int len)
////{
//// int i, j, temp;
//// for (i = 0; i < len - 1; i++) {
//// j = i + 1;
//// temp = num[j]; //temp存储新元素
//// whi... |
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cctype>
#include <vector>
#include <string>
#include <utility>
#include <map>
struct comp
{
bool operator()(const std::pair<char, int> &a, const std::pair<char, int> &b) const
{
return (a.second > b.sec... |
#ifndef MONITOR_H
#define MONITOR_H
#include <QWidget>
#include <QtSql>
#include<QCompleter>
#include<QMenuBar>
#include<QMenu>
#include<QDate>
#include<QSqlQuery>
#include<QMessageBox>
#include<QByteArray>
#include<QtNetwork/QNetworkInterface>
#include<QBuffer>
#include<QFile>
#include<QIODevice>
#inc... |
/***********************************************************************
created: Fri Jan 15 20109
author: Eugene Marcotte
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2010... |
#include <characters/finalmonster.h>
using namespace lab3;
using namespace lab3::characters;
FinalMonster::FinalMonster(const std::string &name, Place *place)
: Character(name, TYPE_FINAL_MONSTER, place),
defeated_player_(false),
distraction_(0)
{
this->talk_msgs_ = {"You will never get out of tha... |
int pinVerde = 11;
int pinAmarelo = 10;
int pinVermelho = 9;
int pinBotao = 7;
int pinPedestreVerde = 3;
int pinPedestreVermelho = 2;
int atraso = 100;
int faseSemaforo;
int estadoBotao;
int estadoAnteriorBotao;
void setup()
{
// put your setup code here, to run once:
pinMode(pinVerde, OUTPUT);
pinMode(pinAma... |
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include "cyoa.h"
using namespace std;
int main(int argc, char ** argv){
ifstream file;
Page page;
if(argc < 2){
cerr << "please enter a valid page" << endl;
exit(EXIT_FAILURE);
}
file.open(arg... |
#include<iostream>
using namespace std;
const int MAX_N=100;
int pos[MAX_N];
int main()
{
int p=0;
const int n=8;
int ans=0;
memset(pos,0,sizeof(pos));
while(true)
{
if(p>=n)
{
ans++;
p--;
continue;
}
if(pos[p]<n)
{
if(check(p))
{
p++;
continue;
}
pos[p]++;
}
el... |
// This file has been generated by Py++.
#include "boost/python.hpp"
#include "generators/include/python_CEGUI.h"
#include "WidgetLookIterator.pypp.hpp"
namespace bp = boost::python;
struct ConstMapIterator_less__std_scope_map_less_CEGUI_scope_String_comma__CEGUI_scope_WidgetLookFeel_comma__CEGUI_scope_StringFastLes... |
char _invoke_command(char *command){
return system(command);
}
|
#ifndef DWIZ_COMMON_CATCH_ALL_APPLICATION_H
#define DWIZ_COMMON_CATCH_ALL_APPLICATION_H
#include <common/dwiz_std.h>
#include <QApplication>
namespace dwiz
{
class CatchAllApplication : public QApplication
{
public:
using QApplication::QApplication;
bool hasException() const;
std::string const& getExcepti... |
#include "Carousel.h"
Carousel::Carousel():ChildrenRide() //default constructor, info from parent
{
//left empty on purpose
}
Carousel::Carousel(string rideName, int maxAge):ChildrenRide(rideName, maxAge)
{
//empty on purpose, constructor inherits from ChildrenRide
}
void Carousel::showInfo() const //pr... |
#include <iostream>
#include <sstream>
#include <vector>
#include <set>
using namespace std;
namespace Graph {
vector<vector<int>> G;
vector<bool> Visited;
vector<int> Predecessors;
vector<set<int>> Dependency;
void DFS(int node)
{
if( Visited[node] ) {
return;
}
... |
/**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/
bool cmp(Interval a,Interval b){
return a.start < b.start;
}
class Solution {
public:
vector<Interval> merge(vector<Inte... |
#include "common.h"
#include "DirectDrawPalette.h"
DirectDrawPalette::DirectDrawPalette(IDirectDrawPalette* original)
{
this->_original = original;
}
DirectDrawPalette::~DirectDrawPalette()
{
}
HRESULT DirectDrawPalette::QueryInterface(
REFIID riid,
LPVOID* obp
)
{
std::ostringstream str;
str << this << " " <<... |
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int s1,s2,s3;
printf("enter ur markx");
scanf("%d %d %d",&s1,&s2,&s3);
int total=s1+s2+s3;
float per=total/3.0;
printf("ur total is %d out of 300\npercentage is %.1f",total,per);
if(per>=75)
printf("distinction");
else if(per<75&&per>=60)
printf("A");
else if(... |
//! Bismillahi-Rahamanirahim.
/** ========================================**
** @Author: Md. Abu Farhad ( RUET, CSE'15)
** @Category:
/** ========================================**/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define scl(n) scan... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;
#define N 10
#define L 30
int n,l;
struct Box
{
int dim[N];
int index;
Box *below;
Box *above;
};
Box boxs[L];
Box *table[L];
void initboxs(int l,int n);
bool compare(Box *a,Box b);
int main(void)
{
int i,j,k,count... |
#pragma once
#include "FirstHeaders.h"
struct Animation {
};
//########################################
// CObjectBase Start ##
// ##
class CObjectBase{
public:
CObjectBase();
~CObjectBase();
};
// ##
// CObjectBase End ##
//########################################
//#################... |
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode *ptr1 = l1, *ptr2 = l2;
ListNode *ans = new ListNode(... |
// 1029. Two City Scheduling
// There are 2N people a company is planning to interview. The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the i-th person to city B is costs[i][1].
// Return the minimum cost to fly every person to a city such that exactly N people arrive in each city.
... |
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> rightSideView(TreeNode* root) {
if (root == NULL) return vector<int>();
... |
class Solution {
public:
int longestMountain(vector<int>& arr) {
if(arr.size()<3) return 0;
int result=0;
int i=0;
bool peak=false, valley=false;
while(i<arr.size()-1){
if(arr[i]<arr[i+1]){
int start=i;
while(i<arr.size()-1 and arr[... |
#ifndef PRINT_H
#define PRINT_H
#include<thrust/host_vector.h>
#include<thrust/device_vector.h>
#include<iostream>
/*courtesy of https://github.com/thrust/thrust/blob/master/examples/expand.cu */
template <typename Vector>
void printVec(const Vector& v, int d1, int d2)
{
typedef typename Vector::value_type T;
fo... |
#include <iostream>
#include <vector>
using namespace std;
void swap (vector<long> &a, int i, int j) {
long tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
void insert(vector<long> &a, int n, long x) {
a[n] = x;
int i = n;
while (i > 0 && a[i] > a[(i - 1) / 2]) {
swap(a, i, (i - 1) / 2);
... |
#include "BNO055.h"
uint8_t BNO055::init(POWER_MODE _Power, OPERATION_MODE _Operation_Mode, PLACEMENT _orientation)
{
write(Page0::SYSTEM_TRIGGER, 0x01); //External oscillator
write(Page0::UNIT_SELECTION, 0x90); //Android orientation(pitch+ counter clockwise), fahrenheit temp, euler degrees, rotation DPS, accel m/s�... |
#ifndef MFMESHQUADSURFACE_H
#define MFMESHQUADSURFACE_H
#include "mfMacros.h"
#include "mfSing.h"
#include "mfMesh.h"
#include "mfMeshOper.h"
//#include "mfVertexStarIteratorQuadSurf.h"
namespace mf
{
/**
* @class mfMeshQuadSurface
* @file mfMeshQuadSurface.h
* @short
* Mesh Operator Class
*
* Operation Clas... |
#pragma once
#include <iostream>
using namespace std;
#define VALID_MAX_AGE 110
#define VALID_MIN_AGE 18
enum DataType {
NUMBER = 0x1,
SYMBOL = 0x2,
LWCASE = 0x4,
UPCASE = 0x8,
SPACE = 0x10,
};
unsigned int stringContains(const string& s);
bool doesStringContainOnlyAndOptional(const string& s, unsigned int Dat... |
#include<iostream>
using namespace std;
enum VehicleType {
VT_Twowheeler, VT_ThreeWheeler, VT_FourWheeler
};
class Vehicle {
public:
virtual void printVehicle()=0;
static Vehicle*create(VehicleType type);
};
class Twowheeler:public Vehicle{
void printVehicle() {
cout<<" IM TWO WHEELER !!";
}
};
class Threewhe... |
// -*- 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 "List.h"
template <typename T>
List<T>::List()
{
arr = new T[1];
maxSize = 1;
currentSize = 0;
}
template <typename T>
List<T>::List(const List& obj)
{
maxSize = obj.maxSize;
currentSize = obj.currentSize;
arr = new int[maxSize];
for (int i = 0; i < currentSize; i++)
{
arr[i] = obj.... |
#ifndef TIMERS_H
#define TIMERS_H
#include <sys/time.h>
#include <time.h>
// See http://apps.topcoder.com/forums/?module=Thread&threadID=642239&start=0
int get_time_counter = 0;
double get_time() {
get_time_counter++;
timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec + tv.tv_usec * 1e-6;
}
double wo... |
#include <iostream>
#include <string>
using namespace std;
void lucky(string s) {
int len = s.size() / 2;
int sum1 = 0, sum2 = 0;
for (int i = 0; i < len; i++) {
int n1 = s[i] - '0';
int n2 = s[i + len] - '0';
sum1 += n1;
sum2 += n2;
}
if (sum1 == sum2)
cout << "LUCKY" << endl;
else if(sum... |
//3->2,5->2,9->4
#include <iostream>
#include<vector>
#include<test_if_sorted.hpp>
#include<random>
using namespace std;
random_device r;
void traverse(vector<int>& a) { for (auto i : a)cout << i << ends; cout << endl; }
void merge(vector<int>&a, vector<int>& aux, int lo, int mid, int hi) {
int k;
for (k = lo;... |
#include "rfiddll.h"
#include <QDebug>
RfidDLL::RfidDLL()
{
qDebug() << "RfidDLL->DLL created, initialising";
}
void RfidDLL::initialiseSerialPort()
{
serial = new QSerialPort(this);
serial->setPortName("com8"); // set this to what is the real port
serial->setBaudRate(QSerialPort::Baud9600... |
#include "FlowWriter.h"
#include "ndpiReader/ndpiReader.h"
#include "MACVendors.h"
#include <sys/stat.h>
#include <iostream>
#include <boost/format.hpp>
#include "tools.h"
FlowWriter::FlowWriter()
{
}
FlowWriter::FlowWriter(ndpi_detection_module_struct* ndpi_struct,
std::string result_dirname... |
#ifndef PowerupType_H
#define PowerupType_H
namespace Dungeon {
enum PowerupType {
Sword,
Heart
};
}
#endif // PowerupType_H |
#pragma once
#include "Transform.h"
#include "CollisionVolume.h"
#include "PhysicsObject.h"
#include "RenderObject.h"
#include "NetworkObject.h"
#include <vector>
using std::vector;
namespace NCL {
namespace CSC8503 {
class NetworkObject;
class GameObject {
public:
GameObject(string name = "");
~GameO... |
/*******************************************************************************
* Cristian Alexandrescu *
* 2163013577ba2bc237f22b3f4d006856 *
* 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ... |
// @copyright 2017 - 2018 Shaun Ostoic
// Distributed under the MIT License.
// (See accompanying file LICENSE.md or copy at https://opensource.org/licenses/MIT)
#pragma once
namespace distant::utility {
template <class Derived>
class static_polymorphic
{
public:
const Derived& derived() const
{
// Downc... |
// 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::UI::Xaml::Markup {
struct XamlBinaryWriterErrorInformation;
struct XmlnsDefinition;
}
namespace Windows::UI::Xaml::Markup {
using Xa... |
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <regex>
#include <math.h>
#define MAX 11
#define INF 987654321
using namespace std;
typedef pair<int, int> pii;
typ... |
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
vector<int> v;
for (int i = 0; i < 100000; i++)
{
v.push_back(i);
}
cout << "capacity:" << v.capacity() << endl;
cout << "size:" << v.size() << endl;
//此时 通过resize改变容器大小
v.resize(10)... |
#include <TESTS/test_assertions.h>
#include <TESTS/testcase.h>
#include <CORE/UTIL/lrparser.h>
#include <CORE/UTIL/tokenizer.h>
using namespace core::util::parser;
struct eTokenNames {
enum type { TOKEN_IDENT, TOKEN_OBRACE, TOKEN_CBRACE, TOKEN_WS, COUNT };
static const char *names[COUNT];
};
const char *eTokenNa... |
// <ctype> 은 없다
// tolower : <ctype.h>
// 문자 하나는 ' '
#include <string>
#include <iostream>
#include <ctype.h>
using namespace std;
bool solution(string s)
{
bool answer = true;
int cntP=0;
int cntY=0;
for(int i=0; i<s.size(); i++){
if (tolower(s[i])=='p') cntP+=1;
else if (tolower(s[i]... |
#include <Arduino.h>
#include <WiFi.h>
const char *ssid = "UniFi";
//const char *ssid = "SRiPhone";
const char *password = "Logitech";
//const IPAddress serverIP(192, 168, 0, 200); //Address to visit
const IPAddress serverIP(85, 191, 171, 18); //Address to visit External IP
uint16_t serverPort = 200; ... |
#ifndef TUNING_H
#define TUNING_H
#include <map>
#include <string>
#include <list>
#include <AstInterface.h>
#include <LoopTree.h>
#include <LoopTreeTransform.h>
class POETProgram;
class XformVar;
class CodeVar;
class LocalVar;
class POETCode;
class LoopTreeNode;
class LoopBlocking;
class ParallelizeLoop;
class Array... |
#include "Polynomial_Utils.h"
#include <iostream>
Polynomial_Utils::Polynomial_Utils()
{
}
Polynomial_Utils::~Polynomial_Utils()
{
}
void Polynomial_Utils::print_polynomial(const char* name, long long *P, int size)
{
std::cout << name << " = ";
for (int i = 0; i < size - 1; i++)
std::cout << P[i] << "X^" << i... |
#include "game_object_factory.hpp"
using namespace game;
engine::GameObject* GameObjectFactory::fabricate(std::string name, std::pair<int, int> position, std::string object_name=""){
if(name == "little_girl"){
return fabricate_little_girl(position, object_name);
}else if(name == "thorn"){
return fabricate... |
#ifndef NETSOCKET_H
#define NETSOCKET_H
#include <stdint.h>
#include <vector>
#include <QThread>
#include <QtNetwork/QHostAddress>
#include <QtNetwork/QTcpSocket>
#include <QtNetwork/QTcpServer>
#include <QByteArray>
#include <QHostInfo>
#include <QNetworkInterface>
using namespace std;
class netsocket : public QTh... |
/*
* SPDX-FileCopyrightText: 2021 Rolf Eike Beer <eike@sf-mail.de>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <settings.h>
#include <wms.h>
#include <algorithm>
#include <cassert>
#include <osm2go_annotations.h>
#include <osm2go_test.h>
namespace {
class emptySettings : public settings_t {
em... |
/*
* HUDWindow.h
*
* Created on: Sep 17, 2009
* Author: ibi
* Purpose: provide the 2D overlay window for a Headsup Display
*/
#ifndef HUDWINDOW_H_
#define HUDWINDOW_H_
//
// Info window
//
class CZWBHUDWindow: public CSkinWindow {
public:
CZWBHUDWindow();
virtual ~CZWBHUDWindow();
void AccelUpdate... |
/*****************************************************************************************************
* 剑指offer第63题
* 给定一棵二叉搜索树,请找出其中的第k小的结点。例(5,3,7,2,4,6,8)中,按结点数值大小顺序第三小结点的值为4。
* Input: 二叉树
* Output: 二叉树第K小的节点数
*
* Note:(二叉树非递归的前、中、后序遍历必须要熟悉)--后序最难
* 本题要用到二叉树的中序遍历,因为中序遍历的二叉树是从小到大进行排... |
#include <chrono>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <math.h>
#include <iostream>
#include <Shader.hpp>
#include <ShaderProgram.hpp>
void framebuffer_size_callback(GLFWwindow *window, int width, int height)
{
glViewport(0, 0, width, height);
}
void processInput(GLFWwindow *window)
{
if (g... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.Phone.Devices.Notification.2.h"
WINRT_EXPORT namespace winrt {
namespace Windows::Phone::Devices::Notification {
struct WINRT_EBO VibrationDevice :
Windows::Phone::Devi... |
#include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode *reverse(ListNode *head);
// or using stack
bool isPalindrome(ListNode *head) {
ListNode *fast = head, *slow = head;
if (!head)
return false;
if (!head->next)
return true;... |
/*
* Scene.cpp
*
*/
#include "Scene.h"
namespace rt {
/**
* Parses json scene object to generate scene to render
*
* @param scenespecs the json scene specificatioon
*/
void Scene::createScene(Value& scenespecs) {
//----------parse json object to populate scene-----------
}
} // namespace rt
|
/*
ID: khurana2
PROG: gift1
LANG: C++
*/
#include <fstream>
#include <iostream>
#include <map>
#include <string>
#include <utility>
using namespace std;
typedef pair<long, long>Balance;
int main()
{
ofstream fout("gift1.out");
ifstream fin("gift1.in");
string names[10];
string current_name, friend_na... |
/**********************************************************************
** Some utility functions that are coommonly used, are listed here
**********************************************************************/
#include "utilities.h"
#include <iostream>
#include <fstream>
using namespace std;
utilities::utilities()
{
... |
#pragma once
#include "Elf.h"
Elf::Elf(std::string n)
:Class(n)
{
}
std::string Elf::render() {
return "Elf " + name;
}
Elf::~Elf()
{
}
|
#include<bits/stdc++.h>
using namespace std;
// remember after sorting always traverse from the end
// codeforces contest 683 div 2 C by meet IT
//https://codeforces.com/contest/1447/problem/C
bool compare(pair<int,int>& a,pair<int,int>& b)
{
return a.first < b.first;
}
int main()
{
int t;
cin >> t;
while(t--)
... |
#include "miscFunctions.hpp"
#include <SFML/Graphics.hpp>
#include <cmath>
#include <ctime>
#include <cstdlib>
sf::IntRect getRectForSprite (SpriteType type)
{
if (type == GRASS_1)
{
return getRectForSpriteSheetPos (0, 0, 1);
}
if (type == GRASS_2)
{
return getRectForSpriteSheetPos (0, 1, 1);
... |
#include "sysconfig.h"
#include "sysdeps.h"
#include "ethernet.h"
#ifdef _WIN32
#include "win32_uaenet.h"
#endif
#include "threaddep/thread.h"
#include "options.h"
#include "traps.h"
#include "sana2.h"
#include "uae/slirp.h"
#include "gui.h"
#include "rommgr.h"
#ifndef HAVE_INET_ATON
static int inet_aton(const char ... |
//
// Created by sunjiaming on 19-5-13.
//
#ifndef EX_7_4_PERSON_H
#define EX_7_4_PERSON_H
class Person {
private:
string name;
string adress;
};
#endif //EX_7_4_PERSON_H
|
//// *** user.cpp ***
void init(int N, int bidArr[], int duration[], int capacity[]) {
}
int add(int tick, int bid, int guestNum, int priority) {
return 0;
}
void search(int tick, int findCnt, int bidArr[], int numResult[]) {
}
|
#include "PizzaService.h"
PizzaService::PizzaService()
{
//ctor
}
PizzaService::~PizzaService()
{
//dtor
}
|
<<<<<<< HEAD
#include <cstdint>
#include <utility>
namespace sum_of_multiples {
uint32_t to(std::pair<uint32_t, uint32_t> input, uint32_t);
}
=======
#ifndef SUM_OF_MULTIPLES_H
#define SUM_OF_MULTIPLES_H
#include <list>
#include <cstdint>
#include <numeric>
namespace sum_of_multiples{
uint32_t to(std::list<uint32_t>... |
#if __has_include(<optional>)
#include <optional>
#define have_optional 1
#elif __has_include(<experimental/optional>)
#include <experimental/optional>
#define have_optional 1
#define experimental_optional 1
#else
#define have_optional 0
#endif
#include <iostream>
int main()
{
if (have_optional)
std::cout... |
//Copyright 2015-2016 Tomas Mikalauskas. All rights reserved.
#pragma once
#include "IRendererInitializer.h"
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE | WS_THICKFRAME)
class WindowsGLRendererInitializer final: public IRendererInitializer
{
friend class GLRenderer;
public:
WindowsGLRen... |
/**********************************************************
* License: The MIT License
* https://www.github.com/doc97/TxtAdv/blob/master/LICENSE
**********************************************************/
#include "catch.hpp"
#include "TxtContentReader.h"
namespace txt
{
TEST_CASE("TxtContentReader - All fields corr... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
/*
题目:
把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。
输入一个非减排序的数组的一个旋转,输出旋转数组的最小元素。
例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。
NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。
因为明确了有序数组一定发生了旋转,所以我们二分的目标就是找到相邻的两个数,而且这两个数是降序的。... |
/* Copyright (C) 2015 Willi Menapace <willi.menapace@gmail.com>, Simone Lorengo - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Willi Menapace <willi.menapace@gmail.com>
*/
#include "DataManager.h"
#include "Globa... |
//分数f1和f2的加法,数学公式展开即可,最后结果化简
Fraction add(Fraction f1,Fraction f2){
Fraction result;
result.up=f1.up*f2.down +f1.down *f2.up ;//分数和的分子
result.down =f1.down *f2.down ;//分数和的分母
return reduction(result);
}
|
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "array_list.h"
#include "quicksort3.h"
#include <ctime>
#include <cstdlib>
#include <string>
#include <QMessageBox>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidge... |
#ifndef __MENU_CREATE_SHAPE_H__
#define __MENU_CREATE_SHAPE_H__
//#include "imgui/imgui.h"
//#include <functional>
//#include "Panel.h"
//#include <vector>
//#include "RenderTexture.h"
//#include "MathGeoLib/include/Math/float3.h"
//
//#define X_COORD 0
//#define Y_COORD 1
//#define Z_COORD 2
//
//typedef unsigned int... |
void loop () {
if (cycletimer < 250 ) cycletimer++;
#if (MIDI_IN_block == 0)
#if defined (__AVR_ATmega32U4__) // USB MIDI in
do {
rx = MidiUSB.read();
if (rx.header != 0) {
incomingByte = rx.byte1; midifeedback();
incomingByte... |
#include "Camera.h"
void Camera::update(Controls* control)
{
position += front * control->forward;
position += up * control->up;
position += (front.cross(up)).normalize() * control->right;
control->forward = 0.0f;
control->right = 0.0f;
control->up = 0.0f;
Maths::mat4 rollRotation = Maths::mat4::r... |
/*
Multicolor Fade
This example code is in the public domain.
Codice per il fade continuo di tre colori in formato RGB 0-255
.--.
| .-.|
|T ||
[_|__|_]
| |
| |
| |
Make it work : Done
Make it right : Done
Make it fast : Work in progress :D
*/
//numerazione pin (variabile ausilira; n... |
/*
* File: String.cpp
* Author: gmena
*
* Created on 23 de agosto de 2014, 11:06 AM
*/
#include "String.h"
using namespace std;
Str::Str(void){}
int Str::findPosition(string target,string filter, int limit)
{
int count = 0;
int find = 0;
string replace("");
while((find = target.find_fi... |
//============================================================================
// Name : C_showBits.cpp
// Author : Cristian Mosquera
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//====================================================================... |
#include <iostream>
#include <map>
using namespace std;
#define toBraille 'S'
#define toNum 'B'
#define nLayers 3
#define nColumns 2
#define nDigits 10
#define zeroInChar 48
typedef struct {
char matrix[nLayers][nColumns];
char digit;
} brailleScript;
bool operator==(const brailleScript &bs1, const brailleSc... |
#include "stdafx.h"
#include "UMosesWorld.h"
#include "CBox.h"
#include "CDirectionalLight.h"
#include "CCharacter.h"
IMPLEMENT_CLASS(UMosesWorld);
UMosesWorld::UMosesWorld()
{
Box = new CBox(SideType_Inside);
Box->m_Scale = TVector3(100.0f,100.0f,100.0f);
Box->UpdateTransform();
AddThing(Box);
... |
// SimulationDocumentManager.h: interface for the SimulationDocumentManager class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SIMULATIONDOCUMENTMANAGER_H__02F90CF5_0D86_4A44_9B66_CC9C9A3D5C36__INCLUDED_)
#define AFX_SIMULATIONDOCUMENTMANAGER_H__02F90CF5_0D86_4A44_9B... |
#include "Qfloat.h"
unsigned int* Qfloat::getData() const
{
unsigned int* Result = new unsigned int[4];
for (int i = 0; i < 4; i++)
Result[i] = this->data[i];
return Result;
}
void Qfloat::setData(int viTrim, unsigned int Data)
{
this->data[viTrim] = Data;
}
bool* DecToBin15Bit(unsigned long l... |
#ifndef SARIBBONLINEEDIT_H
#define SARIBBONLINEEDIT_H
#include "SARibbonGlobal.h"
#include <QLineEdit>
class SA_RIBBON_EXPORT SARibbonLineEdit : public QLineEdit
{
Q_OBJECT
public:
SARibbonLineEdit(QWidget *parent = Q_NULLPTR);
};
#endif // SARIBBONLINEEDIT_H
|
#include <iostream>
#include <tclap/CmdLine.h>
#include "SRSRawFile.h"
#include "vmmef.h"
#include "event.h"
#include "Pedestal.h"
#include "HDF5File.h"
int verbose = 0; // global verbosity level
void buildDAQMap(std::string str, std::vector<size_t >& daqMap) {
std::stringstream ss(str); // Turn the string into a... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2010 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
... |
#include "Unit.h"
#include "PhysicsUnits.h"
#include <algorithm>
namespace solar
{
SimData::units_t * SimData::operator->()
{
return &units;
}
const SimData::units_t * SimData::operator->() const
{
return &units;
}
SimData::units_t & SimData::operator*()
{
return units;
}
const SimData::units_t & SimD... |
/* SPDX-License-Identifier: LGPL-2.1 */
/*
* Copyright (C) 2020 VMware Inc, Yordan Karadzhov (VMware) <y.karadz@gmail.com>
*/
/**
* @file LatencyPlotDialog.hpp
* @brief Dialog class used by the atencyPlot plugin.
*/
#ifndef _KS_EFP_DIALOG_H
#define _KS_EFP_DIALOG_H
// KernelShark
#include "plugins/laten... |
// https://www.luogu.com.cn/problem/P3372
// 洛谷 线段树
// 学习
#include <bits/stdc++.h>
using namespace std;
#define cin ios::sync_with_stdio(false); cin
const int M = 1 << 17;
int date[2 * M - 1];
int arr[2 * M - 1];
int b[2 * M - 1]; // 标记数组
void build(int s, int t, int p) {
// 对 [s,t] 区间建立线段树,当前根的编号为 p
if (s ... |
template <class Type>
Type trans(Type x){
return Type(2)/(Type(1) + exp(-Type(2) * x)) - Type(1);
}
template <class Type>
Type jacobiUVtrans( array<Type> logF){
// int nr=logF.rows(); //Cange to .rows eller .cols
// int nc=logF.cols();
int nr=logF.cols(); //Cange to .rows eller .cols
int nc=logF.rows();
... |
///////////////////////////////////////////////////////////////////////
//ConfigEngine.cpp
///////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include "../common/common.hpp"
#include "ConfigEngine.hpp"
//////////////////////////////////////////////////////////... |
#include "stdafx.h"
#include "StagesWindow.h"
#include "NagDlg.h"
#include "utilites/Localizator.h"
#include "utilites/serl/Archive.h"
#include "utilites/serl/serl_registry.h"
#include "utilites/document.h"
#include "data/nodeFactory.h"
#include "StagesDlg.h"
#include "toolbarbtns.h"
#include "resource.h"
#inclu... |
#include "Textures.h"
Textures::Textures()
{
background_texture.loadFromFile("resources/images/background.png");
overlay_texture.loadFromFile("resources/images/overlay.png");
bird_texture.loadFromFile("resources/images/bird.png");
column_top_texture.loadFromFile("resources/images/column_top.png");
column_bottom_t... |
/*Given an array of integers, sort the array into a wave like array and return it,
In other words, arrange the elements into a sequence such that a1 >= a2 <= a3 >= a4 <= a5.....*/
#include<bits/stdc++.h>
using namespace std;
void print_vector(vector <int> a)
{
for(auto i=a.begin();i!=a.end();++i)
{
c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.