text stringlengths 8 6.88M |
|---|
/*In this program we will be seeing about LOOPS in C++ Program*/
/*In C++ while, do while and for are different loop Statements , which is used to execute certain number of codes for certain number of times. That is the code inside the loop will be execute certain number of times till the condition fails and loop come... |
//
// linear.cpp
// Homework 3
//
// Created by Shashank Khanna on 2/10/15.
// Copyright (c) 2015 CS 32. All rights reserved.
//
// Return true if the somePredicate function returns true for at
// least one of the array elements, false otherwise.
bool anyTrue(const double a[], int n)
{
if (n < 1)
... |
#pragma once
namespace EActiveOperation
{
enum
{
True = 0,
False = 1
};
}
namespace EEntityType
{
enum
{
RenderTarget = 0,
HUD = 1,
StaticObject = 2,
MovableObject = 3,
PlayerCharacter = 4,
NonePlayerCharacter = 5,
EnemyCharacter = 6,
Item = 7,
Buliding = 8,
Visual... |
#include <door_passing/door_passing.h>
#include <ros/ros.h>
DoorPassing::DoorPassing():laser_robot_center_offset_x_(0.3)
{
reset();
}
DoorPassing::~DoorPassing()
{
}
bool DoorPassing::setGoal(int goal, double distance_inside, Gateways detected_gateways)
{
goal_ = goal;
distance_inside_ = distance_inside... |
/*
* the implementation of the Class String
*/
#include <iostream>
#include "string.h"
using std::cout;
using std::endl;
//构造函数
String::String()
{
InitString();
}
//析构函数
String::~Srting()
{
DestoryString();
}
//返回主串的长度
int String::StrLength()
{
return str.length;
}
//用T生成主串
bool String::StrAssign(char *T)... |
#ifndef BASEWINDOW_H
#define BASEWINDOW_H
#include <windows.h>
#include <string>
#include "..\Menu\Menu.h"
/* The callback for all the window classes */
LRESULT CALLBACK windowCallback(HWND, UINT, WPARAM, LPARAM);
class BaseWindow
{
friend LRESULT CALLBACK windowCallback (HWND hwnd, UINT msg, WPARAM wParam, LP... |
#include <iostream>
#include <fstream>
#include <vector>
#include <boost/random.hpp>
#include <cppmc/cppmc.hpp>
using namespace CppMC;
using std::vector;
using std::ofstream;
using std::cout;
using std::endl;
class TauY : public MCMCDeterministic<double,Mat> {
private:
Bernoulli<Col>& state_;
Normal<Col>& sd0_;
... |
#pragma once
//======================================================================
#if defined(_MSC_VER)
#define _CRT_SECURE_NO_WARNINGS
#endif
//======================================================================
/* Everybody needs these: */
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <... |
#pragma once
class preview
{
private:
field f;
console* Console;
int x;
int y;
int r;
int s;
public:
preview(console*);
void drawShip(int, int, int, int, field);
//void moveShip(int);
};
|
#ifndef BLUEDIALOG_H
#define BLUEDIALOG_H
#include <QDialog>
class BlueDialog : public QDialog
{
Q_OBJECT
public:
explicit BlueDialog(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *event) override;
};
#endif // BLUEDIALOG_H
|
#ifndef VERTEX_H
#define VERTEX_H
#include <QGLWidget>
#include <QGLFunctions>
#include <QOpenGLVertexArrayObject>
#include <QTimer>
#include "camera.h"
#include "halfedge.h"
#include "face.h"
#include <QListWidgetItem>
class Vertex : public QListWidgetItem
{
private:
glm::vec4 coordinates;
int id;
public:
... |
class ItemTinBar
{
weight = 0.01;
};
class ItemTinBar10oz
{
weight = 0.1;
}; |
#ifndef _WORLD_AERO_H_
#define _WORLD_AERO_H_
#include "../Toolbox/Toolbox.h"
#include "../Graphics/Color/Color.h"
#include "../Physics/Simulator/PhysicsSimulator.h"
#include "../Toolbox/PoolUniqueID/PoolUniqueID.h"
#include <limits>
#include <array>
#include <unordered_map>
////////////////////////////////////////... |
int LED=11;
int BUTTON=7;
void setup() {
for(;LED>8;LED--){
pinMode(LED,OUTPUT);
}
pinMode(LED,OUTPUT);
pinMode(BUTTON,INPUT);
}
void loop() {
LED=11;
digitalWrite(11,HIGH);
delay(2000);
digitalWrite(11,LOW);
for(int i=0;i<3;i++)
{
digitalWrite(11,HIGH);
delay(300);
digital... |
#ifndef ANALYZERMAINFORM_H
#define ANALYZERMAINFORM_H
#include <QMainWindow>
namespace Ui {
class AnalyzerMainForm;
}
class AnalyzerMainForm : public QMainWindow
{
Q_OBJECT
public:
explicit AnalyzerMainForm(QWidget *parent = 0);
~AnalyzerMainForm();
private:
Ui::AnalyzerMainForm *ui;
};
#e... |
void WriteStringToEEPROM(int beginaddress, String string){
char charBuf[string.length() + 1];
string.toCharArray(charBuf, string.length() + 1);
for (int t = 0; t < sizeof(charBuf); t++)
{
EEPROM.write(beginaddress + t, charBuf[t]);
}
EEPROM.commit();
}
String ReadStringFromEEPROM(int beginaddress){
... |
#pragma once
#include "ToDoAreaWidgets/todoareawidget.h"
#include "PriorityWidget/prioritywidget.h"
#include "ToDoWidgets/TaskWidget/taskwidget.h"
class TaskAreaWidget : public ToDoAreaWidget
{
Q_OBJECT
public:
TaskAreaWidget();
~TaskAreaWidget() override;
void readToDoFromfile() override;
private... |
//: C16:StackTemplate.h
// Kod zrodlowy pochodzacy z ksiazki
// "Thinking in C++. Edycja polska"
// (c) Bruce Eckel 2000
// Informacje o prawie autorskim znajduja sie w pliku Copyright.txt
// Prosty szablon stosu
#ifndef STACKTEMPLATE_H
#define STACKTEMPLATE_H
#include "../require.h"
template<class T>
class... |
//
// C++ Interface: ShareFile
//
// Description:
// 添加或删除共享文件,即管理共享文件
//
// Author: Jally <jallyx@163.com>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef SHAREFILE_H
#define SHAREFILE_H
#include "mess.h"
class ShareFile {
public:
ShareFile();
~ShareFile();... |
/***********************************************************************
class£ºHash Table for vertex clustering
***********************************************************************/
#include "Noise3D.h"
using namespace Noise3D; |
#include <iostream>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <algorithm>
using namespace std;
template<typename T>
void print_sequence(const T &t)
{
typename T::const_iterator pos;
for (pos = t.begin(); pos != t.end(); ++pos) {
cout << *pos << " ";
}
cout << endl;
}
int ... |
#include "concretRA.h"
concretRA::concretRA()
{
}
concretRA::~concretRA()
{
}
void concretRA::ChangeData(int tag)
{
for (int i = 0; i < 128; i++)
{
float v = float(i*i % 31);
this->x.push_back ( v);
}
for (std::vector<float>::const_iterator k = x.begin(); k != x.end(); ++k)
{
fl... |
/* -*- 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.
**
** Petter Nilsen (pettern) / Alexander Remen (alexr)
*/
#ifndef D... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <quic/logging/BaseQLogger.h>
namespace {
void addQuicSimpleFrameToEvent(
quic::QLogPacketEvent* event,
const qu... |
// Sharna Hossain
// CSC 111
// Lab 21 | binary_search.cpp
#include <iostream>
// In order for binary search to work, the array
// needs to already be in ascending order.
// For this exercise, I will use the algorithm's library
// to sort so that I can focus on implementing binary search.
#include <algorithm>
#include... |
#pragma once
/*
Vector2i is a wrapper for the sf::Vector2i
*/
class Vector2i
{
public:
Vector2i();
Vector2i(int aX, int aY);
Vector2i(sf::Vector2i aVector);
int X() const { return m_vec.x; }
int Y() const { return m_vec.y; }
friend Vector2i operator+(const Vector2i& aVec1, const Vector2i& aVe... |
//
// rvHeapArena.cpp - Heap arena object that manages a set of heaps
// Date: 12/13/04
// Created by: Dwight Luetscher
//
#include "../idlib/precompiled.h"
#pragma hdrstop
#ifdef _RV_MEM_SYS_SUPPORT
// rvHeapArena
//
// constructor
rvHeapArena::rvHeapArena()
{
// ResetValues(); do this in the Init() call instead (... |
//implemenetation
#include <iostream>
#include <string>
#include "time.h"
using namespace std;
//operator overloading
ostream& operator <<(ostream& osObject, const time& time1)
{
osObject << time1.Hour << ":" << time1.Min;
return osObject;
}
istream& operator >>(istream& isObject, time& time1)
{
isObject >> time1.H... |
//42. Trapping Rain Water
class Solution {
public:
int trap(vector<int>& arr) {
int n = arr.size();
int trapAmount = 0;
if(n < 3) return 0;
vector<int> leftMax(n, 0), rightMax(n, 0);
leftMax[0] = arr[0];
rightMax[n-1] = arr[n-1];
for(int i = 1; i < n-1; i++) {... |
// Created on: 1993-03-24
// Created by: JCV
// Copyright (c) 1993-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 Gen... |
#include "Sock.h"
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include "PrintLog.h"
#ifdef _WIN32
#include <WinSock2.h>
#else //_WIN32
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/socket.h>
#endif //_WIN32
CSock::CSock()
{
m_fd = INVALID_SOCK_FD;
}
CSock::~CSock()
{
Close()... |
//
// Created by msagebaum on 3/31/18.
//
#ifndef GPSANALYSER_UTIL_H
#define GPSANALYSER_UTIL_H
#include <ctime>
#include <iomanip>
#include <rapidxml.hpp>
inline std::string formatDateTime(long value, bool dateOut, bool timeOut, bool milliOut) {
long milli = value % 1000;
std::time_t time = value / 1000;
st... |
#include <iostream>
using namespace std;
string s1,s2;
bool flag=true;
int ind[10005][30];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>s1>>s2;
int sz1=s1.size();
int sz2=s2.size();
for(int j=0;j<26;j++){
ind[sz1][j]=-1;
}... |
//By SCJ
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define maxn 1000002
int n,m,ans=0,tp,d[maxn],a[maxn];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>m;
string A,B;cin>>A>>B;
for(int i=0;i<n;++i) if(A[i]!=B[i]) a[i+1]=1;
for(int i=1;i<=n-m+1;++i)
{
tp+=d[i];
if((tp&1)^a[i]) d... |
#include "ChessBoardWidget.h"
#include <qpainter.h>
#include <qmessagebox.h>
#include <utility>
#include <random>
#include <ctime>
ChessBoardWidget::ChessBoardWidget(QWidget *parent)
: QWidget(parent)
{
setMouseTracking(true);
brushBlack = QBrush(QColor(0, 0, 0, 200), Qt::SolidPattern);
brushWhite = QBrush(QColo... |
/*
* File: inversedynamics.cpp
* Author: azamat
*
* Created on December 21, 2011, 11:46 AM
*/
//#define VERBOSE_CHECK //switches on console output in kdl related methods
//#define VERBOSE_CHECK_MAIN // switches on console output in main
#include <kdl_extensions/functionalcomputation_kdl.hpp>
using namespace... |
#ifndef HW_TECHNIQUE_H
#define HW_TECHNIQUE_H
#include<string>
#include "Pass.h"
namespace HW
{
class Technique
{
public:
string mName;
std::vector<Pass *> mPasses;
void addPass(Pass * pass)
{
mPasses.push_back(pass);
}
Pass * getPass(unsigned int id)
{
if(id >= mPasses.size())
return NULL;... |
//Using MST. Time-0.190s
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
class UnionFind {
private:
vll p, rank, setSize;
ll numSets;
public:
UnionFind(ll N) {
setSize.assign(N, 1); numSets = N; r... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright 2010 Opera Software ASA. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
*/
/** @file security_docman.cpp
* Cross-module security manager: docman mo... |
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int* m[2];
m[0] = new int[n + 1]; // minimal costs for 1...n
m[1] = new int[n + 1]; // operations
m[0][1] = 0;
// Minimal cost search
for (int i = 2; i <= n; i++)
{
// Adding 1
m[0][i] = m[0][i - 1] + i; // count current cost
m[1][... |
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include "mpi.h"
#include <string>
static void showArrReverse(uint32_t* arr, uint32_t N) {
for (int i = 0; i < N; i++) {
std::cout << " " << arr[N-i-1];
}
printf("\n");
}
int main(int argc, char* argv[])
{
//#proc num N:: N = C / 2 + 1, where C - nums size (co... |
/* -*- Mode: c++; indent-tabs-mode: nil; c-file-style: "gnu" -*-
*
* Copyright (C) 1995-2005 Opera Software ASA. All rights reserved.
*
* This file is part of the Opera web browser. It may not be distributed
* under any circumstances.
*/
#ifndef XPUNIONEXPR_H
#define XPUNIONEXPR_H
#include "modules/xpath/src/... |
#include "ItemSlot.h"
#include "Single/GameInstance/RPGGameInst.h"
#include "Components/Image.h"
UItemSlot::UItemSlot(const FObjectInitializer& objectInitializer) :
Super(objectInitializer)
{
static ConstructorHelpers::FObjectFinder<UDataTable> DT_ITEM_INFO(
TEXT("DataTable'/Game/Resources/DataTables/DT_ItemInfo... |
#include "gtest/gtest.h"
#include "Source.hpp"
namespace
{
const uint32_t DATA_SIZE(10);
}
class TestSource : public testing::Test
{
public:
TestSource();
virtual ~TestSource();
virtual void SetUp();
virtual void TearDown();
protected:
LibMpegTS::Source source_;
uint8_t* pData_;
};
TestSource::TestSource()
{
... |
//
// baza.cpp
// serialowabaza
//
// Created by Julia on 06.11.2018.
// Copyright © 2018 Julia. All rights reserved.
//
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "baza.h"
#include "film.h"
#include "zakonczony.h"
#include "trwajacy.h"
#include "memory"
#include "event.h"
#include <vector>... |
#ifndef PhysVol_SegmentedCrystal_Box_h
#define PhysVol_SegmentedCrystal_Box_h 1
/*! @file PhysVol_SegmentedCrystal_Box.hh
@brief Defines mandatory user class PhysVol_SegmentedCrystal_Box.
@date September, 2015
@author Flechas (D. C. Flechas dcflechasg@unal.edu.co)
@version 2.0
In this header file, the 'p... |
/*
* Copyright 2019 LogMeIn
*
* 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 w... |
#include <Wire.h>
#include "font8x16.h"
//#include "fatty7x16.h"
#include <FastLED.h>
#include <colorutils.h>
#include <SPI.h>
#include "RTClib.h"
#include "kandy_commands.h"
RTC_DS3231 rtc;
const bool USE_12_HOUR_FORMAT = true;
const int DS3231_ADDR = 104;
const int DS3231_ALARM1_OFFSET = 0x7;
const int DS3231_ALARM2... |
/* -*- 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.
*/
#include "core/pch.h"
#ifdef SVG_SUPPORT
#include "modules/svg/src/sv... |
#include <bits/stdc++.h>
using namespace std;
class Graph{
int V;
list<int> *l;
public:
Graph(int V){
this->V = V;
l = new list<int>[V];
}
void addEdge(int x, int y, bool directed=true){
l[x].push_back(y);
if(!directed){
l[y].push_back(x);
}
... |
#ifndef __TREE_H
#define __TREE_H
#include <cstdlib>
#include <vector>
#include <iostream>
#include <cstring>
#include <sstream>
#include <string>
using namespace std;
struct TreeItem
{
string value;
TreeItem *Parent; // parent node
TreeItem *FChild; // pointer to first child node
TreeItem *NextS; // pointer to ne... |
#pragma once
#include "singletonBase.h"
class enemyManager : public singletonBase <enemyManager>
{
private:
//boss _boss;
public:
HRESULT init();
void release();
enemyManager() {}
~enemyManager() {}
};
|
// ------------------------------------------------------------------------------------------------
// File name: PdbInspectorDlg.cpp
// Author: Marc Ochsenmeier
// Email: info@winitor.net
// Web: www.winitor.net -
// Updated: 27.06.2013
//
// Description: An MFC UI Application (PDB Inspector.exe) that consume... |
// Aldvm: Ethereum C++ client, tools and libraries.
// Copyright 2014-2019 Aldvm Authors.
// Licensed under the GNU General Public License, Version 3.
#pragma once
#include <libdvm/VMFace.h>
#include <string>
#include <utility>
#include <vector>
namespace dev
{
namespace dvm
{
/// The wrapper implementing the VMFace... |
//
// GnITabButton.cpp
// Core
//
// Created by Max Yoon on 11. 7. 25..
// Copyright 2011년 __MyCompanyName__. All rights reserved.
//
#include "GnGamePCH.h"
#include "GnITabButton.h"
#include "GnITabPage.h"
GnITabButton::GnITabButton(GnITabPage* pTabPage, const gchar* pcDefaultImage, const gchar* pcCl... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool arr1[1000002];
ll i,j,co=0,arr[1000002],a,num,s=1000001,c,arr2[1000006],d,l;
void sive(){
for(i=3;i<=sqrt(s);i+=2){
if(!arr1[i])
for(j=3*i;j<=s;j+=2*i){
arr1[j]=1;
}
}
c=1;
arr[c++]=2;
for(i=3;i<=s;i+=2){
if(!arr1[i]){... |
#ifndef __mir_mobile__FlutteringFairy__
#define __mir_mobile__FlutteringFairy__
#include "publicDef/PublicDef.h"
typedef enum {
TypeAddExp,
TypeAddBlood,
TypeSubBlood,
TypeSubMagic
}FairyType;
class FlutteringFairy: public Node {
CC_SYNTHESIZE_READONLY(Node*, m_fairy, Fairy);
void initWithFairy(Flutter... |
#pragma once
#include <iberbar/RHI/Texture.h>
#include <iberbar/RHI/D3D9/Headers.h>
namespace iberbar
{
namespace RHI
{
namespace D3D9
{
class CDevice;
class __iberbarD3DApi__ CTexture
: public ITexture
{
public:
CTexture( CDevice* pDevice );
virtual ~CTexture();
public:
virtual... |
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "Marranconi.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, Marranconi, "Marranconi" );
DEFINE_LOG_CATEGORY(LogMarranconi)
|
/**
* Copyright (c) 2015, Timothy Stack
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of condi... |
/*////////////////////////////////////////////////////////////////////////////////////
display module for the renderer
////////////////////////////////////////////////////////////////////////////////////*/
#include<stdio.h>
#include "inc\essentials.h"
//---------------------models------------------------------
extern... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style:"stroustrup" -*-
*
* Copyright (C) 2008-2012 Opera Software AS. All rights reserved.
*
* This file is part of the Opera web browser.
* It may not be distributed under any circumstances.
*/
#ifndef OPNS4PLUGIN_ADAPTER_H
#define O... |
#pragma once
class DxccCountryManager;
bool CheckDxccCountry(string arg, DxccCountryManager *dxccCountryManager);
|
// Created on: 1995-07-24
// Created by: Modelistation
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU ... |
#ifndef QITEMD_HPP
#define QITEMD_HPP
#include <QObject>
class QItemD : public QObject
{
Q_OBJECT
Q_SLOT
void go();
};
#endif
|
#pragma once
#include "../IO.h"
#include <iberbar/Utility/MsgQueue.h>
#include <iberbar/Utility/String.h>
namespace iberbar
{
namespace IO
{
class CSocketClient_UseLibevent;
// string 使用 polymorphic_allocator 分配器
typedef std::basic_string<char, std::char_traits<char>, std::pmr::polymorp... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 1995-2007 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 "modules/widgets/OpMonthView.h"
#... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
*
* Copyright (C) 2008 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/viewers/viewers.h"
Viewers... |
//
// main.cpp
// TOH - Tower of Hanoi
//
// Created by Sivaprasad Tamatam on 20/09/20.
//
#include <iostream>
using namespace std;
void TOH(int n, int A, int B, int C){
if(n>0){
TOH(n-1, A, C, B);
cout<<A<<" "<<C<<endl;
TOH(n-1, B, A, C);
}
}
int main(int argc, const char ... |
/*!
* @copyright GNU General Public License (GNU GPL)
*
* @brief Implementação da classe mãe "mkl_TPM".
*
* @file mkl_TPM.cpp
* @version 1.0
* @date 02 Agosto 2017
*
* @section HARDWARES & SOFTWARES
* +board FRDM-KL25Z da NXP.
* +processor MKL... |
/*
* Copyright (C) 2013 Tom Wong. All rights reserved.
*/
#include "gtuserserver.h"
#include <QtArg/Arg>
#include <QtArg/CmdLine>
#include <QtArg/Help>
#include <QtCore/QCoreApplication>
using namespace Gather;
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QtArgCmdLine cmd(app.argumen... |
/***********************************************************
Starter code for Assignment 3
This code was originally written by Jack Wang for
CSC418, SPRING 2005
Implementations of functions in raytracer.h,
and the main function which specifies the
scene to be rendered.
************... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n , a, b;
cin>>n>>a>>b;
n = n - a;
if (n<= b)
{
cout<< n ;
}
else if (n>b)
{
cout<<b+1;
}
return 0;
} |
class Solution {
private:
int findKthElement(vector<int>& nums1, int beg1, vector<int>& nums2, int beg2, int k){
int m = nums1.size() - beg1, n = nums2.size() - beg2;
if(m < n)
return findKthElement(nums2, beg2, nums1, beg1, k);
if(!n)
return nums1[beg1+k-1];
if(k == 1)
return min(nums1[beg1], nums2[b... |
/*
Name: Adrian Dy
SID: 861118847
Date: 5/07/2015
*/
#include <iostream>
#include <map>
#include "lab5.h"
using namespace std;
int main()
{ //Does not compile with -Wall -Werror -peadantic
BST<int> tree;
tree.insert(50);
tree.insert(20);
tree.insert(60);
tree.insert(1... |
/**
* Copyright (c) 2020, Timothy Stack
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of condi... |
#ifndef SHOC_HASH_MD4_H
#define SHOC_HASH_MD4_H
#include "shoc/util.h"
namespace shoc {
struct Md4 : Eater<Md4> {
static constexpr size_t SIZE = 16;
static constexpr size_t STATE_SIZE = 4; // In words
static constexpr size_t BLOCK_SIZE = 64; // In bytes
public:
void init();
void fee... |
//
// fps.cpp
// pendulum
//
// Created by Ran Bao on 9/23/13.
// Copyright (c) 2013 R&B. All rights reserved.
//
#include "fps.h"
#include <ctime>
#include <string>
/**
* Get the frame per second
* Method 1: Count the time for tick reach certain value
* @return FPS value
*/
double get_fps_1()
{
static int count... |
// Copyright (c) 1999-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 spe... |
#include <iostream>
#include <cmath>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int tc;
cin >> tc;
while(tc--){
int l, n;
cin >> l >> n;
int tn = n;
int mid = l / 2;
int min = 1000000, max = 1000000;
int vMi... |
#include "TestFramework.h"
#define GLEW_STATIC
#include <GL/glew.h>
#include "treeface/gl/VertexTemplate.h"
#include "treeface/base/PackageManager.h"
#include "treeface/scene/Geometry.h"
#include "treeface/scene/GeometryManager.h"
#include <treecore/File.h>
#include <treecore/StringRef.h>
#include <treecore/MemoryBl... |
#include <apriltags_ros/apriltag_detector.h>
#include <sensor_msgs/image_encodings.h>
#include <boost/foreach.hpp>
#include <geometry_msgs/PoseStamped.h>
#include <geometry_msgs/PoseArray.h>
#include <apriltags_ros/AprilTagDetection.h>
#include <apriltags_ros/AprilTagDetectionArray.h>
#include <AprilTags/Tag16h5.h>
#in... |
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QStringList>
#include <QStringListModel>
#include <QAbstractItemView>
#include <QListWidgetItem>
#include <QStandardItemModel>
#include <QDialog>
#include <QLabel>
#include <QStatusBar>
#include <QContextMenuEvent>
#include <QFileDialog>
#inc... |
/*
author chonepieceyb, operatiing-system lab2
2020年 03月 31日 星期二 21:24:51 CST
*/
#include<iostream>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include<string>
using namespace std;
int main( int argc, char** argv){
if(argc!=2){
cout<<"请输入一个参数\n";
exit(-1);
}
int p... |
/* Copyright (c) 2005 Nokia Corporation
*
* 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 agr... |
#pragma once
#include "BaseService/BaseService.h"
class PassedTest;
class PassedTestPreview;
class PassedTestsService : public BaseService {
Q_OBJECT
public:
PassedTestsService(QObject *parent = nullptr);
public slots:
void getPreviews() const;
void getPassedTest(int id) const;
signals:
void p... |
#ifndef SORT_BY_PRICE_VISITOR_H
#define SORT_BY_PRICE_VISITOR_H
#include <vector>
#include "iterator.h"
#include "menu.h"
#include "category.h"
#include "full_menu.h"
// class Item;
// class Menu;
// class Category;
// class FullMenu;
using namespace std;
class SortByPriceVisitor : public Visitor
{
public:
SortByP... |
// Created on: 2012-06-01
// Created by: Eugeny MALTCHIKOV
// 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 General Public License version 2.... |
/*
* Inventory.cpp
*
* Created on: Aug 16, 2016
* Author: Kevin Koza
*/
#include "Inventory.h"
#include <cstddef>
namespace std {
Inventory::Inventory() {
// TODO Auto-generated constructor stub
item = NULL;
next = NULL;
}
Inventory::~Inventory() {
// TODO Auto-generated destructor stub
}
} /* names... |
#include "Calculator.h"
int main(){
const char* str = "/home/denis/CLionProjects/Calculator_Lec/factorial.txt";
Calculator electornika(str);
electornika.work_with_file();
electornika.Run_Calculator();
cout << electornika.array_of_reg[0] << endl;
return 0;
}
|
#include "../src/vector.h"
class VectorTest : public ::testing::Test {
protected:
void SetUp() override {
a[0] = 1;
a[1] = 3;
a_dim = 2;
b[0] = 3;
b[1] = 4;
b_dim = 2;
}
double a[2];
int a_dim;
double b[2];
int b_dim;
};
TEST_F(VectorTe... |
#ifndef TIMEEDITDELEGATE_H
#define TIMEEDITDELEGATE_H
#include <QItemDelegate>
class TimeEditDelegate : public QItemDelegate
{
Q_OBJECT
public:
TimeEditDelegate(const QString timeFormat = "dd.MM.yyyy hh:mm:ss",QObject *parent = 0) : QItemDelegate(parent)
{this->timeformat = timeFormat;};
... |
#include "piece.h"
Piece::Piece(QImage q) {
q = p;
}
QImage Piece::getImager() {
return p;
}
|
#pragma once
#include "IMoveManager.h"
#include "MoveCalibration.h"
#include "MoveOrientation.h"
#include "EyeController.h"
#include "MoveController.h"
#include "NavController.h"
namespace Move
{
//forward decleration
class MoveController;
class EyeController;
class MoveManager : public IMoveMan... |
/***********************************************************************
* File : pipeline.cpp
* Author : Moinuddin K. Qureshi
* Date : 19th February 2014
* Description : Out of Order Pipeline for Lab3 ECE 6100
**********************************************************************/
#include... |
#include <iostream>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
long weight;
cin >> weight;
if (weight % 2 == 0)
{
cout << "YES";
}
else
{
cout << "NO";
}
return 0;
} |
#include "StdAfx.h"
#include "EaseAction.h"
namespace ui
{
bool EaseAction::InitWithAction(IntervalAction* action)
{
if (action == nullptr)
{
return false;
}
if (IntervalAction::InitWithDuration(action->GetDuration()))
{
inner_ = action;
return true;
}
return false;
}
EaseAction::~EaseAc... |
#include "GamePch.h"
#include "AI_TogglePlayerMovement.h"
#include "PlayerComp.h"
void AI_TogglePlayerMovement::LoadFromXML( tinyxml2::XMLElement* data )
{
bool movementOn;
data->QueryBoolAttribute( "movement_on", &movementOn );
m_PlayerMovementOn = movementOn;
m_PlayerComp = nullptr;
}
void AI_TogglePlayerMovem... |
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4; c-file-style: "stroustrup" -*-
*
* Copyright (C) 1995-2007 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 ESUTILS... |
#ifndef GLOBALS_H
#define GLOBALS_H
/*
* actual definition of the global variables, to be included in the main program
* these are referred to as extern everywhere else
*/
long global_TCP_listen_port=22;
/* variables originally from frame.h */
FRAME* firstpanel;
FRM_ONOFF *ONOFF_hold;
//frame: information
FRAME *F... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.