text stringlengths 8 6.88M |
|---|
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2011 Opera Software ASA. 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 SUPPORT_DATA_SYNC
#include "module... |
#include "device.h"
#include <iostream>
#include <string.h>
#include <vector>
#include <queue>
#ifdef CLIENT
#include <gtk/gtk.h>
#endif
#ifndef _SERIAL_DEVICE_H
#define _SERIAL_DEVICE_H
namespace csys
{
#ifdef CLIENT
class window;
#endif
namespace dev
{
class serialDevice: public device
{
/*************... |
#include "colorspace.hpp"
int main(int argc, char **argv)
{
cv::Mat l_imageOutdoor, l_imageIndoor;
l_imageOutdoor = cv::imread(argv[1], CV_LOAD_IMAGE_COLOR);
l_imageIndoor = cv::imread(argv[2], CV_LOAD_IMAGE_COLOR);
// argv[3] is the output.pgm
cv::Mat l_imageDepth = cv::imread(argv[4], CV_LOAD_IMAGE_ANYDEPTH);... |
#ifndef BASEPIECE_CPP_INCLUDED
#define BASEPIECE_CPP_INCLUDED
#include <iostream>
#include <string>
#include "BasePiece.h"
/**@summary Default Constructor
*/
BasePiece::BasePiece()
{
type = " ";
}
/**@summary Default Destructor
*/
BasePiece::~BasePiece()
{ }
/**@summary Print the chess piec... |
// Copyright (c) 2023 ETH Zurich
//
// SPDX-License-Identifier: BSL-1.0
// 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)
#pragma once
#include <pika/config.hpp>
#include <pika/assert.hpp>
#include <pika/async_m... |
//===========================================================================
//! @file collision_3D.h
//! @brief 3D 当たり判定
//===========================================================================
#pragma once
//===========================================================================
//! @class Collision3D
//==... |
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#define INT_MAX 0x7fffffff
#define INT_MIN 0x80000000
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : va... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2012 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef MODULES_UTIL_OPFILE_OPMEMFILE_H
#define MODULES_UTIL_OPF... |
#pragma once
#include "cursur_point.h"
#include "Board.h"
#include "score.h"
#define BLOCK_TYPE_COUNT 7
#define ROTATE_COUNT 4
const cursur_point g_nxt_block_init_pos(14, 17);
const cursur_point g_cur_block_init_pos(4, 18);
enum BLOCK_TYPE {
BLOCK_I, BLOCK_J, BLOCK_L, BLOCK_O, BLOCK_S, BLOCK_T, BLOCK_Z
};
class ... |
#include <iostream>
struct Node {
int m_value;
Node* m_next;
};
Node* addNumber(Node*, int);
int max(Node*);
void jnjel (Node*);
int main() {
Node* root = nullptr;
int a = 0;
std::cout<<"\nMutqagreq tver.avarti hamar greq - end ";
std::cin >> a;
addNumber(root,a);
root = addNumb... |
/*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
class Solution {
public:
vector<vector<int> > FindPath(TreeNode* root, int expectNumber) {
dfs(root, expectNumber);
return result;
}
private:
vector... |
#include <iostream>
#include <math.h>
#include <cstdlib>
using namespace std;
int main()
{ setlocale(LC_ALL, "Russian");
float x, z, y, b;
cout << "Введите число x:" << endl;
cin >> x;
cout << "Введите число y:" << endl;
cin >> y;
cout << "Введите число z:" << endl;
cin >> z;
b = pow(y, pow(labs(x), 1. / 3)) + ((pow(co... |
//
// WelcomeLayer.h
// Aircraft
//
// Created by lc on 12/3/14.
//
//
#ifndef __Aircraft__WelcomeLayer__
#define __Aircraft__WelcomeLayer__
#include <stdio.h>
#include "PlistHandler.h"
#include "GameScene.h"
#include "GameOverLayer.h"
USING_NS_CC;
class WelcomeLayer : public Layer {
private:
bool haveSaveFi... |
#ifndef SOCKS6MSG_VERSIONCHECKER_HH
#define SOCKS6MSG_VERSIONCHECKER_HH
#include "bytebuffer.hh"
namespace S6M
{
template <uint8_t VER>
struct VersionChecker
{
VersionChecker() {}
VersionChecker(ByteBuffer *bb)
{
uint8_t *ver = bb->peek<uint8_t>();
if (*ver != VER)
throw BadVersionException(*ver);
}
};
... |
#pragma once
#include "GameObject/GameObject.h"
class BaseBackGround : GameObject
{
private:
struct Vertex {
Vector2 position;
Vector2 uv;
};
Vertex vertice[4];
LPDIRECT3DTEXTURE9 pTex;
public:
BaseBackGround();
~BaseBackGround();
void Init();
void Release();
void Update();
void Render();
void SetTe... |
#ifndef MENU_H
#define MENU_H
#include <string>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <iomanip>
class menu
{
private:
std::string nom;
std::string *option;
unsigned int nbOption;
int longueurMax;
public:
menu(const std::string &_nom);
~menu();
int Afficher();... |
#include <cstring>
#include <list>
#include <cstdio>
#include <iostream>
#include "z3++.h"
#include "Strategy.h"
using namespace std;
using namespace z3;
const static int X[5] = {0,1,-1,0,0};
const static int Y[5] = {0,0,0,1,-1};
Strategy::Strategy(Graph _graph):graph(_graph),solution(this->graph.size){}
void Strat... |
#include "Poco/Net/HTTPRequest.h"
#include "Poco/Net/HTTPResponse.h"
#include "Poco/Net/NetException.h"
#include "Poco/Net/HTTPClientSession.h"
#include "Poco/Net/NameValueCollection.h"
#include "Poco/StreamCopier.h"
#include "Poco/JSON/JSON.h"
#include "Poco/JSON/Parser.h"
#include "Poco/URI.h"
using namespace Poco;
... |
#ifndef _ABSTRACTMENU_
#define _ABSTRACTMENU_
#include "AbstractScene.h"
USING_NS_CC;
// All menu will derives from this classes
// who is already a subclass or AbstractScene
class AbstractMenu : public AbstractScene
{
protected:
public:
AbstractMenu();
~AbstractMenu();
// rou... |
#ifndef MESH_H
#define MESH_H
#include "material.h"
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
#include <QOpenGLVertexArrayObject>
#include <QVector2D>
#include <QVector3D>
#include <QOpenGLTexture>
#include <QOpenGLFunctions>
#include <bullet/btBulletCollisionCommon.h>
class Mesh
{
public:
Mesh(co... |
#include <bits/stdc++.h>
using namespace std;
void mySort(vector<int> &nums)
{
for (int i = 0; i < nums.size(); i++)
{
int j = i;
while (j > 0 && nums[j] < nums[j - 1])
{
//greater value
swap(nums[j], nums[j - 1]);
j--;
}
}
}
int main()
{... |
// Copyright (c) 2020 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 GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special ... |
#ifndef TEST_COMMON_H
#define TEST_COMMON_H
#undef NDEBUG
#include <cassert>
#include <cmath>
#define assert_false(expr) assert(!expr)
#define assert_throws(expr) { \
bool _ = false; \
try { \
expr; \
... |
#include <iostream>
using namespace std;
void get_stdin_10_20() {
// 实际上只能存19个字符,因为最后一个是'\0'
char buffer[20];
cin.ignore(10);
cin.getline(buffer, 10);
/*
stdin: 1234567890asdfg
output: 0asdfg
*/
cout << buffer << endl;
}
void print_in_ladder_shape() {
int width = 4;
char ... |
#include "stdafx.h"
#include "Program.h"
#include "GameObject\Rect.h"
#include "GameObject\BackGround.h"
#include "./Common/Camera.h"
Program::Program()
{
srand(time(NULL));
//SOUND->AddSound("Test", "sounds/영전3.wav", true, true);
SOUND->AddSound("BGM", "sounds/bgm.mp3", true, true);
mainCamera = new Camera;
... |
/**
* 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:
vector<vector<int>> zigzagLevelOrder(TreeNode* root) {
vector<vector<int> > res;
... |
#ifndef LYTWSTRING_H
#define LYTWSTRING_H
#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <string.h>
#include <wchar.h>
#include <math.h>
#include <iomanip>
using namespace std;
class LytWString
{
protected:
int Length;
wchar_t* String;
public:
LytWString();
LytWString(const wch... |
// Example 5.2 : shared_ptr
// Created by Oleksiy Grechnyev 2017, 2020
// Class Tjej is used a lot here, it logs Ctors and Dtors
#include <iostream>
#include <vector>
#include <string>
#include <memory>
#include "Tjej.h"
using namespace std;
//==============================
// Classes for inheritance
class Animal{... |
// ConsoleApplication1.cpp: определяет точку входа для консольного приложения.
//
#include "fstream"
#include <stdio.h>
//0- пешка //будем считать, что может рубить и вперед, и назад
//1- ладья
//2-конь
//3-слон
//4-ферзь
//5-король
int attack(int i, int j, int **table) {
if (i >= 0 && i < 8 && j >= 0 && j < 8 /*... |
#include <bits/stdc++.h>
using namespace std;
class listNode
{
public:
int data;
listNode *next;
listNode(int data)
{
this->data = data;
this->next = nullptr;
}
};
class mylist
{
public:
listNode *head;
mylist()
{
this->head = nullptr;
}
void addNode(int data)
{
listNode *newNo... |
// Created on : Thu May 14 15:13:19 2020
// Created by: Igor KHOZHANOV
// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0
// Copyright (c) Open CASCADE 2020
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it un... |
#include "Demon.h"
Demon::Demon(Unit* warlock, const std::string& name, const std::string& type,const std::string& mutation, int health, int damage) : Unit(type, new DemonState(name, health, damage), new UnitAttack(), mutation) {
this->master = warlock;
this->getObserversList()->addObserver(this->master);
... |
#include "../../idlib/precompiled.h"
#pragma hdrstop
#include "../Game_local.h"
#include "../Weapon.h"
const idEventDef EV_Railgun_RestoreHum( "<railgunRestoreHum>", "" );
class rvWeaponRailgun : public rvWeapon {
public:
CLASS_PROTOTYPE( rvWeaponRailgun );
rvWeaponRailgun ( void );
virtual void Spawn ( v... |
/*
* tldupdater.h
* Opera
*
* Created by Adam Minchinton
* Copyright 2008 Opera ASA. All rights reserved.
*
*/
#ifndef _TLDUPDATER_H_INCLUDED_
#define _TLDUPDATER_H_INCLUDED_
#include "modules/hardcore/timer/optimer.h"
#include "adjunct/desktop_util/search/tlddownloader.h"
class TLDDownloader;
/////////... |
/**
* \copyright
* (c) 2012 - 2015 E.S.R. Labs GmbH (http://www.esrlabs.com)
* All rights reserved.
*/
/**
* Contains base types for iterators.
* \file SIteratorBaseTypes.h
* \ingroup sstl
*/
#ifndef SITERATORBASETYPES_H_
#define SITERATORBASETYPES_H_
/**
* input iterator
*
* \section Description
* May ad... |
#ifndef GNMESHEBM_H
#define GNMESHEBM_H
class GnMeshEBM
{
public:
static void StartupEBM();
static void ShutdownEBM();
};
#endif // GNMESHEBM_H |
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
* ... |
#pragma once
#include "Player.h"
class RandomPlayer : public Player {
public:
RandomPlayer() {
field = new Field();
}
~RandomPlayer() {
delete field;
}
void Update();
};
|
#ifndef NO_H
#define NO_H
#include "Adjacencia.h"
class No
{
public:
No(int id, int label, int dado);
~No();
void adicionarAdj(No* destino, int peso);
void removerAdj(No* destino, int peso);
void removerAdjs(No* destino);
bool verificarMultiaresta(int ordem);
... |
#include <benchmark/benchmark.h>
#include <permutations.h>
#include <alphabet.h>
#include <cmap.h>
#include <cmath>
#include <cmap-bench.hpp>
namespace {
// Permutation benchmarks
static void BM_permute_next(benchmark::State &state) {
auto arr = new int[state.range(0)];
for (int i = 0; i < state.range(0... |
/********************************************************************************
** Form generated from reading UI file 'newcameradialog.ui'
**
** Created by: Qt User Interface Compiler version 5.8.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
***********************************... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 1995-2009 Opera Software ASA. 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 DATABASE_STORAGE_SUPPORT
#include... |
#include "window.h"
Window::Window()
{
button = new QPushButton("teste", this);
this->show();
}
|
// Copyright (c) 2021 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// 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)
/// \file parallel/executors/scheduler_executor.hpp
#pragma once
#include <pika/conf... |
#pragma once
const int SCREEN_WIDTH = 900;
const int SCREEN_HEIGHT = 700;
const int INITIAL_X = 0;
const int INITIAL_Y = 0;
const int HUD_WIDTH = 200;
const int GAME_SPRITES_SIZE = 35;
const std::string SPLASH_IMAGE_ID = "SplashImage";
const std::string SPLASH_BACKGROUND_PATH = "../../res/img/SPLASH.png";
namespace ... |
#include <iostream>
#define MAX(a,b) a>b?a:b
using namespace std;
int arr[10001];
int d[10001] = { 0 };
int main(){
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
d[1] = arr[1];
d[2] = arr[1] + arr[2];
for (int i = 3; i <= n; i++) {
int max = d[i - 1];
if (max < d[i - 2] + a... |
#ifndef _PCTIME_H_
#define _PCTIME_H_
#ifndef _TIME_H_
#include <time.h>
#define _TIME_H_
#endif
class TimerTest{
public:
void setTime();
double getTime();
private:
double str_t;
};
void TimerTest::setTime(){
str_t=time(NULL);
}
double TimerTest::getTime(){
return time(NULL)-str_t;
}
void Delay(double t){
dou... |
#include<iostream>
#include<cassert>
#include<errno.h>
#include<cstring>
#include<type_traits>
#include<signal.h>
#include<sys/socket.h>
#include<cstdio>
#include<unistd.h>
#include<cstdlib>
#include<sys/ipc.h>
#include<sys/types.h>
#include<string>
#include<arpa/inet.h>
using namespace std;
//#define INET_ADDRSTRLE... |
#include "BasePlayerController.h"
#include "Single/GameInstance/RPGGameInst.h"
#include "Single/PlayerManager/PlayerManager.h"
#include "Actor/Character/PlayerCharacter/PlayerCharacter.h"
#include "Component/WndToggler/WndTogglerComponent.h"
#include "Widget/WidgetControllerWidget/WidgetControllerWidget.h"
ABasePl... |
#pragma once
#include "DynamicObject.h"
class MotorBike :
public DynamicObject
{
public:
MotorBike(int id, std::string name, int x, int y) :DynamicObject(id, name, x, y) {};
void printPosition() override;
void move(Position) override;
};
|
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
**
** Copyright (C) 1995-2004 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
*/
#ifndef MEM_UTILS_H
#define MEM_UTI... |
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
struct Tp {
int x, y;
bool operator<(const Tp& t) const {
return x < t.x || x == t.x && y < t.y;
}
bool operator==(const Tp& t) const {
return x == t.x && y == t.y;
}
} a[333];
int main(... |
#include <iostream>
#include <fstream>
using namespace std;
inline const char* const BoolToString(bool b) {
return b ? "1" : "0";
}
int main() {
FILE* fp;
char path[1035];
std::string siteUrl;
bool fullscreen = false;
fp = _popen("electron --version", "r");
// wait until output is read
while (fgets(path, s... |
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2012-2013.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#include "gdcmIO/reader/DicomSRReader.hpp"
#include "gdcmIO/reader/DicomLa... |
//
// Created by 송지원 on 2020/06/29.
//
#include <iostream>
#include <queue>
#include <utility>
using namespace std;
#define X first
#define Y second
int N, M;
int board[105][105];
bool vis[105][105];
int len[105][105];
string s;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
ios::sync_with_s... |
/*
Copyright 2021 University of Manchester
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 writing, s... |
#define true 1
#define false 0
class CarShops {
/*
* ARRAY FORMAT:
* 0: STRING (Classname)
* 1: STRING (Condition)
* FORMAT:
* STRING (Conditions) - Must return boolean :
* String can contain any amount of conditions, aslong as the entire
* ... |
#include <json/json.h>
#include "Player.h"
#include "Configure.h"
#include "AllocSvrConnect.h"
#include "Logger.h"
#include "GameCmd.h"
#include "GameApp.h"
#include "MoneyAgent.h"
#include "CoinConf.h"
#include "IProcess.h"
#include "Protocol.h"
int pase_json(Json::Value& value, const char* key, int def)
{
int v = d... |
#define F_CPU 16000000
#include<avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#include <ads1292r.h>
#include <SPI.h>
ads1292r ADS1292; // define class
volatile uint8_t SPI_Dummy_Buff[30];
uint8_t DataPacketHeader[16];
volatile signed long s32DaqVals[8];
uint8_t data_len = 8;
volatile byte SPI_RX_Buff[... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2004-2010 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
** \author { Anders Oredsson <anderso@opera.com> }
*/
#include "c... |
#include "../../idlib/precompiled.h"
#pragma hdrstop
#include "../Game_local.h"
CLASS_DECLARATION( idForce, idForce_Constant )
END_CLASS
/*
================
idForce_Constant::idForce_Constant
================
*/
idForce_Constant::idForce_Constant( void ) {
force = vec3_zero;
physics = NULL;
id = 0;
point =... |
#include "State.h"
#include "GameScene.h"
void RunOnBallState::execute(GameScene *gameScene)
{
if (gameScene->isRunFinish())
{
gameScene->runFinish();
}
else
{
gameScene->runOnBall();
}
}
void PassBallState::execute(GameScene *gameScene)
{
if (gameScene->isPassFinish())
{
gameScene->passFinish();
}
... |
//知识点:树形DP
/*
题目要求:
求一个树上点的点集 a,
使 ai != father[aj] (i,j ∈ [1,n])
求此点集 的最大权值和
分析题意:
对于一个点,
选择它 或 不选择它
只会对其 直接的儿子结点 产生影响
也就是说,
如果其直系儿子节点的状态已经确定
就可以推出 该点的状态
算法实现:
设: f[i] 表示 选择第 i 个点后,其子树的最大权值和
g[i]表示 , 不选择第i个点,其子树的最大权值和
那么对于一个子树的根节点 i,
及其 直系儿子结点 集合 son
其状态转移方程为:
f[i] = r[i] + ∑(g[v]) ... |
#include <iostream>
int main()
{
using namespace std;
char ch;
int count = 0;
cout << "Please enter the text and quit with #: " << endl;
cin >> ch;
while (ch != '#') { // blank,制表符,回车都不会被计入
cout << ch;
++count;
cin >> ch;
}
cout << endl << count << " characters read\n";
cin.ignore(1024, '\n'); // 将上一段程... |
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
//#include <dequeue>
struct Node {
int data;
Node *left;
Node *right;
Node(int a):data(a), left(NULL), right(NULL) {}
};
void insert_bst(Node **root, int data)
{
Node *new_node = new Node(data);
Node **node = root;
while (*... |
class Solution {
public:
vector<vector<int>> combinationSum3(int k, int n) {
vector<vector<int>> combinations;
vector<int> combination;
combinationSum(k, n, 0, combinations, combination);
return combinations;
}
private:
void combinationSum(int k, int n, int begin,
... |
#pragma once
#include <iosfwd>
template <typename T>
class Point2 {
private:
T x, y;
public:
bool CheckForNaNs() const { return (std::isnan(x) || std::isnan(y)); };
inline Point2()
{ x = 0; y = 0;};
inline Point2(T a, T b) {
x = a; y = b;
assert(!CheckForNaNs());
};
inline T getX() {
return x;
}
inli... |
#include "EnemySnake.h"
#include<shadyengine/random.h>
using namespace shady_engine;
EnemySnake::EnemySnake(
std::shared_ptr<shady_engine::sprite_renderer> pRenderer,
std::shared_ptr<shady_engine::texture2D> pTexture,
const glm::vec2& pHeadPosition,
const glm::vec2& pHeadVelocity,
float pSpeed,
float pRadius,... |
/**********************************************************************
* Felix Winterstein, Imperial College London
*
* File: lloyds.cpp
*
* Revision 1.01
* Additional Comments: distributed under a BSD license, see LICENSE.txt
*
**********************************************************************/
#include <stdio.h... |
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
long long n, a[200000], gcd, maxi = -1, ans;
vector<long long> changes;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i];
maxi = max(maxi, a[i]);
}
for (int i = 0; i < n; i++)
... |
#include <iostream>
#include "Alien.h"
int main()
{
Alien alien(20, 20, 'm');
std::cout << alien.getWeight();
return 0;
} |
/*
Name : Aman Jain
Date : 16-07-2020
Question-> https://practice.geeksforgeeks.org/problems/count-ways-to-reach-the-nth-stair/0
In the given problem we have to find the no. of ways in which we can reach the top of ladder from the bottom, where
n = total number of steps in ladder.
k = maximum numbers of steps that c... |
// Copyright (c) 2016 Daniel Bourgeois
//
// SPDX-License-Identifier: BSL-1.0
// 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)
#include <pika/future.hpp>
#include <pika/init.hpp>
#include <pika/testing.hpp>
#in... |
/**
* Peripheral Definition File
*
* FLASH - Flash memory controller
*
* MCUs containing this peripheral:
* - STM32F0xx
*/
#pragma once
#include <cstdint>
#include <cstddef>
namespace io {
struct Flash {
/** Flash access control register
*/
struct Acr {
Acr(const uint32_t raw=0) { r = raw; }
... |
/*
* Lanq(Lan Quick)
* Solodov A. N. (hotSAN)
* 2016
* LqPrtScan (LanQ Port Scanner) - Scan ports of local or remote machine. Creates sockets and just trying connect
*/
#include "LqPrtScan.hpp"
#include "LqWrkBoss.hpp"
#include "LqTime.h"
#include "LqStrSwitch.h"
#include "LqFile.h"
#include "LqFileTrd.h"
#include ... |
#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... |
#pragma once
#include <algorithm>
#include <utility>
namespace MathiSMO {
namespace Concepts {
template<class V>
concept Vec = requires(V vec) {
vec.x;
vec.y;
};
template<typename Type>
concept Numeric = std::is_floating_point_v<Type> || std::is_int... |
// SPDX-FileCopyrightText: 2021 Samuel Cabrero <samuel@orica.es>
//
// SPDX-License-Identifier: MIT
#include <Log.h>
#include "config.h"
#include "global.h"
#include "state.h"
TGlobal Global;
TGlobal::TGlobal() : m_state(&StateUnarmored) {
}
TState *TGlobal::getState() {
return m_state;
}
void TGlobal::setState... |
/********************************************************************************
** Form generated from reading UI file 'groupconfigdialog.ui'
**
** Created by: Qt User Interface Compiler version 5.8.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
*********************************... |
#include<bits/stdc++.h>
using namespace std;
main()
{
int n;
while(cin>>n)
{
int i, ar[200];
for(i=1; i<=n; i++)
{
cin>>ar[i];
}
for(int j=1; j<=n; j++)
{
for(i=1; i<=n; i++)
{
if(ar[i]==j)
... |
#include <iostream>
using namespace std;
bool isPrime(int n)
{
if (n <= 1)
return false;
for (int i = 2; i < n; i++)
if (n % i == 0)
return false;
return true;
}
bool isEmirp(int n)
{
if (isPrime(n) == false)
return false;
int ... |
#ifndef UPDATE_APP_H
#define UPDATE_APP_H
#include "qt-tools/application.h"
#include <string>
class update_app : public application
{
public:
update_app (int argc, char** argv) : application (argc, argv) {}
bool run () override;
void at_exit () override;
private:
std::string start_program_;
boo... |
#include <iostream>
using namespace std;
struct node{
int data;
struct node *left;
struct node *right;
};
class tree{
public:
struct node *newNode(int n){
node *nn=new node;
nn->data=n;
nn->left=NULL;
nn->right=NULL;
return (nn);
}
void preOrder(struct node *nn){
if(nn==NULL) return... |
#include "stage.h"
#include "demon.h"
#include<vector>
Stage::Stage()
{
Demon *e;
float positionEnemy [4][2]= {{400,350},{250,250},{250,350},{150,520}};
int nbEnemy = sf::Randomizer::Random(0, 4);
sf::Vector2f vecPos(0.f,0.f);
for(int i=0;i<nbEnemy;i++)
{
vecPos.x=positionEnemy[i][0];
... |
#include "Net/UdpSocket.h"
#include "Net/proto/cmd/SendProto.h"
#include "Net/proto/pb/cliReq.pb.h"
#include <thread>
#include <iostream>
using namespace std;
using namespace CPPClient::Net;
using namespace CPPClient::Net::Cmd;
int main(int argc, const char *argv[])
{
UdpSocket::connectServer("127.0.0.1", 4567);... |
#include "MenuMode.h"
MenuMode::MenuMode()
{
QJSEngine* engine = initScript();
initTextColors(engine);
delete engine;
widgetDistance = 10.0f;
totalCombobox=NULL;
mGui3D=NULL;
mMousePointerLayer=NULL;
mMousePointer=NULL;
Ogre::Viewport * _viewport= rEngine->m_pViewport;
mGui3D = ... |
#include "myCstring.h"
void myStrCpy(char text1[],size_t size ,const char text2[]) {
int i = 0;
for (; text2[i] != '\0' && i < size; i++) {
text1[i] = text2[i];
}
text1[i] = '\0';
}
int myStrlen(const char arr[]) {
int cnt = 0;
while (arr[cnt]) {
++cnt;
}
return cnt;
}
void toSmall(char arr[]) {
for (in... |
#ifndef SOCKET_HANDLER_H
#define SOCKET_HANDLER_H
#include "CDLSocketServer.h"
#include "CDLSocketHandler.h"
#include "DLDecoder.h"
#include "Packet.h"
#include <string>
using namespace std;
#ifdef MAX_CALL_BACK
# undef MAX_CALL_BACK
# define MAX_CALL_BACK 100
#else
# define MAX_CALL_BACK 100
#endif
class ... |
class Game_system {
public:
enum KEYS{UP,DOWN,LEFT,RIGHT};
ALLEGRO_DISPLAY * display;
ALLEGRO_EVENT_QUEUE * event_queue;
ALLEGRO_TIMER * timer;
ALLEGRO_BITMAP * tileset;
ALLEGRO_SAMPLE * sample;
ALLEGRO_FONT * font;
bool done;
bool keys[4];
bool redraw;
bool write_dialogue;
vector<int> wid_height;
int FPS;
time_t timer... |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool check(const long long &num, const vector<int> ×,
const int &n) {
int target = 0;
for (int i : times) {
target += num / i;
}
return target < n;
}
long long solution(int n, vector<int> tim... |
//Write a c++ program that reads a year and checks wheather the entered year is leap year oe not.
#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter any year"<<endl;
cin>>a;
if(a%4==0 && a%100!=0 || a%400==0)
cout<<a<<" is a leap year";
else
cout<<a<<" is not leap year"... |
#pragma once
#ifndef _INITINFO_H_
#define _INITINFO_H_
#define MINUTESPERDAY (24*60);
#ifndef FLOAT_EQ
#define EPSILON 0.001 // floating point comparison tolerance
#define FLOAT_EQ(x,v) (((v - EPSILON) < x) && (x <( v + EPSILON)))
#define MINUTESPERDAY (24*60);
#endif
struct TInitInfo
{
public:
TInitInfo()
{
cha... |
/**
* @file messagedecodersystem.h
*
* @brief This file outlines the functions that are available for message decoding
* @version 0.1
* @date 2021-08-14
*
* @copyright Copyright (c) 2021
*
*/
#include "ArduinoJson.h"
#include "globals.h"
#include "message.h"
#include "messagedecoderbase.h"
... |
// generated by Fast Light User Interface Designer (fluid) version 1.0302
#include "CTaLibFuncViewUI.h"
CTaLibFuncViewUI::CTaLibFuncViewUI() {
{ m_window = new Fl_Double_Window(780, 385, "Technical Analysis Function Browser");
m_window->user_data((void*)(this));
{ m_taLibView = new Fl_Group(-35, 0, 815, 470... |
#include "item.h"
#include "room.h"
Item::Item (string itemDescription)
{
this->itemDescription = itemDescription;
}
string Item::getShortDescription()
{
return itemDescription;
}
string Item::getLongDescription()
{
return " item(s), " + itemDescription + ".\n";
}
string Room:: getItem()... |
//------------------------------------------------------------------------------
/*
This file is part of valueAdded: https://github.com/valueAdd/valueAdded
Copyright (c) 2012, 2013 valueAdd Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee ... |
#include "lateral_controller.hpp"
#include <tf2_eigen/tf2_eigen.h>
#include <utils_ros/ros_console.hpp>
#include <boost/algorithm/clamp.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/range/algorithm/min_element.hpp>
#include "lateral_control_ros_tool/discrete_curvature.h"
#include "motor_interfa... |
#include <iostream>
#include "MyApp.hpp"
#include "MyModule.hpp"
namespace cdt {
MyApp::MyApp() {
std::cout << "CTR" << std::endl;
}
MyApp::~MyApp() {
std::cout << "DTR" << std::endl;
}
void MyApp::load() {
std::cout << "Loading app..." << std::endl;
this->addModule("TEST", cdt::createMyModule());
this->add... |
/*
* 题目:146. LRU 缓存机制
* 链接:https://leetcode-cn.com/problems/lru-cache/
* 知识点:哈希表+双向链表
*/
struct LRULinkedNode {
int key, value;
LRULinkedNode *pre;
LRULinkedNode *next;
LRULinkedNode():key(0), value(0), pre(nullptr), next(nullptr) {};
LRULinkedNode(int _key, int _value):key(_key), value(_value),... |
/**********************************************************************
Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved.
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.