text stringlengths 8 6.88M |
|---|
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_set;
typedef tuple<ll, ll, ll> tp;
typedef pair<ll, ll> pr;
const ll... |
# include <stdio.h>
void exchange_2(int * c, int * d)//c是int*,int是*c;c,d可以不用写 ,形参里卖只有写(int*,int*)
{
int t;
t = *c;
*c = *d;
*d = t;
}
int main(void)
{
int a = 5;
int b = 6;
exchange_2(&a, &b);//&c和a对应,&d和b对应
printf("a = %d, b = %d\n", a, b);
return 0;
}
//不能改变a,b的值
/*
# include <stdio.h>
void exchang... |
//621 - Secret Research
//Dept. ICE, NSTU-11 Batch
#include<bits/stdc++.h>
using namespace std;
//#define INF 99999999
#define INF 1<<28
#define ll long long
#define SZ 100009
#define MX 100000000
#define sfint(a) scanf("%d",&a)
#define sfllint(a) scanf("%lld",&a)
#define sfch(a) scanf("%c",&a)
#define sfchsq(a) scanf(... |
// RetrieveDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Retrieve.h"
#include "RetrieveDlg.h"
#include<shlwapi.h>
#pragma comment(lib,"Shlwapi.lib") //如果没有这行,会出现link错误
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
int xyRetrieveFields_Ref... |
#include <iostream>
#include <vector>
using namespace std;
namespace Chess {
int N;
vector<vector<int>> Moves;
struct Pos {
Pos(int row, int col):Row(row),Col(col)
{}
int Row;
int Col;
};
void Init()
{
cin >> N;
Moves = vector<vector<int>>();
... |
#include "Camera.h"
Camera::Camera(int ScreenWidth, int ScreenHeight)
{
std::cout << "Created Camera" << std::endl;
//m_pplayer = player;
m_ScreenWidth = ScreenWidth;
m_ScreenHeight = ScreenHeight;
}
Camera::~Camera()
{
}
int Camera::GetScreenWidth()
{
return m_ScreenWidth;
}
int Camera::GetScreenHeight()
{
... |
#include<cstdio>
#include<iostream>
#include<queue>
using namespace std;
struct node
{
int n;
friend bool operator<(node a,node b)
{
return a.n>b.n;
}
} a;
int main()
{
int T,t,n;
priority_queue<node>q;
while( ~scanf("%d%d",&T,&t))
{
while(T--)
{
c... |
#include <glm/gtc/type_ptr.hpp>
#include "Shader.h"
using namespace std;
using namespace glm;
// Compile |source| as a shader program of the indicated type. Throw
// any compile errors as an exception. Return shaderId on success.
GLuint Shader::CompileShader(const char *source, GLenum shdType) {
int ok;
con... |
/*************************************************************
* > File Name : UVa12995.cpp
* > Author : Tony
* > Created Time : 2019/05/07 15:51:27
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
long ... |
#include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int nota=0;
cout<<"Ingrese la nota que obtuviste: ";
cin>>nota;
if(nota>100 || nota<0)
{
cout<<"Ingrese una nota entre 0 y 100: ";
return 0;
}
if(nota>=95 && nota<=100)
{
... |
#include<stdio.h>
int search(int arr1[],int arr2[]);
int main(){
int m,n;
scanf("%d",&m);
int arr1[m];
for(int i=0;i<m;i++)
scanf("%d",&arr1[i]);
scanf("%d",&n);
int arr2[n];
for(int i=0;i<n;i++)
scanf("%d",&arr2[i]);
//two piont
int i=m-1;
int j=n-1;
int result;
while(i>0&&j>0){
result=arr1[i]+arr2... |
#include "ParkRide.h"
int ParkRide::numOfParkRides = 0; //initialize static variable to zero
ParkRide::ParkRide()
{
numOfParkRides++; //Not sure ABOUT ANYTHING HERE
rideName = "uninitialized";
}
ParkRide::ParkRide(string name) //initialize park ride with name and increment # of total rides
{
numOfParkRides++;
... |
#include "toolbox.h"
#include <QLabel>
#include <QScrollArea>
#include <QVBoxLayout>
#include <QMouseEvent>
#include <QStyleOption>
#include <QPainter>
#include <QPropertyAnimation>
class Header : public QFrame {
public:
Header(QWidget *parent = Q_NULLPTR) : QFrame(parent) {
setFrameShape(QFrame::StyledPa... |
/*macro definitions of Rotary angle sensor and LED pin*/
/* borrowed from https://github.com/Seeed-Studio/Rotary_Angle_Sensor/blob/master/examples/ControlLEDBrightness/ControlLEDBrightness.ino */
#define ROTARY_ANGLE_SENSOR A0
#define LED 3 //the Grove - LED is connected to D3 of Arduino
#define ADC_REF 5 //reference v... |
#ifndef _GLX_MATH_QUAT_INL_H_
#define _GLX_MATH_QUAT_INL_H_
inline glx::quat& glx::quat::operator += (const quat& q)
{
x += q.x;
y += q.y;
z += q.z;
w += q.w;
return *this;
}
inline glx::quat& glx::quat::operator -= (const quat& q)
{
x -= q.x;
y -= q.y;
z -= q.z;
w -= q.w;
return *this;
}
inline glx::q... |
#include "customtitle.h"
#include <QLabel>
#include <QPushButton>
#include <QHBoxLayout>
#include <QMouseEvent>
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
#include "Common/commdef.h"
CustomTitle::CustomTitle(QWidget *parent,bool maxmin,LoadRes* pRes) : QWidget(parent)
{
this->setAutoFillBackgrou... |
// String.cpp
//
// ICS 46 Winter 2021
// Project #0: Getting to Know the ICS 46 VM
//
// Implement all of your String member functions in this file.
//
// Note that the entire standard library -- both the C Standard
// Library and the C++ Standard Library -- is off-limits for this
// task, as the goal is to exercise y... |
//
// main.cpp
// https://open.kattis.com/problems/spavanac
//
// Created by Sofian Hadianto on 26/12/18.
// Copyright © 2018 Sofian Hadianto. All rights reserved.
//
#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char * argv[]) {
ios::sync_with_stdio(false);
cin.tie(NULL);
... |
#include <cstdio>
#include <iostream>
using namespace std;
// #define DEBUG
const int MAXN = 10005;
int n, qx, qy;
struct Carpet {
int x, y, w, h;
Carpet() {}
Carpet(int _x, int _y, int _w, int _h)
: x(_x)
, y(_y)
, w(_w)
, h(_h) {}
};
Carpet carpet[MAXN];
bool in(int index... |
#pragma once
#include"ArkRcon.h"
#include"ArkUpdate.h"
#include"ArkModsUpdate.h"
#include"CmdLineApplicationBase.h"
#define COUT(str) std::cout<<MyLog::UTF8toGBK(str)<<std::endl;
//#define COUT(str) std::cout<<str<<std::endl;
#define CIN(str) std::cin>>str;
#define CINUTF8(str) std::cin>>str;str=MyLog::GBKtoUTF8(str)... |
#include "Element.h"
Element::Element(const std::string &name, const int price, const int number)
{
m_name = name;
m_price = price;
m_number = number;
}
const std::string &Element::getName() const
{
return m_name;
}
const int Element::getPrice() const
{
return m_price;
}
const int Element::getNu... |
/*
William F. Sampson
williamsampson44444@gmail.com
wsampson
Assignment 8: Breadth-First Search
4/27/17
main.cpp
Full program for Breadth-First Search Program.
Status: Complete
*/
#include <iostream>
#include <vector>
#include <queue>
#include <cctype>
using namespace std;
int main(){
string input... |
#include <iostream>
#include <string>
#define ll long long
using namespace std;
int edit_distance(const string &str1, const string &str2) {
int dp[str1.length() + 1][str2.length() + 1] = {0};
ll i =str1.length();
ll j = str2.length();
for(ll a=0; a <=i;a++)
{
for(ll b=0; b<=j;b++)
{
if(a==0)
{
dp[a... |
// SimulationDocumentManager.cpp: implementation of the SimulationDocumentManager class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SimulationDocumentManager.h"
//////////////////////////////////////////////////////////////////////
// Construction... |
/**
* [Question]
* - 1つのパスの中で片方向連結リストの真ん中の要素を探すにはどうすればよいですか?
*
* [Solution]
* - 2つのポインタで走査する
* - 1つずつ進むポインタと一気に2つ進むポインタ
* - 2つ進むポインタが最後まで到達したときに1つ進むポインタが真ん中を指す
*/
#include <iostream>
#include <vector>
#include "SinglyLinkedList.hpp"
singly_node_t* get_mid_node(SinglyLinkedList &sl)
{
// 空の場合
i... |
/*
* protocol_v2_parser.hpp
*
* Created on: Jul 08, 2021 14:51
* Description:
*
* Copyright (c) 2021 Weston Robot Pte. Ltd.
*/
#ifndef PROTOCOL_V2_PARSER_HPP
#define PROTOCOL_V2_PARSER_HPP
#include "ugv_sdk/details/interface/parser_interface.hpp"
namespace westonrobot {
class ProtocolV2Parser : public ParserI... |
// 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.Storage.Streams.3.h"
#include "internal/Windows.Foundation.3.h"
#include "internal/Windows.Security.Cryptography.DataProtection.... |
/*
* Copyright (C) 2012-2016 Open Source Robotics Foundation
*
* 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 a... |
#pragma once
#include <windows.h>
class SimpleMutex
{
public:
SimpleMutex()
{
InitializeCriticalSection(&mutex_);
}
~SimpleMutex()
{
DeleteCriticalSection(&mutex_);
}
void grab()
{
EnterCriticalSection(&mutex_);
}
void give()
{
LeaveCriticalSection(&mutex_);
}
bool grabTry()
{
return TryEnt... |
/**
* Created by Ken van der Eerden
* Created on 22/7/2017 20:31
* Developed by
* - Ken van der Eerden
* - ...
*
* @Author Ken van der Eerden
* @Version 1.0
*/
#include "IntBuilder.h"
IntBuilder::IntBuilder() :
TokenBuilder("int", "int", false)
{
addBuilder(new TokenBuilder("[a-zA-Z_]+", "var... |
#include "iostream"
#include "string"
using namespace std;
string codificarcadena(string cad)
{
string codificar;
int recorrido = cad.length();
for (int i = 0; i < recorrido; i++) //iteracion que recorre cada caracter de la frase
{
string letra;
char leercadena = cad.at(i);
letra = leercadena;
switch (leercadena... |
/*********************************************************************
Matt Marchant 2014 - 2016
http://trederia.blogspot.com
xygine - Zlib license.
This software is provided 'as-is', without any express or
implied warranty. In no event will the authors be held
liable for any damages arising from the use of this soft... |
class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
int m = ransomNote.length();
int n = magazine.length();
if (n < m)
return false;
unordered_map<int, int> letter;
for (int i = 0; i < magazine.length(); i++) {
letter[maga... |
#include <cctype>
#include "test/util.hpp"
#include <gtest/gtest.h>
#include <tudocomp/util.hpp>
#include <tudocomp/compressors/lz_trie/LZTrie.hpp>
using namespace tdc;
using namespace lz_trie;
struct TestTrieElement {
uint8_t chr;
uint64_t id;
std::vector<TestTrieElement> children;
TestTrieElemen... |
// Filename: cImpulse.h
// Created by: darren (13Jul04)
//
////////////////////////////////////////////////////////////////////
#ifndef CIMPULSE_H
#define CIMPULSE_H
#include "otpbase.h"
#include "typedReferenceCount.h"
#include "config_movement.h"
#include "nodePath.h"
class CMover;
class EXPCL_OTP CImpulse : pub... |
#include "ScreenManager.hpp"
ScreenManager::ScreenManager(SDL_Renderer *renderer) : renderer(renderer) {
reset();
}
SDL_Rect ScreenManager::getScreenRect() {
return screenRect;
}
void ScreenManager::reset() {
int w = 0;
int h = 0;
if (SDL_GetRendererOutputSize(renderer, &w, &h) == 0) {
... |
#include "input.h"
namespace input
{
bool Keys[1024];
void KeyboardCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if(action == GLFW_PRESS)
Keys[key] = true;
if(action == GLFW_RELEASE)
Keys[key] = false;
}
bool SetupInput(GLFWwindow* window)
{
if(!windo... |
#include <iostream>
#include "maze.h"
void maze::initMap() {
int i, j;
map = new short*[hgt];
for (i = 0; i < hgt; i++) map[i] = new short[wdt];
for (i = 0; i < hgt; i++) for (j = 0; j < wdt; j++) map[i][j] = WALL;
}
short** maze::getMazeMap() { return map; }
void maze::setSpecPoint() {
map[1][1] = START;
map[hgt... |
/*
Copyright (C) 2016-2021 Popov Evgeniy Alekseyevich
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including ... |
#include "TestObjects.h"
#include "StringTable.h"
#include "RakPeerInterface.h"
#include "RakNetworkFactory.h"
#include <stdio.h>
#include "Kbhit.h"
#include <string.h>
#include "BitStream.h"
#include "MessageIdentifiers.h"
#include "NetworkIDManager.h"
#include "RakSleep.h"
#include "FormatString.h"
#inc... |
/*******************************************************************************
* Cristian Alexandrescu *
* 2163013577ba2bc237f22b3f4d006856 *
* 11a4bb2c77aca6a9927b85f259d9af10db791ce5cf884bb31e7f7a889d4fb385 ... |
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000;
#define MICROSECOND_CONVERSION 1e6
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
... |
#include<bits/stdc++.h>
#include<stdio.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scc(c) scanf("%c",&c)
#define fr(i,n) for (ll i=0;i<n;i++)
#define fr1(i,n)... |
#ifndef _SHADER_LOADER_H_
#define _SHADER_LOADER_H_
#include "../../../Dependencies/glew/glew.h"
#include "../../../Dependencies/freeglut/freeglut.h"
#include <iostream>
namespace Core
{
class ShaderLoader
{
private:
std::string readShader(const char* filename);
GLuint createShader(GLenum shaderType, std::str... |
#include <stdlib.h>
#include <iostream>
#ifndef STRUCT_LISTNODE
#define STRUCT_LISTNODE
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
#endif /* STRUCT_LISTNODE */
class ReverseLinkedList
{
public:
ListNode* reverseList(ListNode* head);
ListNode* reverseList2(ListNod... |
#pragma once
#ifndef SHIP_HPP
#define SHIP_HPP
// STL
#include <vector>
// Asteroids
#include "Vector2.hpp"
#include "GameObject.hpp"
namespace Engine
{
class App;
class Bullet;
class Ship : public GameObject
{
public:
/* ==========================
* CONSTRUCTORS
* ======... |
#ifndef BASICCOMPONENTS_H
#define BASICCOMPONENTS_H
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
#endif // BASICCOMPONENTS_H
|
#include "LogParsingProcessor.h"
#include "Debug/DebugMacros.h"
#include <QSettings>
#include <QDir>
#include "Globals.h"
#include "Processing/RequestManager.h"
#include "Processing/ProcessingManager.h"
LogParsingProcessor::LogParsingProcessor(QSettings *settings, QString group, QSharedPointer<LogServer> logServer) ... |
// Include Directives (Pre Processor Directives)
#include "Managers.h"
// Constructor
Managers::Managers()
{
// Initialise the member variables to some default values
_numOfMeetings = 10;
_numOfDaysHoliday = 22;
}
// Overloaded Constructor
Managers::Managers(int meetings, int daysHoliday)
{
// Initialise the memb... |
#include "Reference.hpp"
class Bibliography{
private:
int capacity;
int size;
Reference** refs;
public:
Bibliography(int _capacity){
capacity = _capacity;
size = 0;
refs = new Reference*[capacity];
}
void add(Reference* refence... |
/**
* $Source: /backup/cvsroot/project/pnids/zdk/zls/zfc/CThreadSpecialStorage.hpp,v $
*
* $Date: 2001/11/14 17:25:11 $
*
* $Revision: 1.3 $
*
* $Name: $
*
* $Author: zls $
*
* Copyright(C) since 1998 by Albert Zheng - 郑立松, All Rights Reserved.
*
* lisong.zheng@gmail.com
*
* $State: Exp $
*/
#ifndef ... |
#include "rulesfragment.h"
#include <QFile>
#include <QSound>
RulesFragment::RulesFragment() {
QVBoxLayout *mainVLayout = new QVBoxLayout;
QHBoxLayout *mainHLayout = new QHBoxLayout;
QFrame *centerConainer = new QFrame;
QVBoxLayout *startMainLayout = new QVBoxLayout;
QHBoxLayout *startContent = n... |
/***********************************************************************
created: Sun Feb 24 2019
author: Metora Wang
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2019 Paul... |
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include "unistd.h"
#include "pthread.h"
#include "sys/socket.h"
#include "sys/types.h"
#include "sys/epoll.h"
#include "netinet/in.h"
#include "Server.hpp"
#include "Tool... |
#include <iostream>
using namespace std;
int main()
{
int MyArray[] { 1, 2, 4, 6, 7, 89, 123, 231, 1000, 1235 };
int x = 0;
int a = 0;
int b = 9;
int WhatFind = 123;
bool found;
for (found = false; (MyArray[a] < WhatFind) && (MyArray[b] > WhatFind) && !found; )
{
x = a + ((WhatF... |
#include "FragmentOutput.h"
namespace revel
{
namespace renderer
{
FragmentOutput::FragmentOutput()
{
}
}
}
|
/*************************************************************************
> File Name : CmeGetCrlInfo.cpp
> Author : YangShuai
> Created Time: 2016年08月15日 星期一 16时38分19秒
> Description :
************************************************************************/
#include"Primitive.h"
#include"Primitive... |
class Solution {
bool is_prime(int n) {
if (n <= 1)
return false;
else if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i += 6) {
if (n % i == 0 || n % (i + 2) == 0) return false;
}
return true;
}
public:
int countPrimes... |
// \file TestTocSlices.cpp
#include <boost/test/auto_unit_test.hpp>
#include <typelib/typemodel.hh>
#include <typelib/registry.hh>
#include <utilmm/stringtools.hh>
#include "TestSuite.hpp"
#include "Converter.hpp"
#include "VectorTocMaker.hpp"
#include "Utilities.hpp"
#include "TestTypes.h"
using namespace Type... |
#include <iostream>
#include <cmath>
#define EPSILON 0.01
using namespace std;
// example function with first and second order derivatives
double f(double x)
{
return -x*(1/pow(2,x)+1/pow(4,x));
}
double fderiv1(double x)
{
double delta = pow(10,-4);
return (f(x+delta)-f(x-delta))/(2*delta);
}
double ... |
//
// Created by zanbo on 2020/4/21.
//
class Solution {
public:
// 中序遍历 非递归
vector<int> inorderTraversal(TreeNode* root) {
vector<int> res;
if(!root)
return res;
stack<pair<TreeNode*,bool>> s;
s.push(make_pair(root, false));
while(!s.empty())
{
... |
#include <Arduino.h>
#include <SoundMan.h>
void SoundMan::init(SoftwareSerial *sfSerial, uint32_t baudrate, uint32_t volume, uint8_t pinBusy)
{
m_sfSerial = sfSerial;
m_baudrate = baudrate;
m_vol = volume;
m_pinBusy = pinBusy;
m_sfSerial->begin(m_baudrate);
mp3_set_serial(*m_sfSerial);
mp3... |
/*
You are given two non-empty linked lists representing
two non-negative integers. The digits are stored in
reverse order and each of their nodes contain a
single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any
leading zero, except the... |
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/if_ether.h>
#define IPPROTO_INWT 200
typedef struct
{
/* No option (0000 0001), a padding character*/
unsigned char nop;
/* ... |
//**************************************************************************
//**
//** 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 <QtTest/QTest>
#include <QtCore/QObject>
#include <QUrlQuery>
#include "coverageobject.h"
#include <Cutelyst/application.h>
#include <Cutelyst/controller.h>
#include <Cutelyst/View>
#include <Cutelyst/Plugins/StatusMessage/StatusMessage>
#include <Cutelyst/Plugins/Session/Session>
using namespace Cutelyst;
... |
#include "HydroponicGreenhouse.hpp"
HydroponicGreenhouse::HydroponicGreenhouse(SDL_Renderer *renderer, Texture *texture, int level) :
Building(renderer, texture, "Hydroponic Greenhouse", level) {
spriteClip = {
level * 329,
530,
329,
220
... |
#include<iostream>
#include<algorithm>
using namespace std;
//Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution
{
public:
bool isValidBST(TreeNode* root)
{
TreeNode* prev = NUL... |
#include <iostream>
#include <algorithm>
using namespace std;
void heap_test(){
int A[] = {1, 4, 2, 8, 5, 7};
const int N = sizeof(A) / sizeof(int);
make_heap(A, A+N);
cout << "Before pop\t";
copy(A, A+N, ostream_iterator<int>(cout, " "));
cout<<endl;
//pop the top, throw it the end of the list
pop_heap(A, A... |
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int main()
{
//字符串转数字
string s = "100";
int num1 = stoi(s);
cout << num1 << endl;
s = "100.111";
double num2 = stod(s);
cout << num2 << endl;
//数字转字符串
string s1 = ... |
// This file has been generated by Py++.
#include "boost/python.hpp"
#include "generators/include/python_CEGUI.h"
#include "ComponentArea.pypp.hpp"
namespace bp = boost::python;
void register_ComponentArea_class(){
{ //::CEGUI::ComponentArea
typedef bp::class_< CEGUI::ComponentArea > ComponentArea_expos... |
#ifndef IA_H
#define IA_H
#include <QAtomicPointer>
#include "cell.h"
#include "collider.h"
#include "customscene.h"
#include "config.h"
#include <QtCore/qmath.h>
#include "QSemaphore"
class Ia : public QThread
{
public:
Ia(CustomScene* map,Cell* iaCell);
void run();
void move();
QSemaphore sem_cont... |
#include "graphics\Singularity.Graphics.h"
namespace Singularity
{
namespace Graphics
{
#pragma region Static Variables
Material* Material::g_pBasicMaterial = NULL;
#pragma endregion
#pragma region Constructors and Finalizers
Material::Material(InternalMaterial* material)
: m_pShader(mate... |
/*
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 "headr.h"
void countingSort::sort(vector<int>& vect, int N)
{
int maxValue = 0;
int j = 0;
for (int i = 0; i < N; i++) // This loop finds the max value and index that we need for later on in the function
{
if (vect[i] >= maxValue)
{
maxValue = vect[i];
j = i;
}
}
//printf("maxValue is %d... |
#include <iostream>
using namespace std;
template <typename T>
class array
{
private:
T* head;
size_t len;
public:
array():head(nullptr),len(0){}
array(size_t l, T* list):head(new T[l]),len(l)
{
for(size_t i=0;i<l;++i)
head[i] = list[i];
}
~array(){delete[] head;}
typedef T* iterator;
ite... |
#include <iostream>
#include "module.h"
using namespace std;
void main()
{
setlocale(LC_ALL, "Russian");
float a = 0, b = 0, c = 0, x_b = 0, x_e = 0, dx = 0, ans = 0;
cout << "Введите x начальное - ";
cin >> x_b;
cout << "Введите x конечное - ";
cin >> x_e;
cout << "Введите шаг - ";
cin >> dx;
cout << "В... |
#include "IFilter.h"
#include "FilterParameter.h"
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
IFilter::IFilter()
: m_Index(0)
, m_Parameter1(std::numeric_limits<int>::max())
, m_Parameter2... |
#include "Cavalry.h"
Cavalry::Cavalry() : Unit::Unit()
{
charge_bonus = 200;
upkeep_cost = 650;
recruitment_cost = 1000;
}
Cavalry::~Cavalry()
{
}
char Cavalry::type_of_unit()
{
return 'c';
}
int Cavalry::battle_value()
{
return melee_attack + charge_bonus;
}
|
// Filename: dnaSuitPath.cxx
// Created by: shochet (28Jan01)
//
////////////////////////////////////////////////////////////////////
#include "dnaSuitPath.h"
////////////////////////////////////////////////////////////////////
// Static variables
////////////////////////////////////////////////////////////////////... |
/**
* @author Michele Tomaiuolo - http://www.ce.unipr.it/people/tomamic
* @license This software is free - http://www.gnu.org/licenses/gpl.html
*/
#include <chrono>
#include <iostream>
double some_func(double x) {
return x * x + x;
}
double integral(double (*f)(double), double a, double b, int n) {
/**
... |
#include "MACVendors.h"
#include <fstream>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <vector>
#include <string>
MACVendors::MACVendors(std::string path)
{
read_csv(path);
}
std::string MACVendors::operator[](uint64_t mac)
{
return vendors[mac & 0xFFffFF000000];
}
void MACVendors::re... |
#include <string>
#include <vector>
#include <iostream>
#include "utils.h"
// simple data structure. Simply takes a series of strings, and returns a final
// concatenated string when needed. This turns concatenation n string from an
// Theta(n^2) process to theta(n)
class StringBuilder {
private:
std::vector<std::st... |
#ifndef RECCMD_H
#define RECCMD_H
/// @file RecCmd.h
/// @brief RecCmd のヘッダファイル
/// @author Yusuke Matsunaga (松永 裕介)
///
/// Copyright (C) 2005-2012 Yusuke Matsunaga
/// All rights reserved.
#include "YmNetworks/bdn.h"
#include "YmTclpp/TclCmd.h"
BEGIN_NAMESPACE_YM
class FuncMgr;
///////////////////////////////... |
/*
* 1.max area must include the max of (i,ai), the right or left of max area don't include the line which is longer than the
* the border of max area;
* (Reduction to Absurdity):if longest line is out of max area, we will have new max area. that is contradiction to the old
* max area. for example:
* |longest ... |
#include "Graph.h"
#include "mainwindow.h"
#include <QApplication>
#include <iostream>
#include <string>
#include <QTextStream>
#include <vector>
#include <QDebug>
#include "filemanagerheader.h"
int main(int argc, char *argv[])
{
// Start application
QApplication a(argc, argv);
struct stadiumInfo {
... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int const N = 1e5 + 10;
vector<int> g[N] ;
int vis[N] ;
int dist[N] ;
void dfs(int u,int lvl){
dist[u] = lvl;
vis[u] = 1;
for(int v : g[u]){
if(!vis[v]) dfs(v,lvl+1);
}
}
void solve(){
int n, a, b, da, db;
cin >> n ... |
#include "CObj.h"
CObj::CObj(char * adrFile)
{
m_pPoints = NULL; m_pNormals = NULL; m_pTex = NULL;
//引數暫存變數
int vindex = 0;
int nindex = 0;
int tindex = 0;
int mindex = 0;
objfile = fopen(adrFile, "r");
if (objfile == NULL) {
printf("fail to open the file !\n");
}
else {
while (fscanf(objfile, "%s", li... |
#ifndef _HTTP_METHODS_HEADER_H_
#define _HTTP_METHODS_HEADER_H_
#include <string>
struct HttpMethod {
std::string to_string;
};
namespace HttpMethods {
const HttpMethod Get{"GET"};
const HttpMethod Head{"HEAD"};
const HttpMethod Post{"POST"};
const HttpMethod Put{"PUT"};
const HttpMethod Delete{"DELETE"}... |
/**
* @file MDFlexParser.h
* @date 23.02.2018
* @author F. Gratl
*/
#pragma once
#include <getopt.h>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include "autopas/AutoPas.h"
#include "autopas/utils/NumberSet.h"
using namespace std;
class MDFlexParser {
public:
enum FunctorOption { lj12_6, lj1... |
#include "qt_message_box_error_handler.h"
#include <QMessageBox>
namespace dwiz
{
void QtMessageBoxErrorHandler::showErrorMessage(
QWidget* const f_parent, std::string const& f_title, std::string const& f_message)
{
QMessageBox::warning(
f_parent, QString::fromStdString(f_title), QString::fromStdString... |
#ifndef ICORE_H
#define ICORE_H
#include <memory>
#include "render/engine/ifc/IEngine.h"
namespace smeta3d
{
class ICore
{
public:
~ICore() {};
virtual bool Init(const HWND& HWnd) = 0;
virtual bool IsInit() const = 0;
virtual void DeInit() = 0;
virtual const smeta3d::SP_IEngine& GetEngine() cons... |
class Solution
{
public:
int findComplement(int N)
{
int c = 1;
while (c < N)
c = (c << 1) | 1;
return N ^ c;
}
};
|
// ------------------------------------------------------------------------------------------------
#include "Handle/Database.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
// ------------------------------------------------------------------... |
#ifndef COMPRESSOR_H
#define COMPRESSOR_H
#define BUFFER_MAX_SIZE 1024
#include "Global.h"
/*
* Um compressor recebe uma stream de bits e utiliza um algoritmo de compressão para
* gerar uma stream comprimida.
*/
class Compressor {
public:
Compressor(FILE* output);
/*
* Esse método recebe uma sequência de bits (... |
#include "applicationui.h"
ApplicationUI::ApplicationUI() {}
ApplicationUI::~ApplicationUI()
{
delete fileParser;
delete countdown;
}
void ApplicationUI::Display()
{
QDateTime currTime = QDateTime::currentDateTime();
QDateTime giftTime = QDateTime::fromString("2013-12-25T00:00:00", Qt::ISODate);
... |
#include "navmesh.h"
#include "polypartition/polypartition.h"
#include "clipper/clipper.h"
#include "helper.h"
#include <algorithm>
#include <cmath>
#include <iostream>
namespace POICS{
static double CLIPPER_SCALE = 1000.0;
static double SMOOTH_SHIFT = 1.5;
void toClipperPath(Polygon& poly, ClipperLib::Path& path... |
/*
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... |
/* Determines if this drive-letter currently has a disk inserted */
int CheckRM (const TCHAR *DriveName)
{
TCHAR filename[MAX_DPATH];
DWORD dwHold;
BOOL result = FALSE;
_stprintf (filename, _T("\\\\?\\%s"), DriveName);
dwHold = GetFileAttributes (filename);
if(dwHold != 0xFFFFFFFF)
result = TRUE;
return res... |
#include "pqueue-vector.h"
using namespace std;
VectorPQueue::VectorPQueue() {
}
VectorPQueue::~VectorPQueue() {
}
string VectorPQueue::peek() const {
if(isEmpty()) {
error("peek; Attempting to peek at an empty queue");
}
string result = pQueue.get(0);
return result;
}
string VectorP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.