text stringlengths 8 6.88M |
|---|
#include "fibonacci.hpp"
#include <algorithm>
#include <vector>
long int fibonacci1(long int require) {
if (require == 1 || require == 2) {
return 1;
}
return require = fibonacci1(require - 1) + fibonacci1(require - 2);
}
long int fibonacci2(long int require) {
std::vector<long int> vec(requi... |
//
// Copyright (C) 2018 Ruslan Manaev (manavrion@yandex.com)
// This file is part of the Modern Expert System
//
#include "property.h"
using namespace mes_core;
using namespace nlohmann;
using namespace std;
const string kNameJson = "name";
const string kValuesJson = "values";
const string kNegationJson = "negation... |
#ifndef __TIMESERIES_WRAP_ADD_JFLIB_HPP__
#define __TIMESERIES_WRAP_ADD_JFLIB_HPP__
#include <jflib/python/pyconfig.hpp>
#include <jflib/timeseries/all.hpp>
namespace jflib { namespace python {
namespace {
template<class TS, class Tag>
struct MatrixConversion {
typedef boost::python::class_<TS> tsptyp... |
#include <stdio.h>
#include <stdint.h>
#include <netinet/in.h>
#include "sum.h"
void sum(uint32_t num1, uint32_t num2)
{
printf("%d(%#x) + %d(%#x) = %d(%#x)\n", htonl(num1), htonl(num1), htonl(num2), htonl(num2), htonl(num1)+htonl(num2), htonl(num1)+htonl(num2));
} |
/*
* @file hcomm.h
* @author Artur Gilmutdinov <arturg000@gmail.com>
* @brief Contains distributed system's client hcomm_t.
*/
#pragma once
#include "common.h"
#include "hcomms.h"
#include "../../../hlogger/hlogger.h"
using namespace std;
inline void red(char *t, int l)
{
for (int i = 0; i<l; i++) t[i] = ' ';
}
... |
//
// SkillNode.h
// Boids
//
// Created by Yanjie Chen on 3/18/15.
//
//
#ifndef __Boids__SkillNode__
#define __Boids__SkillNode__
#include "cocos2d.h"
class UnitNode;
class SkillNode : public cocos2d::Ref {
protected:
bool _should_recycle;
UnitNode* _owner;
bool _could_interupt;
public:
... |
#include <iostream>
using namespace std;
int main()
{
char ch;
int a, b;
while (cin >> a >> ch >> b) {
while (a != 1) { //最终要达到的目标是分解式中所有分数的分子都为1,
//若不是则需要进行处理,故分子是否为1作为循环条件。
//不要改为b%a,否则虽然原理对但是分解式不是测试用例给出的那个分解结果
... |
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
vector<int> iv(10);
for (int i = 0; i < 10; ++i) {
cout << iv.at(i) << endl;
}
fill(iv.begin(), iv.begin() + iv.size() / 2, 10);
cout << '\n';
for (int i = 0; i < 10; ++i) {
cout << iv.at(i) << endl;
}
... |
#include "gtest/gtest.h"
#include "test/helpers.h"
#include "util/util.h"
using namespace std;
using namespace inexor::util;
// testing split_find_last
namespace {
typedef const char* cstr;
template<typename T>
void ttype(cstr s, T sep, cstr exp) {
string a = split_find_last<T>(string(s), sep),
... |
#include<eosiolib/eosio.hpp>
#include<eosiolib/print.hpp>
using namespace eosio;
class student1 : public eosio::contract
{
public:
using contract::contract;
/// @abi table student i64
struct student
{
uint64_t sid;
account_name sname;
uint64_t tam;
uint64_t eng;
uint64_t mat;
uint64_t sci;
uint64_t ss;
... |
// - RECTANGLE.CPP -
//
// Implementation of class "CRectangle" - which defines the geometric concept
// "Rectangle".
//
// Author: Zhang Lei
// Date: 2015. 4. 11
//
#include "stdafx.h"
#include <math.h>
#include "Tools.h"
#include "Geometry.h"
#include "ScrnRef.h"
/////////////////... |
//============================================================================
// Name : Classe.cpp
// Author : Alexis
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#incl... |
#include "Spool.h"
#include "SpoolCharacter.h"
#include "Components/TextRenderComponent.h"
#include "UnrealNetwork.h"
#include "SpoolGameMode.h"
#include "NeuralManager.h" // test
#define AnalogMouseDistance 200
ASpoolCharacter::ASpoolCharacter(const FObjectInitializer & ObjectInitializer)
: Super(ObjectInitializer... |
void job()
{
Res* r1 = acquisisci_risorsa("res1");
Res* r2 = acquisisci_risorsa("res2");
do_task(r1,r2);
rilascia_risorsa(r2);
Res* r3 = acquisisci_risorsa("res3");
do_task(r1,r3);
rilascia_risorsa(r3);
rilascia_risorsa(r1);
}
1)
void job()
{
Res* r1 = acquis... |
/*
* Copyright (c) 2009-2012 André Tupinambá (andrelrt@gmail.com)
*
* 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 without limitation the rights
* to use... |
#include "workerbase.h"
WorkerBase::WorkerBase(QObject* parent) : QObject(parent) {}
void WorkerBase::stop() {
stopped = true;
}
void WorkerBase::start() {
stopped = false;
run();
}
|
#ifndef OGLWIDGET_H
#define OGLWIDGET_H
#include <QWidget>
#include <QOpenGLWidget>
#include <mutex>
#include "opencv2/core/types_c.h"
class OGLWidget : public QOpenGLWidget
{
Q_OBJECT
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMou... |
//
// intersect.cpp
// TextRetrieval
//
// Created by Joseph Canero on 11/15/15.
// Copyright © 2015 jcanero. All rights reserved.
//
#include "intersect.h"
vector<vector<string>> Intersect::get_intersection(const Query& q,
const DocumentCollection& dc) {
vec... |
#ifndef __TIMESERIES_EXPRESSIONS_ALL_HPP__
#define __TIMESERIES_EXPRESSIONS_ALL_HPP__
#include <jflib/timeseries/expressions/inner_prod.hpp>
#endif // __TIMESERIES_EXPRESSIONS_ALL_HPP__
|
#ifndef _TYPE_ID_H_
#define _TYPE_ID_H_
#include <iostream>
//只有当typeid的操作数是带虚函数的类类型的对象的时候,才返回动态类型信息。
//测试指针返回指针的静态的编译时的类型
//只有Base含有虚函数是,typeid才会有动态信息.
class BaseClass
{
//virtual void f(){}
};
class DerivedClass : public BaseClass
{
//如果仅仅是子类中有虚函数是不行的。typeid不会改变
//virtual void f(){}
};
void ExampleTypeid()
{
i... |
#pragma once
// FibMFCPropPage.h : Declaration of the CFibMFCPropPage property page class.
// CFibMFCPropPage : See FibMFCPropPage.cpp for implementation.
class CFibMFCPropPage : public COlePropertyPage
{
DECLARE_DYNCREATE(CFibMFCPropPage)
DECLARE_OLECREATE_EX(CFibMFCPropPage)
// Constructor
public:
CFibMFCProp... |
#ifndef VECTOR4_H
#define VECTOR4_H
#include "vector3.h"
struct Vector4: public Vector4Base
{
public:
Vector4(void);
Vector4(float x, float y, float z, float w);
Vector4(int x, int y, int z, int w);
Vector4(const Vector4& v);
explicit Vector4( const Vector4Base & v );
Vector4( const Vector3 & v, float w );
#ifd... |
#include "PipelineObject.h"
#include "qlist.h"
#include "qmutex.h"
QList<PipelineObject*> g_ani_objList;
QMutex g_aniThread_mutex;
bool flag_render;
QString openDir;
QString openDisDir; |
#include "Entity.hpp"
void Entity::updateCurrent( sf::Time dt, sf::View& view )
{
move( m_velocity * dt.asSeconds() );
} |
// MainWindow.h: Defines main window for this application.
#pragma once
#include "stdafx.h"
#include "resource.h"
#include "GetURLDialog.h"
#define HOME_PAGE L"http://localhost:8080/"
#define LOADING_PAGE L"file:///%s/loading.html"
static const UINT ID_BROWSER = 1;
class CMainWindow :
public CWindowImpl<C... |
int inByte = 0; // incoming serial byte
void setup()
{
// start serial port at 9600 bps:
Serial.begin(9600);
pinMode(13, OUTPUT);
turnLEDon(1000);
}
void loop()
{
// if we get a valid byte, turn LED on:
if (Serial.available() > 0) {
turnLEDon(1000);
//get all incoming by... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "../base.h"
#include "Windows.ApplicationModel.UserDataAccounts.SystemAccess.0.h"
#include "Windows.Foundation.0.h"
#include "Windows.Security.Credentials.0.h"
#include "Windows.Founda... |
//
// Created by Will Smith on 3/15/18.
//
#include <iostream>
#include "ShoppingCart.h"
ShoppingCart::ShoppingCart(): customerName("none"),currentDate("January 1, 2016") {}
ShoppingCart::ShoppingCart(const string &customerName, const string ¤tDate) : customerName(customerName),
... |
/* ===============================================
Name: list_test.cpp
Code: Kira Corbett
Date: 5/02/2017
Desc: reads and processes strings from a file
using the list class.
=============================================== */
//preprocessor directives
#include <iostream>
#include <fstream>
#include <string>
//header f... |
/**
* @file multi_tables.cpp
* @author your name (you@domain.com)
* @brief Display multiplication based on user input
* @version 0.1
* @date 2019-12-16
*
* @copyright Copyright (c) 2019
*
*/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
const int kMax = 10;
int main()
{
... |
#include <IceE/IceE.h>
#include "Ultrasound.h"
#include <iostream>
#include <unistd.h>
using namespace std;
using namespace RoboCompUltrasound;
class UltrasoundI : public Ultrasound {
public:
UltrasoundI(){};
virtual ~UltrasoundI(){};
virtual BusParams getBusParams(const Ice::Current&);
virtual SensorPar... |
#include "SerialPort.h"
Serial::Serial(const char *portName) {
// Not connected by default
this->connected = false;
// Attempt to connect to the given port by calling CreateFile
this->hSerial = CreateFile(portName,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
/... |
#define BOOST_TEST_MODULE names
#include <boost/test/included/unit_test.hpp>
#include <seqan/python/names.h>
#include <seqan/index.h>
using namespace seqan;
using seqan::python::name;
typedef String< Dna5 > string_t;
typedef StringSet< string_t > string_set_t;
typedef Index< string_set_t > index_t;
BOOST_AUTO_TEST_... |
/*************************************************************
* > File Name : c1088_2.cpp
* > Author : Tony
* > Created Time : 2019/11/10 16:00:41
* > Algorithm :
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
typedef ... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void ipop(){
#ifndef ONLINE_JUDGE
freopen("../input.txt","r",stdin);
freopen("../op.txt","w",stdout);
#endif
}
void solve(){
ll n;cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++) cin>>a[i];
vector<ll>dp(n,0);
for(ll i=1;i<n;i++){
ll x=INT_M... |
// *****************************************************************
// This file is part of the CYBERMED Libraries
//
// Copyright (C) 2012 LabTEVE (http://www.de.ufpb.br/~labteve),
// Federal University of Paraiba.
// All rights reserved.
//
// This program is free software; you can redistribute it and/or
// modify i... |
#include "countdown.h"
Countdown::Countdown(QDateTime final)
{
isCounting = true;
this->final = final;
}
void Countdown::Display()
{
QDateTime countdown = QDateTime::currentDateTime();
while(isCounting)
{
QString formatted = getCountdown(countdown);
QTextStream qtOut(stdout);
... |
class Objets{
public:
Objets() = default;
Objets(sf::Texture* texture) : texture_(texture) {}
void setTexture(sf::Texture* const& adressTextu){
texture_=adressTextu;
}
int findIndice(int y) const {
size_t i, taille;
for(i=0, taille = y_.size(); i<taille; ++i){
if(y < y_[i]) return i;
}
... |
#ifndef FASTCG_MATERIAL_DEFINITION_H
#define FASTCG_MATERIAL_DEFINITION_H
#include <FastCG/Graphics/GraphicsSystem.h>
#include <FastCG/Graphics/GraphicsContextState.h>
#include <FastCG/Graphics/ConstantBuffer.h>
#include <vector>
#include <unordered_map>
#include <cassert>
namespace FastCG
{
struct MaterialDefin... |
/*************************************************************
Author : qmeng
MailTo : qmeng1128@163.com
QQ : 1163306125
Blog : http://blog.csdn.net/Mq_Go/
Create : 2018-03-19 19:01:25
Version: 1.0
**************************************************************/
#include <cstdio>
#include <iostream>
using namespa... |
//
// Created by twome on 09/05/2020.
//
#ifndef GAMEOFLIFE_OPENGL_GRAPHICS_H
#define GAMEOFLIFE_OPENGL_GRAPHICS_H
#include "../gl/MeshBuilder.h"
#include "font/FontRenderer.h"
#include "../gl/Vao.h"
#include "../render/shaders/BasicShader.h"
#include "../render/shaders/TexturedShader.h"
enum class GraphicsMode {
... |
#include <bits/stdc++.h>
using namespace std;
int waterHoldingCapacity(vector<int> bricks)
{
int n = bricks.size(), ans = 0;
if (n < 2)
return 0;
for (size_t i = 1; i < n; i++)
if (bricks[i] > bricks[i - 1])
ans += bricks[i] - bricks[i - 1];
return ans;
}
int main()
{
c... |
#ifndef THBDDGEN_H
#define THBDDGEN_H
/// @file ThBddGen.h
/// @brief ThBddGen のヘッダファイル
/// @author Yusuke Matsunaga (松永 裕介)
///
/// Copyright (C) 2005-2011 Yusuke Matsunaga
/// All rights reserved.
#include "YmLogic/BddMgr.h"
#include "YmLogic/Bdd.h"
#include "Weight.h"
#include "ItvlList.h"
BEGIN_NAMESPACE_YM
... |
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include <ras_msgs/RAS_Evidence.h>
#include <sensor_msgs/Image.h>
#include <geometry_msgs/TransformStamped.h>
#include <geometry_msgs/Pose.h>
#include <image_transport/image_transport.h>
#include... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
int f[1001];
memset(f, -1, sizeof(f));
vector<bool>isprime(1001, true);
for(int i = 2; i <= 1001; i++){
if(isprime[i]){
for(int j = i * i; j <= 1001; j += i){
if(f[j] == -1){
... |
//
// celestialBody.cpp
// solarsystem
//
// Created by Pelayo M. on 26/04/13.
//
//
#include "celestialBody.h"
void celestialBody::setup(float _size, float _orbitRadius, float _speed, string _name) {
size = _size;
name = _name;
orbitRadius = _orbitRadius;
speed = _speed;
longitude =... |
#include "stdafx.h"
#include "vector_expression_ext.hpp"
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
void testVectorUnaryReturningVector () {
using namespace boost::numeric::ublas;
vector<double> v(10);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = (i+1);
std::cout << ab... |
#include "net/TcpServer.h"
int main()
{
TcpServer::getInstance()->Start(8888);
}
|
/*
* Software fo the Snap|Click|Track SD module rev 1
* Software version 1; Created 7 September 2018
*
* This code is made for one way data transfer to SD card
*
* Usage instructions to interface with other modules:
* - Once the module is turnt on it waits for a string of data on sent to SerialSoftware(3,2)
*... |
#include <cstdio>
#include <cmath>
// 简单 进制转换
// input: 10 2 10 10 0 0
void to2(int n);
void to10(int n);
int main() {
int n, m;
while(scanf("%d %d", &n, &m) != EOF) {
if(n == 0 && m == 0)
break;
if(m == 2) { // 10->2
to10(n);
} else { // 2->10
to2(n);
}
printf("\n"); ... |
/* NO WARRANTY
*
* BECAUSE THE PROGRAM IS IN THE PUBLIC DOMAIN, THERE IS NO
* WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
* LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE AUTHORS
* AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
* WARRANTY OF ANY KIND, EITHER E... |
/*
* Copyright (C) 2015 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... |
#include <iostream>
#include <fstream>
#include <sstream>
#include <Eigen/Dense>
#include <H5Cpp.h>
#include <H5Group.h>
#include "general.hpp"
#include "kpm_vector.hpp"
#include "aux.hpp"
#include "ComplexTraits.hpp"
#include "myHDF5.hpp"
#include "messages.hpp"
void print_dos(parameters P, unsigned N_lists, unsign... |
//
// CST 126 - Assignment 1
//
// Author: Leander Rodriguez
//
// File: main.cpp
//
// Sample program to illustrate the usage of the consoleGraphics.h
// character graphics constants.
//
#include <iostream>
#include "consoleGraphics.h"
#define LENGTH 10
#define HEIGHT 3
using namespace std;
//
// Main p... |
#include<iostream>
using namespace std;
class subject
{
private:
float sub1,sub2,sub3,sub4,sub5;
public:
float res;
float cgpa;
subject(float a=0,float b=0,float c=0,float d=0,float e=0)
{
sub1=a;
sub2=b;
sub3=c;
sub4=d;
sub5=e;
}
v... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.in","r",stdin);
freopen("output.in","w",stdout);
#endif
int t;
cin>>t;
while(t--)
{
}
} |
vector<int> Solution::findPerm(const string A, int B) {
int n = A.size();
int num_I =0,num_D =0;
for(int i=0;i<n;i++)
{
if(A[i] == 'I')
{
num_I++;
}
else
{
num_D++;
}
}
vector<int> toreturn;
int ind_I,ind_D;
if(A[0] ... |
int sum(const int size, const int iarr[]) {
arrLen = size;
sum += iarr + arrLen;
if (arrLen >= 0) {
arrLen--;
return sum(arrLen, iarr[]);
} else {
return sum;
}
}
|
#include "il_rewriter_wrapper.h"
#include <vector>
ILRewriter* ILRewriterWrapper::GetILRewriter() const { return m_ILRewriter; }
void ILRewriterWrapper::SetILPosition(ILInstr* pILInstr) {
m_ILInstr = pILInstr;
}
void ILRewriterWrapper::Pop() const {
ILInstr* pNewInstr = m_ILRewriter->NewILInstr();
pNewInstr->m... |
#ifndef OBJECT_H
#define OBJECT_H
#include <string>
#include <sstream>
#include <utils/utils_io.h>
#include <names.h>
namespace lab3
{
class Object
{
public:
Object(const std::string &name,
const std::string &description,
int price,
int volume,
int weight);
virtua... |
#include "Nav6CalibrationBehavior.h"
Nav6CalibrationBehavior :: Nav6CalibrationBehavior ( MecanumMagDirOrientationOffset * Offset, double StartingOffset ):
Offset ( Offset ),
StartingOffset ( StartingOffset )
{
};
Nav6CalibrationBehavior :: ~Nav6CalibrationBehavior ()
{
};
void Nav6CalibrationBehavior :: Init ( B... |
#include "graphicrender.h"
int netTreePainter(QGraphicsScene *&scene, Node *node, int w, int h, int wDelta, int hDelta, QPen &pen, QBrush &brush, QFont &font, int depth, int color_c)
{
if (node == nullptr)
return 0;
QString out;
out += node->info;
QColor color,color_n;
color_n.setRgb(201, ... |
// $Id: SemanticProcessor.h,v 1.15 2013/02/10 19:18:23 david Exp $ -*- c++ -*-
#ifndef __CDK8_SEMANTICS_PROCESSOR_H__
#define __CDK8_SEMANTICS_PROCESSOR_H__
#include <iostream>
namespace cdk {
namespace node {
class Composite;
class Sequence;
class Data;
class Nil;
namespace expression {
... |
#include "lisp.h"
#include <iostream>
#include <cstdlib>
#include <fstream>
using namespace std;
namespace h_list {
lisp head(const lisp s) {
if (s != NULL)
if (!isAtom(s))
return s->node.pair.hd;
else { cerr << "Error: Head(atom) \n"; exit(1); }
else {
cerr << "Error: Head(nil) \n";
... |
#ifndef PATHTABLE_H
#define PATHTABLE_H
#include <vector>
#include <SFML/System/Vector2.hpp>
enum PathType
{
HorizontalShortBackAndForth,
TypeCount
};
struct PathSegment
{
sf::Vector2f vector;
unsigned int duration;
unsigned int totalDuration;
};
struct Path
{
std::vector<PathSegment> path;... |
// 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.Foundation.3.h"
#include "internal/Windows.Graphics.Printing.3.h"
#include "internal/Windows.UI.Xaml.3.h"
#include "internal/Win... |
#include <iostream>
#include "OptimisedMinimum.h"
using namespace std;
int main() {
double a, b, eps;
cout << "Define the segment by inputing 2 positive numbers a and b (a <= b):" << endl;
cin >> a >> b;
cout << "Input Epsilon:" << endl;
cin >> eps;
OptimisedMinimum myConstrait(a, b, eps);
... |
#pragma once
#include <boost/asio.hpp>
#include <deque>
#include "Graphics\DrawData.h"
#include "Graphics\UpdateData.h"
#include "Graphics\Camera.h"
#include "Graphics\Camera_Original.h"
#include "Game\Model.h"
#include "GameObjects.h"
#include "util\Protos.pb.h"
#include "util\Util.h"
#include <mutex>
#include "So... |
// 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.Foundation.3.h"
#include "internal/Windows.Storage.3.h"
#include "internal/Windows.Storage.Streams.3.h"
#include "Windows.Storag... |
/*
* Person.cpp
*
* Created on: Aug 25, 2016
* Author: Istvan
*/
#include "Person.h"
Person::Person(){
firstName = "N/A";
lastName = "N/A";
}
Person::Person(string fn, string ln){
firstName = fn;
lastName = ln;
}
Person::Person(string s){
/*Last name converter
* Finds the last word of a full na... |
#include<iostream>
using namespace std;
// 引用的本质,在c++内部实现是一个指针常量
//引用的本质是指针常量,但是所有的指针操作由编译器做了,所以推荐使用
void func()
{
}
int main()
{
int a = 10;
int &ref = a;
//系统自动转化为
// int * const ref = & a;
// 指针常量是指针指向不可改,所以引用不可改
ref = 20;
//系统发现是引用,自动转为 * ref = 20;
//例如
int aa = 100;
... |
#pragma once
#include "System.h"
class CExponentialSmooth
{
public:
CExponentialSmooth(){_smooth_ampl = 1.; _data = 0;};
void init( float ampl , float init_data = 0){_smooth_ampl = ampl; _data = init_data;};
CExponentialSmooth( float ampl , float init_data = 0){init(ampl, init_data);};
void reset(float data) ... |
#include <common/future_utils.h>
#include <exception>
#include <gtest/gtest.h>
#include <string>
using namespace dwiz;
// isReady() tests:
TEST(isReadyTest, InvalidIntFutureIsNotReady)
{
std::future<int> future;
ASSERT_FALSE(future.valid());
EXPECT_FALSE(isReady(future));
}
TEST(isReadyTest, InvalidStri... |
/*
* initQP.cpp
*
* Created on: Jul 8, 2015
* Author: shapa
*/
#include "initQP.h"
#include "myEvents.h"
#include "BoardSupportPackage.h"
#include "DebugTracer.h"
namespace QP {
extern "C" void Q_onAssert(char_t const Q_ROM * const file, int_t line);
static void init_QP_Pools();
void initializeFramework... |
#include <iostream>
#include <sstream>
#include <vector>
#include <limits>
#include <algorithm>
template<class T, typename Comparator>
class PriorityQueue {
public:
PriorityQueue():m_Container()
{
make_heap(m_Container.begin(), m_Container.end(), Comparator());
}
void Push(T el)
{
m... |
//
// main.cpp
// energyUsage (based on c++Postgres)
//
// Created by Clifford Campo on 4/24/18.
// Copyright © 2018 CliffordCampo. All rights reserved.
//
#include <AvailabilityMacros.h>
#include <iostream>
#include <thread>
#include "/usr/local/pgsql/pgsql101/include/libpq-fe.h"
#include <cstring>
#include <sstr... |
//
// Created by Alexey A. Ponomarev on 05.03.19.
//
#include "string.h"
StringBuilder& StringBuilder::operator<<(int obj) {
buffer_ += std::to_string(obj);
return *this;
}
StringBuilder& StringBuilder::operator<<(std::string obj) {
buffer_ += obj;
return *this;
}
std::string StringBuilder::Get() co... |
/*
Copyright (c) 2005-2023, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms... |
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.ApplicationModel.Core.2.h"
WINRT_EXPORT namespace winrt {
namespace Windows::ApplicationModel::Core {
struct WINRT_EBO AppListEntry :
Windows::ApplicationModel::Core::I... |
#include "window.h"
#ifndef __EMSCRIPTEN__
#include <glbinding/gl/gl.h>
#include <glbinding/Binding.h>
using namespace gl;
#endif
#include "utils.h"
#include "viewport.h"
std::map<GLFWwindow*, GLPlay::Window*> GLPlay::Window::window_map_;
extern "C" {
void WindowResizeCallback(GLFWwindow *glfw_window, int width, i... |
#include<bits/stdc++.h>
using namespace std;
vector<int>parent(100,-1);
int find(int a)
{
if(parent[a]<0)
return a;
int x=find(parent[a]);
parent[a]=x;
return x;
}
void union1(int a,int b)
{
parent[b]=a;
}
int main()
{
int n,m,a,b;
cin>>n>>m;
parent.resize(n+1);
for(int i... |
/**
*
* @file Robot.cpp
* @author Naoki Takahashi
*
**/
#include "Robot.hpp"
namespace IO {
Robot::Robot() {
}
Robot::Robot(RobotStatus::InformationPtr &robot_status_information_ptr) {
robo_info = robot_status_information_ptr;
}
Robot::Robot(const int &argc, char **argv) {
robo_info = std::make_... |
#include <compressor/bitset/bitset_iterator.h>
#include <compressor/bitset/bitset.h>
namespace compressor
{
bitset_iterator::bitset_iterator(const bitset& vector, const std::size_t index)
{
this->internal_bitset = &vector;
this->internal_bit_index = index;
}
// Dereferencable.
bool bitset_iterator::operator*... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int deg, dis, W;
cin >> deg >> dis;
string dir;
if (deg >= 112.5 && deg < 337.5) {
dir = "NNE";
} else if (deg >= 337.5 && deg < 562.5) {
dir = "NE";
} else if (deg >= 562.5 && deg < 787.5) {
dir = "ENE";
} else if (deg >= 787.5 && de... |
//ウィンドウ表示&DirectX初期化
#include<Windows.h>
#include<tchar.h>
#include<d3d12.h>
#include<dxgi1_6.h>
#include<vector>
#ifdef _DEBUG
#include<iostream>
#endif
#pragma comment(lib,"d3d12.lib")
#pragma comment(lib,"dxgi.lib")
///@brief コンソール画面にフォーマット付き文字列を表示
///@param format フォーマット(%dとか%fとかの)
///@param 可変長引数
///@remarksこの関... |
// This file is subject to the terms and conditions defined in 'LICENSE' in the source code package
#include <gtest/gtest.h>
#include "core/filesystem.h"
namespace jactorio
{
class FileSystemTest : public testing::Test
{
std::string originalExecutingDir_;
};
TEST_F(FileSystemTest, ReadFileSt... |
#ifndef DB_COLUMNSTORAGE_H
#define DB_COLUMNSTORAGE_H
#include "DbColumnDataType.h"
class DbColumnDataSource;
class DbColumnStorage {
cpp11::sexp data;
int i;
DATA_TYPE dt;
const int n_max;
const DbColumnDataSource& source;
public:
DbColumnStorage(DATA_TYPE dt_, const R_xlen_t capacity_, const int n_m... |
#include "common.h"
#include "Timecode.h"
namespace CMI
{
Timecode::Timecode() :
_pos(0),
_fps(0),
_dropFrame(false)
{
}
Timecode::Timecode(UInt16 hours,
UInt16 minutes,
UInt16 seconds,
UInt16 frames,
UInt16 roundedBase,
... |
/*************************************************************************
> File Name: time_main.cpp
> Author: Jason
> Mail: jie-email@jie-trancender.org
> Created Time: 2017年03月29日 星期三 13时42分55秒
************************************************************************/
#include "time.h"
#include <muduo/base/Logg... |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
//公众号:一航代码
int main()
{
string s;
getline(cin,s);
int count = 0;
for (int i = 0; i < (int)s.size(); i++) {
if (s[i] == 'a') {
count++;
}
}
cout << count... |
////////////////////////////////////////////////////////////////////////////////
//
// 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 <algorithm>
#include <cmath>
#include <iostream>
#include <thread>
#include <vector>
#include <random>
using namespace std;
class MonteCarloSimThread {
private:
std::random_device rd;
std::mt19937 gen{rd()};
std::normal_distribution<double> distribution{0.0, 1.0};
double gaussian_rnd() {
... |
#include <set>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
// recursive + cache
// class Solution
// {
// public:
// int numSquares(int n)
// {
// int i = 1, now = 1;
// while (now <= n)
// {
// squares.insert(now);
// i... |
//---------------------------------------------------------------------------
#include <vcl.h>
#include "MainForm.h"
#pragma hdrstop
#include "RegHelper.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// constructor
__fastcall TRegHelper::TRegHelper(bool b... |
#ifndef GRAPH_H
#define GRAPH_H
#include <set>
#include <vector>
#include <memory>
struct Vertex
{
Vertex(int num):num(num){}
int num;
std::set<std::shared_ptr<Vertex>> adjacents;
};
class Graph
{
public:
Graph();
void addEdge(int vertex, int adjacentVertex);
void BFS(int startNum);
int numVertices() const;
pr... |
#include<bits/stdc++.h>
using namespace std;
long long getccode(long long cen)
{
if(cen%4==1) return 4;
else if(cen%4==2) return 2;
else if(cen%4==3) return 0;
return 6;
}
bool getleapyear(long long year)
{
if(year%400==0) return 1;
if(year%100==0) return 0;
if(year%4==0) return 1;
return 0;
}
int main()
{... |
/* ============================================================================
* Tywyl Engine
* Platform: Windows
* WWW:
* ----------------------------------------------------------------------------
* Copyright 2015 Tomas Mikalauskas. All rights reserved.
*
* Redistribution and use in source and binary forms, wi... |
#ifndef USERMAINWINDOW_H
#define USERMAINWINDOW_H
#include "linqedinclient.h"
#include <QWidget>
namespace Ui {
class UserMainWindow;
}
class UserMainWindow : public QWidget
{
Q_OBJECT
public:
explicit UserMainWindow(LinQedInClient*, QWidget *parent = 0);
~UserMainWindow();
private slots:
void on_f... |
#include "competitive.h"
/*
* Articulation points and bridges in an UNDIRECTED graph.
* Time complexity of O(V+E), since it uses a modified DFS.
*/
USESTD;
map<int, VPII> adjList;
VI dfs_num, dfs_low, dfs_parent, articulation_vertex;
int UNVISITED = 1000000000;
void articulationPointAndBridge(map<int, VPII>& adjLi... |
// File: ola3.cc
// Due Date: March 15, 2016
// Author: David Ludwig
// Description: From a file called 'scores.txt', find the students with the lowest and highest scores, and calculate the average of all of the students
// Course: CSCI 2170 - 004
// Input: Data file of students and scores: "scores.txt"
// Output: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.