text stringlengths 8 6.88M |
|---|
/*
*
* Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* KF acknowledges the support of the Faculty of Civil Engineering,
* Uni... |
#include <iostream>
#include "matrix.h"
using namespace std;
template <class T>
Matrix<T>::Matrix(){
this->matrix = NULL;
rows=0;
cols = 0;
}
template <class T>
Matrix<T>::Matrix(int rows, int cols){
// rol cols constructor called
matrix = new T* [rows];
for(int i=0; i< rows; i++) matrix[i] = new T[cols];
... |
#pragma once
#include "SFML/Graphics.hpp"
namespace RTB
{
class TileMap : public sf::Drawable, public sf::Transformable
{
};
} |
#include "valid_test_sub.h"
#include "my_utils.h"
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
double apk(unordered_set<unsigned long> &actual, vector<unsigned long> &predicted, const int k){
int num_pred = predicted.size();
num_pred = num_pred < k ? num_pre... |
#include <iostream>
#include <deque>
using namespace std;
deque <int> Cycle;
void findHamiltonianCycle (bool ** A, int B) {
for (int k = 0; k < B * (B - 1); k++) {
if (A[Cycle.at (0)][Cycle.at (1)] == 0) {
int i = 2;
while (A[Cycle.at (0)][Cycle.at (i)] == 0 || A[Cycle.at (1)][Cycle.at (i + 1)] == 0) i... |
#include <gtest/gtest.h>
#include <whiskey/Unicode/FileByteOutStream.hpp>
using namespace whiskey;
TEST(Unicode_Unit_FileByteOutStream, Unopened) {
const char *path = "thisIsAFileNameThatProbablyDoesntExist.txt";
FileByteOutStream bs(path);
ASSERT_FALSE(bs.isOpen());
ASSERT_EQ(bs.getEncoding(), Encoding::... |
#include "COREVector.h"
using namespace CORE;
COREVector::COREVector() {
m_theta = 0;
m_r = 0;
}
COREVector::COREVector(const COREVector &other) {
m_r = other.m_r;
m_theta = other.m_theta;
}
COREVector::COREVector(double r, double theta) {
m_r = r;
m_theta = theta;
}
COREVector COREVector:... |
#pragma once
#include <memory>
#include "../rtti.hpp"
#include "DataObject.hpp"
namespace fantom
{
/**
* Vector of arbitrary data objects that can be added as a DataOutput.
*
* This class is a \c DataObject itself, but also stores a bundle of \c DataObject s
* that are of the same kind in mos... |
#include "PuzzleGenerator.h"
#include <iostream>
using namespace std;
//Constructor
PuzzleGenerator::PuzzleGenerator(int _nRows, int _nColumns, int _minVal, int _maxVal)
:nRows(_nRows), nColumns(_nColumns), minVal(_minVal), maxVal(_maxVal)
{
maxtime = 57.0; //set the max time value
}
/*Sample code, not used*/
/*Puzz... |
#ifndef THREADBEHAVIOR_H
#define THREADBEHAVIOR_H
#include <QThread>
class ThreadBehavior : public QThread
{
public:
ThreadBehavior();
virtual void run();
};
#endif // THREADBEHAVIOR_H
|
/**
REFERENCES:
BasicBot - The basic working bot.
Part of the Asimi project - http://sudarmuthu.com/arduino/asimi
Copyright 2011 Sudar Muthu (email : sudar@sudarmuthu.com)
**/
int E1 = 5; // Enable Pin for motor 1
int E2 = 4 // Enable Pin for motor 2
int I1 = 3 // Control pin 1 f... |
#include <iostream>
#include "dsl/interpreter.h"
#include "device_manager.h"
using namespace std;
using namespace dm;
int main(int argc, const char *argv[]) {
if (argc != 2) {
cout << "ERROR: supply only one DSL sourcecode file" << endl;
return -1;
}
cout << "starting Device Manager" << en... |
// Copyright (c) 2014-2019 winking324
//
#include "controller/agora_rtc_engine.h"
#include <QMessageBox>
#include "commons/definitions.h"
#include "model/video_renderer.h"
namespace avc {
class AgoraRtcEngineEvent : public agora::rtc::IRtcEngineEventHandler {
public:
AgoraRtcEngineEvent(AgoraRtcEngine *rtc_e... |
#ifndef __CLUCK2SESAME_PLATFORM_POWERMANAGEMENT_INC
#define __CLUCK2SESAME_PLATFORM_POWERMANAGEMENT_INC
radix decimal
extern initialisePowerManagement
extern pollPowerManagement
extern preventSleep
extern ensureFastClock
extern allowSlowClock
#endif
|
/**
MIT License
Copyright (c) 2019 mpomaranski at gmail
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, copy, modify... |
//**************************************************************************
//**
//** See jlquake.txt for copyright info.
//**
//** This program is free software; you can redistribute it and/or
//** modify it under the terms of the GNU General Public License
//** as published by the Free Software Foundation; either ... |
#include "stdafx.h"
#include "UXMLParser.h"
#include "BRenderer.h"
#include "BRenderingBatch.h"
#include "CWindowsViewport.h"
#include "CWindowsApplication.h"
#include "CDirectXDriver.h"
#include "CWaveIODriver.h"
#include "BViewport.h"
#include "RSKNImporter.h"
#include "UWorld.h"
BXMLParser::BXML... |
//mainึ
#include "DevAreaFlamework_ver.2.h"
int main(int argc, char *argv[]){
DevAreaFlamework daf;
daf.LoadParamater(argv[1]);
//daf.LoadParamater("step1.ini");
daf.Run();
return 0;
} |
#include "ThreadPool.h"
ThreadPool::ThreadPool(int min, int max) : finished_(false), min_(min), max_(max)
{
for (int i = 0; i < min_; i++) {
AddThread();
}
manageThread_ = std::thread([this]() {
while (!finished_) {
if ((taskQue_.GetSize() > 2 * threads_.size()) && (t... |
#include "scene.hpp"
Scene::Scene() :
cloud(MAP_WIDTH,CLOUD_COUNT)
{
//Background Initialize
textureBackground.setRepeated(true);
textureBackground.loadFromFile("images/background.png");
spriteBackground.setTexture(textureBackground);
//spriteBackground.setOrigin(textureBackground.getSize().x/2.... |
using namespace std;
extern datatable bufferuser;
extern int u;
int load(){
mkdir("D:\\My\\icode\\database\\database\\user");
if(bufferuser.load("user","user") == 0){
datatable user("user");
user.addrow("id","char","10");
user.addrow("password","char","10");
user.add... |
/*
* Copyright (c) 2012 Joey Yore
*
* 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, copy, modify, merge, publish, dist... |
#include <iostream>
using namespace std;
int task1();
int task2();
int task3();
int main()
{
setlocale(LC_ALL, "Russian");
task1();
return 0;
}
// Дано трехзначное число. Вывести вначале его последнюю цифру (единицы), а затем — его среднюю цифру (десятки).
int task1()
{
int number = 0;
cin >> number;
cout <... |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
typedef long long ll;
typedef vector<bool> vb;
typedef... |
// p293
// case1.
// case2.
// case3.
// case4. 뛰어넘기만
// n+mCn 에서.. 앞에 -일 경우 n+m-1Cn-1 / o일경우 n+m-1Cn..
// 재귀호출할 때마다 1씩 줄어드므로 O(n+m)
#include <iostream>
#include <string>
using namespace std;
const int M = 1000000000+100;
int bino[201][201];
int n, m;
int skip;
// nCm
void calcBino(){
memset(bino, 0, sizeof(bino));... |
/*
Given a NxN matrix with 0s and 1s. now whenever you encounter a 0 make the
corresponding row and column elements 0.
Flip 1 to 0 and 0 remains as they are.
*/
#include<iostream>
using namespace std;
void removezero(int arr[][5],int n)
{
int rowzero=0;
int columnzero=0;
for(int i=0;... |
// @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
#include <distant/types.hpp>
#include <distant/utility/meta/array.hpp>
#include <boost/assert.hpp>
namespace distant
{
template <class Scala... |
/***************************************************************************
Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
2010-2020 DADI ORISTAR TECHNOLOGY DEVELOPMENT(BEIJING)CO.,LTD
FileName: RTPSessionInterface.h
Description: Provides an API interface for objects to access t... |
#include "interface_selectors.h"
#include "asylo/platform/primitives/extent.h"
#include "asylo/platform/primitives/primitive_status.h"
#include "asylo/platform/primitives/trusted_primitives.h"
#include "asylo/util/status_macro.h"
extern void show_score(screen_t* screen);
extern void setup_level(screen_t* screen, snake... |
class Solution {
public:
multiset<int, less<int> > big;
multiset<int, greater<int> > small;
double add(int val)
{
if (small.empty())
{
small.insert(val);
return val;
}
else if (small.size() == big.size())
{
... |
/*
* GameObject.cpp
*
* Created on: 28 ÿíâ. 2015 ã.
* Author: azakharov
*/
#include "headers/GameObject.h"
GameObject::GameObject(float x, float y, float width, float height)
{
this->x = x;
this->y = y;
this->width = width;
this->height = height;
}
GameObject::GameObject(float width, float heig... |
#include "stdafx.h"
#include "Resource.h"
Resource::Resource()
{
}
Resource::~Resource()
{
}
|
#ifndef __CLUCK2SESAME_TESTS_PLATFORM_SHIFTREGISTER_INITIALISESHIFTREGISTERMOCK_INC
#define __CLUCK2SESAME_TESTS_PLATFORM_SHIFTREGISTER_INITIALISESHIFTREGISTERMOCK_INC
extern initialiseInitialiseShiftRegisterMock
extern calledInitialiseShiftRegister
#endif
|
#include <atomic>
#include <iostream>
#include <thread>
using namespace std;
//原子数据类型
atomic<long> total = {0}; //需要头文件 #include <atomic>
//点击函数
void func()
{
for (int i = 0; i < 1000000; ++i)
{
total += 1;
}
}
int main()
{
clock_t start = clock(); // 计时开始
//线程
thread t1(func);
... |
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <stack>
#include <cctype>
//#include <iomanip>
//#define LOCAL
#define Inf 0x3f3f3f3f
#define NeInf 0xc0c0c0c0
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;
stack<char> S;
int main(){
#ifdef LOCAL
freopen("./file/in.t... |
#include "ReverseLinkedListII.hpp"
ListNode *ReverseLinkedListII::reverseBetween(ListNode *head, int m, int n) {
ListNode *rprev = nullptr;
ListNode *rhead = head;
for (int i = 1; i < m; i++) {
rprev = rhead;
rhead = rhead->next;
}
ListNode *p1 = rhead, *p2 = rhead->next;
for... |
#include <iostream>
using namespace std;
void merge(int array[], int izq, int mid, int derecha)
{
auto const subarrayuno = mid - izq + 1;
auto const subarraidos = derecha - mid;
auto *izqArray = new int[subarrayuno],
*derechaArray = new int[subarraidos];
for (auto i = 0; i < subarrayuno; i++... |
#ifndef BUNNY_WRL
#define BUNNY_WRL \
"/Users/nikhil/IfsViewer-data/bunny-opts.wrl"
#endif // BUNNY_WRL
#include <iostream>
#include "WrlMainWindow.hpp"
#include "WrlGLWidget.hpp"
#include "WrlAboutDialog.hpp"
#include <QApplication>
#include <QMenuBar>
#include <QGroupBox>
#include <QStatusBar>
#include <QFileD... |
#include "Com.h"
namespace Native {
using namespace Com;
FILE* GetStdOut() {return stdout;}
FILE* GetStdIn() {return stdin;}
FILE* GetStdErr() {return stderr;}
int SignificantBits(dword x) {
// basically log2(x) + 1 except that for 0 this is 0, number of significant bits of x
#ifdef COMPILER_MSC
DWORD index;
retu... |
///
/// \file Subject.h
/// \brief
/// \author PISUPATI Phanindra
/// \date 01.04.2014
///
#ifndef SUBJECT_H
#define SUBJECT_H
#include "Settings.h"
#include "StringFunc.h"
#include "TextReader.h"
#include "Sequence.h"
#include "Targets.h"
#include <string>
#include <memory>
///
/// \class Subje... |
//
// Copyright Jason Rice 2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef NBDL_SQL_DB_STATEMENT_INSERT_HPP
#define NBDL_SQL_DB_STATEMENT_INSERT_HPP
#include <mpdef/list.hpp>
#include <nbdl/sql_d... |
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
vector<int> hi[1005];
bool f[1005];
vector<int> edge[1005];
set<int,less<int> > set1;
vector<int> v;
void dfs(int v){
f[v]=0;
int p;
for(int i=0;i<hi[v].size();i++){
p=hi[v][i];
s... |
/* License: Apache 2.0. See LICENSE file in root directory.
Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
#include "python.hpp"
#include "../include/librealsense2-framos/hpp/rs_types.hpp"
void init_types(py::module &m) {
/** rs2_types.hpp **/
// error+subclasses
py::class_<rs2::option_rang... |
/***************************************************************************
Copyright (c) 2020 Philip Fortier
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or... |
#include "DUIColor.h"
#include "DUIDebug.h"
DUI_BGN_NAMESPCE
//////////////////////////// CARGB /////////////////////////
CARGB::CARGB()
:m_byteR(0), m_byteG(0), m_byteB(0), m_byteA(0)
{
}
CARGB::CARGB(BYTE r, BYTE g, BYTE b, BYTE a /* = 0 */)
:m_byteR(r), m_byteG(g), m_byteB(b), m_byteA(a)
{
}
BOOL CARGB::IsE... |
/*
* insultgenerator.cpp
* Author: Mike Cruickshank
*/
#include "insultgenerator.h"
FileException::FileException(const string& message) : message(message) {}
string& FileException::what() { return message; }
NumInsultsOutOfBounds::NumInsultsOutOfBounds(const string& message) : message(message) {}
strin... |
# include <cstdio>
# include <set>
# include <vector>
# include <list>
// Não funciona
using namespace std;
int L, K, fileiras, fileirasMax;
set<int> X;
vector<int> Xvec;
inline int somaTabuas(int i, int altura) {
int tamParcial, tamParcialAtual;
list<vector<int>::iterator> selecionados;
bool fechou = f... |
#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <string>
#include <string.h>
#include <list>
#include "rapidxml_utils.hpp"
#include "rapidxml.hpp"
#include "rapidxml_print.hpp"
using namespace std;
using namespace rapidxml;
class Attack{
public:
st... |
//===--- FormalEvaluation.cpp ---------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/L... |
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <QWidget>
class graphics : public QWidget
{
Q_OBJECT
public:
explicit graphics(QWidget *parent = 0);
void paintEvent(QPaintEvent *);
void thaiCuc(QPainter &painter, QPoint p, int x, int y);
//Chỉ cần truyền vị trí và kích thước cần vẽ là được
voi... |
#ifndef WBPERODINBLACKBOARDGET_H
#define WBPERODINBLACKBOARDGET_H
#include "wbpe.h"
class WBPERodinBlackboardGet : public WBPE
{
public:
WBPERodinBlackboardGet();
virtual ~WBPERodinBlackboardGet();
DEFINE_WBPE_FACTORY( RodinBlackboardGet );
virtual void InitializeFromDefinition( const SimpleString& DefinitionNa... |
/*WishTest.cpp
Wish
copyright Vixac Ltd. All Rights Reserved
*/
#include "Wish.h"
#include <gtest/gtest.h>
namespace VI = vixac;
namespace IN = VI::inout;
TEST(Wish, aTest)
{
// EXPECT_STREQ( "write some tests for Wish", "TODO");
}
|
/**
* ****************************************************************************
* Copyright (c) 2015, Robert Lukierski.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributi... |
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define ld long double
#define rep(i,n) for(lli i=0;i<n;i++)
#define ii pair<lli,lli>
#define F first
#define S second
vector<vector<ii> > g;
vector<lli> dist;
lli n, m,st;
void bellman()
{
for(lli i=1;i<=n;i++)
{
for(auto v:g[i])
... |
/*
* SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "validatorip_p.h"
#include <utility>
#include <QHostAddress>
#include <QRegularExpression>
using namespace Cutelyst;
ValidatorIp::ValidatorIp(const QString &field, Constraints... |
#ifndef __SCRIPT_SCOPE__
#define __SCRIPT_SCOPE__
#include <functional>
#include <unordered_map>
#include "string_t.h"
#include "ActionVal.h"
#include "ScriptRaw.h"
typedef std::function<ActionVal(ActionVal*)> script_action_t;
typedef std::pair<script_action_t, ActionVal*> script_statement_t;
typedef std::list<scrip... |
/*
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... |
#include <opencv2/highgui.hpp>
#include <opencv2/video.hpp>
#include <opencv2/objdetect.hpp>
#include <opencv/cv.h>
#include <opencv2/optflow.hpp>
#include<iostream>
#include<fstream>
#include<conio.h>
#include<cmath>
#define MHI_DURATION 0.5
using namespace cv;
using namespace cv::motempl;
using namespace std;
char... |
/*
* Copyright (c) 2014, Julien Bernard
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DIS... |
// 50. Write a program in C++ to enter length in centimeter and convert it into meter and kilometer.
#include<iostream>
using namespace std;
int main()
{
float km, met,cent;
cout<<"Enter the distance in centimeter:";
cin>>cent;
met = (cent/100);
km = (cent/100000);
cout << " The distance in meter i... |
#include <iostream>
#include<vector>
using namespace std;
class Union {
public:
Union(size_t size = 10) :SIZE(size) { parent = vector<int>(SIZE); weight = vector<int>(SIZE); for (auto i = 0; i < SIZE; ++i) { parent[i] = i; weight[i] = 0; } }
void union_element(int source, int destination);
bool if_connected(int f... |
//
// Created by Sweet Acid on 02.05.2021.
//
#pragma once
#include <Snow.h>
class ExampleWindow : public Snow::GUIWindow {
private:
int corner = 0;
public:
ExampleWindow() {
name = "Statistics";
window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_Alwa... |
/*
===============================================================================
Name : main.c
Author : $(author)
Version :
Copyright : $(copyright)
Description : main definition
===============================================================================
*/
#if defined (__USE_LPCOPEN)
#if ... |
// github.com/andy489
// AutoComplete Trie
#include <iostream>
#include <vector>
#include <map>
using namespace std;
struct Node {
bool end;
map<char, Node*> children;
Node(bool end = false) :end(end) {}
};
struct Trie {
Node* root = new Node();
void insert(const string& word) {
Node* curr = root;
int len(... |
#ifndef POOL
#define POOL
#include <iostream>
#include <vector>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include "Event.hpp"
#include "TargetPointChangeEvent.hpp"
#include "MoveLeftEvent.hpp"
#include "MoveRightEvent.hpp"
#include "MoveUpEvent.hpp"
#include "RollLeftEvent.hpp"
#include "Rol... |
#include "statistics.h"
void Statistics::UpdateStatistics(int iteration)
{
{
if (sai.verbose)
{
DumpAllCustomers();
}
firstTimeUntilServ.UpdateMean();
firstTimeServ.UpdateMean();
secondTimeUntilServ.UpdateMean();
secondTimeServ.UpdateMean();
... |
#include "processor.h"
#include "linux_parser.h"
#include <fstream>
#include <string>
// TODO: Return the aggregate CPU utilization
float Processor::Utilization() {
std::ifstream filestream(LinuxParser::kProcDirectory + LinuxParser::kStatFilename);
if (filestream.is_open()){
std::string line;
std::getline(... |
#include <iomanip>
#include <string>
#include <sdf_tracker.h>
#include <opencv2/opencv.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
int main(int argc, char* argv[])
{
boost::filesystem::path p(argv[1]);
//Parameters for an SDFtracker object
SDF_Parameters myParameters;
myParameters.... |
#include "graphics\Singularity.Graphics.h"
using namespace Singularity;
using namespace Singularity::Threading;
using namespace Singularity::Components;
using namespace Singularity::Graphics::Devices;
namespace Singularity
{
namespace Graphics
{
IMPLEMENT_OBJECT_TYPE(Singularity.Graphics, RenderSubTa... |
#include "Common.h"
#include "Devices.h" |
// https://s-kita.hatenablog.com/entry/20130502/1367458848
#include <windows.h>
#include <strsafe.h>
#include <process.h>
#include <stdio.h>
#include <errhandlingapi.h>
#include <iostream>
SERVICE_STATUS ss;
SERVICE_STATUS_HANDLE hss;
BOOL installservice() {
SC_HANDLE hSCM = NULL;
SC_HANDLE hService = NULL;
TCHA... |
#ifndef POSITIONCOMPONENT_H
#define POSITIONCOMPONENT_H
#include "../Component.h"
class PositionComponent : public Component
{
public:
PositionComponent() { x = 0; y=0;}
PositionComponent(float xx, float yy) { x = xx; y = yy;}
float x;
float y;
};
#endif // POSITIONCOMPONENT_H
|
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "dbmanager.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow), m_testSession{0,0}
{
ui->setupUi(this);
path = "../../database/vocabulary.db";
db = new DbManager(path);
if (db->isOpen()){
Q... |
#include<stdio.h>
#include<vector>
using namespace std;
struct Edge {
int to;
int cost;
int len;
};
int dist[1001];
int cost[1001];
bool marked[1001];
vector<Edge> edge[1000];
void func() {
int n, m;
while (scanf("%d %d",&n,&m)) {
if (n == 0 && m == 0) {
break;
}
for (int i = 1;i <= n;i++) {
dist[i]... |
#ifndef GAMESFML_H
#define GAMESFML_H
#include "game.h"
#include <SFML/Graphics.hpp>
class GameSFML : public Game
{
public:
GameSFML(int nrow, int ncol);
virtual ~GameSFML();
bool initGraphics();
void releaseGraphics();
UserInput getUserInput();
bool isWindowOpen() const { return window.isOpe... |
#include <bits/stdc++.h>
using namespace std;
struct node
{
node* next;
int data;
};
void print_list(node** head,int n)
{
node *temp=*head;
while(temp!=NULL && n!=0)
{
cout<<temp->data<<" ";
temp=temp->next;
n--;
}
cout<<"\n";
}
void reverse_head_tail(node** head,node** tail,int n)
{
if(n==1)
return;... |
#pragma once
#include "cmonster.h"
class cBacteria :
public cMonster
{
public:
virtual void Init();
virtual void Update();
virtual void Render();
public:
cBacteria(void);
~cBacteria(void);
};
|
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
int main()
{
double x = .0;
std::cout<<"# Plotting sin fuction in [0,2pi] with delta=0.01pi.";
std::cout<<std::scientific;
while (x < 2* M_PI)
{
std::cout<<x<<" "<<std::sin(x)<<'\n';
x += .01* M_PI;
};
retur... |
/**
* \file myIncludes.h
*
* \ingroup MySoftwarePackage
*
* \brief Class def header for a class myIncludes
*
* @author erezcohen
*/
/** \addtogroup MySoftwarePackage
@{*/
#ifndef MYINCLUDES_H
#define MYINCLUDES_H
#include <iostream>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <ma... |
#ifndef GRAPHICSDLL_LIGHTHANDLER_H
#define GRAPHICSDLL_LIGHTHANDLER_H
#include <DirectXMath.h>
#ifdef GRAPHICSDLL_EXPORTS
#define GRAPHICSDLL_API __declspec(dllexport)
#else
#define GRAPHICSDLL_API __declspec(dllimport)
#endif
#include <d3d11_1.h>
#include <vector>
#include "LightStructs.h"
#include "ConstantBufferHa... |
#ifndef SPAN_SRC_SPAN_EXCEPTIONS_EXCEPTION_HH_
#define SPAN_SRC_SPAN_EXCEPTIONS_EXCEPTION_HH_
#include <errno.h>
#include "span/Common.hh"
#if UNIX_FLAVOUR == UNIX_FLAVOUR_BSD
#define error_t errno_t
#endif
error_t lastError();
void lastError(error_t error);
#endif // SPAN_SRC_SPAN_EXCEPTIONS_EXCEPTION_HH_
|
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <utility>
#include <cmath>
#include <condition_variable>
#include <mutex>
#include <chrono>
#include <iterator>
#include <thread>
#include <algorithm>
#include <cassert>
#include <map>
#inc... |
#include "ImageDrawer.hh"
void ImageDrawer::Compute()
{
sf::Texture texture = LimitTextureSize(in_texture->GetData());
sf::Vector2u texture_size = texture.getSize();
sf::Sprite sprite;
sprite.setTexture(texture);
sf::RenderWindow window(
sf::VideoMode(texture_size.x, texture_size.y),
"Image Display" );
wi... |
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
srand(time(NULL));
ofVec2f sunPos = ofVec2f(ofGetWidth() / 2.0f, ofGetHeight() / 2.0f);
// ,distance, radiusAtraction, velocity, mass,size
SolarSystem.push_back(Planet(sunPos, 0, 350, 0,... |
#include "onefilter.h"
#include "ui_onefilter.h"
#include <QTimer>
#include <iodev.h>
OneFilter::OneFilter(IoDev &src,QWidget *parent) :
QDialog(parent),
m_ui(new Ui::OneFilter),
n(1),
s(src)
{
m_ui->setupUi(this);
QTimer *t=new QTimer(this);
t->setInterval(1000);
t->start();
co... |
#pragma once
#include <deque>
#include "input_utils.hpp"
#include <range/v3/all.hpp>
template<size_t PreambleSize> struct preamble_finder
{
using preamble = std::array<int, PreambleSize>;
static auto find_pair(preamble &p, size_t ¤t_pos, const int num) -> bool
{
auto sorted{ p };
ranges::sort(sor... |
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(250000);
}
void loop() {
uint16_t u1 = pulseIn(A0, 1, 45000);
uint16_t u2 = pulseIn(A1, 1, 45000);
int8_t v1 = constrain(map(u1 < 1000 ? 1500 : u1 < 1480 ? u1 : u1 < 1520 ? 1500 : u1 < 2000 ? u1 : 1500, 1100, 1900, -127, 127), -127, 127);
int8_t ... |
#include "Plane.h"
Plane::Plane(Vec3f a, Vec3f b, Vec3f c, Material M)
{
Vec3f AB = b - a;
Vec3f AC = c - a;
Vec3f normal = AB.cross(AC);
x = normal.getX();
y = normal.getY();
z = normal.getZ();
d = ((x * a.getX()) + (y * a.getY()) + (z * a.getZ())) * -1;
m = M;
}
Plane::Plane(doub... |
/**
* Unit test harness
*/
#include <iostream>
#include ".generated/version.h"
#include "testcase.h"
#include <CORE/BASE/asserts.h>
#include <CORE/BASE/logging.h>
#include <CORE/VFS/vfs.h>
int main(int argc, char **argv) {
core::logging::RegisterSink(
std::make_shared< core::logging::iLogSink >(~core::typ... |
vector<int> Solution::maxone(vector<int> &A, int B) {
int n=A.size();
int curr_left=0,curr_right=0;
int best_left=0,best_right=0;
int count0=0;
while(curr_right<n)
{
if(count0<=B)
{
if(A[curr_right]==0)
count0++;
curr_right++;
}
... |
#include "bintree.h"
BinTree *createBinTree()
{
BinTree *tree = new BinTree;
tree->root = nullptr;
tree->deep = 0;
return tree;
}
BinNode *createBinNode(char info, bool isNum)
{
BinNode *node = new BinNode;
node->info = info;
node->isLeaf = isNum;
node->left = nullptr;
node->right ... |
// Copyright 2016 Carrie Rebhuhn
#include "Domains/Rover/include/RoverDomain.h"
#include <algorithm>
#include <vector>
void append(matrix1d &a, const matrix1d &b) {
a.insert(a.end(), b.begin(), b.end());
}
int Loc::relQuadrant(Loc* l) {
double dx = l->x_ - x_;
double dy = l->y_ - y_;
int val = 2;
... |
// 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::Devices::Midi {
struct IMidiChannelPressureMessage;
struct IMidiChannelPressureMessageFactory;
struct IMidiControlChangeMessage;
struct... |
//
// Created by wqy on 19-11-28.
//
#ifndef VERIFIER_EDGE_H
#define VERIFIER_EDGE_H
#include "Vertex.h"
#include "Action/Action.h"
#include "Guard/Guard.h"
using std::list;
namespace esc {
class Edge {
private:
Vertex* from;
Vertex* to;
Guard* guard;
list<Action*> actions;
... |
#include "gtest/gtest.h"
#include "config_parser.h"
#include <sstream>
#include <iterator>
class ConfigParserSemanticsTest : public ::testing::Test {
protected:
NginxConfigParser parser;
NginxConfig out_config;
std::string handler_text = // TODO: add quotes to url and root argument
"listen 8000;\n"
... |
#include <iostream>
#include <vector>
using namespace std;
/*
Implementation of a class stack, storing the stack elements in a vector.
constructor: initially the stack is empty
bool isEmpty() const: return whether the stack is empty
void push (int i): putting i on top of the stack
int top() const: return the top elem... |
//! 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) scanf... |
#pragma once
#include <vector>
#include <random>
using namespace std;
class VasicekModel
{
public:
VasicekModel(double a, double b, double Sigma, double r0) :
ma(a), mb(b), mSigma(Sigma), mr0(r0) {}
void GeneratePath(double Time, int Steps);
double PathDependentDF(double Time, int Steps);
double MCDF... |
#include <iostream>
using namespace std;
// int add(int a, int b)
// {
// return a + b;
// }
template <typename T>
int addWithTemplate(T a, T b)
{
return a + b;
}
int main(int argc, char *argv[])
{
int a = 100;
int b = 10;
char c = 'a';
// cout << add(b, c) << endl;
// cout << addWithTe... |
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <math.h>
#define MAX 1001
using namespace std;
int N, S, Max = 0;
vector<int> Subway;
void Input()
{
cin >> N;
for(int i = 0; i < N; i++)
{
cin >> S;
Subway.push_back(S);
}
}
void S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.