text stringlengths 8 6.88M |
|---|
/*
ModbusTCP.h - Header for Modbus IP Library
Copyright (C) 2015 André Sarmento Barbosa
*/
#include "mbed.h"
#include "Modbus.h"
#include "NetworkInterface.h"
#ifndef MODBUSTCP_H
#define MODBUSTCP_H
#define MODBUSTCP_PORT 502
#define MODBUSTCP_MAXFRAME 200
//#define TCP_KEEP_ALIVE
class ModbusTCP : publi... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2006 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
*/
#ifndef FORMVALUERADIOCHECK_H
#define FORMVALUERADIOCHECK_H
c... |
/*In this program we will be seeing all the Misc Operators like Sizeof, Adress , pointer , Conditional Expression avaliable in C++*/
/*including preprocessor in the program*/
#include <iostream>
/*using namespace*/
using namespace std ;
/*creating a main() function of the program*/
int main()
{
/*Declaring Vari... |
#ifndef CDT_CORE_ASINGLETON_IMPL_HPP
#define CDT_CORE_ASINGLETON_IMPL_HPP
#include <memory>
namespace cdt {
template<class T>
std::shared_ptr<T> ASingleton<T>::instance() {
auto result = mp_inst.lock();
if (!result) {
result.reset(new T, deleteFxn);
mp_inst = result;
}
return result;
}
template<class T>
vo... |
#include "Display.h"
#include <Arduino.h>
Display::Display()
{
for (int i = 0; i < CONFIG_MAP_SIZE; i++)
{
color[i] = 0;
type[i] = 0;
}
}
uint32_t Display::rgb2hex(byte R, byte G, byte B)
{
return (R << 16) | (G << 8) | B;
}
void Display::add_dot(byte position, uint32_t rgb_hex)
{
/*
* add pixel o... |
#include "babel.h"
#include <QtGui/QApplication>
#include "QNetwork.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Babel w;
// QNetwork net;
// quint16 port = 20701;
// net.socketConnection("127.0.0.1", port);
w.show();
// if (net.getSocketStatus())
// net.disconnect();
re... |
#include <iostream>
#include <cstdlib>
using namespace std;
void burbuja(int [], int);
int main()
{
srand(time(0));
const int tamanio = 10;
int t[tamanio] = {1+rand()%100, 1+rand()%100, 1+rand()%100, 1+rand()%100, 1+rand()%100, 1+rand()%100, 1+rand()%100, 1+rand()%100, 1+rand()%100, 1+rand()%100 };
for(int i=0;... |
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <map>
#include <string>
#include <cstdio>
using namespace std;
int strToTime(string s) {
return ((s[0] - '0') * 10 + s[1] - '0') * 3600 +
((s[3] - '0') * 10 + s[4] - '0') * 60 +
(s[6] - '0') * 10 + s[7] - ... |
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
vector<vector<int>> res;
vector<int> cur;
vector<vector<int>> combinationSum3(int k, int n) {
//基本思想:递归回溯,深度优先搜索
dfs( k, n, 1);
return res;
}
void dfs(int k, int n, int num)
... |
#include <bits/stdc++.h>
using namespace std;
class Trie {
public:
bool isEnd;
vector<Trie *> nodes;
Trie() {
nodes.resize(26, nullptr);
isEnd = false;
}
void insert(string word) {
Trie *next = this;
for (auto ch : word) {
ch -= 'a';
if (!next->nodes[ch])
next->nodes[ch]... |
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution1 {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if(!root ||... |
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int pa = 0, pb = 0, ans = 1;
for (int i = 0; i < N; ++i) {
int a, b;
cin >> a >> b;
ans += max(0, min(a, b) - max(pa, pb) + 1);
if (pa == pb) --ans;
pa = a, pb = b;
}
cout << ans << ... |
#include "chercheurMot.hpp"
#include <regexBuilder.hpp>
#include <utilitaires/fonctionsClasseString.hpp>
#include <utilitaires/recupPageHTML.hpp>
#include <boost/regex.hpp>
#include <sstream>
namespace
{
std::string createURL( const std::string & inMotARechercher )
{
std::ostringstream url;
url << "http://w... |
/**
* Copyright (C) Omar Thor, Aurora Hernandez - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
*
* Written by
* Omar Thor <omar@thorigin.com>, 2018
* Aurora Hernandez <aurora@aurorahernandez.com>, 2018
*/
#ifndef DMTK_ALGORI... |
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<cmath>
using namespace std;
const int MAXN = 2e5 + 100;
double a[MAXN];
int main()
{
int n;double w,sum;... |
#include "../src/Dvector.h"
#include <iostream>
#include <cassert>
#include <sstream>
int main(){
Dvector v0 = Dvector();
Dvector v = Dvector(3,10);
Dvector v2 = Dvector(4,10);
Dvector v3 = Dvector(3,11);
assert(v3.size() == 3);
bool faux = (v == v2);
assert(faux == false );
bool faux2 = (v == v3);
... |
/*
* Program: Warping.cpp
* Usage: Implement warping logics
*/
#include "Warping.h"
Warper::Warper(){
this->ut = Utils();
}
// Start-up of warping, using homography
void Warper::warpImage(CImg<unsigned char> &src, CImg<unsigned char> &dst, Axis ax, int offset_x, int offset_y){
cimg_forXY(dst, x, y){
int src_x =... |
#include <iostream>
#include "nrainhas.h"
using namespace std;
int main(int argc, char *argv[ ]){
string cmd = "";
cmd = argv[1];
NRainhas nR = NRainhas(cmd);
nR.gegarArquivo();
return 0;
}
|
#pragma once
class PostProccessing {
public:
PostProccessing();
};
|
// Created on: 1991-04-15
// Created by: Philippe DAUTRY
// Copyright (c) 1991-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... |
#include "Racional.h"
Racional::Racional(){
}
Racional::Racional(int num,int den){
this->numerador = num;
this->denominador = den;
}
int Racional::getNumerador(){
return numerador;
}
void Racional::setNumerador(int num){
numerador = num;
}
int Racional::getDenominador(){
return denominador;
}
void Ra... |
//
// main.cpp
// VectorClass
//
// Created by Vincent Liang on 12/15/19.
// Copyright © 2019 Vincent Liang. All rights reserved.
//
#include "Vector.hpp"
#include <iostream>
int main(int argc, const char * argv[]) {
Vector<int> hi(1,0);
hi.push_back(25);
hi.push_back(50);
hi.push_back(75);
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 2005-2011 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef SVG_MANAGER_H
#define SVG_MANAGER_H
#ifdef SVG_SUPPORT
... |
#include <iostream>
#include <cmath>
#include <string>
#include <unistd.h>
#include <fcntl.h>
#include <error.h>
#include <cstring>
#include <fstream>
#include <deque>
#include "./Node.hpp"
#define LEFT 0
#define RIGHT 1
using std::getline;
using std::cout;
using std::endl;
using std::string;
using std::ifstream;
... |
// #include <boost/multiprecision/cpp_int.hpp>
// using boost::multiprecision::cpp_int;
#include <bits/stdc++.h>
using namespace std;
// ¯\_(ツ)_/¯
#define f first
#define s second
#define p push
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) -... |
// ДАННЫЙ ПРИМЕР ОТОБРАЖАЕТ СОСТОЯНИЯ КЛАВИШ НА ИХ СВЕТОДИОДАХ: // * Строки со звёздочкой являются необязательными.
// (нажимайте удерживайте и отпускайте кнопки клавиатуры) //
//
#include "../iarduino_I2C_Keyboard.h" ... |
#pragma once
#include "QuestionStateImpl.h"
class CQuestionStateForTesting : public qp::CQuestionState
{
public:
LOKI_DEFINE_VISITABLE()
CQuestionStateForTesting(qp::CConstQuestionPtr const& question)
:qp::CQuestionState(question)
,doSubmitCallCounter(0)
{
}
int doSubmitCallCounter;
protect... |
#pragma once
namespace aeEngineSDK
{
/*************************************************************************************************/
/* Forward declarations needed
/*************************************************************************************************/
struct aeVector3;
struct aeMatrix3;
/*******... |
#ifndef MYTCPSERVER_H
#define MYTCPSERVER_H
#include <QObject>
#include <QtNetwork/QTcpServer>
#include "mytcpsocket.h"
#include "waitqueue.h"
#include <QVector>
class gameServer;
class MyTCPServer : public QTcpServer
{
public:
MyTCPServer(gameServer *gs_);
~MyTCPServer();
void incomingConnection(qintpt... |
//
// buffer.hpp
//
//
// Created by Six on 1/9/2020.
// Copyright 1/9/2020 Six. All rights reserved.
//
#ifndef _GJ_MESSAGES_BUFFER_HPP
#define _GJ_MESSAGES_BUFFER_HPP
#include <string.h> // for memcpy
#include <vector> // for um...vector.
#include <functional> // for std::function
#include <stdint.h> // for int t... |
//camera_control.cpp
#include "camera_control.h"
//define IO
|
#include <QHostAddress>
#include "gateadapter.h"
GateAdapter::GateAdapter(QObject *parent) : AdapterBase(parent)
{
setDataPort(&m_tcpSocket);
}
void GateAdapter::setAddress(QString address)
{
if (m_address == address)
return;
m_tcpSocket.connectToHost(QHostAddress(address), 5555);
if(m_tcpS... |
/*--------------------------------------------------------------------
This file is part of the Adafruit NeoMatrix library.
This has been ported to the Spark.
NeoMatrix is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free... |
#include <iostream>
#include<queue>
using namespace std;
/*IDEA:
*if eventually you get a negative current petrol then that means that you cant start from where you started. Therefore you remove that pump out from queue and remove the petrol count of it too.
In such a case you keep removing till you get a positive p... |
/** @file Decoration.cxx
** Visual elements added over text.
**/
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <c... |
// Tutorial task 1
#include "mbed.h"
// Green LED
DigitalOut led1(LED1);
// Blue LED
DigitalOut led2(LED2);
// Red LED
DigitalOut led3(LED3);
void select_led(int l)
{
if (l==1) {
led1 = true;
led2 = false;
led3 = false;
} else if (l==2) {
led1 = false;
led2 = true;
... |
/*
* This node is to indicate the whole parking lot status
* for example: idle for parking, fault at maintenance, car permitted, car rejected, ...
* Inputs:
* ROS message(string)
* Outputs:
* hardware modbus operation
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/time.h>
#i... |
/*
Given a binary tree, print the zig zag order. In zigzag order, level 1 is printed from left to right, level 2 from right
to left and so on. This means odd levels should get printed from left to right and even level right to left.
Input format:
The first line of input contains data of the nodes of the tree in level ... |
//
// main.cpp
// Matrice_Creuse
//
// Created by Despret Jean-Philippe on 19/05/2015.
// Copyright (c) 2015 Despret Jean-Philippe. All rights reserved.
//
#include <iostream>
#include "Matrice.h"
using namespace std;
int main()
{
cout << "Projet Matrice" << endl;
Matrice matrice1(100,100); // nombr... |
/**
* Class that publishes C++ classes for use inside QML.
*/
class Engine
{
public:
static void start(); ///< static to publish C++ classes to QML
};
|
/*
* Copyright 2021 The Android Open Source Project
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
int main() {
ll N, M;
cin >> N >> M;
ll a[N];
for (int i = 0; i < N; ++i) cin >> a[i];
sort(a, a + N);
ll ok = N + 1, ng = 0;
while (ok - ng > 1) {
ll mid = (ok + ng) / 2;
ll cnt = 0, d = 0... |
/*
==========================================
Copyright (c) 2016-2018 Dynamic_Static
Patrick Purcell
Licensed under the MIT license
http://opensource.org/licenses/MIT
==========================================
*/
#pragma once
#include "Dynamic_Static/Core/Action.hpp"
#include "Dynamic_Static/Core/Def... |
#include "House.h"
void House::printPosition() {
std::cout << "The house'position is ";
BaseObject::printPosition();
}
void House:: move(Position newPosition) {
std::cout << "House can not move\n";
} |
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <functional>
#include <numeric>
#include <ss... |
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
//
// Copyright (C) 2003-2007 Opera Software AS. All rights reserved.
//
// This file is part of the Opera web browser. It may not be distributed
// under any circumstances.
//
// Julien Picalausa
//
#include "core/pch.h"
#include "adjunct/d... |
/**
* Copyright (c) 2021, Timothy Stack
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of condi... |
#include <jni.h>
#include <android/native_activity.h>
#include "mylog.h"
static void printInfo(ANativeActivity* activity) {
LOGI(2, "internalDataPath: %s", activity->internalDataPath);
LOGI(2, "externalDataPath: %s", activity->externalDataPath);
jmethodID toStringMID;
jclass activityCls = activity->env->... |
//
// Created by Stephen Clyde on 1/16/17.
//
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <sstream>
#include "Comparer.h"
#include "FormattedTable.hpp"
int Comparer::load(int argv, char* argc[])
{
if (argv<3)
{
std::cout << "Invalid parameters" << std::endl;
... |
// Generated from grammars/sv2012.g4 by ANTLR 4.7
#include "sv2012BaseVisitor.h"
using namespace sv;
|
#include "../classes/ConfBill.h"
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include "Exception.h"
#include "BDb.h"
bool ConfBill::parse_config_variables(boost::property_tree::ptree &pt) {
web_port = pt.get<uint16_t>("main.web_port", 8032);
db_main = pt.get<string>("db.master");
... |
/**
* @file test/test_client.cc
* @brief
* @version 0.1
* @date 2021-01-14
*
* @copyright Copyright (c) 2021 Tencent. All rights reserved.
*
*/
// Client side implementation of UDP client-server model
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
... |
#include "Stdafx.h"
#include "SBRPLib.h"
//move pair within a route
bool PairRelocate::evaluate(class SBRP *S, int u, int i, int r, int k, SBRPMove *M)
{
//u -sudent depot; insert after node i; destination of u insert afer k
//r- routenum; i and k must in route r;
//all must have be visited
int d = S->... |
#pragma once
#include <stdio.h>
#include <stdlib.h>
class questHall;
class quest;
class party;
questHall *getQuestHall(int);//Needs to be completed in questHall.cpp
class questHall
{
int id;
char name[32];
quest **quest_list;
int num_quests;
int member_price;
party *team;
public:
questHall();
~quest... |
/*
* Lanq(Lan Quick)
* Solodov A. N. (hotSAN)
* 2016
* LqSysPoll... - Multiplatform abstracted event folower
* This part of server support:
* +Windows native events objects.
* +linux epoll.
* +kevent for FreeBSD like systems.(*But not yet implemented)
* +poll for others unix systems.
*
*/
#incl... |
#pragma once
#include <maya/MPxNode.h>
class GroundShadowNode : public MPxNode
{
public:
static const MTypeId id;
static void *creator();
static MStatus initialize();
virtual MStatus compute(const MPlug &plug, MDataBlock &data);
static MObject lightPosition;
static MObject castingSurface;
static MObject shad... |
#include "PList.h"
using namespace ece309;
namespace ece309{
DList::DList()
{
// initialize empty list
head = NULL;
tail = NULL;
}
void DList::append(Object *a)
{
DListNode *node = new DListNode(a,NULL,tail);
if (head == NULL)
{
// list is empty
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) Opera Software ASA 2006 - 2008
*
*/
#ifndef WEBSERVER_BODY_OBJECTS_H_
#define WEBSERVER_BODY_OBJECTS_H_
#include "modules/webserver/webserver_resources.h"
#include "modules/mime/multipart_parser/abstract_mpp.h"
#include... |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, m;
vector<int> nums;
vector<int> targets;
int low, high, mid;
int upperBound(int target){
low = 0;
high = nums.size() - 1;
while(low <= high){
mid = (low + high) / 2;
if(nums[mid] <= target){
... |
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
pair<int, int> search_min_sub_segment(const vector<int>& Trees, const int& cnt_uniq_trees) {
vector<int> unique(cnt_uniq_trees + 1);
int cnt_of_uniq = 0;
int best_l = 1, best_r = Trees.size();
for (int l = ... |
#include "pch.h"
#include "StateMachine.h"
#include "GameObject.h"
#include "GameObjectData/GameObjectData.h"
StateMachine::StateMachine()
:OnStateChangeEvent(std::make_unique<StateChangeEvent>())
{
}
void StateMachine::Start(GameObject* aOwner)
{
m_owner = aOwner;
m_data = m_owner->GetData();
} |
#include "precompiled.h"
#include "script/script.h"
#include "script/jsscript.h"
#include "vfs/vfs.h"
#include "vfs/file.h"
#pragma warning( disable : 4311 4312 )
REGISTER_STARTUP_FUNCTION(jsscript, jsscript::init, 10);
namespace jsscript
{
JSBool jsexecfile(JSContext *cx, uintN argc, jsval *vp);
JSBool jsdumpobje... |
//
// YouMeVoiceEngineImp.hpp
// TalkCppSample
//
// Created by 杜红 on 2017/3/21.
//
//
#ifndef YouMeVoiceEngineImp_hpp
#define YouMeVoiceEngineImp_hpp
#include <stdio.h>
#include "IYouMeEventCallback.h"
#define YouMe_Log( ... )
//printf("_______________YouMe:");printf( __VA_ARGS__ );printf("\n");
class YouMeVoi... |
#include <iostream>
#include <string>
int main()
{
char skizb[4];
char verj[4];
int zngaluQanak = 0;
std::cout << "mutqagreq skzbi jam:rope - verji Jam:rope" << std::endl;
std::cin >> skizb;
std::cin >> verj;
int skzbiJam = ((int)skizb[0] - (int)'0') * 10 + (int)skizb[1]-(int)'0';
int verjiJam = ((int)verj[... |
#include <bits/stdc++.h>
using namespace std;
#define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0)
#define MAXN 1000
#define INF 0x3F3F3F3F
int table[MAXN+5][MAXN+5];
string str;
int DP(int i, int j){
if( !(i<j) )
return table[i][j] = 0;
if( table[i][j] != INF )
return table[i][j];
if( str[i] == s... |
#pragma once
class ThirdPersonCameraComponent : public hg::IComponent
{
public:
ThirdPersonCameraComponent();
void LoadFromXML(tinyxml2::XMLElement * data);
virtual int GetTypeID() const { return s_TypeID; }
void Init();
void Update();
void AttachTo(hg::Entity* target);
virtual hg::IComponent* MakeCopyDerived... |
#include<iostream>
#include<cstdlib>
using namespace std;
class Stack
{
struct node
{
int data;
node* link;
}*top;
public:
Stack();
void push(int);
void pop();
void display();
};
Stack::Stack()
{
top = NULL;
}
void Stack::p... |
//
// graph.cpp
// A_STAR
//
// Created by Reb and Santi
// Copyright 2018 Smols. All rights reserved.
//
#include "Graph.hpp"
#include "Node.hpp"
#include <map>
#include <vector>
#include <string>
#include <iostream>
std::ostream &operator<<(std::ostream &os, const Graph &g) {
os << "This graph has nodes:" << std:... |
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int a[1000100];
bool rec[1000100];
/*
int big(int l,int r,int k)
{
while (l < r)
{
int mid =... |
#ifndef _PAYLOAD_H_
#define _PAYLOAD_H_
#include <boost/shared_ptr.hpp>
class Payload;
typedef boost::shared_ptr<Payload> PayloadPtr;
class Payload {
public:
Payload();
~Payload();
void inject(const PayloadPtr& ref);
private:
PayloadPtr reference;
};
#endif // _PAYLOAD_H_
|
#ifndef __STDAFX_HPP_INCLUDED__
#define __STDAFX_HPP_INCLUDED__
#include "config.hpp"
#if defined(CURSES_HAS_PRAGMA_ONCE) && !defined(CURSES_GCC_VERSION)
#pragma once
#endif // CURSES_HAS_PRAGMA_ONCE
#include "geometry.hpp"
#include "sobject.hpp"
//#include "views.hpp"
#endif // __STDAFX_HPP_INCLUDED__
|
#include "analyzers.h"
//------------------------------------------------------------------------------
// Анализ на функцию
void FuncDeclAnalyzer::run(const MatchFinder::MatchResult &Result) {
ASTContext *context = Result.Context;
const FunctionDecl *FD = Result.Nodes.getNodeAs<FunctionDecl>("funcDecl");
... |
#include<thread>
#include<iostream>
#include <iomanip>
#include<chrono>
#include<ctime>
#include<vector>
using namespace std;
class Timer{
bool is_clear;
clock_t start_time, end_time;
public:
Timer(){
is_clear = false;
}
template<typename T>
void setAlarmClock(T func, tm *ptm){
// cout<<ptm<<endl;
is... |
#include <map>
#include <vector>
using namespace std;
class tower {
public:
Point loc;
vector<Point> direc;
vector<bullet*> fired;
bullet *b;
tower(int x, int y);
std::pair<bool, Point> targetScan(board* m);
void shoot(board* m);
};
tower::tower(int x, int y)
{
loc.x = x;
loc.y ... |
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
struct point{
int ed;
int son[3];
};
point trie[3000100];
int sum = 0;
string st;
void build()... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2010 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef BROWSER_MENU_HANDLER_H
#define BROWSER_MENU_HANDLER_H
#i... |
#include "stdafx.h"
#include "SMBIOS.h"
const char* LocateStringA (const char* str, UINT i)
{
static const char strNull[] = "Null String";
if (0 == i || 0 == *str) return strNull;
while (--i) {
str += strlen ((char*)str) + 1;
}
return str;
}
const wchar_t* LocateStringW (const char* str, UINT i)
{
static w... |
#include "Flags.hpp"
char * PIPE_FILENAME = "./fifo_adas";
int setupNamedPipe(int rights)
{
int fd;
if(rights == O_WRONLY)
mkfifo(PIPE_FILENAME, 0666);
//O_WRONLY - O_RDONLY
fd = open(PIPE_FILENAME, rights);
if(fd == -1)
{
char buffer[256];
char * message = strerror_r(errno, buffer, 256);
std::cout ... |
#ifndef COLUMN_H
#define COLUMN_H
#include <iostream>
#include <string>
#include <vector>
#include "elevator.hpp"
class Column {
//int _id;
int _numberOfFloors;
int _numberOfColumns;
int _callButtonFloor;
std::vector<int> _listOfCallButtonFloors;
std::vector<Elevator> _elevatorLi... |
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* C... |
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
} |
#include<iostream>
using namespace std;
int prime(int c)
{
int a,flag;
flag=0;
a=1;
while(a<=c)
{
if(c%a==0)
{
flag++;
}
a++;
}
if(flag==2)
{
return 1;
}
else
return 0;
}
int main()
{
int c,x;
c=1;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
... |
/*********************************************************\
* Copyright (c) 2012-2018 The Unrimp Team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including wit... |
#include "Login.h"
boost::property_tree::ptree Login::execute(std::shared_ptr<Controller> controller) {
return controller->loginUser(commandParams);
}
Login::Login(boost::property_tree::ptree ¶ms) : BaseCommand("Login") {
commandParams = params;
}
|
#include <iostream>
using namespace std;
//Cautare binara
int main()
{
int x,n,st,dr,m,i,v[10];
cout<<"n=";
cin>>n;
cout<<"x=";
cin>>x;
cout<<"Sirul va fi dat in ordine crescatoare!"<<endl;
for(i=0; i<n; i++)
{
cout<<"v["<<i<<"]=";
cin>>v[i];
}
st=0;
dr=n+1;
... |
/*
* Ball.h
*
* Created on: Oct 24, 2013
* Author: ilansh
*/
#ifndef BALL_H_
#define BALL_H_
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#else
#include <GL/gl.h>
#endif
#include <glm/glm.hpp>
#define MIN_COLOR 0.7
class Model;
struct Ball {
Ball(int xPos, int yPos, const Model* model);
void update()... |
#include "statement.h"
#include "visitor.h"
Statement::Statement() {}
Statement::~Statement() {}
Assignment_statement::Assignment_statement(std::string _id, Expression* _expr) : id(_id), expr(_expr) {
posx = NULL;
posy = NULL;
}
Assignment_statement::Assignment_statement(std::string _id, Expression* _posx, Ex... |
#include "f3lib/assets/model/Skeleton.h"
using namespace f3;
Skeleton::Skeleton()
{
}
Skeleton::~Skeleton()
{
}
void Skeleton::initBoneTransforms(std::vector<types::Matrix>& boneTransforms)
{
boneTransforms.resize(_bones.size());
for (unsigned int i = 0; i < boneTransforms.size(); ++i)
{... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <quic/logging/QLoggerTypes.h>
#include <quic/QuicException.h>
#include <quic/logging/QLoggerConstants.h>
namespace qui... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
*
* Copyright (C) 2011-2012 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef OPPLUGINLIBRARY_H__
#define OPP... |
#include "Multivector.h"
#include <set>
#include "MatlabEng.h"
#include <algorithm>
#include <iterator>
namespace alg {
class DelaunayVertex {
public:
DelaunayVertex() {}
DelaunayVertex(const Multivector<double> &pt) : m_pt(pt) {}
DelaunayVertex(const DelaunayVertex &V) : m_pt(V.m_pt), m_simplex(V.m_simplex)... |
/*
#include "timer.h"
#include <QtCore>
#include <QDebug>
timer::Timer(QObject *parent) : QObject(parent)
{
timer = new QTimer(this);
connect(timer.SIGNAL(timeout()).this,SLOT(slot()));
// How long the timer is (ms)
timer->start(1000);
}
void timer::slot()
{
qDebug() << "Timer executed";
}
*/
|
#include "image.h"
#include <QFileInfo>
#include <math.h>
namespace
{
/*std::vector<std::vector<float>> kernel = {{1./256, 4./256, 6./256, 4./256, 1./256},
{4./256, 16./256, 24./256, 16./256, 4./256},
{6... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//based on padovan sequence.
vector<ll> dp(1000000,0);
int main(){
ll d = 1000000007;
dp[2]=1;
dp[3]=1;
for(ll i=4;i<=1000000;i++){
dp[i] = (dp[i-2] + dp[i-3])%d;
}
ll t;
cin>>t;
while(t--){
ll n;
cin>>n;
cout<<dp[n]<<"\n";
}
... |
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
#include "advantech_pci1714/Ping_received.h"
int main(int argc, char **argv)
{
ros::init(argc, argv, "advantechDriver_node");
ros::NodeHandle n;
ros::Rate loop_rate(10);
while (ros::ok())
{
/**
* This is a message o... |
#include<bits/stdc++.h>
using namespace std;
#define PI 3.1415926535897932
void addMatrix (int arrayA[2][2], int arrayB[2][2]) {
int x=2;
int y=2;
for (int i=0;i<y;++i) {
for (int j=0;j<x;++j) {
arrayA[i][j]+=arrayB[i][j];
}
}
}
void printMatrix(int array[2][2]) {
for ... |
#pragma once
#include <iostream>
using namespace std;
class Employee
{
public:
Employee();
virtual void init() = 0;
virtual void calcSalary() = 0;
virtual void disInfo() = 0;
virtual void promote() = 0;
virtual ~Employee();
protected:
string _name;
int _num;
int _grade;
float _salary;
static int _startNum;
... |
#include <cppunit/extensions/HelperMacros.h>
#include <Poco/Exception.h>
#include "cppunit/BetterAssert.h"
#include "model/OpMode.h"
using namespace std;
using namespace Poco;
namespace BeeeOn {
class OpModeTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(OpModeTest);
CPPUNIT_TEST(testParse);
CPPUNIT_TES... |
//////////////////////////////////////////////////////////////////////
///Copyright (C) 2011-2012 Benjamin Quach
//
//This file is part of the "Lost Horizons" video game demo
//
//"Lost Horizons" is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published ... |
#include "TestCPU.h"
#include <iostream>
int main(int argc, char** argv)
{
using namespace test;
memoryInterface *mem = new RAMImpl(10);
cpu device(mem);
CPUtestbench tester(&device);
tester.storeReg(1, 654321);
tester.constructInstruction(SW, 0, 1, 0x108);
tester.run();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.