text
stringlengths
8
6.88M
#include <iostream> #include <stdlib.h> using namespace std; int main(){ int n, resp, pos; cout<<"Ingrese el numero de elementos del arreglo"<<endl; cin>>n; float vector[n]; for (int i = 0; i < n; i++) { cout<<"Ingrese un numero en la posicion "<<i<<" : "; cin>>vector[i]; } ...
// // Created by max on 17/05/19. // #include <sys/stat.h> #include <signal.h> #include <sys/types.h> #include <fcntl.h> #include "Fifo.h" #include "helper.h" Fifo::Fifo(const std::string &inp, Fifo::flag flag) { Printer::println(std::cout, "Fifo::Fifo(string)"); std::stringstream strstr(inp); strstr >> ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2007-2009 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #ifndef _OBML_CONFIG_H #define _OBML_CONFIG_H #ifdef WEB_TURBO_M...
#ifndef __OBJ_LOADER_H #define __OBJ_LOADER_H #include <vector> #include <GLGraphics/GLHeader.h> #include <CGLA/Vec3f.h> #include <CGLA/Vec2f.h> #include <Mesh/Material.h> namespace Mesh { class ObjLoader { public: // Load an OBJ model into the out parameters. // Note only simple OBJ files are supported. static bool...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 1995-2002 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" #if defined(SPELLCHECK_SUPPORT) #inclu...
#include <bits/stdc++.h> using namespace std; #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) #define MAXN 100 #define INF 0x3f3f3f3f #define DEVIATION 0.00000005 typedef long long LL; int digit(int k){ int dig = 1; while( k/=10 ) dig++; return dig; } bool isArm(int num, int dig){ int ans = 0; in...
#pragma once #include "../../modules/input/EventModule.h" #include <SFML/Window/Event.hpp> namespace Game { class EventModule; class EventSubscriber { public: virtual ~EventSubscriber(); virtual void subscribed(EventModule *manager, int hash) final; virtual void onEvent(sf::Event event) = 0; private: ...
#include<iostream> #include"Node.h" using namespace std; /* * Insert a node in the given bst *IDEA: Search for it if present exit else search until you find a leaf node add node there */ Node* insert(Node* root,int x){ if(root==NULL) return new Node(x); else if(root->key>x){ root->left=in...
#include<iostream> #include<conio.h> using namespace std; main() { int a,b,choice; int *p1,*p2; float c; float *p3; cout<<"\t\t\t\tWELCOME TO CALCULATOR\n"; do { cout<<"\n1.Addition\n2.Subraction\n3.Multiplication\n4.Division\n5.Exit\n"; cout<<"\t\t\t\tEnter Your choice : "; cin>>choice; ...
/* ID: stevenh TASK: ariprog LANG: C++ */ #include <fstream> using namespace std; int N, M, S[62500], ansList[10000][2]; bool flags[125001]; void printS(int len) { for (int i = 0; i < len; i++) { printf("%d ", S[i]); } printf("\n"); } void sort(int len) { for (int i = 0; i < len - 1; i++) { for (int j = i ...
#include <string> #include <iostream> #include <cmath> #include "Player.hpp" #include "Engimon.hpp" #include "Skill.hpp" #include "Map.hpp" using namespace std; const int Player::MAX_CAPACITY = 20; Player::Player() { this->map = Map(); map.setplayerPosition(1, 1); map.setactiveEngimonPosition(0, 0); } P...
/*========================================================================= Program: Visualization Toolkit Module: vtkOpenVRRenderWindow.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distri...
int buzzer = 7; int MQ2 = A0; int Value = 500; void setup() { // put your setup code here, to run once: pinMode(buzzer,OUTPUT); pinMode(MQ2,INPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: int analogSensor = analogRead(MQ2); Serial.print("Sensor value:")...
// MAIN.CPP #include "constants.h" #include "graphics.h" #include "UI.h" #include "Control.h" Control C; // functions void process_input(); void update(); void render(); void generate(); void show_title_screen(); bool is_colliding(SDL_Rect &a, SDL_Rect &b); double current_time(); void createNumberFont(vector<Control...
#include "shared.h" HANDLE hPipe; DWORD dwWritten; void getGameMsg() { char data[1000]; DWORD numRead; char *token; DWORD bytesAvail = 0; BOOL isOK = PeekNamedPipe(hPipe, NULL, 0, NULL, &bytesAvail, NULL); if (bytesAvail > 0) { ReadFile(hPipe, data, 1000, &numRead, NULL); if (numRead > 0) { printf("RECEI...
#include "Camera.h" Camera::Camera() { } Camera::Camera(glm::vec3 origin, glm::vec3 end) { //position = origin; //direction = glm::normalize(end - origin); //glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0); //glm::vec3 side = glm::normalize(glm::cross(direction, up)); //glm::vec3 finalUp = glm::normalize(glm::cross...
#ifndef NEURO_EVOLUTION_ENVIRONMENT_H #define NEURO_EVOLUTION_ENVIRONMENT_H #include "evolution/EvolutionEnvironment.h" #include "neural_network/NeuralNetworkConfiguration.h" class NeuroEvolutionEnvironment: public EvolutionEnvironment<NeuralNetworkConfiguration> { public: NeuroEvolutionEnvironment(int populatioSize...
#include <cstdio> int main() { int a, b, res; char c; scanf("%d %c %d", &a, &c, &b); switch (c) { case '+': res = a + b; break; case '-': res = a - b; break; case '*': res = a * b; break; case '/': res = a / b; break; case '%': res = a % b; break; defau...
#include <iostream> void foo(int a, int b, int c) { std::cout << "Call foo with args (int, int, int)" << std::endl; } void foo(int x, int* y) { std::cout << "Call foo with args (int, int*)" << std::endl; } void foo1(int a, int b, int c = 3) { std::cout << "Call foo1 with args (int, int, int default)" << ...
#ifndef _GERENCIADORGRAFICO_H_ #define _GERENCIADORGRAFICO_H #include <allegro.h> class GerenciadorGrafico { private: public: GerenciadorGrafico(); ~GerenciadorGrafico(); void init(); void deinit(); }; #endif
/* * string.h * * Created on: 31-Mar-2016 * Author: abhiarora */ #ifndef _STRING_H_ #define _STRING_H_ #include <stddef.h> #define STRING_DEF(n,s) char __str_##n[s]; \ String n = String(__str_##n, s); class String { private: char *buffer; //Buffer to hold strings of characters unsigned int length; //A...
#include "NumberConverter.h" /** * @brief Convert a Roman Numeral string to a decimal number. * @param roman The string to convert. * @return Decimal value of the string. */ int NumberConverter::RomanToDecimal(const std::string& roman) { // Running total, the value of this is returned as the result. int total = ...
#include <bits/stdc++.h> using namespace std; #define TESTC "" #define PROBLEM "13216" #define USE_CPPIO() ios_base::sync_with_stdio(0); cin.tie(0) int main(int argc, char const *argv[]) { #ifdef DBG freopen("uva" PROBLEM TESTC ".in", "r", stdin); freopen("uva" PROBLEM ".out", "w", stdout); #endif int CASE; ...
#include <bits/stdc++.h> using namespace std; ofstream fout ("square.out"); ifstream fin ("square.in"); #define For(x) for(int i = 0; i < x; i++) #define Forv(vector) for(auto& i : vector) int main(){ int x1,x2,x3,x4,y1,y2,y3,y4; fin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4; int maxx=max({x1,x2,x3,x4}); int minx...
#pragma once #include "client.hpp" #include "gm_mgr_class.hpp" #include <map> using namespace std; namespace pc = proto::config; namespace pcs = proto::cs; namespace pd = proto::data; namespace nora { namespace login { template <typename T> class client_mgr : public enable_shared_from_this<client_mg...
/*Problem: Chef and Calculation Link: https://www.codechef.com/SEPT16/problems/RESCALC Author: Jono */ #pragma warning(disable:4786) #define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:16777216") #include <bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false); #define endl '\n...
#include <iostream> using namespace std; long long arr[1001][10] = { 0 }; int main() { int N; cin >> N; for (int i = 0; i <= 9; i++) arr[1][i] = 1; for (int i = 2; i <= N; i++) { for (int j = 0; j <= 9; j++) { for (int k = j; k <= 9; k++) { arr[i][j] += arr[i-1][k]; arr[i][j] %= 10007; ...
#include<bits/stdc++.h> #define rep(i,n) for (int i =0; i <(n); i++) using namespace std; using ll = long long; const double PI = 3.14159265358979323846; bool is_Prime(int n){ if(n == 1)return false; for(int i = 2; i * i <= n; i++){ if(n % i == 0)return false; } return true; ...
#include<bits/stdc++.h> using namespace std; int m, n; int a[100][100]; void input(){ cin >> m >> n; for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++) cin >> a[i][j]; } } int main(){ freopen("MINROW.inp", "r", stdin); freopen("MINROW.out", "w", stdout); input(); int hang[100]; for(int ...
// // settings.hpp // AutoCaller // // Created by Micheal Chen on 2017/7/20. // // #ifndef settings_hpp #define settings_hpp #include "cocos2d.h" #include "testbase/BaseTest.h" DEFINE_TEST_SUITE(TestSettings); class GlobalSetting { public: static GlobalSetting* instance(); ~GlobalSetting(); void con...
#include<iostream> #include<cstdio> #include<string.h> using namespace std; int main() { char str[30]; int i,f=0,l; cout << "enter the string " << endl; gets(str); l=strlen(str); for(i=0;i<l;i++) { if(str[i]!=str[l-1-i]) { f=1; break; ...
#include <iostream> #include <random> #include "../src/heapsort.h" void printArray(int arr[], unsigned int size); void fillArray(int arr[], unsigned int size); bool isSorted(int arr[], unsigned int size); int main(){ unsigned const int SIZE = 10; int *arr = new int[SIZE]; fillArray(arr, SIZE); std::cout << "The...
// // Created by Noam pnueli on 2/11/17. // #include "collisions.h" double clamp(double min, double max, double n) { if(n < min) return min; else if(n > max) return max; return n; } // TODO: support more collision types Manifold collision_overlap(Collider* coll1 , Collider* coll2) {...
/** * @file No_Tag.hpp * * @author Matthew * @version 1.0.0 * @date Apr 17, 2015 */ #ifndef VALKNUT_CORE_TAGGING_POLICIES_NO_TAG_HPP_ #define VALKNUT_CORE_TAGGING_POLICIES_NO_TAG_HPP_ namespace valknut{ namespace tagging_policies{ /////////////////////////////////////////////////////////...
#include <Core.h> #include <PrimitiveManager.h> #include <PrimitiveInstance.h> #include <d3dx9math.h> #include <Timer.h> #include <iostream> using namespace std; class TestApp : public AppBase { public: TestApp() : AppBase() {} void InitVars(); void CreateAssets(); void DestroyAssets(); void OnUpdate(); void O...
#ifndef MYSERVICE #define MYSERVICE #include <QxtHttpServerConnector> #include <QxtHttpSessionManager> #include <QxtWebSlotService> #include <QxtWebPageEvent> class MyService : public QxtWebSlotService{ Q_OBJECT; public: MyService(QxtAbstractWebSessionManager * sm, QObject * parent = 0 ): QxtWebS...
// // Created by 송지원 on 2020/08/20. // //새로 생각한 솔류션으로 푸는 코드 //구글에서 스택을 비우게 하는 코드 검색해서 사용함. #include <iostream> #include <stack> using namespace std; int N; int temp; int MAX; int ANS = 0; template <typename T> inline void clear(std::stack<T>& Stacks){ while ( false == Stacks.empty()) { Stacks.pop(); ...
#ifndef HH_SCREEN #define HH_SCREEN #include <iostream> #include <string> #include <vector> #include "title.h" using namespace std; class screen { private: public: vector< vector<string> > state; vector< vector<string> > blank; vector<title> titles; int w; int h; int currentSelectedTitle; string FILL = " "; ...
//Password Validation // // //You are given a function: // //int CheckPassword(char str[ ], int n); // // // //The function accepts string 'std of size int as argument Implement the function which returns 1 if given string 'str' is a valid password else 0. // //'str' is a valid password if it satisfies below conditi...
/* * @lc app=leetcode.cn id=560 lang=cpp * * [560] 和为K的子数组 */ // @lc code=start #include<iostream> #include<vector> #include<algorithm> #include<map> using namespace std; class Solution { public: int subarraySum(vector<int>& nums, int k) { int n = nums.size(); vector<int> Sum(n+1, 0); ...
/* This sketch sends random data over UDP on a ESP32 device */ #include <WiFi.h> #include <ESPmDNS.h> #include <WiFiUdp.h> #include <ArduinoOTA.h> // WiFi network name and password: const char * networkName = "TP-LINK_40FE00"; const char * networkPswd = "78457393"; //IP address to send UDP data to: // either use...
#include <Arduino.h> // Su un file .ino non è necessario #include <Adafruit_NeoPixel.h> // Schetch che utilizza la libreria Adafruit NeoPixel // Ogni LED utilizzato utilizza circa 3 BYTES di RAM, quindi la striscia usa circa 3 x 150 = 450 BYTES di RAM // Ogni metro si striscia utilizza circa 2 Ah alla massima lum...
/******************************************************************************* Copyright (c) 2010, Steve Lesser Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1) Redistributions of source code must retain the above c...
#include <iostream> #include <vector> int main() { int n; std::cin >> n; std::vector<int> arr(n); for(int arr_i = 0;arr_i < n;arr_i++){ std::cin >> arr[arr_i]; } for (int i = n - 1; i >= 0; i--) { std::cout << arr[i] << " "; } return 0; }
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmUnsetCommand.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" // cmUnsetCommand bool cmUns...
/* * Program: ImageStitching.cpp * Usage: Start image stitching */ #ifndef IMAGE_STITCHING_H #define IMAGE_STITCHING_H #include <iostream> #include <vector> #include "SIFT.h" #include "Utils.h" #include "Matching.h" #include "Warping.h" #include "Blending.h" class Stitcher{ public: Stitcher(vector<CImg<float>> input...
#pragma once #include "Model.h" constexpr int NUMBER_OF_SENTIMENTS = 2; class ModelAnalyzer { Model* model; std::vector<BagOfWords> testingReviews; std::vector<int> actualSentiments; std::vector<int> predictedSentiments; int confusionMatrix[NUMBER_OF_SENTIMENTS][NUMBER_OF_SENTIMENTS] = { 0 }; double accuracy; ...
const int MAXN=1005; int n; ll a[MAXN]; struct Trie { int ch[2],sz; }T[MAXN*32]; int root=1,tot=1; void init(){ for(int i=1;i<=tot;i++) T[i].ch[0]=0,T[i].ch[1]=0,T[i].sz=0; tot=1; } void Insert(ll x) { int o=root; T[o].sz++; for(int k=32;k>=0;k--) { int c=((x>>k...
/*************************************************** * Program Assigment : 自定义工具栏按钮类 * File Name: tdtoolbar.h * Author : ThreeDog * Date : 2016/12/28 * Description: 自定义工具栏类,继承自自定义复选框,几乎没有改动,只是 * 去除了复选框的右控件,可以通过信号和槽或者回调函数实现功能。 * * **************************************************/ #ifndef TDTOOLBAR_H #define ...
// Problem No. 2 => Find the maximum and minimum element in the array #include <iostream> #include <climits> using namespace std; int main(){ int n; cout<<"Please enter the length of the array: "; cin>>n; int myarr[n]; for(int i=0; i<n; i++){ cout<<"Please enter the elements in the array...
// // Created by gurumurt on 11/6/18. // #ifndef EXEC_ENGINE_COMPARISON_IMPORTKERNELSOURCE_H #define EXEC_ENGINE_COMPARISON_IMPORTKERNELSOURCE_H #include <fstream> #include "globals.h" namespace dispatcher{ string readKernelFile(string _path) { //cout << "PATH :: " << _path << endl; string _m_o...
/******************************************************************************* * Filename : Character.h * Content : Character class (interacts with the scene and has time update) * Created : June 21, 2020 * Authors : Yash Patel * Language : C++17 *********************************...
// Created on: 2013-11-11 // Created by: Anastasia BORISOVA // Copyright (c) 2013-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 GNU Lesser General Public License version 2...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*- ** ** Copyright (C) 1995-2008 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" #include "mod...
#include <iostream> #include <ctime> using namespace std; int Min(int x, int y) { if(x<y)return x; else return y; } class Tank { private: int damage, health, x, y, direction; float armorclass; public: Tank(int sx, int sy, int sd) { damage = 40; health = 400; armorclass =...
#include "omp.h" #include "emmintrin.h" #include "nmmintrin.h" #include "immintrin.h" #include "defs.h" void conv_filter(int imgHeight, int imgWidth, int imgWidthF, short *filter, unsigned char *imgSrcExt, unsigned char *imgDst) { #if USE_OMP==1 #pragma omp parallel for #else #endif for (int row=0; row<imgH...
// Created on: 1999-06-22 // Created by: Roman LYGIN // Copyright (c) 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 GNU Lesser ...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2005 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. */ #ifndef SVG_PAINT_H #define SVG_PAINT_H #ifdef SVG_SUPPORT #include "...
#ifndef __SEMODEL_H__ #define __SEMODEL_H__ #include "SERenderObject.h" #include "SEMath.h" #include "SEMesh.h" #include "SEMaterial.h" template <class T> class SESkeleton; class SEAnimation; template <class T> class SEModel : public SERenderObject<T> { public: const bool &loade...
/*nest.cpp Tyler Jackson */ double nest(Mat& a, double x); inline double nest(Mat&a, double x){ int n=a.Rows(); double p=a(n-1); for(int i=n-2;i>=0;i--){ p=a(i)+p*x; } return p; }
/** Copyright (c) 2015 Eric Bruneton All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the follo...
#ifndef AMVK_INPUT_MANAGER_H #define AMVK_INPUT_MANAGER_H #ifdef __ANDROID__ #include <android/looper.h> #else #include <GLFW/glfw3.h> #endif #include <exception> #include "camera.h" class InputManager { public: InputManager(); virtual ~InputManager(); void pollEvents(); void handleMovement(double dt); bool k...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define rep1(i, n) for(int i = 1; i <= (int)(n); i++) #define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;} #define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;} typedef long l...
#pragma once // From Tutorial // http://allenchou.net/2013/05/memory-management-part-1-of-3-stl-compatible-allocators/ // http://allenchou.net/2013/05/memory-management-part-2-of-3-stl-compatible-allocators/ // http://allenchou.net/2013/05/memory-management-part-3-of-3-stl-compatible-allocators/ #include "Module/Memor...
#ifndef FILLIMAGEEXPANDER_H #define FILLIMAGEEXPANDER_H #include "iimageexpander.h" class FillImageExpander : public IImageExpander { public: FillImageExpander(); QImage * expand(QImage *original, int expand) override; }; #endif // FILLIMAGEEXPANDER_H
#include<bits/stdc++.h> using namespace std; int main(){ int f,x,sum = 0,ans = 0; cin>>f; for (int i = 0; i < f; i++) { cin>>x; sum += x; } for (int i = 1; i < 6; i++) { if ((sum + i)%(f+1) != 1){ ans += 1; } } cou...
#include "AnimationMove.h" #include "Task.h" #include "Animation.h" namespace T3D { AnimationMove::AnimationMove(T3DApplication *app) : Task(app) { elapsedTime = 0; variance = 0.2f; rotate = false; displace = false; } AnimationMove::~AnimationMove() { } void AnimationMove::update(float dt) { elapsedT...
// This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com #include "shared.h" #include "window.h" #include "vec3.h" #include "sphere.h" #include "raytracer.h" #include "xrng.h" #define STB_IMAGE_WRITE_IMPLEMENTATION #in...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 1995-2002 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" #include "OpTabs.h" #include "modules/util...
// // Created by tudom on 2019-12-31. // #include <utility> #include "../include.hpp" //&!off #include INFO_DYNAMITE_INCLUDE_N(exception/NoSuchFunction.hpp) //&!on INFO_DYNAMITE_API const char* info::dynamite::no_such_function::what[[nodiscard]]() const noexcept { static std::string ret; ret = "Requested fun...
#include "SceneLoader.h" #include <rapidjson\document.h> #include <rapidjson\writer.h> #include <rapidjson\stringbuffer.h> #include <fstream> #include <sstream> //shit using namespace Block; using namespace rapidjson; using std::pair; using std::cout; using std::endl; using std::pair; using std::ifstream; using std::...
#ifndef SERVERCLIENT_H #define SERVERCLIENT_H #include <SFML/Network.hpp> #include <common/serverclient.h> class ServerClient { public: ServerClient(); ~ServerClient(); void Update(); sf::IpAddress clientIp; unsigned short clientPort; std::string clientName; int clientId = 1; sf::Packet clientPacke...
// // Created by Masayuki IZUMI on 5/11/16. // #include <pcl/console/parse.h> #include <pcl/console/print.h> #include <pcl/io/pcd_io.h> #include <pcl/filters/filter.h> #include <pcl/point_cloud.h> #include <pcl/point_types.h> #include <boost/filesystem.hpp> #include <boost/range/iterator_range.hpp> #include "pctools...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** ** Copyright (C) 1995-2000 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 M2_SUPPORT #include "modules/ut...
#include "SLL.h" void main() { SLL sll; cout << "Last Node Add (for Loop) : "; for (int i = 0; i < 10; i++) sll.Add(i); sll.Print(); cout << endl; cout << "Last Node Erase : "; sll.Erase(); sll.Print(); cout << endl; cout << "Nth Node Add (100, 3th) : "; sll.Add(100, 3); sll.Print(); cout << endl; ...
// // nextNum // J. A. Pearson, jon@jpoffline.com // Feb 2017 // #pragma once #include <vector> //----------------- Declarations of the tool helpers -----------------// namespace JP{ // Turn a PDF into a CDF. template<typename T> std::vector<T> pdftocdf(const std::vector<T>& pdf); // Pretty-print the contents of ...
class Solution { public: int lengthOfLastWord(string s) { if (s.length() <= 0) return 0; string::reverse_iterator last, last2; for (last = s.rbegin(); last != s.rend(); ++last) { if (' ' != *last) break; } for (last2 = last; last2 != s.rend(); ++last2) { ...
/* Given a string S, remove consecutive duplicates from it recursively. Input Format : String S Output Format : Output string Constraints : 1 <= |S| <= 10^3 where |S| represents the length of string Sample Input 1 : aabccba Sample Output 1 : abcba Sample Input 2 : xxxyyyzwwzzz Sample Output 2 : xyzwz */ #include...
#include <bits/stdc++.h> using namespace std; long long int a,b,c,d,r; int esta[7] = {0,580,980,1190,1250,1420,3000}; int N; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> a; if(a < 540 || a > 1520){ cout << "error"; } else { for(b=1;b<=5;b++){ if(a >= esta[b]...
/** ****************************************************************************** * Copyright (c) 2019 - ~, SCUT-RobotLab Development Team * @file dev_manager.h * @author Mentos_Seetoo * @brief Support code of device manager. * @date 2019-06-26 * @version 0.1 * =============================...
/** * @copyright 2013 Christoph Woester * @author Christoph Woester * * 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 ...
#include<stdio.h> #include<string.h> int read(int arr[],int h) { int d=0,n=0,m=0; if(h%2==0) { for(int i=0;i<h;i++) { if(arr[i]%2==0) { d=d+1; } } } else { for(int i=0;i<h;i++) { if(arr[i]%2==0) ...
#include "stack_node.h" stack_node::stack_node(uint32_t size, std::string tag, bool is_uninitialized) : start(0), size(size), tag(std::move(tag)), is_uninitialized(is_uninitialized) { } stack_node::stack_node(uint32_t start, uint32_t size, std::string tag, bool is_uninitialized) : stack_node(size, tag, is_un...
void setup() { Serial.begin(9600); randomSeed(analogRead(0)); } void loop() { Serial.println(random(1,4)); delay(100); }
// BEGIN CUT HERE // PROBLEM STATEMENT // In Digraph Country, there are N cities indexed 0 through N- // 1. // Each pair of different cities is connected by two one-way // roads, one in each direction. // The lengths of roads may be asynmetric. I.e., it is // possible that the road from i to j and the road from j to ...
// -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- // // Copyright (C) 2003-2007 Opera Software AS. All rights reserved. // // This file is part of the Opera web browser. It may not be distributed // under any circumstances. // // Julien Picalausa // #ifndef COMMANDLINEARGUMENTHANDLER_H #defi...
#ifndef TRANSFORMGROUP_H #define TRANSFORMGROUP_H #include <QObject> #include "trajectory.h" #include "transform.h" #include "node.h" #include "math.h" /** * @brief Classe TransformGroup */ class TransformGroup : public QObject { Q_OBJECT public: TransformGroup(double x, double y, double z, bool canRot); ...
/*********************************************************\ * Copyright (c) 2012-2018 The Unrimp Team * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without * restriction, including wit...
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- ** ** Copyright (C) 2002-2011 Opera Software AS. All rights reserved. ** ** This file is part of the Opera web browser. It may not be distributed ** under any circumstances. ** */ #include "core/pch.h" #ifdef ECMASCRIPT_REMOTE_DEBUGGER #inc...
/** @file * * VBox frontends: Qt GUI ("VirtualBox"): * OpenGL support info used for 2D support detection */ /* * Copyright (C) 2009-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you...
class ItemFertilizer { weight = 2.5; }; class ItemPumpkinSeed { weight = 0.1; }; class ItemPumpkinPlant { weight = 0.1; }; class ItemHempSeed { weight = 0.1; }; class ItemHempPlant { weight = 0.1; }; class ItemKiloHemp { weight = 1; }; class ItemKiloTobacco { weight = 1; }; class ItemKiloBlackTea { weigh...
// Created by Suraj Parkale BTech Computer Engineer // Student of Vishwakarma Institute of Information Technology, Pune #include<iostream> using namespace std; int main(){ int n; cout<<"Enter the number of elements : "; cin>>n; int a[n]; cout<<"Enter the elements of array : "; for(int i=0;i<n;...
#include "vector3.h" // RAII захват ресурса есть инициализация Resource Acquisition Is Initialization //Мы используем класс Range_error, чтобы облегчить отладку операции //индексирования. // vector_base realisation template<typename T, typename A> vector_base<T, A>::vector_base(): elem{nullptr}, sz{0}, space{0}...
//heavily modified from ruby/audio/directsound.cpp (original author: byuu) #include <stdint.h> void audio_init(double sample_rate); void audio_sample(int16_t left, int16_t right); void audio_clear(); void audio_term(); #if 1 #include <dsound.h> const GUID GUID_NULL = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } }; static...
#include <fstream> #include <limits> #include "Utils.h" //double utils::calculateResultOf(char oper, const char *number1, const char *number2) { // // double res = std::numeric_limits<double >::infinity(); // double num1 = extractDoubleFrom(number1); // double num2 = extractDoubleFrom(number2); // // swit...
#include <stdio.h> #include "pico/stdlib.h" #include "hardware/gpio.h" //#include <atomic> //#include <stdatomic.h> using u64 = uint64_t; using u32 = uint32_t; using u16 = uint16_t; u32 counter = 0; // I'm reasonably confident this is atomic // On GP2 (physical pin 4) void gpio_callback(uint gpio, uint32_t event...
// Created on: 2000-01-28 // Created by: data exchange team // Copyright (c) 2000-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 GNU Lesser General Public License version 2...
#ifndef LIST_HPP #define LIST_HPP #include <iostream> #include <string> class List { public: struct node { node* next; std::string key; std::string value; node(): key(""), value(""), next(nullptr) { } node(std...
/* -*- 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" #include "modules/widgets/OpWidget.h" #inc...
#include "GamePch.h" #include "AI_PlayAudioEvent.h" void AI_PlayAudioEvent::LoadFromXML(tinyxml2::XMLElement* data) { m_EventName = WSID(""); const char* eventName = data->Attribute("event_name"); if (eventName) { m_EventName = WSID(eventName); } m_Delay = 0.0f; data->QueryFloatAttribute("delay", &m_Delay);...