text stringlengths 8 6.88M |
|---|
#include "points_untangler.h"
#include<iostream>
#include"mesh.h"
#include"grid.h"
std::string inputPath = "C:/projects/github/cellogram/data/debug/marco_LARGE.txt";
std::string outputPath = "C:/projects/github/cellogram/data/debug/";
namespace cellogram
{
namespace PointsUntangler
{
Grid g;
Mesh m;
void test02()... |
/*
Given a BST and an integer k. Find and return the path from the node with data k and root (if a node with data k is present
in given BST) in a list. Return empty list otherwise.
Note: Assume that BST contains all unique elements.
Input Format :
The first line of input contains data of the nodes of the tree in level... |
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_CONTROLLER_MANAGER_H_
#define MYGUI_CONTROLLER_MANAGER_H_
#include <_GUI/Prerequest.h>
#inclu... |
#include "test_main.h"
#include <unity.h>
std::vector<TestClass*> TestClass::tests = std::vector<TestClass*>();
TestClass* TestClass::active = nullptr;
void tearDown(void) {
TestClass::tearDown();
}
void setUp(void) {
TestClass::setUp();
}
int main()
{
UNITY_BEGIN();
TestClass::runAll();
UNITY... |
#include <simplecpp>
main_program{
turtleSim();
int i = 1;
repeat(10){
forward(i*10); right(90);
forward(i*10); right(90);
i = i + 1;
}
wait(5);
}
|
#pragma once
namespace Hourglass
{
class RenderWindow
{
public:
bool Create(WNDPROC WndProc, int width, int height, bool fullscreen = false, int bpp = 32);
void Destroy();
HWND GetHwnd() const { return m_Window; }
LPCWSTR GetTitle() const;
private:
HINSTANCE m_Instance; // Win32 application instance... |
#include <bits/stdc++.h>
using namespace std;
ofstream fout ("paintbarn.out");
ifstream fin ("paintbarn.in");
#define For(x) for(int i = 0; i < x; i++)
#define For2(x) for(int j = 0; j < x; j++)
#define For3(x) for(int k = 0; k < x; k++)
#define Forv(vector) for(auto& i : vector)
#define Forv2(vector) for(auto& j : vec... |
#ifndef __JOSEPHUS_H__
#define __JOSEPHUS_H__
#include "person.h"
#include <vector>
using namespace std;
class JosephusRing
{
public:
JosephusRing();
JosephusRing(unsigned, unsigned);
~JosephusRing();
void append(Person);
vector<Person> ringSort();
private:
vector<Person> people_;
unsigned ... |
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{ int i=0;
char s[]="m.name.is";
char *start=s;
char *end;
while(*(s+i)!='\0'){
if(*(s+i)=='.'){
end=s+i;
cout<<"start-> "<<*start<<" "<<"end-> "<<*(en... |
#include "stdafx.h"
#include "Camera.h"
DECLARE_IDENTIFIER(Jaraffe::Component::Camera);
Jaraffe::Component::Camera* Jaraffe::Component::Camera::g_pMainCamera;
Jaraffe::Component::Camera::Camera()
: m_Theta(1.5f * XM_PI)
, m_Phi(0.25f * XM_PI)
, m_Radius(5.0f)
, m_vEye(0.0f, 0.0f, -20.0f)
, m_vUp(0.0f, 1.0f, 0.0f)
, ... |
#ifndef __VIEW_BROWSER_H
#define __VIEW_BROWSER_H
#include "IViewBrowser.h"
#include "ViewBrowserDVModel.h"
namespace wh{
//-----------------------------------------------------------------------------
class ViewTableBrowser : public IViewTableBrowser
{
// selection
std::set<int64_t> mClsSelected;
std::set<Object... |
/**********************************************************************************************************************
* @file Attribute
* @date 2014-06-25
* @brief <# Brief Description#>
* @details <#Detailed Description#>
**********************************************************************************... |
/*********************************************************\
* 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 "Game.h"
Game* Game::_instance = NULL;
Game* Game::getInstance() {
if (Game::_instance == NULL)
Game::_instance = new Game();
return Game::_instance;
}
Game::Game() {
_gameState = Uninitialized;
}
Game::Game(const Game&) { }
Game& Game::operator=(const Game&) { return *this; }
Game::~... |
///
/// @author Florian Feuerstein
///
/// @date 02/2017
///
/// @class StereographicModel
///
/// @brief
///
#pragma once
#include "ProjectionModel.h"
namespace Cvl
{
class StereographicModel : public ProjectionModel
{
public:
StereographicModel(
double focalLengthX,
double focalLengthY,
do... |
#include<bits/stdc++.h>
using namespace std;
char as[1000][1000];
main()
{
int n;
while(cin>>n)
{
int i, j, k, ans=0;
for(i=0; i<n; i++)
for(j=0; j<n; j++)cin>>as[i][j];
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
for(k=j+1;... |
#include<iostream>
#include<cstdio>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
const int cou = 100000;
struct point{
double x,y;
point(double x=0,double y=0):x(x),y(y) {}
};
double dis(point a,point b)
{
return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
in... |
#include "components/furniture.hpp"
#include "components/room.hpp"
#include "city.hpp"
#include "components/position.hpp"
#include "entities/entity.hpp"
void Furniture::on_add() {
pos.city->add_furniture(this);
}
void Furniture::on_remove() {
pos.city->del_furniture(this);
}
|
#include "stdafx.h"
#include "CppUnitTest.h"
#include "..\TieredVector\K2TieredVector.cpp"
#include "..\TieredVector\TieredVector.cpp"
#include <vector>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
#define DEBUG false
#define DETAILED_CONFIRM true
#define SIZE 1000
#define SEED1 491
#define SEED2 ... |
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> p1, pair<int, int> p2) {
double r1 = (double)p1.first / p1.second;
double r2 = (double)p2.first / p2.second;
return r1 > r2;
}
int main()
{
// only gravity will pull me down
// Fractional Knapsack
int t, n, w;
cin ... |
#include <iostream>
using namespace std;
int countbits(int a)
{
int ctr=0;
while(a>0)
{
if(a&1)
ctr+=1;
a=a>>1;
}
return ctr;
}
void insertionSort(int arr[],int aux[], int n)
{
for (int i = 1; i < n; i++)
{
int k1 = aux[i];
int k2 = a... |
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// 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 F... |
/* -*- 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.
*/
#include "core/pch.h"
#ifdef AUTO_UPDATE_SUPPORT
#include "adjunct/autoupdate/countr... |
#ifndef BS_FUZZY_SUGENO_HPP
#define BS_FUZZY_SUGENO_HPP
#include <bs/defs.hpp>
#include <bs/detail/base.hpp>
#include <vector>
#include <opencv2/core/mat.hpp>
namespace bs {
//
// @inproceedings{zhang:2006:FCT:2092283.2092396,
// author = {zhang, Hongxun and xu, De},
// title = {Fusing Color and Texture Features... |
// DADL Test.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms.
//
#include <Windows.h>
#include <Malloc.h>
#include <DataFS\Client\DataFS Client.h>
//using namespace DataFoundation;
#include <DataFS\Access\DataFS Access.h>
using namespace DataFoundationAccess;
#incl... |
#include "settingdialog.h"
#include "ui_settingdialog.h"
#include "udp_pic5000.h"
#include <QSettings>
#include <QDebug>
SettingDialog::SettingDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SettingDialog),
bready(false)
{
ui->setupUi(this);
char* devlist;
int size;
st... |
#pragma once
// 00 - U
// 10 - F
// 11 - T
namespace tritsBits {
enum trit { T, F, U };
unsigned bpow(unsigned pow);
trit GetTrit(unsigned* src, unsigned index);
void SetTrit(unsigned* src, unsigned index, trit trit);
trit AndOperation(trit a, trit b);
trit OrOperation(trit a, trit b);
trit NotOperation(tr... |
#include "pch.h"
#include "GameLogic.h"
const float dt = 0.033f;
VOID ResetSyncData(USER_SYNC &Data)
{
Data.Direction = 0;
Data.HP = 0;
Data.IsDeath = TRUE;
Data.IsNULL = TRUE;
Data.IsShoot = FALSE;
Data.Ping = 0;
Data.pos_X = 0;
Data.pos_Y = 0;
Data.Speed = 0;
Data.UID = 0;
Data.WorldFrame = 0;
}
GameLog... |
// Author: Miles Meacham
// Course: CS-1410-X01-deBry-Fall 2015
// Instructor: Professor deBry
// File: Person.h
// Date: 9/12/2015
// Contents: project02 The header file for the "Person" class
// I delcare that the following source code was written solely by me, or provided by the instructor.
// I understand that co... |
#include "ShapesBlocks.h"
void cuboidBlocks::printVectorSphere(){
for(int i=0; i<w.size(); i++)
{
if(w[i] == l[i]){
W.push_back(w[i]);
cout << w[i]<<endl;
}
}
}
|
#include "stdafx.h"
#include "CategoryTests.h"
#include "StringUtils.h"
#include "Category.h"
#include "Station.h"
#include "Contest.h"
#include "CategoryMgr.h"
CategoryTests::CategoryTests()
:
TestBase("CategoryTests")
{
}
CategoryTests::~CategoryTests()
{
}
bool CategoryTests::Setup()
{
if (SetupComplete()... |
#include <bits/stdc++.h>
using namespace std;
const int LIM = 1e5;
int N, K;
int h[LIM];
int main(){
cin >> N >> K;
for(int i=0; i<N; i++) cin >> h[i];
sort(h, h+N);
int ans = 1e9;
for(int i=0; i<N-K+1; i++){
ans = min(ans, h[i+K-1] - h[i]);
}
cout << ans << endl... |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
#define INF 10e18 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) f... |
#ifndef CABAL_BINARYEXPR_H
#define CABAL_BINARYEXPR_H
#include "Expr.h"
#include <memory>
class BinaryExpr : public Expr {
private:
char op;
std::unique_ptr<Expr> LHS;
std::unique_ptr<Expr> RHS;
public:
explicit BinaryExpr(char op, std::unique_ptr<Expr> LHS, std::unique_ptr<Expr> RHS)
:... |
#pragma once
class BattleLogic
{
public:
BattleLogic();
~BattleLogic();
public:
private:
}; |
/*
** EPITECH PROJECT, 2021
** B-CPP-300-STG-3-1-CPPrush3-maxime.owaller
** File description:
** TableRectShape
*/
#pragma once
#include "RectShape.hpp"
#include "TitleSection.hpp"
class TableRectShape : public RectShape
{
public:
TableRectShape(unsigned int height, unsigned int width, unsigned int colum... |
#include <iostream>
#include <cstdio>
using namespace std;
struct Node {
int val;
Node *link;
Node(int val) : val(val) {};
Node(int val, Node *link) : val(val), link(link) {};
};
class Stack {
private:
Node *top;
int size;
public:
Stack(); // constructor
void push(int val) {
Node *node = new Node... |
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->widget_map->resize(941,525);
QObject::connect(ui->widget_search,SIGNAL(emitSearchRequestData(QVector<float>,float,QVec... |
#include "Planificateur.h"
#include "NPCManager.h"
#include "ObjectManager.h"
#include "Zone.h"
#include "BehaviourTree/BehaviourTreeModule.h"
#include <vector>
#include <map>
std::pair<std::vector<Mission>, std::vector<Mission>> Planificateur::planifyMissions(Mission mission, unsigned npcId)
{
unsigned npcZone =... |
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <string.h>
int main(int argc, char** argv)
{
if (argc != 2)
{
printf("usage: a.out <... |
/*
* Copyright 2019 LogMeIn
*
* 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 w... |
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <iomanip>
#include <set>
#include <climits>
#include <ctime>
#include <complex>
#include <cmath>
#include <string>
#in... |
#include <iostream>
#define zangvaciElementneriMutqagrum \
int size = 0; \
std::cout << "Nermucel zangvaci chap "; \
std::cin >> size; \
int array[size]; \
std::cout << "Nermucel zangvaci elementnern "; \
for (int i = 0; i < size; ++i) { \
std::cin >> array[i]; \
};
#define mecagu... |
/****************************************************************************
* *
* Author : lukasz.iwaszkiewicz@gmail.com *
* ~~~~~~~~ *
* Lice... |
#include "components/citizenname.hpp"
#include <cstdlib>
std::vector<std::string> names = {
"Alex",
"Alice",
"Ansi",
"Arnold",
"Ben",
"Bob",
"Bill",
"Casie",
"Cal",
"David",
"Dan",
"John",
"Jim",
"James",
"Zim"
};
std::vector<std::string> sectors = {
"QNX",
"ABC",
"TRN",
"NZB",
... |
#include <iostream>
#include <cmath>
using namespace std;
const int INF = 2147483647;
// merge(A,9,12,16)
// ...9 10 11 12 13 14 15 16 ...
// 2, 4, 5, 6, 1, 2, 3, 6
// p q r
// L1 = {2,4,5,7,INF}
// R1 = {1,2,3,6,INF}
void merge(int A[],int p,int q, int r){
int n1 = q-... |
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<n;i++)
#define FORn1(i,n) for(ll i=1;i<=n;i++)
#define FORmap(i,mp) for(auto i=mp.begin();i!=mp.end();i++)
#define vll vector<ll>
#define vs vector<string>
#define pb(x) push_... |
#pragma once
#include "ISystem.h"
#include "../Core/ComponentFactory.h"
#include "../Component/GPUParticleEmitter.h"
#include "../Core/ParticleDefine.h"
#include <unordered_map>
#include "GPUSort.h"
namespace Hourglass
{
#define _MAX_PARTICLE_SQRT 256
#define _SHAPE_PRIMITIVE_SIZE 151
class GPUSort;
class GPUPartic... |
/*
* the implementation of the radix sort
*
* author: dongbeibei
* time: 2013/6/24
*
* input: 1. array[] : 待排序数组
* 2. length : 数组长度
*
* output: true: 正确排序;false: 输入有误
*/
#include "sortBase.h"
#include <math.h>
#include <iostream>
int getLoopTimes(int num);
int findMaxNum(ElemType *array, int length);
v... |
#include <QtGui>
#include "imageviewer.h"
#include "qfiledialog.h"
#include "qmessagebox.h"
ImageViewer::ImageViewer(QWidget *parent)
{
imageLabel = new MouseLabel();
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
... |
#include <iostream>
#include <stdexcept>
#include "pieces.h"
// § Marker
char to_char(Marker m)
{
switch (m)
{
case Marker::carrier:
return 'C';
case Marker::battleship:
return 'B';
case Marker::destroyer:
return 'D';
case Marker::submarine:
return 'S';
... |
# 1 "d:\\code\\Robot\\xunxian_PID_4\\xunxian_PID_4.ino"
# 1 "d:\\code\\Robot\\xunxian_PID_4\\xunxian_PID_4.ino"
# 2 "d:\\code\\Robot\\xunxian_PID_4\\xunxian_PID_4.ino" 2
//左右电机码盘
//左右电机PWM波以及电机正负极接入
//从前进方向的最左边开始排序红外传感器引脚
# 28 "d:\\code\\Robot\\xunxian_PID_4\\xunxian_PID_4.ino"
const float originTargetV = 60... |
// Copyright 2018 Benjamin Bader
//
// 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 agree... |
#include"../head/decode1.h"
using namespace std;
void ConvertBatToText()//二进制转文本
{
ifstream infile("decode.txt");//文件名要加入文件地址!
ofstream outfile("output.txt", ofstream::out);
string s;
if (infile.fail())
{
cout << "Cannot open text File" << endl;
system("pause");
exit(0);
}
char c;
int idx = 0, asc = 0;... |
//
// Created by OLD MAN on 2020/1/7.
//
//小蒜上了他的第一堂计算机概论,老师说计算机内部是由很多的小开关来组成:1 代表开、0 代表关。于是聪明的小蒜便了解了,原来我们平常使用电灯开关就是把 1 变成 0、0 变成 1 嘛!
//
//输入格式
// 输入只有一行,含有一个为 0 或 1 的整数。
//
//输出格式
// 输入为 0 则输出 1;
//
//输入为 1 则输出 0。
#include <iostream>
using namespace std;
int main(){
bool a;
cin>>a;
if(a){
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup" -*-
*
* Copyright (C) Opera Software ASA 2002 - 2010
*
* Bytecode compiler for ECMAScript -- overview, common data and functions
*
* @author Jens Lindstrom
*/
#ifndef ES_NATIVE_ARCH_H
#define ES_NATIVE_ARCH_H
#... |
#pragma once
#include "acquisition_result.hpp"
#include "../common.hpp"
#include "../signal_parameters.hpp"
#include "../matched_filter/matched_filter.hpp"
#include "../matched_filter/ipp_matched_filter.hpp"
#include "../math/upsample.hpp"
#include "../mixer/ipp_mixer.hpp"
#include "../prn_codes/codegen.hpp"
#include ... |
#include <bricks/io/filepath.h>
#include <gtest/gtest.h>
static Bricks::IO::FilePath TestPath(TEST_PATH);
|
/*
Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/
/**
* Example for Getting Started with nRF24L01+ radios.
*
* This is an exa... |
/**
* @file valknut/core/internal/type_properties.hpp
*
* @brief This internal library detects properties of types.
*
* @note This is an internal header file, included by other library headers.
* Do not attempt to use it directly.
*/
/*
* Symbols Defined:
*
* VALKNUT_DECLARE_SIGNED_TYPE :... |
#include<iostream>
using namespace std;
int main(int argc, char const *argv[])
foo();
return 0;
}
void foo(){
cout<<endl;
} |
#include<bits/stdc++.h>
#define rep(i,n) for (int i =0; i <(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;
const ll MOD = 1000000007;
int main(){
ll N;
cin >> N;
ll ans=1;
for(ll i=1;i<=N;i++){
ans=ans*i/gcd(ans,i);
}
cout << ans+1 << endl;
... |
//
// Created by Masayuki IZUMI on 5/9/16.
//
#include <pcl/point_cloud.h>
#include <OpenNI.h>
template <typename PointT>
class VideoFrameConverter<PointT> {
public:
VideoFrameConverter(
const openni::VideoStream *color_video_stream,
const openni::VideoStream *depth_video_stream,
const unsigned wi... |
#include "Scene/Component/Transform.h"
#include "Scene/SceneNode.h"
using namespace Rocket;
void Transform::SetTransform(const Matrix4f& mat)
{
auto LocalTransform = mat;
Vector3f Skew;
Vector4f Perspective;
if (LocalTransform(3,3) == static_cast<float>(0))
return;
for (int16_t i = 0; i < 4; ++i)
for (i... |
#include <iostream>
#include <time.h>
#include <string>
#define ROUNDS 3
#define ROCK 1
#define PAPER 2
#define SCISSORS 3
using namespace std;
int main()
{
int player, computer , tie=0 , winner1=0 , winner2=0;
string playerName;
cout << " ENTER YOUR NAME : ";
cin >> playerName;
srand(time(NULL)); // randomise the see... |
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main(){
int r1,c1,r2,c2;
cin >> r1 >> c1 >> r2 >> c2;
int r = r2 - r1;
int c = c2 - c1;
int ans = 3; //最大でも3手;
if (r == 0 && c == 0)ans = 0; //移動しない、0手
... |
/** Copyright (c) 2018 Mozart Alexander Louis. All rights reserved. */
#ifndef __ACTION_UTILS_HXX__
#define __ACTION_UTILS_HXX__
/**
* Includes
*/
#include "globals.hxx"
class ActionUtils {
public:
/**
* All action public to the rest of the application
*/
static Action* fadeIn(float delay, float duratio... |
/*
* Copyright 2016 Robert Bond
*
* 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 ... |
#ifndef _MSG_0XD0_DISPLAYSCOREBOARD_STC_H_
#define _MSG_0XD0_DISPLAYSCOREBOARD_STC_H_
#include "mcprotocol_base.h"
namespace MC
{
namespace Protocol
{
namespace Msg
{
class DisplayScoreboard : public BaseMessage
{
public:
DisplayScoreboard();
DisplayScoreboard(int8_t _position, const String16& _scoreName);
size_... |
//
// Created by peachy_ash on 15.09.2021.
//
#include "folium_of_Descartes.hpp"
namespace fancyCurve {
double foliumOfDescartes::distanceToCenter (double angle) const {
if (!correct(angle))
throw std::invalid_argument("Angle must be from 0 to 2Pi");
double c = cos(angle), s = sin(angl... |
#include<iostream>
#include<string>
#include<cstring>
#include<queue>
#ifndef ALPHABETS
#define ALPHABETS 26
#endif
#ifndef F_ALPHA
#define F_ALPHA 'a'
#endif
using namespace std;
class suffix_trie {
private:
class node {
node *next[ALPHABETS];
int depth[ALPHABETS];
node *backtrack;
public:
node() {
... |
#include "../Precompiled.h"
Body::Body(Shape *_shape, int x, int y) :
staticFriction(0.5f),
dynamicFriction(0.5f),
restitution(0.4f),
shape(_shape->Clone()),
position({x,y})
{
shape->body = this;
shape->Initialize();
}
void Body::ApplyImpulse(const glm::vec2& impulse, const glm::vec2& contactVector)
{
velo... |
#include <iostream>
int gcd(int num1, int num2)
{
int mod;
while (num2)
{
mod = num1 % num2;
num1 = num2;
num2 = mod;
}
return num1;
}
int lcm(int num1, int num2, int gcdV)
{
return num1 * num2 / gcdV;
}
int main(void)
{
int num1, num2;
scanf("%d %d", &num1, &num2);
int resultGCD = gcd(num1, num2);
... |
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
class Solution {
public:
bool isAdditiveNumber(string num) {
//基本思想:递归,主函数找第一个数num1=[0,i]长度len1,第二个数num2=[i+1,j]长度len2,然后找第三个数num3=[j+1,k],如果num1+num2=num3则递归继续搜寻接下来的数字是否满足
//递归函数有三个参数,第一个是string num剔除第一个数... |
#include "emhandler.h"
#include <QDateTime>
#include <QThread>
#include <iostream>
#define FPS 5
static void* connectThread(void* arg)
{
return ((DR::EMHandler*)arg)->thread_connect();
}
DR::EMHandler::EMHandler(QObject *parent) :
QObject(parent),
m_connected(false),
m_running(false)
{
}
DR::EMHandler::~EMHandle... |
#include "stdafx.h"
#include "sceneCreator.h"
#include "sphere.h"
#include "lambertian.h"
#include "dielectric.h"
#include "metal.h"
#include "material.h"
#include "specmath.h"
#include "surfcluster.h"
#include "scene.h"
#include <vector>
#include <memory>
scene sceneCreator::random_scene(vec3 & look_from, vec3 & l... |
/**
* Copyright (C) 2017 Zach Laine
*
* 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 YAML_PARSER_STREAM_HPP
#define YAML_PARSER_STREAM_HPP
#include <yaml/parser/parser_fwd.hpp>
#include <yaml/... |
#include <iostream>
using namespace std;
//Program Databases: With "Binary Search Tree" : Author : @_mhmdriduan11
struct Node {
int data{};
Node* left{};
Node* right{};
};
void addDatabases(Node** superuser, int keyword){
if ((*superuser) == nullptr)
{
Node* temp = nullptr ;
temp = new Node();
temp->data ... |
#include "../include/codeblock.h"
#include "crc16.h"
#include "xor.h"
#include <cstring>
#include <iostream>
#include <bitset>
#include <sstream>
using namespace std;
// Constructor from payload
trevi::CodeBlock::CodeBlock(uint16_t mtu, uint8_t *payloadBuffer, int payloadSize)
{
initMemory( CODEBLOCK_HEADER_SIZ... |
#include "TextFileParser.hpp"
TextFileParser::TextFileParser(TextFile& text_file) : m_text_file {text_file}
{
}
TextFileParser::~TextFileParser()
{
}
int TextFileParser::ParseFile(const TextFile& text_file, const ParseType parse_type)
{
int occurences_count = 0;
switch (parse_type)
{
case ... |
/*
* ThreadPool.h
*
* Created on: Jun 10, 2017
* Author: root
*/
#ifndef THREAD_THREADPOOL_H_
#define THREAD_THREADPOOL_H_
#include "../Common.h"
#include "../define.h"
#include "../Memory/MemAllocator.h"
namespace CommBaseOut
{
/*
* 单例类
* 用于执行有限次任务
*/
class CThreadPool
#ifdef USE_MEMORY_POOL
: public... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2006-2007 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
*/
#ifndef _SVG_TEXT_LAYOUT_
#define _SVG_TEXT_LAYOUT_
#ifdef SVG... |
/*
* Copyright (c) 2016-2020 Morwenn
* SPDX-License-Identifier: MIT
*/
#include <algorithm>
#include <functional>
#include <iterator>
#include <list>
#include <stdexcept>
#include <type_traits>
#include <vector>
#include <catch2/catch.hpp>
#include <cpp-sort/adapters.h>
#include <cpp-sort/sorter_facade.h>
#include <... |
// Solution 1 two pointers swap
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int n = nums.size();
if (n == 0) return 0;
int begin = -1, end = n;
while (true) {
while (++begin < n && nums[begin] != val);
while (--end >= 0 && nums[end... |
#include<iostream>
struct Rect {
int x;
int y;
Rect( int x1, int y1 ) {
x = x1;
y = y1;
}
int area( int , int );
};
int Rect::area( int x, int y ) {
return x * y;
}
int merge( arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1];
int R[n2];
for... |
//
// RealLib.cpp
// Landru
//
// Created by Nick Porcino on 10/29/14.
//
//
#include "RealLib.h"
#include "LandruActorVM/Fiber.h"
#include "LandruActorVM/Generator.h"
#include "LandruActorVM/Library.h"
#include "LandruActorVM/VMContext.h"
#include <algorithm>
#include <cmath>
#include <memory>
using namespace st... |
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Portions of this file are from JUCE.
Copyright (c) 2013 - Raw Material Software Ltd.
Please visi... |
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string>
#include <termios.h>
#include <unistd.h>
#include <pthread.h>
#include <sstream>
#include <map>
#include "temp.h"
#include "newsreader.h"
using namespace std;
#define MAX_LEN 100
c... |
#pragma once
#include <maya/MPxLocatorNode.h>
class BasicLocator : public MPxLocatorNode
{
public:
BasicLocator();
virtual ~BasicLocator();
virtual MStatus compute(const MPlug&, MDataBlock&);
virtual void draw(M3dView&, const MDagPath&, M3dView::DisplayStyle, M3dView::DisplayStatus);
virtual bool isBounded() c... |
#include<bits/stdc++.h>
#include<string>
using namespace std;
string twoStrings(string s1, string s2) {
map<char, unsigned int> m;
for(unsigned int i=0; i<s1.length(); i++){
m[s1[i]]++;
}
bool res = false;
for( unsigned int i=0; i<s2.length(); i++){
if(m[s2[i]]>0){
res ... |
/*
* File: main.cpp
* Author: Kenton
*
* Created on June 30, 2014, 6:02 PM
*/
#include <cstdlib>
#include <iostream>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
float US; // dollars
float yen;
float euro;
cout << "US dollar amount " << endl;
cin >> US;
... |
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/statistical_outlier_removal.h>
int
main (int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud... |
#include "Map.h"
//---------------------------------------------------------------------------------------
Map::Map(int aWidth, int aHeight) : width(aWidth), height(aHeight)
{
//field.resize(height);
//for (int i = 0; i < height; i++)
// field[i].resize(width);
//ifstream map("Map\\map.txt");
//for (int i = 0; ... |
/* -*- 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 SPELL_CHECK_CONTEXT_H
#define SPELL_CHECK_CONTEXT_H
#inc... |
/*
* Key.h
*
* Created on: 30/11/2019
* Author: frank
*/
#ifndef SOURCES_KEY_H_
#define SOURCES_KEY_H_
#include <mkl_GPIOPort.h>
class Key : mkl_GPIOPort{
public:
Key(gpio_Pin pin);
bool isOn();
};
#endif /* SOURCES_KEY_H_ */
|
//
// Created by fab on 25/02/2020.
//
#include "../../../headers/rendering/helper/Time.hpp"
Time Time::instance; |
#include "CApplication.h"
#include "Controller.h"
#include <QFileOpenEvent>
#include <QObject>
#include <QtWidgets>
int main(int argc, char *argv[]) {
CApplication app(argc, argv);
app.setApplicationName("Controller");
SynthController controller;
controller.show();
CApplication::connect(&app, &CApplication... |
#include "catch.hpp"
#include "../unit/Soldier.h"
TEST_CASE( "Tests for Soldier class" ) {
int hp = 150;
Soldier* soldier = new Soldier();
REQUIRE( soldier->getHP() == hp );
REQUIRE( soldier->getHPLimit() == hp );
REQUIRE( soldier->getDmg() == 20 );
REQUIRE( soldier->getTitle() == "Soldier" );... |
//
// Created by seafood on 2020-09-28
//
#ifndef _STATE_TRACKING_TARGET_H_
#define _STATE_TRACKING_TARGET_H_
#include "kalmanfilter.h"
#include "stateSearchingTarget.h"
#include <opencv2/tracking.hpp>
class StateTrackingTarget{
public:
bool run(cv::Mat &srcImage,cv::Mat &processImage,ArmorBox &target_box, Kalman ... |
#include "caffe2/operators/db.h"
namespace caffe2 {
namespace db {
DEFINE_REGISTRY(Caffe2DBRegistry, DB, const string&, Mode);
} // namespacd db
} // namespace caffe2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.