text stringlengths 8 6.88M |
|---|
#include <iostream>
using namespace std;
int main()
{
string var1 = "Esto es un ejemplo";
cout << var1[3] << endl;
return 0;
} |
#ifndef SYSTEM_H
#define SYSTEM_H
class System
{
public:
System();
int init(const char* title);
private:
};
#endif
|
// C++ for the Windows Runtime vv1.0.170303.6
// Copyright (c) 2017 Microsoft Corporation. All rights reserved.
#pragma once
#include "../base.h"
#include "Windows.System.Threading.0.h"
#include "Windows.Foundation.0.h"
WINRT_EXPORT namespace winrt {
namespace ABI::Windows::System::Threading {
struct __declspec(uu... |
/*题目:小Q是一个非常聪明的孩子,除了国际象棋,他还很喜欢玩一个电脑益智游戏――矩阵游戏。
矩阵游戏在一个 [公式] 黑白方阵进行(如同国际象棋一般,只是颜色是随意的)。每次可以对该矩阵
进行两种操作:行交换操作:选择矩阵的任意两行,交换这两行(即交换对应格子的颜色)列交换操作:
选择矩阵的任意两列,交换这两列(即交换对应格子的颜色)游戏的目标,即通过若干次操作,使得方阵
的主对角线(左上角到右下角的连线)上的格子均为黑色。对于某些关卡,小Q百思不得其解,以致他开始怀
疑这些关卡是不是根本就是无解的!于是小Q决定写一个程序来判断这些关卡是否有解。*/
#include <cstdio>
#include <cstri... |
//
// discount.cpp
// polymorth
//
// Created by Damir Mustafin on 26/11/15.
// Copyright (c) 2015 Damir Mustafin. All rights reserved.
//
#include "discount.h"
DiscountSale :: DiscountSale() : Sale(), discount(0) { } // init section
DiscountSale :: DiscountSale(double thePrice, double theDiscount) : Sale(thePri... |
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Core.h"
#include "Engine.h"
#include "GameFramework/Actor.h"
#include "XSpace.generated.h"
UCLASS()
class XPROJECT_API AXSpace : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's ... |
#ifndef RIGID2D_INCLUDE_GUARD_HPP
#define RIGID2D_INCLUDE_GUARD_HPP
/// \file
/// \brief Library for two-dimensional rigid body transformations.
#include<iosfwd> // contains forward definitions for iostream objects
#include<cmath>
namespace rigid2d
{
/// \brief PI. Not in C++ standard until C++20.
constexpr ... |
#include "ClockGame.h"
ClockGame::ClockGame(sf::RenderWindow *window, sf::Clock *clock)
{
this->window = window;
this->clock = clock;
}
ClockGame::~ClockGame()
{
}
int ClockGame::getTime()
{
sf::Time elapsed = clock->getElapsedTime();
int a = elapsed.asSeconds();
return a;
} |
//
// Created by 王润基 on 2017/4/8.
//
#include "ParallelLight.h"
Light ParallelLight::illuminate(Vector3f const &point) const {
float t = ray.calcProjectionT(point);
float d = ray.calcDist(point);
if(d > r || t < 0) return Light(point, point, Vector3f::zero);
return Light(point - ray.getUnitDir() * t,... |
#pragma once
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
class BigInteger
{
public:
BigInteger() = default;
BigInteger(size_t num)
{
mData.reserve(30);
while (num > 0)
{
mData.push_back(num % 10);
num /= 10;
}
}
... |
#ifndef __CSECTION_H_
#define __CSECTION_H_
class CSection
{
public:
CSection();
~CSection();
};
#endif |
#define WINDOW_HEADER ("")
#define SCREEN_WIDTH (1280.0f)
#define SCREEN_HEIGHT (720.0f)
#define MS_PER_S (1000.0)
#define FRAMES_PER_SECOND (60.0)
#define EDITOR
//#define DEBUG_PRINT
#define FPS_COUNT
#define RELEASE_MODE (false)
#if !(RELEASE_MODE)
#define USE_ASSERTS
#endif
#define UNITY_BUILD (true)
/... |
#ifndef CINEMASIMULATION_H
#define CINEMASIMULATION_H
#include "ServiceDesk.h"
class CinemaSimulation
{
public:
CinemaSimulation(int simulationLen, int timeBetweenPeople);
void run();
void printStats() const;
protected:
private:
int timeBetweenPeople;
... |
#pragma once
#include <cstdlib>
#include <iostream>
#include "Windows.h"
#include <string>
using namespace std;
void TakeName();
void TimerIO();
void Update();
|
//ex14.cpp 的pair写法
#include <bits/stdc++.h>
using namespace std;
char maze[205][205];
bool vis[205][205];
int step[205][205];
int dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
queue<pair<int,int>> p;
int n, m;
bool in(int x, int y) {
return 0 <= x && x < n && 0 <= y && y < m;
}
int bfs(int x, int y) {
... |
/****************************************************************************/
/* C++ library for creating a game (i.e., set of all strongly connected */
/* components) */
/* Written by SCHULZ Quentin, quentin.schulz@utbm.fr , Nov. 2013 */
/****************************************************... |
#include"ArkRcon.h"
using namespace std;
ArkRcon::ArkRcon()
{
}
ArkRcon::~ArkRcon()
{
WSACleanup();
for (auto& i : this->_server)delete(i);
}
bool ArkRcon::init()
{
WORD sockVersion = MAKEWORD(2, 2);
WSADATA data;
if (WSAStartup(sockVersion, &data) != 0)
{
LOG("WSA init Error");
return false;
}
return t... |
//
// BulletNode.h
// Boids
//
// Created by Yanjie Chen on 3/13/15.
//
//
#ifndef __Boids__BulletNode__
#define __Boids__BulletNode__
#include "cocos2d.h"
#include "../data/DamageCalculate.h"
#include <spine/spine-cocos2dx.h>
#define DEFAULT_BULLET_SPEED 500.0
class BulletNode : public cocos2d::Node {
protected... |
#ifndef BULLET_CLASS_HPP
# define BULLET_CLASS_HPP
#include "GameElement.class.hpp"
class Bullet : public GameElement {
std::string _name;
public:
Bullet();
Bullet(std::string name);
Bullet(Bullet const & rhs);
Bullet & operator=(Bullet const &);
~Bullet();
};
#endif |
//
// Created by user on 8/26/2021.
//
#include "UdpSocket.h"
UdpSocket::UdpSocket(const char * const othersIp, int othersPort) {
this->socketId = socket(AF_INET, SOCK_DGRAM, 0);
if (this->socketId < 0) {
perror("error creating socket");
}
memset(&this->othersin, 0, sizeof(this->othersin));
... |
/* value.cpp -*- C++ -*-
Rémi Attab (remi.attab@gmail.com), 12 Apr 2014
FreeBSD-style copyright and disclaimer apply
reflect::Value reflection implementation.
*/
#include "value.h"
/******************************************************************************/
/* VALUE ... |
#ifndef SYNC_BLOCKCHAIN_H
#define SYNC_BLOCKCHAIN_H
#include <bitcoin/blockchain/blockchain.hpp>
using namespace libbitcoin;
struct transaction_index_t
{
size_t depth, offset;
};
class sync_blockchain
{
public:
sync_blockchain(blockchain& chain);
message::block block_header(size_t depth) const;
mess... |
#include<iostream>
#define OJ 98
using namespace std;
int main()
{
#ifndef OJ
freopen("201512-1.txt","r",stdin);
#endif
long long n;
cin>>n;
long res=0;
while(n!=0)
{
res+=n%10;
n/=10;
}
cout<<res;
#ifndef OJ
fclose(stdin);
#endif
return 0;
}
|
/*
* SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "validatordate_p.h"
#include <QDate>
using namespace Cutelyst;
ValidatorDate::ValidatorDate(const QString &field, const char *inputFormat, const Cutelyst::ValidatorMessages &me... |
#include<cstdio>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
struct node {
int time;
int num;
int pri;
char msg[100];
bool friend operator < (node a, node b) {
if(a.pri == b.pri)
return a.time > b.time;
return a.pri > b.pri;
}
};
in... |
#ifndef CREATEPAGEDIALOG_H
#define CREATEPAGEDIALOG_H
#include <QDialog>
namespace Ui {
class CreatePageDialog;
}
class CreatePageDialog : public QDialog
{
Q_OBJECT
static int m_create_page_counter;
explicit CreatePageDialog(QStringList modules,
QWidget *parent = 0);
~... |
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
const int maxn = 105;
const int w[5][5]
= { { 5, -1, -2, -1, -3 }, { -1, 5, -3, -2, -4 }, { -2, -3, 5, -2, -2 }, { -1, -2, -2, 5, -1 }, { -3, -4, -2, -1, 0 } };
int alen, blen, dp[maxn][maxn] = { 0 };
string a, b;
i... |
#include "FoundationPch.h"
#include "Foundation/Math/SimdSphere.h"
|
#pragma once
#include <fstream>
#define assert(X, ...) \
do { \
if (!(X)) { \
printf("assert failed in %s:%d: ", __FILE__, __LINE__); \
printf(__VA_ARGS__); \
} \
} while (0)
#define die(msg) do { puts(msg); exit(1); } while (0)
|
/*
* Shader.cpp
*
* Created on: 21 ÑенÑ. 2017 г.
* Author: СонÑ
*/
#include "Shader.h"
#include "Common.h"
Shader::Shader(String vertex_filename, String fragment_filename) {
if (vertex_filename.size() == 0 || fragment_filename.size() == 0) Msg::Error(L"Shader: ошибка не указан один... |
#include <cstdio>
#include <iostream>
using namespace std;
typedef long long ll;
struct Comod {
int id, cost, weight, father, cnt, son[2];
Comod() { cnt = son[0] = son[1] = 0; }
};
const int maxn = 32000, maxm = 60;
// n-总钱数,m-商品数
int n, m, dp[maxn] = { 0 };
Comod comod[maxm];
int main() {
// #define DEBUG
#... |
#include <SoftwareSerial.h>
#include <SPI.h>
#define o1 7
#define o2 8
SoftwareSerial BTserial(5,6); // 5 for tx, 4 rx
int state = 0;
void setup() {
// put your setup code here, to run once:
BTserial.begin(38400);
Serial.begin(9600);
Serial.println("Hello");
SPI.begin();
pinMode(o1, OUTPUT);
pinMode... |
/*
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 "ObjLoader.h"
ObjLoader::ObjLoader(string filename)
{
std::ifstream file(filename);
std::string line;
while (getline(file, line))
{
if (line[0] == 'v')
{
Vertex Point;
std::istringstream s(line.substr(2));
s >> Point.Position.x >> Point.Position.y >> Point.Position.z;
vSets.pu... |
/*
* UAE - The Un*x Amiga Emulator
*
* Win32 DirectInput/Windows XP RAWINPUT interface
*
* Copyright 2002 - 2011 Toni Wilen
*/
int rawinput_enabled_hid = -1;
int xinput_enabled = 0;
// 1 = keyboard
// 2 = mouse
// 4 = joystick
int rawinput_log = 0;
int tablet_log = 0;
int no_rawinput = 0;
int no_directinput = 0;
int ... |
#include "book.h"
/**
* @brief Book::getAvailable
* gets the list of
* @return
*/
std::vector<bool> Book::getAvailable() const
{
return available;
}
void Book::setAvailable(const std::vector<bool> &value)
{
available = value;
}
std::vector<time_t> Book::getRentedOn() const
{
return r... |
class Solution {
public:
int numTrees(int n) {
vector<int> M(n+1,0);
M[0] = 1;
for(int i = 1; i <= n; i++)
{
int temp = 0;
for(int j = 1; j <= i; j++)
{
temp += M[j-1]*M[i-j];
}
M[i] = temp;
}
... |
#include <iostream>
using namespace std;
int main() {
double iP;
double total;
double tax;
cout << "enter the amount of items purchased";
cin >> iP;
tax = iP * 0.07;
total = iP + tax;
cout << "Your items purchased + taxs = " << total << "$" << endl;
return 0;
... |
#ifndef TEXTTESTER_H_
#define TEXTTESTER_H_
#include <string>
#include <vector>
class TextTester {
public:
TextTester();
~TextTester();
void testResize();
void testReadText();
void testAppendText();
void testDeleteWordAll();
private:
std::string* generateText_(std::vector<std::string>& text_vector, unsigne... |
// - SCRNREF.CPP -
//
// Implementation of class "CScreenReference".
//
// Author: Zhang Lei
// Date: 2000. 4. 26
//
#include "stdafx.h"
#include "ScrnRef.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n+1];
for(int i=1; i<=n; i++) cin>>a[i];
a[0] = -10001;
for(int i=2; i<=n; i++)
{
int v = a[i], j = i-1;
while(j>=0 && v<a[j])
{
a[j+1] = a[j];
j--;
}
a[j+1] = v;
for(int i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<e... |
#include "SafetyConnection.h"
namespace database {
SafetyConnection::SafetyConnection() {
source_ind_ = -1;
PoolConnections* instance = PoolConnections::GetInstance();
instance->SetParams("config.txt");
source_ind_ = instance->GetConnection(conn_);
}
SafetyConnection::~SafetyConnection() {
Retu... |
#include "AVLtree.h"
bool isContain(const QString &str1,const QString &str2){
for(int i=0;i<str2.length();i++){
if(str1[i]!=str2[i]){return false;}
}
return true;
}
AVLTree::AVLTree()
{
root=NULL;
}
AVLNode *AVLTree::Search(QString x, AVLNode *ptr){
if (ptr == NULL){
return NULL;
... |
#ifndef SRADIO_CPP
#define SRADIO_CPP
#include <windows.h>
#include "SApp.h"
#include "SWindow.h"
#include "SButton.h"
#include "SRadio.h"
SRadio::SRadio(SWindow * pWin, UINT uStyle, UINT uId, UINT uExStyle):
SButton(pWin, uStyle | BS_RADIOBUTTON, uId, uExStyle)
{ }
SRadio::~SRadio()
{ }
BOOL SRadio::IsChecked()
{
... |
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int n;
cout<<"Enter a number: ";
cin>>n;
bool flag = 0;
for(int i = 2; i <= sqrt(n); i++) {
if(n % i == 0) {
flag = 1;
cout<<"Not prime";
break;
}
}
if(flag == 0) {
... |
#pragma once
#include "ofMain.h"
#include "ofxCv.h"
#include "FaceOsc.h"
#include "ofxXmlSettings.h"
#include "ofxOsc.h"
#include "ofxBox2d.h"
class ofApp : public ofBaseApp, public FaceOsc {
public:
void setup();
void update();
void draw();
void keyPressed(int key);
bool bUseCamera, bPaused;
int camWid... |
#pragma once
#include <map>
#include <string>
#include "Tags.h"
class TradosUnit
{
public:
TradosUnit();
virtual ~TradosUnit();
std::map<std::wstring, std::wstring>& pairs(void) { return m_pairs; }
const std::map<std::wstring, std::wstring>& pairs(void) const { return m_pairs; }
const std::wst... |
#pragma once
#include "cui.h"
class cButton :
public cUI
{
private:
_SYNTHESIZE_INHER( bool, m_IsVirusPatten, VirusPatten );
_SYNTHESIZE_REF_INHER( float, m_fPattenTime, PattenTime );
_SYNTHESIZE_REF_INHER( D3DXVECTOR3, m_vStart, StartPos );
_SYNTHESIZE_REF_INHER( D3DXVECTOR3, m_vEnd, EndPos );
public:
virtual vo... |
#include <gtest/gtest.h>
#include "CppLinq.h"
#include "TestUtils.h"
TEST(Contains, ThreeInts)
{
std::vector<int> src = { 1, 2, 3 };
auto rng = CppLinq::From(src);
EXPECT_TRUE(rng.Contains(1));
EXPECT_TRUE(rng.Contains(2));
EXPECT_TRUE(rng.Contains(3));
EXPECT_FALSE(rng.Contains(0));
EXPECT_FALSE(rng.Contai... |
#include "wizFolderView.h"
#include <QtGui>
#include "widgets/wizScrollBar.h"
#include "wizdef.h"
#include "share/wizsettings.h"
#include "share/wizuihelper.h"
#include "wiznotestyle.h"
CWizFolderView::CWizFolderView(CWizExplorerApp& app, QWidget *parent)
: QTreeWidget(parent)
, m_app(app)
, m_dbMgr(app... |
#include<stdio.h>
#include<string.h>
void fun(char s[])
{
int len=strlen(s);
int letter=0,num=0,space=0,other=0;
for (int i=0; i<len; i++)
{
if ((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
letter++;
else if (s[i]>='0'&&s[i]<='9')
num++;
else if (s[i]==' '||s[i]=='\t')
s... |
string Solution::largestNumber(const vector<int> &A) {
vector<int> v;
int n=A.size();
int count=0;
for(int i=0;i<n;i++)
{
if(A[i]==0)count++;
v.push_back(A[i]);
}
if(count==n)
{
return "0";
}
sort(v.begin(),v.end(),[](int &a,int &b)
{
string t1... |
#ifndef __GEOMETRY2D_H__
#define __GEOMETRY2D_H__
#include <Python.h>
#include <boost/python.hpp>
#include <boost/python/numeric.hpp>
#include <boost/python/tuple.hpp>
#include <boost/numpy.hpp>
#include <boost/filesystem.hpp>
#include <boost/math/distributions.hpp>
const boost::math::normal_distribution<> standard_n... |
/**
* @author Levi Armstrong
* @date January 1, 2016
*
* @copyright Copyright (c) 2016, Southwest Research Institute
*
* @license Software License Agreement (Apache License)\n
* \n
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the Licens... |
// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.
#include "core/CompileConfig.h"
#if OUZEL_SUPPORTS_DIRECT3D11
#include "ShaderResourceD3D11.h"
#include "RendererD3D11.h"
#include "core/Engine.h"
#include "utils/Log.h"
namespace ouzel
{
namespace graphics
{
ShaderReso... |
#ifndef _PLAYER_KEYBOARD_CONTROL_COMPONENT_H_
#define _PLAYER_KEYBOARD_CONTROL_COMPONENT_H_
#include "TransformComponent.h"
#include "InputComponent.h"
#include "GameObject.h"
//Input handling component for the player. This is unique to the player object and does not exist anywhere else.
class PlayerKeyboardControlCo... |
#ifndef GLOBALS_H
#define GLOBALS_H
#include <functional>
#include <string>
typedef std::basic_string<uint8_t> Bytes;
#define VERSION "0.1"
#define SlowBaudRate 19200
/* Global options. */
extern bool Verbose;
extern const char* SerialPort;
/* Utilities. */
extern void error(const char* message, ...);
extern void... |
#pragma once
#include "State.h"
#include "Font.h"
enum
{
MM_SINGLE,
MM_HIGH,
MM_OPTIONS,
MM_QUIT,
};
class NewGame;
class MainMenu final : public State
{
public:
MainMenu(NewGame *game);
~MainMenu() final;
void Enter() final;
void Update(float dt) final;
void Draw() final;
void Exit() final;
private:
... |
#include "pch.h"
#include "data_structure.h"
#define M_PI 3.14159265358979323846 /* pi */
bool kinect_data::full_frame()
{
for (int i = 0; i < number_of_joints; i++)
{
if (needed_joints[i].joint_name == -1)
{
return false;
}
}
return true;
}
void kinect_data::print_data()
{
//if (full_frame())
/... |
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
int n, i, score=0;
cin>>n;
int a[n], b[n];
for(i=0; i<n; i++){
cin>>a[i];
}
for(i=0; i<n; i++){
cin>>b[i];
if(a[i]>b[i]){
score+=3;
}
else if(a[i]==b[i]){
scor... |
#pragma once
#include "GameState.h"
const int NUM_OF_MENU = 4;
class MainMenu : public GameState
{
public:
MainMenu(int windowWidth, int windowHeight);
void Update(sf::RenderWindow* window);
void Draw(sf::RenderWindow *window);
private:
sf::Texture texture;
sf::Sprite sprite;
sf::Font *font;
sf::Text titl... |
#include "ColormapWin.h"
ColormapWin::ColormapWin(QWidget *parent)
:QDialog(parent)
{
ui.setupUi(this);
connect(ui.yesBtn, SIGNAL(clicked()), this, SLOT(yesBtnPressed()));
connect(ui.noBtn, SIGNAL(clicked()), this, SLOT(noBtnPressed()));
}
ColormapWin::~ColormapWin()
{
}
void ColormapWin::yesBtnPressed()
{
C... |
#ifndef DYNAMICCOREHANDLER_H
#define DYNAMICCOREHANDLER_H
#include <dlfcn.h>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
#include "../DynamicLibraryLoader/dynamic_library_loader.hpp"
#include "../Multigraph/MultiGraph.h"
#include "DynamicCore.h"
class DynamicCoreHandler {
DynamicLibr... |
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int k = 1;
double t = 1;
int sum = 0;
while (t < 9) {
t = 10.0/pow(10, 1.0/k);
sum = sum + (10 - t);
k++;
}
cout << sum << endl;
return 0;
}
|
/**
* @brief Deals with in game mechanisms and subsystems
* @file BaseLogic.h
* @author matthewpoletin
*/
#pragma once
#include "ILogic.h"
#include "../../Levels/LevelManager.h"
#include "../../Actors/ActorFactory.h"
#include "../../Input/InputManager.h"
#include "../../Utilities/Timer/Timer.h"
namespace liman {... |
#ifndef __SCREEN_H__
#define __SCREEN_H__
#include <string>
class Screen {
public:
typedef std::string::size_type pos;
Screen() = default;
Screen(pos ht, pos wd, char c) : height(ht), width(wd), contents(ht * wd, c) {}
char get() const { return contents[cursor]; }
inline char get(pos ht, pos wd) const;
Screen &... |
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#inclu... |
#include "rendering.h"
namespace Rendering {
int RenderModule::MakeWindow(int width, int height, const char* title) {
printf("Gets here 1");
m_Title = title;
m_Width = width;
m_Height = height;
m_CursorFocused = false;
m_Camera = new Camera(glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0));
if (!glfwInit()... |
#ifndef FOGCATCHSTATEMENT_HXX
#define FOGCATCHSTATEMENT_HXX
class FogCatchStatement : public FogStatement
{
typedef FogStatement Super;
typedef FogCatchStatement This;
TYPEDECL_SINGLE(This, Super)
PRIMREF_DERIVED_DECLS(This)
// FOGTOKEN_DERIVED_DECLS
FOGTOKEN_MEMBER_DECLS
FOGTOKEN_LEAF... |
// Copyright (c) 2012-2017, The CryptoNote developers, The Bytecoin developers
// Copyright (c) 2018-2020, The Qwertycoin Group.
//
// This file is part of Qwertycoin.
//
// Qwertycoin is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
... |
//
// 46_Permutations.hpp
// algorithms
//
// Created by Maple Yin on 2020/4/24.
// Copyright © 2020 Maple Yin. All rights reserved.
//
#ifndef _6_Permutations_hpp
#define _6_Permutations_hpp
#include <stdio.h>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> permute(vector... |
/*************************************************************
* > File Name : c1090_0.cpp
* > Author : Tony_Wong
* > Created Time : 2019/11/13 11:34:07
* > Algorithm :
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
typ... |
#ifndef __SNESAPU_FILTER_H__
#define __SNESAPU_FILTER_H__
namespace SnesApu
{
class Filter
{
public:
Filter(int taps);
~Filter();
void SetCoefficient(int index, unsigned char value);
int Next(int value);
private:
int taps;
unsigned char *coefficients;
int *buffer;
int bufferPos;
};
}
#endif
|
#include "ScoreScreen.h"
#include "Entity.h"
#include "Counter.h"
#include "EntityGenerators.h"
#include "Rendering.h"
int ScoreScreen::highScore = 0;
ScoreScreen::ScoreScreen() {}
ScoreScreen::~ScoreScreen() {
delete _gameScore;
delete _highScore;
delete _scoreboard;
delete _medal;
}
void ScoreScreen::setSc... |
#ifndef ANSWERWINDOW_H
#define ANSWERWINDOW_H
#include <QMainWindow>
class AnswerWindow : public QMainWindow
{
Q_OBJECT
public:
AnswerWindow(QWidget *parent = 0);
~AnswerWindow();
void showAnswer();
void solve();
void setGrid(int v);
void setThread(int v);
private:
int grid=51;
int... |
#include <iostream>
using namespace std;
class parentMember {
public:
parentMember() {
cout << "Construct parent member class" << endl;
}
~parentMember() {
cout << "Destruct parent member class" << endl;
}
};
class childMember {
public:
childMember() {
cout << "Construct ... |
#include <cstdio>
//#include <ctime>
int main()
{
//freopen("..\\file\\input.txt","r",stdin);
//freopen("..\\file\\output.txt","w",stdout);
/*clock_t s,e;
s=clock();*/
int a,b;
while(scanf("%d%d",&a,&b)==2)
printf("%d\n",a+b);
/*e=clock();
printf("Use %.0lf ms\n", (((double)(e-s)... |
#include<stdio.h>
#include<stdlib.h>
#define size 10
int arr[size];
void binarySearch(int arr[],int ele,int startIndex,int endIndex)
{
while(startIndex<=endIndex)
{
int mid=(startIndex+endIndex)/2;
if(arr[mid]==ele)
{
printf("\n index is %d ",mid);
return;
}
if(arr[mid]>ele)
endIndex=mid-1;
else
... |
#pragma once
#include <sc2api/sc2_api.h>
#include <sc2utils/sc2_manage_process.h>
#include <SC2.h>
#include <EventListener.h>
#include <utils/GridUtils.h>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <set>
namespace sc2::utils
{
class Map;
}
class Kubot : public sc2::Agent
{
public:
~K... |
#include<iostream>
using namespace std;
int main()
{
int iNum,iDen,iAns;
cout<<"enter the Number and Denonter\t";
cin>>iNum>>iDen;
try
{
if(0==iDen)
throw iDen;
else
iAns=iNum/iDen;
}
catch(int exception )
{
cout<<"exception found\t"<<exception<<endl;
return 0;
}
cout<<"exception not found\t"<... |
#ifndef _SPLASHSCREEN_H_
#define _SPLASHSCREEN_H_
#include "cocos2d.h"
#include <vector>
class SplashScreen :public cocos2d::Layer
{
public:
static cocos2d::Scene *createScene();
virtual bool init();
bool setupSprites();
void swapPosition(cocos2d::Sprite* spr1, cocos2d::Sprite* spr2);
void start... |
#include <windows.h>
#include <gl/glut.h>
void DoDisplay();
void DoMenu(int value);
int Action;
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance
,LPSTR lpszCmdParam,int nCmdShow)
{
glutCreateWindow("OpenGL");
glutDisplayFunc(DoDisplay);
glutCreateMenu(DoMenu);
glutAddMenuEntry("변환 없음",0);
glut... |
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int solve(int n)
{
int count = 0;
for (int i = 5; n / i >= 1; i *= 5)
count++;
return count;
}
};
int main()
{
Solution solve;
cout << solve.solve(18);
return 0;
} |
#include <ESP8266WiFi.h>
#include <Wire.h>
#include <WiFiUdp.h>
/* I2C MPU6050*/
const int8_t R_CONFIG = 0x1A;
const int8_t R_GYRO_CONFIG = 0x1B;
const int8_t R_ACCEL_CONFIG = 0x1C;
const int MPU_ADDR = 0x68;
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
/* WiFi */
const char* ssid = "Sergio_LINK";
const char* password ... |
#include "ResMagicChain.h"
void ResMagicChain::setData(char *buf, int offset)
{
mType = (int)buf[offset] & 0xff;
mIndex = (int)buf[offset + 1] & 0xff;
mNum = (int)buf[offset + 2] & 0xff;
int index = offset + 3;
mMagics.resize(mNum);
for (int i = 0; i < mNum; i++)
{
int magicType... |
/*
* SPDX-FileCopyrightText: (C) 2018 Daniel Nicoletti <dantti12@gmail.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef HPACKTABLES_H
#define HPACKTABLES_H
#include <QHash>
#include <QString>
#include <QVector>
namespace Cutelyst {
struct DynamicTableEntry {
QString key;
QString value;
};
class He... |
#include<bits/stdc++.h>
#define ll long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
#define N 100000
#define mod 1000000007
template <typename T>
void print(T x){cout<<x<<"\n";}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<"\n";}
te... |
#include "../memPool_t.h"
#include <assert.h>
#include <string.h>
int main() {
memPool_t::setNewPageSize(1024);
memPool_t *pool = new memPool_t(5);
assert(pool->getPageCount() == 5);
assert(pool->getCapacity() == 5 * 1024);
assert(pool->getSize() == 0);
assert(pool->isEmpty());
assert(pool->getPosition() == 0);... |
#include "Bullet.h"
#include "Tank.h"
#include "Buff.h"
int Bullet::run()
{
for (int i = 0; i < speed; i++)
{
draw(false);
if (map.map[y][x / 2] && map.map[y][x / 2]->getType() == type)
map.map[y][x / 2] = nullptr;
if (x <= 2 || x >= WIDTH - 4 || y <= 1 || y >= HEIGHT - 2)
return -1;
if (c... |
#include <iostream>
#include <fstream>
const char * file1 = "input1.txt";
const char * file2 = "input2.txt";
const char * file3 = "output1.txt";
int main() {
using namespace std;
ifstream fin1(file1, ios_base::in);
ifstream fin2(file2, ios_base::in);
ofstream fout1(file3, ios_base::out);
if (!fin1.is_open() || !... |
#ifndef SSPEDITOR_AIHANDLER_AIHANDLER_H
#define SSPEDITOR_AIHANDLER_AIHANDLER_H
#include "Header.h"
#include "../AIDLL/AIComponent.h"
#include <vector>
/*
Author: Martin Clementson
This Class holds the AI components that is in use by the current level.
The components are related to a container/entity and share the sa... |
#pragma once
#include <string>
#include <unordered_map>
#include "paraphrase.h"
#include "errorID.h"
PP_API extern Context *GlobalContext;
PP_API extern std::unordered_map<std::string,const Word*> Dict;
extern unsigned int G_NumOfCores;
PP_API bool Docol(Context& inContext) NOEXCEPT;
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int bubbleSort(vector<int> &a);
int printVector(vector<int> a);
int linear_search(vector<int> a, int);
int main()
{
int input,n,num;
vector<int> a;
cout<<"Enter the number of inputs: ";
cin>>n;
cout << "Enter your numbers to be e... |
#ifndef PETSC_FD_UTILS_H
#define PETSC_FD_UTILS_H
#include <fd/Operator.h>
#include <vector>
#include <utility>
#include <tuple>
#include <optional>
#include <variant>
#include <memory>
#include <fstream>
#include <cfenv>
namespace fd
{
/* NOTE: DO NOT CALL VecCreate() on out! This routine does that! You DO, howev... |
/*
Fichero calculadora2.cc que almacena el módulo principal del programa
*/
#include <iostream>
#include "../calculos1/calculos.h"
#include "calculosGen.h"
using namespace std;
/*
* Pre: ---
* Post: Presenta el menu de opciones disponibles
*/
void presentarMenu () {
cout << "\nMENU DE OPERACIONES\n======... |
#include<bits/stdc++.h>
using namespace std;
int arr[100000], len;
void read_inputs(string file_name)
{
ifstream input_stream;
input_stream.open(file_name);
if (!input_stream)
{
cout << "Cannot open file or File dose not exist.\n";
exit(1);
}
int num, i = 0;
while(input_strea... |
#include <cstddef>
typedef int Rank;
#define ListNodePosi(T) ListNode<T>* // 文本宏替换
template <typename T> class ListNode {
public:
// Data member
T data; ListNodePosi ( T ) pred; ListNodePosi ( T ) succ; // 数据区,前驱,后继
// constructor
ListNode ( T e, ListNodePosi ( T ) p = nullptr, ListNodePosi ( T ) s = null... |
#ifndef __PROXY_FACTORY_H__
#define __PROXY_FACTORY_H__
#include "Proxy.h"
#include <memory>
class ProxyFactory
{
std::shared_ptr<Proxy> getObject();
};
#endif // __PROXY_FACTORY_H__
|
//
// Created by wqy on 19-12-11.
//
#ifndef VERIFIER_ACTION_H
#define VERIFIER_ACTION_H
#include "../Term/AttributeTerm.h"
namespace esc {
class Action {
public:
//Action();
//Action(const string& toParse);
virtual string to_string() const;
virtual int getID() = 0; // ID : {1 ... |
#include "randomizer_options.hpp"
#include <iostream>
#include <landstalker-lib/constants/item_codes.hpp>
#include <landstalker-lib/tools/stringtools.hpp>
#include <landstalker-lib/tools/vectools.hpp>
#include <landstalker-lib/tools/bitstream_writer.hpp>
#include <landstalker-lib/tools/bitstream_reader.hpp>
#include ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.