text stringlengths 8 6.88M |
|---|
#ifndef module_h
#define module_h
#include <sys/types.h>
#include <assert.h>
#include <cstddef>
#include <iostream>
#define SOCKET_TCP_BUFFER 1024 * 256
#define SOCKET_ERROR -1
#define SOCKET_CLOSE 0
namespace KernelEngine {
/**
* 网络引擎 接口定义
*/
class ITCPNetworkEngine
{
public:
... |
#ifndef _D3D_H_
#define _D3D_H_
#include <wrl\client.h>
#include <memory>
#include <Windows.h>
#include <stdio.h>
#include <d3d11.h>
#include <CommonStates.h>
#pragma once
class D3D
{
public:
D3D();
~D3D();
bool Initialize(HWND hwnd, int outputWidth, int outputHeight);
bool Present();
bool Clear();
void upd... |
#include <stdio.h>
#include <string.h>
int main(void)
{
char a[10] = "aaaa";
char b[5] = "aaaa";
strcat(a, b);
puts(a);
return 0;
}
|
#include "BTTask_UpdateTrackingPosition.h"
#include "Actor/Controller/EnemyController/EnemyController.h"
using namespace EBTNodeResult;
EBTNodeResult::Type UBTTask_UpdateTrackingPosition::ExecuteTask(
UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
Super::ExecuteTask(OwnerComp, NodeMemory);
AEnemyContro... |
#include "ventaviewer.h"
#include "clienteviewer.h"
#include "tipoviewer.h"
#include "articuloviewer.h"
#include "articulodao.h"
VentaViewer::VentaViewer()
{
//ctor
}
VentaViewer::~VentaViewer()
{
//dtor
}
int VentaViewer::menu()
{
int opcion;
cout << endl << endl << "MENU" << endl << end... |
#include<iostream>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j) for(i=j;i>=0;i--)
#define MAX(a,b) (a)>(b)?(a):(b)
using namespace std;
int main()
{
int Mi[2002],Md[2002],A[2002],n,testcases,curri,currd;
int i,j,count;
cin>>testcases;
while(testcases--)
{
... |
/* Copyright 2016 tgil All Rights Reserved */
#include "ui/Event.hpp"
using namespace ui;
Event::Event() {
// TODO Auto-generated constructor stub
m_type = NONE;
m_objects.object = 0;
}
|
#pragma once
class Maths
{
public:
struct xyz { float x, y, z; };
struct Plane
{
xyz normal; /*the normal to the plane*/
float d; /* the 'd' constant in the equation for this plane*/
};
float Dot(xyz* v1, xyz* v2);
xyz Cross(xyz* v1, xyz* v2);
xyz Normal(xyz* v1, xyz* v2, xyz* v3);
Plane TrianglePlane(xy... |
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
// parameters are commented
// string read_month_name(string); // month name
// int print_month(string, string, int, int); // first day, last day, no of days, month name
// void print_heading(int); // year
// int get_start... |
/*
* Copyright [2017] <Bonn-Rhein-Sieg University>
*
* Author: Torsten Jandt
*
*/
#pragma once
#include <mir_planner_executor/actions/place/base_place_action.h>
#include <actionlib/client/simple_action_client.h>
#include <mir_yb_action_msgs/PlaceObjectAction.h>
class PlaceAction : public BasePlaceA... |
//--------------------------------------------------------
// CS 215 - Fall 2018
// Project 3: The New Link Blue
//--------------------------------------------------------
#include <iostream>
#include "userint.h"
int main() {
// create the app and start it!
userint x;
x.go();
syste... |
// DEMO : https://www.instagram.com/p/CPGtv9Khelz/
// OLED
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 0 // GPIO0
Adafruit_SSD1306 display(OLED_RESET);
#define OLED_w 128
#define OLED_h 64
int cmode = 0;
int counter = 0;
float delta = 0;
float delta_t = 0.1;
void setup()
{
Serial.be... |
#include "button.h"
RRG::Button::Button() {
}
RRG::Button::~Button() {
}
|
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) Opera Software ASA 1999 - 2006
*
* Data types allocated on the garbage collected heap.
*
* @author Lars T Hansen
*/
#ifndef ES_BOXED_H
#define ES_BOXED_H
/* The data allocated on the GC heap are POD-structs in the s... |
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Texture.h"
#include "CinderOpenNI.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class SimpleViewerApp : public AppNative {
public:
void prepareSettings(Settings *settings);
void setup();
void mouseDown( MouseE... |
#include <iostream>
#include <cstdlib>
using namespace std;
// prototype
int* create2DArray(int rows, int columns);
void set(int *arr, int rows, int columns, int desired_row, int desired_column, int val);
int get(int *arr, int rows, int columns, int desired_row, int desired_column);
int main()
{
int rows = 2, colum... |
#pragma once
#include "Score.h"
class PlayersScore {
Score current;
Score score[4][10];
public:
PlayersScore() = default;
~PlayersScore() = default;
void Load();
void Save() const;
void Draw() const;
Score* getScore(int diff);
}; |
int main() {
/// TODO 0.改测例
vector<pair<vector<int>, bool>> test_cases = {
{{0, 1}, false},
{{2, 0, 0}, true},
{{3, 2, 1, 0, 4}, false},
{{2, 3, 1, 1, 4}, true},
};
int passed = 0;
auto solver = Solution();
for (const auto& i : test_cases) {
/// TODO 1. ... |
/* Um comerciante comprou um produto e quer vendê-lo com lucro de 35% se o valor
da compra for menor que 300,00; caso contrário, o lucro será de 50%.
Entrar com o valor do produto e imprimir o valor da venda. */
#include<stdlib.h>
#include<stdio.h>
main(){
float lucro, produto;
printf("Digite o v... |
// Created on: 1994-08-25
// Created by: Jacques GOUSSARD
// Copyright (c) 1994-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 G... |
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <cwchar>
#include "In.h"
#include "Error.h"
namespace In {
IN getin(wchar_t infile[])
{
IN tempIN;
tempIN.size = 0;
tempIN.lines = 0;
std::ifstream fin;
std::string Buff;
unsigned char textTemp[IN_MA... |
#pragma once
#include <QWidget>
#include <QStringList>
#include <QTableWidgetItem>
#include "Entities/Question/Question.h"
#include "Forms/AddPartOfKeyForm/AddPartOfKeyForm.h"
class Scale;
class Key;
namespace Ui {
class ScaleForm;
}
class KeyForm : public QWidget {
Q_OBJECT
public:
explicit KeyForm(Scale ... |
#include "Unit.hpp"
// Unit class is well implemented, no need to change it
Unit::Unit(SDL_Renderer* rend, SDL_Texture* ast): gRenderer(rend), assets(ast){
}
void Unit::draw(SDL_Rect srcRect, SDL_Rect moverRect){
SDL_RenderCopy(gRenderer, assets, &srcRect, &moverRect);
} |
//
// LinkedUnsorted.h
//
//
// Created by Luke Winker on 7/20/18.
//
//
#include <stdio.h>
#include "ItemType.h"
struct NodeType
{
ItemType info;
NodeType* next;
};
class LinkedUnsortedType {
public:
LinkedUnsortedType();
~LinkedUnsortedType();
void MakeEmpty();
bool IsFull() const;
int GetLength() con... |
#ifndef PILA_H
#define PILA_H
#include "Nodo.h"
#include <iostream>
#include <stdlib.h>
using namespace std;
class Pila
{
private:
Nodo* tope;
public:
Pila(){
tope = NULL;
}
void push(int v){
tope = new Nodo(v,tope);
}
int cima(void){
... |
#include <iostream>
using std::ostream;
using std::istream;
class Array{
friend ostream &operator<<(ostream &, const Array &);
friend istream &operator>>(istream &, const Array &);
public:
Array(int = 10);
Array(const Array &);
~Array();
int getTamanio() const;
cons... |
#ifndef IO_H
# define IO_H
# include "character.h"
class dungeon;
void io_init_terminal(void);
void io_reset_terminal(void);
void io_display(dungeon *d);
void io_handle_input(dungeon *d);
void io_queue_message(const char *format, ...);
int io_select_item(dungeon *d);
void io_list_free_inv(dungeon *d);
void io_list_e... |
#include "Produce.h"
PassengerCar* Produce::create_passenger_car(UserInterface* ui)
{
PassengerCar* car = new PassengerCar;
ui->passenger_car_alert();
double weight;
while (true)
{
ui->vehicle_weight_req();
std::cin >> weight;
if (ui->check_symbols() || weight < 0 || weight > 2500)
{
ui->problem_value(... |
#include <fstream>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
//#include <vector.h>
#include <iostream>
#include <string>
#include <string.h>
#include <iomanip>
#include <sstream>
#include "TH2D.h"
#include "TF1.h"
#include "TH1D.h"
#include "TCanvas.h"
#include "TStyle.h"
#include "TRandom3.h"
#include "... |
#ifndef __RECTANGLE_H__
#define __RECTANGLE_H__
// Library Includes
#include <windows.h>
#include <windowsx.h>
#include "shape.h"
class CRectangle : public IShape {
public:
CRectangle();
CRectangle(EBRUSHSTYLE _iBrushStyle, int _iHatchStyle, COLORREF _FillColor, int _iPenWidth, int _iPenStyle, COLORREF _PenColor)... |
#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 10e10
#define REP(i,n) for(int i=0; i<n; i++)
#define R... |
#include <iostream>
void allocatedMatrix(char**& matrix, int row) {
matrix = new char*[row];
for (int i = 0; i < row; ++i) {
matrix[i] = new char[row];
}
}
void deleteMatrix(char**& array, int size) {
for (int i = 0; i < size; ++i) {
delete[] array[i];
}
delete[] array;
}
void... |
#ifndef CARTSCREEN_H
#define CARTSCREEN_H
#include <QDialog>
//#include "usertype.h"
#include "productType.h"
namespace Ui {
class cartscreen;
}
class cartscreen : public QDialog
{
Q_OBJECT
public:
explicit cartscreen(QWidget *parent = nullptr);
~cartscreen();
private slots:
v... |
#include <iostream>
#include "Networking/Auth/SG_AuthServer.h"
#include "Networking/MMO/SG_MmoServer.h"
#include "Networking/Lobby/SG_LobbyServer.h"
#include "Networking/Relay/SG_RelayServer.h"
#include "Networking/Message/SG_MessageServer.h"
#include "Tools/Database/Database.h"
#include "Tools/SG_Logger.h"
#include ... |
/*!
* \file mpostdialog.cpp
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Implementation of mpost dialog
*/
#include <QtGui>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "./mpostdialog.h"
MpostDialog::MpostDialog(MemoryModel * m, QWidget *parent)
... |
#include <iostream>
using namespace std;
int mabs(int x){
if(x < 0) return -x;
return x;
}
int find(int x, int *a, int n){
int l = 0;
int r = n - 1;
int m;
while(l < r){
m = (l + r) / 2;
if(x > a[m]) l = m + 1;
else r = m;
}
int d1 = mabs(x - a[m]);
int d2 = mabs(x - a[r]);
int d3 = mabs(x - a[r-... |
#include<iostream>
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstdio>
#include<cfloat>
using namespace std;
double EPS = 1.0e-6;
struct point{
double x,y;
point(){}
point(double a, double b){x=a;y=b;}
};
double dist(point p){
return sqrt(p.x*p.x + p.y*p.y);
}
bool hits(double d, point p, poin... |
#include <iostream>
using namespace std;
int main()
{
float x1, x2, x3, y1, y2, y3;
float area;
cout << "Bienvenido a este programa, Creado por Seba20xx\n";
cout << "Digite la primera coordenada de x\n";
cin >> x1;
cout << "Digite la primera coordenada de y\n";
cin >> y1;
cout << "Digite la segunda coordenada ... |
const int pinLed = 9;
const int pinBoton = 3;
const int pinEjeY = A1;
const int pinEjeX = A0;
int estadoBoton =0;
void setup() {
pinMode(pinBoton, INPUT);
digitalWrite(pinBoton, HIGH);
Serial.begin(9600);
}
void loop() {
estadoBoton= digitalRead(pinBoton);
Serial.println(estadoBoton);
... |
#pragma once
#include <iostream>
#include <vector>
#include<list>
#include <math.h>
struct Vector2
{
Vector2() : x(0), y(0){}
Vector2(float X, float Y) : x(X), y(Y) {}
float x;
float y;
float Magnitude()
{
return sqrt(x * x + y * y);
}
};
struct Edge;
namespace Pathfinding
{
... |
// Copyright 2012 Yandex
#ifndef LTR_LEARNERS_DECISION_TREE_DECISION_TREE_H_
#define LTR_LEARNERS_DECISION_TREE_DECISION_TREE_H_
#include <map>
#include <cmath>
#include <string>
#include <vector>
#include <stdexcept>
#include "boost/weak_ptr.hpp"
#include "logog/logog.h"
#include "ltr/learners/decision_tree/condi... |
#pragma once
#include "Render/DrawBasic/BufferLayout.h"
namespace Rocket
{
Interface VertexBuffer
{
public:
virtual ~VertexBuffer() = default;
virtual void Bind() const = 0;
virtual void Unbind() const = 0;
virtual void SetData(const void* data, uint32_t size) = 0;
virtual const BufferLayout& GetLayout... |
/****************************************************************************
** Meta object code from reading C++ file 'newdvrnvrdialog.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************... |
// internal
#include "render_system.hpp"
#include <array>
#include <fstream>
#include "../ext/stb_image/stb_image.h"
// This creates circular header inclusion, that is quite bad.
#include "tiny_ecs_registry.hpp"
// stlib
#include <iostream>
#include <sstream>
// World initialization
bool RenderSyst... |
#pragma once
template<typename T>
class RangedFunction
{
public:
virtual T Compute(T argument) const = 0;
virtual T GetMinArgument() const = 0;
virtual T GetMaxArgument() const = 0;
virtual ~RangedFunction() = default;
};
|
/*
* Ultrasonic Sensor HC-SR04 and Arduino Tutorial
*
* by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
// defines pins numbers
const int sensorOneTrigPin = 6;
const int sensorOneEchoPin = 7;
const int sensorTwoTrigPin = 9;
const int sensorTwoEchoPin = 10;
// defines variables
long durationOne, durationTwo;
i... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using PriorityQueue = std::priority_queue<int, std::vector<int>, std::greater<int>>;
int calculateLoopCount(PriorityQueue &queue) {
int count = 0;
while (queue.size() > 1) {
int num = queue.top();
queue.pop();
num += queue.top... |
#pragma once
#include "QsoItem.h"
class Qso;
class DxccCountry;
class Location : public QsoItem
{
public:
Location(Qso* qso);
virtual ~Location();
// Return true if location is valid
// Return false if location is invalid and set error string
bool Validate(const set<string>& validLo... |
#ifndef __AI_MANAGER_H__
#define __AI_MANAGER_H__
typedef enum {
AITEAM_MARINE,
AITEAM_STROGG,
AITEAM_NUM
} aiTeam_t;
typedef enum {
AITEAMTIMER_ANNOUNCE_TACTICAL, // Tactical change
AITEAMTIMER_ANNOUNCE_SUPPRESSING,
AITEAMTIMER_ANNOUNCE_SUPPRESSED,
AITEAMTIMER_ANNOUNCE_FRIENDLYFIRE, // Shot by a te... |
// -----------------------------------------------------------------------------
// G4Basic | TrackingAction.h
//
// User run action class.
// -----------------------------------------------------------------------------
#ifndef TRACKING_ACTION_H
#define TRACKING_ACTION_H
#include <G4UserTrackingAction.hh>
class G... |
/** InsanePixels ************************************************************************************/
/* */
/* SOLUTION: InsaneWare */
/* PROJECT: Runtime */
/* FOLDER: Launcher/Windows */
/* FILE: InsaneWareLauncher.cpp */
/... |
/*!
* \file sortdelegate.cpp
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Implementation of message sort delegate
*/
#include <QtGui>
#include "./sortdelegate.h"
#include "./sortdialog.h"
#include "./messagesort.h"
SortDelegate::SortDelegate(Machine * m, C... |
#include "position.hpp"
#include <cmath>
position::position(double x, double y, double z)
:
x(x),
y(y),
z(z)
{
}
double position::ETEDist() {
return sqrt(x * x + y * y + z * z);
}
void position::set(double x, double y, double z) {
this->x = x;
this->y = y;
this->z = z;
}
|
// #pragma GCC optimize("Ofast")
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <iterator>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
void abhisheknaiid... |
#include "RayTracer.h"
RayTracer::RayTracer() {
}
void RayTracer::createImage() {
cout << "Creating BMP..." << endl;
bmp.createBMP(512, 512, "output");
cout << "Size of BMP: " << bmp.width << " x " << bmp.height << endl;
bmp.setInitialBMPColor(0, 0, 0);
}
void RayTracer::setupCamera() {
cout << "Setting up ca... |
// Created on: 1995-12-04
// Created by: Laurent BOURESCHE
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the ... |
#ifndef CRYPTOVIEW_H
#define CRYPTOVIEW_H
#include "coin.h"
#include <coin_db.h>
#include <QMainWindow>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QLabel>
#include <QMap>
#include <QList>
#include "socketclient.h"
#include "httpclient.h"
#include "candlestickdialog.h"
namespace Ui {
class Cr... |
/*
* Item.cpp
*
* Created on: Aug 16, 2016
* Author: Kevin Koza
*/
#include "Item.h"
#include <iostream>
#include <cstddef>
namespace std {
Item::Item() {
// TODO Auto-generated constructor stub
name = "\0";
}
Item::Item(string n){
name = n;
}
Item::~Item() {
// TODO Auto-generated destructor stub
}
... |
//Recurssion+Memoization
int solve(int A, vector<int> & dp){
if(A<0) return 0;
if(A==0) return 1;
if(dp[A]!=-1) return dp[A];
return dp[A]=solve(A-1,dp)+solve(A-2,dp);
}
int Solution::climbStairs(int A) {
if(A<0) return 0;
if(A==0) return 1;
vector<int> dp(A+1,-1);
return solve(A,dp);
}
... |
#pragma once
class unitTest
{
public:
unitTest();
~unitTest();
// true ha a,b,c egyenlőek és d hamis, egyébként hamis
bool functionToTest1(bool a, bool b, bool c, bool d);
// ha a és b és c igaz de d hamis akkor az f2() igaz, egyébként hamis
bool functionToTest2(bool a, bool b, bool c, bool d);
//... |
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
//基本思想:位运算,将nums中所有元素异或得到的就是所求元素a和b不进位的相加结果x
//那么x的第一个非0位n就是a和b在第n位上互为0和1,所以可以将nums中所有元素在第n位上是0或1分成两类,这两类元素分别异或就得到了a和b值
int a=0,b=0;
int... |
/*
* ×î¶ÌÅÅÐò×ÓÊý×é
*/
#include <bits/stdc++.h>
using namespace std;
class Solution{
public:
int shortest_sort_subsequence(vector<int> &nums){
if(nums.empty() || nums.size() < 2){
return 0;
}
int left = 0;
int right = nums.size() - 1;
int max = nums[0];
... |
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include "ShellState.h"
#include "ShellContext.h"
#include "transport/TTransportException.h"
using namespace std;
using namespace apache::thrift::transport;
const char * PMT = ">> ";
void ShellStateStart::run(ShellContext * c) {
if(!c->P... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 2008-2009 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 WIDGETS_IMS_SUPPORT
#include "modules/wi... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 2004-2008 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*
* Yngve N. Pettersen
*/
#include "core/pch.h"
#ifdef SELFTEST
... |
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
//
// Copyright (C) 2003-2012 Opera Software ASA. All rights reserved.
//
// This file is part of the Opera web browser. It may not be distributed
// under any circumstances.
//
// Julien Picalausa
//
#include "platforms/windows_common/utils/... |
#include "StdAfx.h"
#include "Gt2DSequence.h"
GnImplementRTTI(Gt2DSequence, Gn2DSequence);
Gt2DSequence::Gt2DSequence(void)
{
}
Gt2DSequence::~Gt2DSequence(void)
{
}
void Gt2DSequence::ChangeTextureFile(gtuint uiAniIndex, gtuint aniInfoIndex, const char* pcFileName)
{
SetModifed( true );
Gn2DTextureAni* ani = Ge... |
/** Kabuki SDK
@file /.../Source/Kabuki_SDK-Impl/_G/Layer.h
@author Cale McCollough
@copyright Copyright 2016 Cale McCollough ©
@license Read accompanying /.../README.md or online at http://www.boost.org/LICENSE_1_0.txt
*/
#include "Entity.h"
namespace _G {
/** */
struct Layer
{
En... |
#include "aeResourceManager.h"
namespace aeEngineSDK
{
aeTexture2DResource::aeTexture2DResource()
{
}
aeTexture2DResource::aeTexture2DResource(const aeTexture2DResource &TR)
{
*this = TR;
}
aeTexture2DResource::~aeTexture2DResource()
{
}
void aeTexture2DResource::Release()
{
}
inline void aeTexture2... |
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
int visited[51] = {
0,
};
bool wordFind(const string &curStr, const string &nextStr, const int &wSize) {
int overlapCnt = 0;
for (int i = 0; i < wSize; i++) {
if (curStr[i] == nextStr[i]) {
overlapCnt++;
... |
#include<iostream>
#include<cmath>
class Fraction
{
private:
int numerator, denominator;
public:
Fraction()
{
numerator = 1;
denominator = 1;
}
Fraction(int n, int d)
{
if(d==0){
numerator=0;
denominator=0;
throw "ERROR: ATTEMPTING ... |
#pragma once
#include "ElementSketch.h"
namespace siu {
/**
* Элемент эскиза в виде цельного физического тела.
*/
struct PhysicsSolidES : public ElementSketch {
typedef double density_t;
explicit inline PhysicsSolidES(
const std::string& nick
) :
ElementSketch( nick ),
densi... |
/*
Given a binary search tree and data of two nodes, find 'LCA' (Lowest Common Ancestor) of the given two nodes in the BST.
LCA
LCA of two nodes A and B is the lowest or deepest node which has both A and B as its descendants.
Note:
1. If out of 2 nodes only one node is present, return that node.
2. If both are not pr... |
// https://oj.leetcode.com/problems/spiral-matrix/
class Solution {
void find_order(vector<vector<int> > &matrix, vector<int> &ret,
int row_from, int row_to, int col_from, int col_to) {
if (row_from > row_to || col_from > col_to) {
return;
}
// go right
... |
#include "clockMenus.h"
int clockMenus::checkKeyPress() {
if ((GetAsyncKeyState(0x51) & 0x01)) { // 'q' key for 'quit'
return 0;
}
else if ((GetAsyncKeyState(0x49) & 0x01)) { // 'i' key for 'info'
return 3;
}
else if ((GetAsyncKeyState(0x4C) & 0x01)) {
return 4;
}
else { // nada, keep going
... |
#include <iostream>
#include <cstdio>
#include <assert.h>
int main() {
freopen("crypto.in", "r", stdin);
freopen("crypto.out", "w", stdout);
int n, a, b;
long long ans = -1;
int outx, outy;
std::cin >> n >> a >> b;
for (int x = 1; x <= n; ++x) {
for (int y = x; y; y = (y - 1) & x)... |
#pragma once
#include <string>
#include <sstream>
class Converter
{
public:
static std::string intToString(int);
}; |
#include <iostream>
#include "Execute.h"
using namespace std;
char* catalog_path = "catalog";
char* dbfile_dir = "bin/";
char* tpch_dir = "../tables";
int main (int argc, char* argv[]) {
Execute execute;
execute.run();
return 0;
}
|
/*
** EPITECH PROJECT, 2018
** cpp_indie_studio
** File description:
** Map.cpp
*/
#include "Map.hpp"
void Map::createMap(int width, int height)
{
std::vector<MapCase> v;
struct MapCase m;
m._food = 0;
m._stone1 = 0;
m._stone2 = 0;
m._stone3 = 0;
m._stone4 = 0;
m._stone5 = 0;
m._stone6 = 0;
for(int i = 0; i... |
#pragma once
#include "ISceneChanger.h"
#include "object\Object.h"
#include <array>
#include <vector>
#include <memory>
#include "Image.h"
#include "Sound.h"
#include "misc\Input.h"
using namespace std;
class Scene {
protected:
bool CustomObjectActive;
bool IsActive;
int sceneCounter;
ISceneChanger *mChanger;
v... |
#include <iostream>
#include <queue>
using namespace std;
struct Node
{
int data;
struct Node *left, *right;
};
void print(Node* root)
{
if (root == nullptr)
return;
// 队列是FIFO,所以能保证按照parent,left,right方式打印
std::queue<Node*> printing_queue;
printing_queue.push(root);
while (... |
#include "CGame.h"
#define VAR_CGame__currArea 0xB72914
__int32& CGame::currArea = *(__int32*)VAR_CGame__currArea;
void CGame::TidyUpMemory(bool arg1, bool arg2)
{
((void (__cdecl *)(bool, bool))0x53C500)(arg1, arg2);
} |
#include "stdafx.h"
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <vector>
#include "connection.hpp" // Must come before boost/serialization headers.
#include <boost/serialization/vector.hpp>
#include "stock.hpp"
/// The data to be sent t... |
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
//
// Copyright (C) 1995-2003 Opera Software ASA. All rights reserved.
//
// This file is part of the Opera web browser. It may not be distributed
// under any circumstances.
//
// Morten Stenshorne, Espen Sand
//
// Platform dependency: UNIX
... |
namespace my {
template<typename T>
class complex {
public:
complex(T const& re = T{}, T const& im = T{});
complex(complex const&);
template<typename U>
complex(complex<U> const&);
complex<T> &operator=(complex const&);
complex<T> &operator=(T const&);
complex<T> &operator+=(T const&);
... |
#include <QHostAddress>
#include "buttonadapter.h"
ButtonAdapter::ButtonAdapter(QObject *parent) : AdapterBase(parent)
{
setDataPort(&m_tcpSocket);
}
void ButtonAdapter::setAddress(QString address)
{
if (m_address == address)
return;
m_tcpSocket.connectToHost(QHostAddress(address), 5555);
i... |
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;
struct ListNode{
int val;
ListNode* next;
ListNode(int x):val(x),next(NULL){}
};
void printLL(ListNode* head){
ListNode* temp = head;
while(temp!=NUL... |
/*
* Robot_Thread.cpp
*
* Created on: 25 janv. 2012
* Author: adrien
*/
#include "Robot_Thread.h"
#include <pthread.h>
#include <math.h>
#include <semaphore.h>
#include <iostream>
sem_t sem_pos;
/* Permet de stocker la position actuelle du robot 1 */
Robot robot1;
/* Permet de stocker la position actu... |
#ifndef Scaler_h
#define Scaler_h
#include "Arduino.h"
class Scaler
{
public:
Scaler();
float ScaleAnalogInput(int analogInput);
float VoltToCelsius(float voltage);
private:
int _resolution;
int _maxVolt;
int _minVolt;
int _maxTemp;
int _minTemp;... |
/*
* 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 <folly/ScopeGuard.h>
#include <quic/dsr/frontend/WriteFunctions.h>
namespace quic {
uint64_t writePacketizationRequest(... |
#ifndef _NIHTTPD_TEST_ROUTE_H
#define _NIHTTPD_TEST_ROUTE_H 1
#include <nihttpd/nihttpd.h>
#include <nihttpd/socket.h>
#include <nihttpd/http.h>
namespace nihttpd {
class test_router : public router {
public:
test_router( ) : router( "/", "/srv/http" ){ };
test_router( std::string pref ) : ... |
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<cstdlib>
#include<cstring>
using namespace std;
char score2grade(int score){
if(score >= 80) return 'A';
if(score >= 70) return 'B';
if(score >= 60) return 'C';
if(score >= 50) return 'D';
else return 'F';
}
string to... |
#include "mutiplex/Timestamp.h"
#include <sys/time.h>
namespace muti
{
#define MICROSECONDS_PER_SECOND (1000 * 1000)
uint64_t Timestamp::current()
{
struct timeval tv;
gettimeofday(&tv, nullptr);
return static_cast<uint64_t>(tv.tv_sec * MICROSECONDS_PER_SECOND + tv.tv_usec);
}
std::string Timestamp::t... |
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
//
// Copyright (C) 1995-2011 Opera Software AS. All rights reserved.
//
// This file is part of the Opera web browser. It may not be distributed
// under any circumstances.
//
// Adam Minchinton
//
#ifndef __COMMANDLINE_MANAGER_H__
#define _... |
#include <entt.hpp>
template <typename ...Components, typename Func>
double iterate_view(entt::registry<std::uint64_t> &ecs, int n_iter, Func func) {
double result = 0;
for (int i = 0; i < n_iter; i ++) {
struct timespec start; timespec_gettime(&start);
ecs.view<Components...>().each(func);
... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2003 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 DOM2_EVENTS_API
#include "modules/do... |
#include <bits/stdc++.h>
using namespace std;
ofstream fout ("loan.out");
ifstream fin ("loan.in");
int main(){
long long N,K,M;
fin>>N>>K>>M;
long long left = 1;
long long right = K;
while(right-left>0){
long long x= ceil((left+right)/2.0);
long long k = 0;
long long cur = ... |
#ifndef TEXTREADER_H
#define TEXTREADER_H
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
#include "CLArguments.h"
namespace cppag
{
class Textreader
{
public:
Textreader(std::string loc);
bool read ();
std::string getContent ();
... |
#include "compute.h"
#include "auxCmd.h"
#include "FactoryIO.h"
#include "IO.h"
#include "ColmapIO.h"
#include "JacobianIO.h"
#include "JacobianComposer.h"
#ifdef USE_MATLAB
#include <mex.h>
#include "matlabInterface.h"
#include "uncertainty_mex.h"
#endif
#ifdef _WIN32
#define EXECUTABLE_FIL... |
// Copyright 2012 Yandex
#ifndef LTR_SERIALIZATION_TEST_GENERATOR_GENERATOR_UTILITY_H_
#define LTR_SERIALIZATION_TEST_GENERATOR_GENERATOR_UTILITY_H_
#include <string>
#include "ltr/data/data_set.h"
#include "ltr/learners/learner.h"
using std::string;
using ltr::DataSet;
using ltr::Object;
using ltr::Learner;
name... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.