text stringlengths 8 6.88M |
|---|
#pragma once
#include <string>
#include <vector>
#include <algorithm>
#include "BagOfWords.h"
#include "parser.hpp"
const int COLUMN_NUMBER_RATING = 1;
const int COLUMN_NUMBER_TEXT = 2;
const int CUTOFF_FOR_POSITIVE_SENTIMENT = 4;
class Input {
std::string fileLocation;
std::vector<std::string> textReviews;
std... |
/*
Copyright 2021 University of Manchester
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 applicable law or agreed to in writing, s... |
#include <iostream>
using namespace std;
struct NodeType {
char data;
NodeType* prev;
NodeType* next;
};
int main() {
NodeType* editor;
NodeType* cursor;
editor = new NodeType; // dummy node
editor->data = '\0';
editor->prev = NULL;
editor->next = NULL;
cursor = editor;
char buffer = '\0... |
#pragma once
namespace BeeeOn {
class FileLoader;
class ConfigurationExplorer {
public:
virtual ~ConfigurationExplorer();
virtual void explore(FileLoader &loader) = 0;
};
}
|
// Copyright 2018 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#include "packager/media/chunking/chunking_handler.h"
#include <gmock/gmock.h>
#include <gtest/gt... |
#pragma once
#include <gpu/material.h>
class Transparent : public Material {
public:
__device__ Transparent(float ref_index) :
refractive_index(ref_index) {};
__device__ ~Transparent() = default;
__device__ bool Transparent::scatter(const Ray& r, HitDesc& d, glm::vec3& attenuation, Ray& scattered, curandState* l... |
// energy.h
#ifndef ENERGY_H
#define ENERGY_H
#include <memory>
#include <unordered_map>
#include <utility>
#include <vector>
#include "BlobCrystallinOligomer/config.h"
#include "BlobCrystallinOligomer/ifile.h"
#include "BlobCrystallinOligomer/hash.h"
#include "BlobCrystallinOligomer/monomer.h"
#include "BlobCrystal... |
#include "pch.h"
#include "AISystem.h"
#include "Core\EntityAssembler.h"
#include "Core\AssembledBehaviorReg.h"
#include "Core\Entity.h"
#include "Component\Transform.h"
#include <io.h>
#include "Core\InputManager.h"
#include "Renderer\DebugRenderer.h"
#include "Component\Motor.h"
#include "Core\TimeManager.h"
namespa... |
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
class ModuloCombination {
private:
vector<ll> fact, inv_fact;
static ll modulo_power(ll a, ll n) {
if(n == 0) return 1;
if(n % 2 == 0) return modulo_pow... |
/* -*- Mode: c++; tab-width: 4; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2011 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*
* Allowed #if-ery: none.
* Sort order: alphabetic
*/
#ifndef POSIX_SYS_NONIX_CHOICE_H... |
// Created on: 1997-03-26
// Created by: Christian CAILLET
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the ... |
// Copyright: 2017 Bing-Hui WANG
//
// Author: Bing-Hui WANG
//
// Date: 2017-10-3
//
// Description: This code has build a class (FHandle) for parsing math expression from string.
// It just like "function handle" in MATLAB. User can creat a FHandle variable from string, and
// calculate the value of your func... |
#ifndef BVHVIEW_H
#define BVHVIEW_H
#include "BVH.h"
#include "viewwidget.h"
class BVHView : public ViewWidget
{
Q_OBJECT
public:
explicit BVHView(Manager *, QWidget *parent = 0);
signals:
public slots:
protected:
/// Initialise the GL scene
void initializeGL();
/// Paint the GL scene
void... |
#pragma once
#include "modes.h"
#include "events/event.hpp"
#include <chrono>
namespace lab {
enum class PlayMode { NotStarted, Playing, Paused };
class Timeline : public MinorMode
{
PlayMode _playMode = PlayMode::NotStarted;
double _current_time = 100.0;
void play();
void pause();
void rewind();
... |
/* Author: Mincheul Kang */
#ifndef OMPL_GEOMETRIC_PLANNERS_PRM_HARMONIOUS_LAZY_PRM_STAR_MULTI_
#define OMPL_GEOMETRIC_PLANNERS_PRM_HARMONIOUS_LAZY_PRM_STAR_MULTI_
#include <ompl/geometric/planners/PlannerIncludes.h>
#include <ompl/datastructures/NearestNeighbors.h>
#include <boost/graph/graph_traits.hpp>
#include <b... |
// Created on: 1998-04-08
// Created by: Philippe MANGIN
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GN... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*-
*
* Copyright (C) 1995-2010 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
/**
* Wrapper to invoke the parser f... |
#ifndef SDB_HPP
#define SDB_HPP
void sdb();
#endif
|
// https://oj.leetcode.com/problems/minimum-window-substring/
class Solution {
public:
string minWindow(string S, string T) {
int ssize = S.size(), tsize = T.size();
if (ssize < tsize || ssize == 0) {
return "";
}
int wbegin = 0;
int win_len = INT_MAX;
i... |
/*
ID: stevenh6
TASK: comehome
LANG: C++
*/
#include <fstream>
#include <string>
#include <climits>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
ofstream fout("comehome.out");
ifstream fin("comehome.in");
int main()
{
int grid[60][60];
int shortpath = INT_MAX / 4;
map<in... |
#include "FusionEKF.h"
#include <iostream>
#include "Eigen/Dense"
#include "tools.h"
//#include "cmath"
|
/*
* =====================================================================================
*
* Filename: dup_elements.cpp
*
* Description: Remove duplicates from linked list using hash table
*
* Version: 1.0
* Created: 11/06/2013 11:28:48
* Revision: none
* Compiler: g+... |
//
// Created by Yujing Shen on 29/05/2017.
//
#include "../../include/nodes/VarNode.h"
namespace sjtu{
VarNode::VarNode(Session *sess, const Shape &shape):
SessionNode(sess, shape)
{
}
VarNode::~VarNode()
{
}
Node VarNode::forward()
{
return this;
}
Node Var... |
// #include "TcpServer.h"
// #include "EventLoop.h"
// void onConnection(TcpConnPtr conn) {
// }
int main() { return 0; } |
#pragma once
#include <iberbar\Gui\Widgets\Button.h>
namespace iberbar
{
namespace Gui
{
class __iberbarGuiApi__ CCheckBox
: public CButton
{
public:
enum class UCheckState
{
CheckedFalse,
CheckedTrue,
CheckedIndeterminate,
};
public:
CCheckBox( void );
protected:
CCheckB... |
#include "Wall.h"
#include "cocostudio/CocoStudio.h"
#include "GameManager.h"
using namespace cocos2d;
Wall* Wall::create()
{
Wall* myNode = new Wall();
if (myNode->init())
{
myNode->autorelease();
return myNode;
}
else
{
CC_SAFE_DELETE(myNode);
return nullptr;
}
return myNode;
}
bool Wall::init()
{... |
#include <iostream>
/* Exercise 2.40 - write your own version of the Sales_data class (struct)*/
struct Sales_data {
std::string bookId;
unsigned unitsSold;
double revenue;
};
int main()
{
/* let's see if this works */
Sales_data book;
Sales_data book2;
book.bookId = "some id";
b... |
/*
* @lc app=leetcode.cn id=27 lang=cpp
*
* [27] 移除元素
*/
// @lc code=start
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int left=0;
int right=nums.size()-1;
while(left<=r... |
// Created on: 2003-05-06
// Created by: Galina KULIKOVA
// Copyright (c) 2003-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 ... |
#ifndef FREQAN_HPP
#define FREQAN_HPP
#include <string>
#include "cipher.hpp"
static const int C = 26;
static const float english[C] = { .0781, .0128, .0293, .0411, .1305, .0288,
.0139, .0565, .0677, .0023, .0042, .036, .0262, .0728, .0821, .0215, .0014,
.0664, .0646, .0902, .0277, .01, .0149, .003, .0151, .00... |
/**********************************************************************
*Project : EngineTask
*
*Author : Jorge Cásedas
*
*Starting date : 24/06/2020
*
*Ending date : 03/07/2020
*
*Purpose : Creating a 3D engine that can be used later on for developing a playable demo, with the engine as static library
*
***... |
// KC NOIRE - RACHEL J. MORRIS, 2012 - WWW.MOOSADER.COM - GNU GPL V3
#include "State/StateManager.h"
#include "IOUtils/GameIO.h"
#include <stdio.h>
#include <stdlib.h>
#include "IOUtils/Utils.h"
int GIO::m_TypeSpeedMs = 0;
std::ofstream GIO::m_OutStream;
std::ofstream GIO::m_DebugStream;
int main()
{
GIO::Init(... |
#include "messagebox.h"
MessageBox::MessageBox(QString message)
{
//label_dialog = new QLabel(message, this);
// label_dialog->setGeometry(20, 20, 20, 20);
setText(message);
exec();
}
MessageBox::~MessageBox()
{
}
|
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <utility>
#include <vector>
#include "block_system.h"
#include "dbg.h"
#include "dump.h"
#include "orbits.h"
#include "perm.h"
#include "perm_group.h"
#include "perm_set.h"
namespace cgtl
{
bool BlockSy... |
#include "Heal.h"
Heal::Heal(int cost, int points): Spell(cost, points) {}
Heal::~Heal() {}
void Heal::action(Unit* target) {
target->increaseHP(this->points);
}
|
#include "FadeIn.h"
#include "Utils.h"
#include "Time.h"
#ifdef USING_OGL
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
#else
#include <d3dcompiler.h>
extern Microsoft::WRL::ComPtr<ID3D11Device> D3D11Device;
extern Microsoft::WRL::ComPtr<ID3D11DeviceContext> D3D11DeviceContext;
#endif
void CFadeIn::Cre... |
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout... |
#pragma once
#include <windows.h>
#include <gl/glu.h>
#include "math.h"
#include "includelist.h"
// DEFINE THIS IF YOU WANT TO OPTIMIZE TO SQUARE TEXTURES
#define __TEXGEN_SQUARE_TEXTURES__
// DEFINE THIS IF YOU WANT BILINEAR FILTERED TEXTURES
#define __TEXGEN_BILINEAR__
#pragma pack(1)
#ifdef INCLUDE_TEX_Envmap
... |
#include <algorithm>
#include <iostream>
#include <iterator>
#include <map>
#include <string>
using kv_map = std::map<std::string, std::string>;
template <typename InputIterator, typename Container, typename InputValueType = typename std::iterator_traits<InputIterator>::value_type>
void parse_key_value_message(InputI... |
#include "muduo/base/ThreadPool.h"
#include "muduo/base/Exception.h"
#include "muduo/base/Thread.h"
using std::placeholders::_1;
namespace muduo {
void ThreadPool::start(int numThreads) {
#ifndef NDEBUG
fprintf(stderr, "Start thread pool with %d threads\n", numThreads);
#endif
assert(threads_.empty());
running... |
#ifndef __DCLSMOVEEDITOR_H
#define __DCLSMOVEEDITOR_H
#include "MClsMove.h"
#include "MGroup.h"
#include "TPresenter.h"
#include "TViewCtrlPanel.h"
#include "PathPatternEditor.h"
namespace wh{
namespace view{
//-----------------------------------------------------------------------------
/// Редактор для свойства дей... |
#include <iostream>
#include <pqxx/pqxx>
int main()
{
try
{
pqxx::connection conn("postgresql://<user>:<pass>@<host>:<port>/<db>");
std::cout << "Connected as " << conn.username()
<< "@" << conn.hostname()
<< ":" << conn.port()
<< "/" << conn.dbname() << std::endl;
// Start a tr... |
#include <ax12.h> //AX-12 libraries allow the ArbotiX to communicate with DYNAMIXEL servos, AX and MX
#include <BioloidController.h> //The Bioloid controller library is used for servo interpolation
#include <avr/pgmspace.h> //PROGMEM library allows the ArboitX to store poses in Flash memory, so ... |
/*
filename: moruleset.h
author: Sherri Harms
last modified: 8/8/01
description: Class moruleset interface file for parallel MINEPI REAR rules
Values of this type are vectors of rules, where a morule is a composite of
an antecedent episode, and a consequent episode, with a confidence;
****************************... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2011 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser. It may not be distributed
* under any circumstances.
*/
#include "core/pch.h"
#include "adjunct/desktop_pi/DesktopOpView... |
class Solution {
public:
int maxProfit(vector<int>& prices) {
if(prices.empty()) return 0;
int sell = 0;
int buy = INT_MAX;
for(int i=0; i<prices.size(); ++i){
buy = min(buy,prices[i]);
sell = max(sell,prices[i]-buy);
}
return sell;
}
};
|
#pragma once
namespace Petunia
{
enum ConnectionRole {
Auto,
Server,
Client
};
} |
#include <eosiolib/eosio.hpp>
using namespace eosio;
class[[eosio::contract]] externcont : public eosio::contract{
public:
using contract::contract;
externcont(name receiver, name code, datastream<const char*> ds) : contract(receiver, code, ds) {};
[[eosio::action]]
void eostransfer(name from, name to, uint64_... |
#ifndef DOUBLE_H
#define DOUBLE_H
class Double {
public:
double value;
Double();
Double(double val);
Double(const Double &other);
Double& operator+= (const Double &val);
Double& operator* (Double &t);
};
inline
Double::Double() : value(0.0)
{}
inline
Double::Double(double val)
{
value = val;
}
... |
#include<iostream>
#include<cstdlib>
using namespace std;
void shuffle(int *arr,int s,int e)
{
srand(time(NULL));
int i,j;
for(i=e;i>0;i--)
{
j=rand()%(i+1);
swap(arr[i],arr[j]);
}
}
int partition(int *arr,int s,int e)
{
int i=s-1;
int p=e;
int j=s;
for(j=s;j<e;j++)
{
if(arr[j]<arr[p])
{
i++;
sw... |
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Triad National Security, LLC. This file is part of the
// Tusas code (LA-CC-17-001) and is subject to the revised BSD license terms
// in the LICENSE file found in the top-level directory of this distribution.
//
////... |
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPushButton>
#include <QPoint>
#include <mycanvas.h>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
void change_button_color(QPushButton *butt, QColor color);
void add_new_point(const ... |
#pragma once
#include "uninitialized.hpp"
template<typename T, std::size_t N>
class uninitialized_array
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
t... |
#include <iostream>
#include <cmath>
bool checkPrime(int num) {
for( int i = 2; i <= sqrt(num); i++) {
if(num%i == 0) {
return false;
}
}
return true;
}
int main() {
int number;
std::cout << "Please, enter a number: ";
std::cin >> number;
for( int i = 1; i <= number; i++... |
#include <stdint.h>
#include <string.h>
void blocked_reorder_naive(
float* src, float* dst,
uint32_t* src_block_starts, uint32_t* dst_block_starts,
uint32_t* block_sizes,
uint32_t num_blocks)
{
for (uint32_t block_idx = 0; block_idx < num_blocks; ++block_idx) {
for (uint32_t elem_idx = 0; e... |
// windowdriver_p.cc
// 2/1/2013 jichi
#include "config.h"
#include "window/windowdriver_p.h"
#include "window/windowhash.h"
#include "window/windowmanager.h"
#include "winiter/winiter.h"
#include "winiter/winitertl.h"
#include <commctrl.h>
#include <QtCore/QHash>
#include <QtCore/QTextCodec>
#include <QtCore/QTimer>
... |
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int n,m;
int square[3][maxn];
int pre[3][maxn];
int ans[maxn];
int k,l,r;
int main() {
memset(ans,1000000,sizeof(ans));
scanf("%d%d",&n,&m);
for(int i=1; i<=n; i++) {
for(int j=1; j<=m; j++) {
scanf("%d",&squ... |
#include <iostream>
// We are going to create a videogame log class
class Log {
public:
enum Level {
levelError, levelWarning, levelInfo
};
private:
Level m_LogLevelM = levelInfo;
public:
void setLevel(Level level) {
m_LogLevelM = level;
}
void warn(const char* message) {
if (m_LogLevelM >=... |
/*
* UserRepositoryImpl.cc
*
* Created on: Nov 11, 2017
* Author: cis505
*/
#include "UserRepositoryImpl.h"
using namespace std;
//Status UserRepositoryImpl::GetUser(ServerContext* context, const GetUserRequest* request, UserDTO* user) {
//
// cerr << "Received a request for user" << endl;
// // TODO: Thi... |
/* Cheat that uses a driver for reading / writing virtual memory,
instead of using Win32API Functions. Written By Zer0Mem0ry,
https://www.youtube.com/watch?v=sJdBtPosWQs */
#include <Windows.h>
#include <vector>
#include <string>
/* IOCTL Codes needed for our driver */
// Request to read virtual user memor... |
#include "GnSystemPCH.h"
#include "GnMemoryObject.h"
#if !defined(NI_DISABLE_EXCEPTIONS)
#include <exception> // for std::bad_alloc
#include <new>
#endif
#ifdef GN_MEMORY_DEBUGGER
void* GnMemoryObject::operator new(gsize stSize)
#if defined(NI_DISABLE_EXCEPTIONS)
throw()
#endif
{
#if defined(NI_DISABLE_EXCEPTIONS)
r... |
#include<iostream>
#include<map>
#include<iterator>
#include<string>
using namespace std;
int main()
{
//Map object creation
//2d map
map<int, map<int, int>> m;
//to access map value use iterator
//To access the outer iterator
map<int, map<int, int>> ::iterator outer_itr=m.begin();
//To acce... |
/*
* OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees
* https://octomap.github.io/
*
* Copyright (c) 2009-2013, K.M. Wurm and A. Hornung, University of Freiburg
* All rights reserved.
* License: New BSD
*
* Redistribution and use in source and binary forms, with or without
* modificat... |
class PartWheel
{
weight = 10;
};
class PartFueltank
{
weight = 10;
};
class PartGlass
{
weight = 5;
};
class PartEngine
{
weight = 15;
};
class PartVRotor
{
weight = 15;
};
class PartFueltankBroken
{
weight = 10;
};
class PartWheelBroken
{
weight = 10;
};
class PartEngineBroken
{
weight = 15;
};
class Par... |
#include "outputwindow.h"
#include <QHBoxLayout>
#include <QTextEdit>
#include <QToolBar>
#include <QToolButton>
#include <QDebug>
OutputWindow::OutputWindow(QWidget *parent)
:QWidget(parent)
{
m_editor = new QTextEdit;
m_editor->setReadOnly(true);
m_toolBar = new QToolBar;
QVBoxLayout *mainLayou... |
#include<iostream>
using namespace std;
typedef struct node
{
int value;
struct node *next;
}qu;
qu *front=NULL,*rear=NULL;
void store(int data);
void retrieve();
int main()
{
int data,prompt=1;
while(prompt!=0)
{
cout<<"Enter <1>To store data\n"<<endl;
cout<<"Enter <2>To retrieve data\n"<<en... |
//
// Created by kamlesh on 30/10/15.
//
#ifndef PIGEON_HTTP_SERVER_H
#define PIGEON_HTTP_SERVER_H
namespace pigeon {
class http_server {
private:
void init_parser();
void init_server();
public:
void start();
};
}
#endif //PIGEON_HTTP_SERVER_H
|
//
// Created by 송지원 on 2020/06/29.
//
#include <iostream>
#include <queue>
#include <utility>
using namespace std;
#define X first
#define Y second
int M, N;
int box[1005][1005];
int vis[1005][1005];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt_input[3] = {0}; //-1, 0, 1
int change_cnt = 0;
int DAY ... |
#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
int gd=DETECT,gm;
int x1,y1,x2,y2,m,x,y;
initgraph(&gd,&gm,"C:\\TC\\BGI");
x=0;
cout<<"Enter left cordinate:";
cin>>x1>>y1;
cout<<"Enter right cordinate:";
cin>>x2>>y2;
m=abs((y2-y2)/(x2-x1));
cout<<"Slope"<<m;
y=y1;
for(x=x1;x<=... |
/*
* File: main.cpp
* Author: Daniel Canales
*
* Created on June 30, 2014, 5:37 PM
*/
#include <cstdlib>
#include <iostream>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
float home; // value of home
cout << "What is the value of your home? " << endl;
cin >> home;
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2008 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
*/
#ifndef _MATCHURL_TESTMAN_H_
#define _MATCHURL_TESTMAN_H_
#if... |
#include "GnSystemPCH.h"
#include "GnStandardAllocator.h"
#define IS_POWER_OF_TWO(x) (((x)&(x-1)) == 0)
void* GnStandardAllocator::Allocate(gsize& stSizeInBytes, gsize& stAlignment,
GnMemoryEventType eEventType, bool bProvideAccurateSizeOnDeallocate)
{
GnAssert(IS_POWER_OF_TWO(stAlignment));
return GnEx... |
// Created on: 1997-02-11
// Created by: Alexander BRIVIN and Dmitry TARASOV
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
//... |
#include<bits/stdc++.h>
using namespace std;
const int siz=50005;
int tr[siz<<2];
void pushup(int rt){
tr[rt]=tr[rt<<1]+tr[rt<<1|1];
}
void build(int l,int r,int rt){
int mid;
if(l==r){
scanf("%d",&tr[rt]);
return;
}
mid=(l+r)>>1;
build(l,mid,rt<<1);
build(mid+1,r,rt<<1|1);
... |
#pragma once
#include "gameNode.h"
class Phoenix : public gameNode
{
private:
float _x, _y;
image* img;
RECT _rc;
bool isFire;
float speed;
int _count;
int _index;
public:
Phoenix() {}
~Phoenix() {}
HRESULT init();
void release();
void update();
void render();
void fire(float x , float y);
void bullet... |
#pragma once
#include "AvatarLogic.h"
#include "Core.h"
class IALogic : public AvatarLogic
{
public:
IALogic();
virtual ~IALogic();
public:
virtual void computeNextAction(const float elapsedTime, AvatarEntity* ,AvatarLogicInfo );
private:
int m_commonThresholds[4][4];
float m_timeout;
ActionManager::actions m... |
#include "ros/ros.h"
#include "std_msgs/String.h"
#include "beginner_tutorials/Num.h"
#include "custom_messages/driveMessage.h"
#include "std_msgs/Float32.h"
#include "std_msgs/Int16.h"
#include "beginner_tutorials/driveCmd.h"
#include "math.h"
class PID_Event_Trig
{
ros::NodeHandle n;
ros::Publisher pub_teleop;... |
#pragma once
#include "ofMain.h"
class sphere : public ofBaseApp{
public:
sphere(); //constructor
~sphere(); //deconstructor
void setup(int posX, int posY, int posZ, int size);
void update();
void draw();
ofSpherePrimitive sphereShell;
int sphereRadius, sphereRes, spherePulse, co... |
#include "MyWnd.h"
MY_IMPLEMENT_DYNCREATE(CMyWnd, CMyCmdTarget)
CMyWnd::CMyWnd()
{
MyOutPutDebugString(_T("CMyWnd::CMyWnd()"));
}
CMyWnd::~CMyWnd()
{
MyOutPutDebugString(_T("CMyWnd::~CMyWnd()"));
}
|
#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Enter two numbers:";
cin>>a>>b;
cout<<a<<"=="<<b<<"="<<(a==b);
cout<<"\n";
cout<<a<<"!="<<b<<"="<<(a!=b);
return 0;
}
|
#include "AuthorizationManager.h"
boost::property_tree::ptree AuthorizationManager::loginUser(boost::property_tree::ptree ¶ms) {
auto login = params.get<std::string>("body.login");
if (dbConnector.userIsRegistered(login)) {
std::cout << "TUT";
dbConnector.authorizeUser(login);
dbCo... |
// Copyright (c) 2019, tlblanc <tlblanc1490 at gmail dot com>
#ifndef OS_EVENTLOOP_H_
#define OS_EVENTLOOP_H_
#include "aio.hpp"
#include "channel.hpp"
#include "status.hpp"
#include <chrono>
class EventLoopException final {
public:
EventLoopException(const char *msg, int err):
m_msg(msg),
m_err(err)... |
// Created on: 1995-04-24
// Created by: Modelistation
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU ... |
#include<iostream>
#include<algorithm>
using namespace std;
int countPair(int x[],int n1,int y[],int n2){
stable_sort(y,y+n2);
int freq[5]={0};
for(int i=0;i<n2;i++){
if(y[i]<5){
freq[y[i]]++;
}
}
int ans=0;
for(int i=0;i<n1;i++){
if(x[i]==0){
cont... |
#include <unistd.h>
#include <errno.h>
#include <sys/shm.h>
#include <thread>
#include <vector>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <clock.h>
#include <tools.h>
#include <sysv_shm.h>
int main()
{
std::vector<char> b(202,0);
std::generate(b.begin(),b.end(),[](){return rand()&0xFF;})... |
/*****************************************************************************************************************
* File Name : PrimeNumberChecker.h
* File Location : C:\Users\AVINASH\Desktop\CC++\Programming\src\tutorials\topcoder\number theory\PrimeNumberChecker.h
* Created on : Jan 23, 2014 :: 7:33:59... |
#pragma once
#include <exception>
#include <memory>
#include <type_traits>
#include <boost/iterator/counting_iterator.hpp>
#define MAYBE_UNUSED(var) (void)var
struct throw_reaction
{
void operator () () { throw std::invalid_argument ("convert null pointer to not_null");}
};
template<typename T, typename NULL_R... |
#include <jni.h>
#include <string>
#include "x264.h"
#include "librtmp/rtmp.h"
#include "VideoChannel.h"
#include "AudioChannel.h"
#include "macro.h"
#include "safe_queue.h"
int isStart = 0;// 为了防止用户重复点击开始直播,导致重新初始化
VideoChannel *pVideoChannel;
AudioChannel *pAudioChannel;
pthread_t pid;
uint32_t start_time;// 记录开始时间
... |
// Created on: 2009-01-20
// Created by: Alexander A. BORODIN
// Copyright (c) 2009-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version... |
#include "BaseKeyTapListener.hpp"
using namespace Leap;
Gesture::Type BaseKeyTapListener::getGestureType() {
return Gesture::TYPE_KEY_TAP;
}
void BaseKeyTapListener::onGestureDetected(const Gesture& gesture) {
onKeyTap(KeyTapGesture(gesture));
} |
#include <Dot++/lexer/Token.hpp>
namespace dot_pp { namespace lexer {
Token::Token()
: type_(TokenType::string)
{
}
Token::Token(const std::string& value, const TokenType type)
: value_(value)
, type_(type)
{
}
bool Token::empty() const
{
i... |
#include <PA9.h>
#include "Blob.h"
#include "Cell.h"
#include "C3DSpriteData.h"
#include "Team.h"
#include "DSspecs.h"
#include "STDfunctions.h"
#include "all_gfx.h"
#include "Scroll.h"
#include "Sound.h"
C3DSpriteData g_blobGfx[3] = {
C3DSpriteData((void*)NULL, (void*)NULL, 32, 32, TEX_256COL), //fake ... |
//
// Created by Brady Bodily on 4/22/17.
//
#ifndef ITAK_KEYVALUE_HPP
#define ITAK_KEYVALUE_HPP
#include "UserIP.hpp"
#include <vector>
#include <string>
class KeyValue {
public:
std::string Key;
KeyValue();
std::string GetKey();
std::vector<UserIP> GetValue();
std::vector<UserIP> Value;
voi... |
// Copyright (c) 2021 ETH Zurich
// Copyright (c) 2020 John Biddiscombe
// Copyright (c) 2016 Thomas Heller
// Copyright (c) 2016 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boo... |
// Project #12 Driver header file
// CS-1410-X01-deBry-Fall 2015
// Miles Meacham
// 10/11/2015
// ------------------------
#include <iostream>
#include "MyVector.h"
using namespace std;
const int TEST_VALUE1 = 21;
const int TEST_VALUE2 = 31;
const int TEST_VALUE3 = 41;
const int MAX = 12; |
#include <iostream>
using std::cin;
using std::cout;
const int SIZE = 5; // input size.
int main(void)
{
int numero;
int quant = 0;
for(int i=0; i < SIZE; i++){
cin >> numero;
if(numero < 0){
quant = quant + 1;
}
}
cout << quant;
return 0;
}
|
/*
* touch_dispatcher.h
*
*
*
*/
#ifndef TOUCH_DISPATCHER_H
#define TOUCH_DISPATCHER_H
#include "mbed.h"
#include <vector>
#include "uLCD_4DLibrary.h"
#include "singleton.h"
#include "ulcd_rect.h"
/*
* public types
*
*/
typedef enum
{
not_touched,
touch_began,
touch_moved,
touch_ended
} touch... |
#include <CVMLParse.h>
#include <cstring>
bool
CVML::
parse(const std::string &filename)
{
try {
reset();
pc_ = 0;
if (! parseFile(filename))
return false;
}
catch (CVMLError error) {
std::cerr << error.msg << std::endl;
return false;
}
return true;
}
bool
CVML::
parseFile(const... |
/*
* 题目:1442. 形成两个异或相等数组的三元组数目
* 链接:https://leetcode-cn.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor/
* 知识点:前缀和
*/
class Solution {
public:
// 三层循环
int countTriplets(vector<int>& arr) {
int n = arr.size();
vector<int> s(n + 1);
for (int i = 0; i < n; i++) {
... |
#include "Shader.h"
#include "Exception.h"
#include "Core.h"
#include <fstream>
#include <iostream>
#include <sstream>
void Shader::Load(std::string _path)
{
rendShader = core->GetContext()->createShader();
std::ifstream file(_path.c_str());
std::string shaderSrc;
if (!file.is_open())
{
throw Exception("Cann... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.