blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
247
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 4
111
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
58
| visit_date
timestamp[ns]date 2015-07-25 18:16:41
2023-09-06 10:45:08
| revision_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| github_id
int64 3.89k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 25
values | gha_event_created_at
timestamp[ns]date 2012-06-07 00:51:45
2023-09-14 21:58:52
⌀ | gha_created_at
timestamp[ns]date 2008-03-27 23:40:48
2023-08-24 19:49:39
⌀ | gha_language
stringclasses 159
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
10.5M
| extension
stringclasses 111
values | filename
stringlengths 1
195
| text
stringlengths 7
10.5M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
26df3844f0936e1407ae04e0c5390627e214a375
|
e12376aadfc081042c5df6eeb9954091b8801493
|
/vcf/src/vcf/ApplicationKit/Containers.h
|
e7fba1029756bc5fe56f12154d2b0df5474bb8ee
|
[] |
no_license
|
jimcrafton/visualcomponentframework
|
65d5c4a72309884477089ce102ebc44f3eb28e27
|
87d7f44ad15bbf42fac6c8cd5fba3c6ecc51eb45
|
refs/heads/master
| 2022-11-30T05:44:27.210513
| 2022-11-19T01:29:35
| 2022-11-19T01:29:35
| 181,391,567
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,560
|
h
|
Containers.h
|
#ifndef _VCF_CONTAINERS_H__
#define _VCF_CONTAINERS_H__
//Containers.h
/*
Copyright 2000-2004 The VCF Project.
Please see License.txt in the top level directory
where you installed the VCF.
*/
#if _MSC_VER > 1000
# pragma once
#endif
#ifndef _VCF_ABSTRACTCONTAINER_H__
#include "vcf/ApplicationKit/AbstractContainer.h"
#endif // _VCF_ABSTRACTCONTAINER_H__
//container properties
//that may use component contants
//when be written to a Visual Form file.
#define CONTAINER_BOTTOMHEIGHT "bottomborderheight"
#define CONTAINER_TOPHEIGHT "topborderheight"
#define CONTAINER_LEFTWIDTH "leftborderwidth"
#define CONTAINER_RIGHTWIDTH "rightborderwidth"
#define CC_WINDOW_BORDER "WindowBorder"
#define CC_CONTAINER_BORDER "ContainerBorder"
#define CC_CONTROL_VSPACE "ControlVBorder"
#define CC_CONTROL_HSPACE "ControlHBorder"
#define CC_INFO_TOPSPACE "InfoTopBorder"
#define CC_INFO_BOTTOMSPACE "InfoBottomBorder"
namespace VCF {
#define STANDARDCONTAINER_CLASSID "a1236d3c-6c40-4f25-b0a1-39065a9d8f0a"
/**
\class StandardContainer Containers.h "vcf/ApplicationKit/Containers.h"
Basic implementation of a container
handles basic alignment,layout of child components.
*/
class APPLICATIONKIT_API StandardContainer : public AbstractContainer {
public:
StandardContainer();
StandardContainer( Component* owner );
virtual void resizeChildren( Control* control );
double getBottomBorderHeight() {
return bottomBorderHeight_;
}
void setBottomBorderHeight( const double& bottomBorderHeight );
double getTopBorderHeight() {
return topBorderHeight_;
}
void setTopBorderHeight( const double& topBorderHeight );
double getRightBorderWidth() {
return rightBorderWidth_;
}
void setRightBorderWidth( const double& rightBorderWidth );
double getLeftBorderWidth() {
return leftBorderWidth_;
}
void setLeftBorderWidth( const double& leftBorderWidth );
double getBorderWidth();
void setBorderWidth ( const double& borderWidth );
void calcAlignmentList( const AlignmentType& alignment, std::vector< Control* >& alignmentList );
Control* getControlWithAlignment( const AlignmentType& alignment, const bool& first = true );
Control* getControlInAlignmentList( const AlignmentType& alignment, const bool& first = true );
virtual bool generatePropertyValue( const String& fullPropertyName, Property* property, VariantData* value, String& strValue );
protected:
double bottomBorderHeight_;
double topBorderHeight_;
double rightBorderWidth_;
double leftBorderWidth_;
bool insertBefore( Control* initialControl, const bool& controlJustAdded, Control* c1, Control* c2, const AlignmentType& alignment, Rect* bounds );
void doPosition( Control* component, const AlignmentType& alignment, Rect* rect );
void doAlign( Control* initialControl, const bool& controlJustAdded, const AlignmentType& alignment, Rect* rect );
bool alignWork();
bool anchorWork();
void doAnchors( Control* control, const bool& controlJustAdded, Rect* bounds );
void alignFixed( Control* initialControl, const bool& controlJustAdded, const AlignmentType& alignment, Rect* rect );
};
/**
\class DesignTimeContainer Containers.h "vcf/ApplicationKit/Containers.h"
*/
class APPLICATIONKIT_API DesignTimeContainer : public StandardContainer {
public:
DesignTimeContainer(){};
DesignTimeContainer( Component* owner ):StandardContainer(owner){}
virtual void resizeChildren( Control* control );
protected:
void resizeChildrenUsingBounds( Control* control, Rect* bounds );
};
};
#endif // _VCF_CONTAINERS_H__
/**
$Id$
*/
|
c7d45599a94c4bdc26465be3ce2fa15249e99ac3
|
6b2a8dd202fdce77c971c412717e305e1caaac51
|
/solutions_6404600001200128_1/C++/fidels/a.cpp
|
59b194473da78dc03fb33464d60b4e22c95f294f
|
[] |
no_license
|
alexandraback/datacollection
|
0bc67a9ace00abbc843f4912562f3a064992e0e9
|
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
|
refs/heads/master
| 2021-01-24T18:27:24.417992
| 2017-05-23T09:23:38
| 2017-05-23T09:23:38
| 84,313,442
| 2
| 4
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 478
|
cpp
|
a.cpp
|
#include <iostream>
using namespace std;
#define MAXN 1024
int main() {
int T, t, i, N, n[MAXN], RES1, RES2, tmp;
cin >> T;
for (t=1; t<=T; t++) {
cin >> N;
for (i=0; i<N; i++) cin >> n[i];
RES1 = RES2 = tmp = 0;
for (i=1; i<N; i++) if (n[i] < n[i-1]) { RES1 += n[i-1]-n[i]; tmp = max(tmp, n[i-1]-n[i]); }
for (i=0; i<N-1; i++) RES2 += min(n[i], tmp);
cout << "Case #" << t << ": " << RES1 << ' ' << RES2 << endl;
}
return 0;
}
|
0a8142cde56f7ada28d1e117e7425ac24bb5fed0
|
a38f0bdc1eee30eb2147ea38f2f6373872828672
|
/test/test_nvim_eval.cpp
|
a6300d40bdf357b84d693bb2c59e829abb495fd8
|
[
"MIT"
] |
permissive
|
nightcat85/nvui
|
e23529045b3f58692dfb5cac270f493f97eed706
|
1069bfe34346f748ae8623327f29f9fde5f836a5
|
refs/heads/main
| 2023-08-27T00:58:33.405444
| 2021-11-01T20:11:04
| 2021-11-01T20:11:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,162
|
cpp
|
test_nvim_eval.cpp
|
#include "nvim.hpp"
#include "utils.hpp"
#include <catch2/catch.hpp>
#include <atomic>
#include <iostream>
#include <memory>
#include <string>
#include <utility>
#include "object.hpp"
using namespace std::chrono_literals;
TEST_CASE("nvim_eval callbacks work", "[eval_cb]")
{
Nvim nvim;
REQUIRE(nvim.running());
SECTION("Evaluating math")
{
std::atomic<bool> done = false;
nvim.eval_cb("1 + 2", [&](Object res, Object err) {
REQUIRE(err.is_null());
REQUIRE(res.try_convert<int>());
REQUIRE(*res.try_convert<int>() == 3);
done = true;
});
wait_for_value(done, true);
}
SECTION("Can evaluate variables")
{
std::atomic<bool> done = false;
nvim.eval_cb("stdpath('config')", [&](Object res, Object err) {
REQUIRE(err.is_null());
REQUIRE(res.string());
done = true;
});
wait_for_value(done, true);
}
SECTION("Will send errors in the 'err' parameter")
{
std::atomic<bool> done = false;
nvim.eval_cb("stdpath", [&](Object res, Object err) {
REQUIRE(res.is_null());
REQUIRE(!err.is_null());
done = true;
});
wait_for_value(done, true);
}
}
|
894b99ddce2f095f2dfb2ad55e13e8be49bf0fa4
|
0d8fec925f144e1133607dd07b3b36e803c81926
|
/Project1/Project1/UnitTests.cpp
|
d6a58a21d06c5056ec965e0117eda65b1e2cb839
|
[] |
no_license
|
Xydrel/UdemyDataAndAlg
|
d771746161938af0b857d15d7255aa44f6ef5249
|
3cdb9e8b0bc0b29b170d122cf24e8af83fe8925a
|
refs/heads/master
| 2022-12-15T09:41:57.437211
| 2020-09-09T22:43:38
| 2020-09-09T22:43:38
| 198,282,160
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,654
|
cpp
|
UnitTests.cpp
|
#include <iostream>
#include "UnitTests.h"
#include "Includes.h"
namespace utests
{
UnitTests::UnitTests()
{
}
UnitTests::~UnitTests()
{
}
std::string UnitTests::GetUserInputStringFromConsole()
{
std::string input;
printf("Please enter a response y/n: ");
getline(std::cin, input);
return input;
}
int UnitTests::GetUserInputIntFromConsole()
{
std::string input;
printf("Please enter a value: ");
getline(std::cin, input);
return std::stoi(input);
}
void UnitTests::SetAndRunDesiredTests()
{
printf("Should the Structure tests be run?: ");
std::string userResponse = GetUserInputStringFromConsole();
if (userResponse == "y" || userResponse == "Y")
{
_bShouldTestStructures = true;
}
printf("Should the Arith tests be run?: ");
userResponse = "";
userResponse = GetUserInputStringFromConsole();
if (userResponse == "y" || userResponse == "Y")
{
_bShouldTestArith = true;
}
printf("should the recursive tests be run?: ");
userResponse = "";
userResponse = GetUserInputStringFromConsole();
if (userResponse == "y" || userResponse == "Y")
{
_bShouldTestRecursion = true;
}
Run_EnabledTests();
}
bool UnitTests::AreAnyTestsEnabledForRun() const
{
if (_bShouldTestStructures == true ||
_bShouldTestArith == true ||
_bShouldTestRecursion == true)
{
return true;
}
return false;
}
void UnitTests::Run_EnabledTests()
{
if (_bShouldTestStructures)
{
Run_StructureTests();
}
if (_bShouldTestArith)
{
Run_ArithmeticTests();
}
if (_bShouldTestRecursion)
{
Run_RecursionTests();
}
if (!AreAnyTestsEnabledForRun())
{
printf("No tests were enabled for run...\n");
}
}
void UnitTests::Run_StructureTests()
{
StructTests::Run_ArrayConstructionTest();
StructTests::Run_IntLinkedListTests();
StructTests::Run_IntDoublyLinkedListTests();
StructTests::Run_IntCircularLinkedListTests();
StructTests::Run_IntStackLinkedListTests();
}
void UnitTests::Run_ArithmeticTests()
{
printf("Enter a value for how many numbers to evaluate for prime: ");
int primesToTest = GetUserInputIntFromConsole();
mathtests::Test_PrimeNumbers(primesToTest);
mathtests::Test_Add(4, 2);
mathtests::Test_Sub(4, 2);
printf("Enter a value for how many factorial terms to generate: ");
mathtests::Test_FactorialPrint(GetUserInputIntFromConsole());
printf("Enter a base for the power of calculation: ");
int base = GetUserInputIntFromConsole();
printf("Enter a power to multiply to: ");
int power = GetUserInputIntFromConsole();
mathtests::Test_PowerOf(base, power);
mathtests::Test_IterativePowerOf(base, power);
mathtests::Test_RecursiveSum(5);
mathtests::Test_TaylorSeriesRecurs(4, 10);
mathtests::Test_TaylorSeriesIter(4, 10);
mathtests::Test_TaylorSeriesOrderNRecurse(4, 10);
printf("Enter a numeric term to calculate Fibonacci series to: ");
int input = GetUserInputIntFromConsole();
mathtests::Test_FibanacciIter(input);
mathtests::Test_FibanacciRecurse(input);
printf("Enter values to test the Combination Formula method.\n");
int n = GetUserInputIntFromConsole();
int r = GetUserInputIntFromConsole();
mathtests::Test_CombinationFormulaRecurse(n, r);
mathtests::Test_NCRPascalsTriangle(n, r);
printf("Enter a number of discs to move for the tower of Hanoi problem: ");
n = GetUserInputIntFromConsole();
mathtests::Test_TOH(n, 1, 2, 3);
}
void UnitTests::Run_RecursionTests()
{
recursiontesting::Test_AscDesc();
recursiontesting::Test_CallingPrint();
recursiontesting::Test_TreeRecursionPrint();
recursiontesting::Test_IndirectRecursion();
recursiontesting::Test_NestedRecursion();
recursiontesting::Test_RecursiveSum();
}
} // end namespace utests
|
d48b12d367a00f279fa4515750c514902b05396c
|
dfbe2e3f04e29dd30f67af8caf73aba4e4f97345
|
/include/libfoundation/AEKeyboard.hpp
|
6433148eb3be7acbadf1422009e32ec6e36023e4
|
[] |
no_license
|
rossomathieu/Ipsum
|
a0e236c87b27324bf5eebfc8a9ffc6904f0a139d
|
d2b3dc9864a197de7be034dc5189adc477096cfd
|
refs/heads/master
| 2021-01-13T02:44:38.199626
| 2014-05-21T00:35:54
| 2014-05-21T00:35:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 161
|
hpp
|
AEKeyboard.hpp
|
/*
* AEKeyboard.hpp
*
* Created on: Apr 29, 2014
* Author: ross
*/
#ifndef AEKEYBOARD_HPP_
#define AEKEYBOARD_HPP_
#endif /* AEKEYBOARD_HPP_ */
|
39100bc851500e36ba2f53ef39c89d967d3929e9
|
3c355838cb81b2427b3b7fc7d8fc047940b4147e
|
/set7/blocks/keyframe_block.hh
|
a5e4f9f26864349de4f6d203427c53387a1858c4
|
[] |
no_license
|
abjose/CS171
|
0878bec569906fb46025dcfa09a9f3be17e7dd55
|
0bd9f861b371948295f96a94eed31d8a989374e4
|
refs/heads/master
| 2016-09-06T03:43:14.190167
| 2014-02-08T19:58:05
| 2014-02-08T19:58:05
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,085
|
hh
|
keyframe_block.hh
|
#ifndef __KEYFRAME_BLOCK_H_GUARD__
#define __KEYFRAME_BLOCK_H_GUARD__
#include <memory>
#include <math.h>
#include <algorithm>
#include "../matrix/matrix.hh"
#include "../matrix/transform.hh"
#define PI 3.14159265
class KeyframeBlock {
public:
//private:
Matrix<float,4,1> rotation;
Matrix<float,4,1> quat;
Matrix<float,3,1> translation;
Matrix<float,3,1> scale;
int frame;
//public:
// default constructor
KeyframeBlock() {}
void set_rotation(float x, float y, float z, float theta) {
//float deg = (theta * 180) / PI;
//rotation = makeVector4<float>(x,y,z,deg);
rotation = makeVector4<float>(x,y,z,theta); // theta already in degrees
}
void set_translation(float x, float y, float z) {
translation = makeVector3<float>(x,y,z);
}
void set_scale(float a, float b, float c) {
scale = makeVector3<float>(a,b,c);
}
void find_quat() {
// assumes x,y,z,theta in 'rotation'. Convert theta to radians.
float half_theta = 0.5*(rotation[3]*PI / 180.0);
float x = rotation[0]; float y = rotation[1]; float z = rotation[2];
quat = makeVector4<float>(cos(half_theta),
x*sin(half_theta),
y*sin(half_theta),
z*sin(half_theta));
quat = quat.normalize();
}
void find_rot() {
// assumes quat =(s,v1,v2,v3) has been found, overwrites rotation with
// stuff to pass to glRotate. Make sure to convert back to degrees.
// again switching back to x,y,z,theta....lol.
float q0 = std::min<float>(std::max<float>(-1.0, quat[0]), 1.0);
float theta = (2*acos(q0))*180 / PI;
float x = quat[1]; float y = quat[2]; float z = quat[3];
rotation = makeVector4<float>(x,y,z, theta);
}
void set_frame(int f) {
frame = f;
}
void display() {
std::cout << "FRAME:\n";
std::cout << frame << std::endl;
std::cout << "ROTATION:\n";
rotation.display();
std::cout << "QUAT\n";
quat.display();
std::cout << "TRANSLATION:\n";
translation.display();
std::cout << "SCALE:\n";
scale.display();
}
};
#endif // __KEYFRAME_BLOCK_H_GUARD__
|
89e1dceced805fa3528947b2f6b116a49ad8779a
|
39e348a6cfdc365a49b03695a3a86f92aa72fd2b
|
/C++/StackandMatch/stack.cpp
|
5a68c70e3c6eec4786367aac6d701c259224fdb8
|
[] |
no_license
|
qiuyongchen/code_saver
|
fd646e969774b190d764f709c4233e6283af84f1
|
afbec799e72901e85e9434bbe3cc745d9735fc6f
|
refs/heads/master
| 2021-01-10T04:48:00.349287
| 2016-02-21T04:18:52
| 2016-02-21T04:18:52
| 45,052,084
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 588
|
cpp
|
stack.cpp
|
#include "stack.h"
#include <iostream>
#include <string>
using namespace std;
Stack::Stack() {
for (int i = 0; i < 200; i++) {
base[i] = -1;
}
size = 0;
}
void Stack::push(char c) {
base[size] = c;
size++;
}
char Stack::pop() {
char c;
c = base[size - 1];
size--;
return c;
}
char Stack::top() const {
return base[size - 1];
}
bool Stack::isEmpty() const {
if (size == 0)
return true;
else
return false;
}
void Stack::clear() {
for (int i = 0; i < 200; i++) {
base[i] = -1;
}
size = 0;
}
int Stack::getSize() const {
return size;
}
|
82e838458b4bb157148c044b8503d3233759d399
|
15ccb7ec378269cb7e1f78578ee979f352ba28c8
|
/src/engine/utils.hpp
|
57d0731154a06822fc7f8aea06b9497938546e44
|
[] |
no_license
|
coudam/Fractal_engine_Course_project
|
e030fa9207f89e38f17cc98e42d058c0e321bf0c
|
2b754e0e207efc5f8e36dafcfdc9b543aba08d44
|
refs/heads/main
| 2023-03-31T16:45:56.036428
| 2021-04-05T12:35:17
| 2021-04-05T12:35:17
| 323,935,860
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 511
|
hpp
|
utils.hpp
|
#pragma once
#include <vector>
template<typename T>
struct safe_vec_ptr{
safe_vec_ptr() {}
safe_vec_ptr(const safe_vec_ptr<T> &&t): it(t.it), id(t.id) {}
safe_vec_ptr(const safe_vec_ptr<T> &t): it(t.it), id(t.id) {}
safe_vec_ptr(std::vector<T> &v, int i): it(&v), id(i) {}
T *operator ->() {return &((*it)[id]);}
T& operator *() {return (*it)[id];}
const T& operator =(const safe_vec_ptr<T> &t){it = t.it; id = t.id; return *this;}
operator T() {return (*it)[id];}
std::vector<T> *it;
int id;
};
|
5326e24194846c89c3ed307a19e734536fee9432
|
42bdf0843dff8f892bc0b77507686436efdca391
|
/include/SMCE/SketchConf.hpp
|
877e9d6dcba2423d566ef8302227a96bc46641d2
|
[
"Apache-2.0"
] |
permissive
|
ItJustWorksTM/libSMCE
|
08e89413595944babf5cd3bc3836806473a24e55
|
bbe3bb390a43971d242998299c367eb1d7facf85
|
refs/heads/master
| 2022-11-10T20:48:34.452546
| 2022-11-05T23:25:55
| 2022-11-05T23:27:40
| 330,171,147
| 7
| 35
|
Apache-2.0
| 2022-06-07T10:47:30
| 2021-01-16T13:40:11
|
C++
|
UTF-8
|
C++
| false
| false
| 1,777
|
hpp
|
SketchConf.hpp
|
/*
* SketchConf.hpp
* Copyright 2021-2022 ItJustWorksTM
*
* 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, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef SMCE_SKETCHCONF_HPP
#define SMCE_SKETCHCONF_HPP
#include <string>
#include <vector>
#include <SMCE/BoardDeviceSpecification.hpp>
#include <SMCE/PluginManifest.hpp>
#include <SMCE/SMCE_iface.h>
#include <SMCE/fwd.hpp>
namespace smce {
/**
* Configuration for sketch building
**/
struct SMCE_API SketchConfig {
/**
* Library to pull from the Arduino library manager
**/
struct ArduinoLibrary {
std::string name; // Library name as found in the install command
std::string version; // Version string; empty if latest
};
std::string fqbn; /// Fully-qualified board name that the sketch is targeting
std::vector<std::string> extra_board_uris; /// Extra board.txt URIs for ArduinoCLI
std::vector<ArduinoLibrary> legacy_preproc_libs; /// Libraries to use during legacy preprocessing
std::vector<PluginManifest> plugins; /// Plugins to compile with
std::vector<BoardDeviceSpecification> genbind_devices; /// Board devices to generate bindings for
};
} // namespace smce
#endif // SMCE_SKETCHCONF_HPP
|
075fdbd8e8bff030badb72ef0b2f74348ba2e0dd
|
b2773b26091468ca05bef1507ebb9d7f9dc64eaf
|
/src/MicroZedHCC.cpp
|
b0d4a35d485fd8e77d38f26179d6a8eb02ce8105
|
[] |
no_license
|
kkrizka/chister
|
c8f4eac519b567fd760a68c8dad13ef0086040ba
|
910d98ae5f5255a2bc281ad7c936603873f7f598
|
refs/heads/master
| 2021-01-20T18:33:00.452273
| 2018-08-17T22:44:47
| 2018-08-17T22:44:47
| 90,922,600
| 0
| 1
| null | 2017-09-29T20:20:39
| 2017-05-11T01:12:05
|
Jupyter Notebook
|
UTF-8
|
C++
| false
| false
| 849
|
cpp
|
MicroZedHCC.cpp
|
#include "MicroZedHCC.h"
#include <QDebug>
MicroZedHCC::MicroZedHCC(QObject *parent)
: SerialDevice("COM4", parent),
m_testRunning(true)
{
setLineEnd("\n\r");
}
void MicroZedHCC::interpretData(const QByteArray& data)
{
if(data.startsWith("ZYNQ_REPORT: Start HCC Test"))
{
m_testRunning=true;
m_lastTestLog.clear();
}
else if(data.startsWith("STOP"))
{
m_testRunning=false;
}
else if(data.startsWith("ZYNQ_REPORT: TEST_CHIP_COMPLETED"))
{
emit testDone(data.split(' ').last()=="PASSED\n", m_lastTestLog);
}
// Append to log
if(data.startsWith("ZYNQ_REPORT"))
m_lastTestLog+=data;
if(m_testRunning)
emit testMessage(QString(data));
}
void MicroZedHCC::runBasicTest()
{
sendCommand("bt");
}
|
85d8c79579ef308dc18f5e7e7c8614bfb43cac29
|
bc84c328d1cc2a318160d42ed1faa1961bdf1e87
|
/windows/VC++/DLL/DLL_var_func_class/call.cpp
|
e7878ac71f5642d5e92fb06b1ab2509bfc532750
|
[
"MIT"
] |
permissive
|
liangjisheng/C-Cpp
|
25d07580b5dd1ff364087c3cf8e13cebdc9280a5
|
8b33ba1f43580a7bdded8bb4ce3d92983ccedb81
|
refs/heads/master
| 2021-07-10T14:40:20.006051
| 2019-01-26T09:24:04
| 2019-01-26T09:24:04
| 136,299,205
| 7
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 337
|
cpp
|
call.cpp
|
#include"stdio.h"
#include"..\\1095.h" // 类声明
#pragma comment(lib,"..\\Debug\\1095.lib")
int __declspec(dllimport) nMy1095;
int __declspec(dllimport) fnMy1095();
class __declspec(dllimport) CMy1095;
int main()
{
printf("nMy1095=%d\n",nMy1095);
printf("fnMy1095=%d\n",fnMy1095());
CMy1095 A;
A.print();
getchar();
return 0;
}
|
6285cc8335cc922c6e6b621b1a65cbbcbd0fe342
|
f2b1a0eb2c9bb452eba10136f1854c14099f3f36
|
/Arduino_uno_klon/Genel_kod.ino
|
f6205347dd83e171f8bfee0b60f5fdf19c7ff421
|
[
"Unlicense"
] |
permissive
|
HuseyinOzlu/Robocop
|
84f76322a1d594056a05b29b42b28b098f516efb
|
046759d577afe2345f82dacae81aa78c0d940241
|
refs/heads/main
| 2023-03-06T02:33:46.842694
| 2021-02-20T14:00:35
| 2021-02-20T14:00:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,672
|
ino
|
Genel_kod.ino
|
#include <LiquidCrystal.h>
#define Wifi_ismi "WiFi_Ismi"
#define Wifi_sifresi "WiFi_Sifresi"
#define IP "184.106.153.149" //thingspeak.com IP adresi
int ToprakPin = 6;
int veri;
int trigPin = 7; //Ultrasonik sensör trig pini değişkeni
int echoPin = 6; //Ultrasonik sensör echo pini değişkeni
int sure; //Ses dalgasının gidip gelme süresi değişkeni
int uzaklik; //Ölçülen uzaklık değeri değişkeni
int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
pinMode(trigPin, OUTPUT); //trig pinini OUTPUT olarak ayarlıyoruz.
pinMode(echoPin,INPUT); //echo pinini INPUT olarak ayarlıyoruz.
lcd.begin(16, 2);
pinMode (ToprakPin, INPUT);
Serial.begin(115200); //Seriport'u açıyoruz. Güncellediğimiz
//ESP modülünün baudRate değeri 115200 olduğu için bizde Seriport'u 115200 şeklinde seçiyoruz
Serial.println("AT"); //ESP modülümüz ile bağlantı kurulup kurulmadığını kontrol ediyoruz.
delay(3000); //EPSP ile iletişim için 3 saniye bekliyoruz.
if (Serial.find("OK")) { //esp modülü ile bağlantıyı kurabilmişsek modül "AT" komutuna "OK" komutu ile geri dönüş yapıyor.
Serial.println("AT+CWMODE=1"); //esp modülümüzün WiFi modunu STA şekline getiriyoruz. Bu mod ile modülümüz başka ağlara bağlanabilecek.
delay(2000);
String baglantiKomutu = String("AT+CWJAP=\"") + Wifi_ismi + "\",\"" + Wifi_sifresi + "\"";
Serial.println(baglantiKomutu);
delay(5000);
}
}
void loop() {
//=============Uzaklık degeri===============//
digitalWrite(trigPin, LOW); //Ultrasonik sensör ile ölçüm sekansını başlatıyoruz.
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
sure = pulseIn(echoPin, HIGH, 1160); //Ses dalgasının gidip gelme süresini ölçüyoruz.
uzaklik= sure*0.0345/2; //Ölçülen süre ile uzaklık hesabı yapıyoruz.
lcd.clear(); //LCD'deki eski yazılar temizlenir.
lcd.setCursor(0, 0); //LCD'nin 1. satır 1. sütunundan yazmaya başlıyoruz.
lcd.print("Uzaklik: | Sıcaklık:");
lcd.setCursor(0, 1); //LCD'nin 2. satır 1. sütunundan yazmaya başlıyoruz.
lcd.print(uzaklik); //Uzaklık değerini LCD'ye yazdırıyoruz.
lcd.print("cm");
// ===============Toprak Sensoru============//
veri = digitalRead(ToprakPin);
float veri;
Serial.println(veri);
verii(veri);
if (veri == false) {
Serial.println("Veri Yok");
return;
}
//==================Twitter kismi===========//
}
void verii(float veri) {
Serial.println(String("AT+CIPSTART=\"TCP\",\"") + IP + "\",80"); //thingspeak sunucusuna bağlanmak için bu kodu kullanıyoruz.
//AT+CIPSTART komutu ile sunucuya bağlanmak için sunucudan izin istiyoruz.
//TCP burada yapacağımız bağlantı çeşidini gösteriyor. 80 ise bağlanacağımız portu gösteriyor
delay(1500);
String tweet = "POST /apps/thingtweet/1/statuses/update HTTP/1.1\n";
tweet += "Host: api.thingspeak.com\n";
tweet += "Connection: close\n";
tweet += "Content-Type: application/x-www-form-urlencoded\n";
tweet += "Content-Length:50\r\n\r\napi_key=";
tweet += String("HZ61GK32N3FG0TLM"); //ThingSpeak'den aldığımız Twitter API KEY'ini buraya yazıyoruz.
tweet += String("&status=");
tweet += String("Toprakta nem var"); // Yollamak istediğimiz tweeti buraya yazıyoruz.
Serial.print("AT+CIPSEND="); //veri yollayacağımız zaman bu komutu kullanıyoruz. Bu komut ile önce kaç tane karakter yollayacağımızı söylememiz gerekiyor.
delay(100);
Serial.println(tweet.length());
if (Serial.find(">")) { //eğer sunucu ile iletişim sağlayıp komut uzunluğunu gönderebilmişsek ESP modülü bize ">" işareti ile geri dönüyor.
// arduino da ">" işaretini gördüğü anda sıcaklık verisini esp modülü ile thingspeak sunucusuna yolluyor.
Serial.println(tweet);
Serial.println("AT+CIPCLOSE=0");
delay(100);
} else {
Serial.println("AT+CIPCLOSE=0");
}
}
|
bb207e07d0f5317f76213b8a5173dc19fe7caef0
|
7343924e48a713dba2982cc9d195ecadc81fda60
|
/csd_parser/LotteryRecordNode.cpp
|
caaafb338a5640cc4c918922606d950cc2065a49
|
[] |
no_license
|
pjvslx/django_test
|
1383f0f00fff6cca6bee8f0560f9f39a2719e18a
|
294db9e8265f4026496b48dda57be31136ef4a16
|
refs/heads/master
| 2020-05-22T01:19:27.003295
| 2016-09-14T09:30:36
| 2016-09-14T09:30:36
| 56,908,753
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,346
|
cpp
|
LotteryRecordNode.cpp
|
#include "LotteryRecordNode.h"
#include "ComponentManager.h"
#include "ResourceManager.h"
#include "ui/CocosGUI.h"
#include "OS.h"
#include "UIHelperHydra.h"
#include "Localization.h"
USING_NS_CC;
using namespace hydra;
using namespace ui;
using namespace std;
LotteryRecordNode::LotteryRecordNode()
: m_Image_back(nullptr)
, m_Image_title(nullptr)
, m_Image_time(nullptr)
, m_Image_nickname(nullptr)
, m_Image_reward(nullptr)
, m_ScrollView_1(nullptr)
{
}
LotteryRecordNode::~LotteryRecordNode()
{
}
LotteryRecordNode* LotteryRecordNode::create()
{
LotteryRecordNode *view = new LotteryRecordNode;
if (view && view->init())
{
view->autorelease();
return view;
}
else
{
delete view;
view = nullptr;
return nullptr;
}
}
bool LotteryRecordNode::init()
{
if(!Node::init())
{
return false;
}
ResourceManager* rm = static_cast<ResourceManager*>(hydra::ComponentManager::instance()->getComponent("resource_manager"));
/******************需要手动修改createNodeWithType的文件名******************/
auto entryNode = rm->createNodeWithType(LotteryRecordNode, ResourceType::kResourceTypeCSB);
addChild(entryNode);
__setupCocosUI(entryNode);
__addUIEvent();
return true;
}
void LotteryRecordNode::__addUIEvent()
{
}
void LotteryRecordNode::onEnter()
{
Node::onEnter();
}
void LotteryRecordNode::onExit()
{
Node::onExit();
}
/*************************工具生成begin*************************/
void LotteryRecordNode::__setupCocosUI(Node* rootNode)
{
m_Image_back = static_cast<cocos2d::ui::ImageView*>(rootNode->getChildByName("Image_back"));
m_Image_title = static_cast<cocos2d::ui::ImageView*>(rootNode->getChildByName("Image_back")->getChildByName("Image_title"));
m_Image_time = static_cast<cocos2d::ui::ImageView*>(rootNode->getChildByName("Image_back")->getChildByName("Image_time"));
m_Image_nickname = static_cast<cocos2d::ui::ImageView*>(rootNode->getChildByName("Image_back")->getChildByName("Image_nickname"));
m_Image_reward = static_cast<cocos2d::ui::ImageView*>(rootNode->getChildByName("Image_back")->getChildByName("Image_reward"));
m_ScrollView_1 = static_cast<cocos2d::ui::ScrollView*>(rootNode->getChildByName("ScrollView_1"));
}
/*************************工具生成end*************************/
|
0e231eb090721adb7209b4b8628a816a817ff423
|
c3158c987fbd27437a8d22e1789648a373ac263c
|
/corona.cpp
|
2ee7c701534f834f81f92690eb3eb3cc4a5f6a77
|
[] |
no_license
|
paulmathai01/VIRUS-DNA-VISULAISATION-OPENCV
|
cfa0d7c04af17174d00b743de78ec1b75efbec6d
|
2a0b9fdb160d5058f39f31d6f4f74ed8542a9729
|
refs/heads/master
| 2022-07-17T21:42:50.930828
| 2020-05-07T05:29:36
| 2020-05-07T05:29:36
| 261,957,345
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,142
|
cpp
|
corona.cpp
|
#include "pch.h"
#include "corona.h"
string corona::getmeta()
{
return meta_file_path;
}
void corona::openfile(vector <string>& file_names, ifstream& in)
{
//for loop runs till the number of images mentioned at the start of the meta file
string file_path;
in >> file_path;
//file names are read and stored
file_names.push_back(file_path);
in >> file_path;
file_names.push_back(file_path);
}
void corona::setcount(int& count1, int& count2, ifstream& file1, ifstream& file2)
{
file1.open(corona_file_names[0]);
if (file1.is_open())
{
cout << "file 1 open" << endl;
}
else
{
cout << "failed to open file 1" << endl;
}
file2.open(corona_file_names[1]);
if (file2.is_open())
{
cout << "file 2 open" << endl;
}
else
{
cout << "failed to open file 2" << endl;
}
while (file1)
{
char a;
file1 >> a;
count1++;
}
cout << "\ncount set1" << endl;
cout << count1 << endl;
while (file2)
{
char a;
file2 >> a;
count2++;
}
cout << "\ncount set2" << endl;
cout << count2 << endl;
int root1 = sqrt(count1);
if (root1 * root1 < count1)
{
col1 = root1 + 1;
row1 = root1 + 1;
}
else
{
col1 = root1;
row1 = root1;
}
int root2 = sqrt(count2);
if (root2 * root2 < count2)
{
col2 = root2 + 1;
row2 = root2 + 1;
}
else
{
col2 = root2;
row2 = root2;
}
file1.close();
file2.close();
}
void corona::open_arr(int virus_arr_1[], int virus_arr_2[], ifstream& file1, ifstream& file2, int& count1, int& count2)
{
file1.open(corona_file_names[0]);
file2.open(corona_file_names[1]);
char inp1, inp2;
int i = 0;
while (!file1.eof())
{
file1 >> inp1;
switch (inp1)
{
case 'a':
{
virus_arr_1[i] = 1;
break;
}
case 'c':
{
virus_arr_1[i] = 2;
break;
}
case 't':
{
virus_arr_1[i] = 3;
break;
}
case 'g':
{
virus_arr_1[i] = 4;
break;
}
default:
break;
}
i++;
}
i = 0;
while (!file2.eof())
{
file2 >> inp2;
switch (inp2)
{
case 'a':
{
virus_arr_2[i] = 1;
break;
}
case 'c':
{
virus_arr_2[i] = 2;
break;
}
case 't':
{
virus_arr_2[i] = 3;
break;
}
case 'g':
{
virus_arr_2[i] = 4;
break;
}
default:
break;
}
i++;
}
file1.close();
file2.close();
}
void corona::open_image(Mat& image_1, Mat& image_2, int virus_arr_1[], int virus_arr_2[], int count1, int count2)
{
image_1 = Mat::zeros(row1, col1, CV_8UC3);
image_2 = Mat::zeros(row2, col2, CV_8UC3);
cout << "\nrow1 = " << row1 << endl;
cout << "col1 = " << col1 << endl;
cout << "row2 = " << row2 << endl;
cout << "col2 = " << col2 << endl;
int inc = 0;
while (inc < count1)
{
for (int i = 0; i < row1; i++)
{
for (int j = 0; j < col1; j++)
{
Vec3b color_s = image_1.at<Vec3b>(Point(i, j));
if (virus_arr_1[inc] == 1)
{
color_s.val[0] = 255;
color_s.val[1] = 0;
color_s.val[2] = 0;
image_1.at<Vec3b>(Point(i, j)) = color_s;
}
else if (virus_arr_1[inc] == 2)
{
color_s.val[0] = 0;
color_s.val[1] = 255;
color_s.val[2] = 0;
image_1.at<Vec3b>(Point(i, j)) = color_s;
}
else if (virus_arr_1[inc] == 3)
{
color_s.val[0] = 0;
color_s.val[1] = 0;
color_s.val[2] = 255;
image_1.at<Vec3b>(Point(i, j)) = color_s;
}
else if (virus_arr_1[inc] == 4)
{
color_s.val[0] = 0;
color_s.val[1] = 255;
color_s.val[2] = 255;
image_1.at<Vec3b>(Point(i, j)) = color_s;
}
else
{
color_s.val[0] = 0;
color_s.val[1] = 0;
color_s.val[2] = 0;
}
inc++;
}
}
}
inc = 0;
while (inc < count2)
{
for (int i = 0; i < row2; i++)
{
for (int j = 0; j < col2; j++)
{
Vec3b color_s = image_2.at<Vec3b>(Point(i, j));
if (virus_arr_2[inc] == 1)
{
color_s.val[0] = 255;
color_s.val[1] = 0;
color_s.val[2] = 0;
image_2.at<Vec3b>(Point(i, j)) = color_s;
}
else if (virus_arr_2[inc] == 2)
{
color_s.val[0] = 0;
color_s.val[1] = 255;
color_s.val[2] = 0;
image_2.at<Vec3b>(Point(i, j)) = color_s;
}
else if (virus_arr_2[inc] == 3)
{
color_s.val[0] = 0;
color_s.val[1] = 0;
color_s.val[2] = 255;
image_2.at<Vec3b>(Point(i, j)) = color_s;
}
else if (virus_arr_2[inc] == 4)
{
color_s.val[0] = 0;
color_s.val[1] = 255;
color_s.val[2] = 255;
image_2.at<Vec3b>(Point(i, j)) = color_s;
}
else
{
color_s.val[0] = 0;
color_s.val[1] = 0;
color_s.val[2] = 0;
}
inc++;
}
}
}
cv::namedWindow("Image_1");
cv::namedWindow("Image_2");
cv::resizeWindow("Image_1", 600, 600);
cv::resizeWindow("Image_2", 600, 600);
cv::imshow("Image_1", image_1);
cv::imshow("Image_2", image_2);
cv::waitKey(0);
}
double corona::compare_img(Mat& image_1, Mat& image_2)
{
Mat m_flat_1 = image_1.reshape(1, 1);
Mat m_flat_2 = image_2.reshape(1, 1);
int count = 0;
int limit_i = (m_flat_1.cols / 3) - 10;
int limit_j = (m_flat_2.cols / 3) - 10;
double divide = 0;
cout << limit_i << endl;
cout << limit_j << endl;
for (int i = 0; i < limit_i; i = i + 10)
{
divide++;
for (int j = 0; j < limit_j; j = j + 10)
{
bool equal = 1;
for (int c = 0; c < 10; c++)
{
//cout <<endl<< i << " " << j;
if (m_flat_1.at<Vec3b>(Point(i + c, 0)) != m_flat_2.at<Vec3b>(Point(j + c, 0)))
{
equal = 0;
}
}
if (equal)
{
count++;
cout << endl << " Count = " << count;
break;
}
}
}
cout << endl << "Count = " << count;
cout << endl << "Divide = " << divide;
cout << endl << "Percentage = " << (count / divide) * 100 << "%";
return (count / divide) * 100;
}
void corona::subt(Mat& image_1, Mat& image_2)
{
Mat subt = image_1 - image_2;
cv::imshow("Subtracted Image", subt);
cv::waitKey(0);
}
void corona::sim(Mat& image_1, Mat& image_2)
{
Mat siml = Mat::zeros(row1, col1, CV_8UC3);
for (int i = 0; i < row1; i++)
{
for (int j = 0; j < col1; j++)
{
Vec3b color_s = image_1.at<Vec3b>(Point(i, j));
if (image_1.at<Vec3b>(Point(i, j)) == image_2.at<Vec3b>(Point(i, j)))
{
color_s.val[0] = 255;
color_s.val[1] = 255;
color_s.val[2] = 255;
siml.at<Vec3b>(Point(i, j)) = color_s;
}
else
{
color_s.val[0] = 0;
color_s.val[1] = 0;
color_s.val[2] = 0;
siml.at<Vec3b>(Point(i, j)) = color_s;
}
}
}
cv::imshow("Similarity Image", siml);
cv::waitKey(0);
}
void corona::per_out()
{
ifstream per_in;
per_in.open("per_dat.txt");
if (per_in.is_open())
{
cout << endl << "percentage file open" << endl;
}
else
{
cout << "failed to open" << endl;
}
for (int i = 0; i < 5; i++)
{
double val;
per_in >> val;
per_val.push_back(val);
}
for (int i = 0; i < per_val.size(); i++)
{
cout << endl << per_val[i];
}
}
|
ec300956031ac6482d04c95402accb0d60e20ec3
|
3b105fc8398d9c5308c1585f17b922e9df124929
|
/src/vm/CodeWriter.h
|
6b71f7367d9bf4abd394d4030ef61da8a22a316c
|
[] |
no_license
|
cbebe/computer-from-scratch
|
2f05894fffe77e2907bb8c721bcb69e7450a7a94
|
3a26d5b90f28c20cf60e80373bf50abf7f7793f7
|
refs/heads/master
| 2023-01-08T08:25:53.662062
| 2020-11-07T00:38:06
| 2020-11-07T00:38:06
| 294,025,097
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 414
|
h
|
CodeWriter.h
|
#ifndef _CODE_WRITER_H_
#define _CODE_WRITER_H_
#include <fstream>
#include <string>
#include "commands.h"
class CodeWriter {
public:
CodeWriter(const std::string &filename);
void setFileName(std::string &filename);
void writeArithmetic(std::string &command);
void writePushPop(command command, std::string segment, int index);
void close();
private:
std::ofstream out;
};
#endif
|
b7e26eb27d54bb2629e9d14b481afc4bbe7c149e
|
c22c1aed75252533bb5de8ce9ff3c0f5ac9814bc
|
/secure_tunneling/source/SecureTunnel.cpp
|
abcf4cb6d89567690c6715391c961af20df35a7b
|
[
"Apache-2.0"
] |
permissive
|
QPC-database/aws-iot-device-sdk-cpp-v2
|
d141caef6916646967dff1bb48e661bccc6f45f3
|
163fdf3bff9cc2a51f5d0aeca3d9356f665583a3
|
refs/heads/main
| 2023-06-15T00:33:28.643390
| 2021-06-22T21:02:05
| 2021-06-22T21:02:05
| 384,712,786
| 1
| 0
|
Apache-2.0
| 2021-07-10T14:07:43
| 2021-07-10T14:07:43
| null |
UTF-8
|
C++
| false
| false
| 6,927
|
cpp
|
SecureTunnel.cpp
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/iotsecuretunneling/SecureTunnel.h>
namespace Aws
{
namespace Iotsecuretunneling
{
SecureTunnel::SecureTunnel(
Crt::Allocator *allocator,
Aws::Crt::Io::ClientBootstrap *clientBootstrap,
const Aws::Crt::Io::SocketOptions &socketOptions,
const std::string &accessToken,
aws_secure_tunneling_local_proxy_mode localProxyMode,
const std::string &endpointHost,
const std::string &rootCa,
OnConnectionComplete onConnectionComplete,
OnConnectionShutdown onConnectionShutdown,
OnSendDataComplete onSendDataComplete,
OnDataReceive onDataReceive,
OnStreamStart onStreamStart,
OnStreamReset onStreamReset,
OnSessionReset onSessionReset)
{
// Client callbacks
m_OnConnectionComplete = onConnectionComplete;
m_OnConnectionShutdown = onConnectionShutdown;
m_OnSendDataComplete = onSendDataComplete;
m_OnDataReceive = onDataReceive;
m_OnStreamStart = onStreamStart;
m_OnStreamReset = onStreamReset;
m_OnSessionReset = onSessionReset;
m_socketOptions = socketOptions;
m_accessToken = accessToken;
m_endpointHost = endpointHost;
m_rootCa = rootCa;
// Initialize aws_secure_tunneling_connection_config
aws_secure_tunneling_connection_config config;
AWS_ZERO_STRUCT(config);
config.allocator = allocator;
config.bootstrap = clientBootstrap ? clientBootstrap->GetUnderlyingHandle() : nullptr;
config.socket_options = &m_socketOptions.GetImpl();
config.access_token = aws_byte_cursor_from_c_str(m_accessToken.c_str());
config.local_proxy_mode = localProxyMode;
config.endpoint_host = aws_byte_cursor_from_c_str(m_endpointHost.c_str());
config.root_ca = m_rootCa.c_str();
config.on_connection_complete = s_OnConnectionComplete;
config.on_connection_shutdown = s_OnConnectionShutdown;
config.on_send_data_complete = s_OnSendDataComplete;
config.on_data_receive = s_OnDataReceive;
config.on_stream_start = s_OnStreamStart;
config.on_stream_reset = s_OnStreamReset;
config.on_session_reset = s_OnSessionReset;
config.user_data = this;
// Create the secure tunnel
m_secure_tunnel = aws_secure_tunnel_new(&config);
}
SecureTunnel::SecureTunnel(SecureTunnel &&other) noexcept
{
m_OnConnectionComplete = other.m_OnConnectionComplete;
m_OnConnectionShutdown = other.m_OnConnectionShutdown;
m_OnSendDataComplete = other.m_OnSendDataComplete;
m_OnDataReceive = other.m_OnDataReceive;
m_OnStreamStart = other.m_OnStreamStart;
m_OnStreamReset = other.m_OnStreamReset;
m_OnSessionReset = other.m_OnSessionReset;
m_socketOptions = other.m_socketOptions;
m_accessToken = std::move(other.m_accessToken);
m_endpointHost = std::move(other.m_endpointHost);
m_rootCa = std::move(other.m_rootCa);
m_secure_tunnel = other.m_secure_tunnel;
other.m_secure_tunnel = nullptr;
}
SecureTunnel::~SecureTunnel()
{
if (m_secure_tunnel)
{
aws_secure_tunnel_release(m_secure_tunnel);
}
}
SecureTunnel &SecureTunnel::operator=(SecureTunnel &&other) noexcept
{
if (this != &other)
{
this->~SecureTunnel();
m_OnConnectionComplete = other.m_OnConnectionComplete;
m_OnConnectionShutdown = other.m_OnConnectionShutdown;
m_OnSendDataComplete = other.m_OnSendDataComplete;
m_OnDataReceive = other.m_OnDataReceive;
m_OnStreamStart = other.m_OnStreamStart;
m_OnStreamReset = other.m_OnStreamReset;
m_OnSessionReset = other.m_OnSessionReset;
m_socketOptions = other.m_socketOptions;
m_accessToken = std::move(other.m_accessToken);
m_endpointHost = std::move(other.m_endpointHost);
m_rootCa = std::move(other.m_rootCa);
m_secure_tunnel = other.m_secure_tunnel;
other.m_secure_tunnel = nullptr;
}
return *this;
}
int SecureTunnel::Connect() { return aws_secure_tunnel_connect(m_secure_tunnel); }
int SecureTunnel::Close() { return aws_secure_tunnel_close(m_secure_tunnel); }
int SecureTunnel::SendData(const Crt::ByteCursor &data)
{
return aws_secure_tunnel_send_data(m_secure_tunnel, &data);
}
int SecureTunnel::SendStreamStart() { return aws_secure_tunnel_stream_start(m_secure_tunnel); }
int SecureTunnel::SendStreamReset() { return aws_secure_tunnel_stream_reset(m_secure_tunnel); }
aws_secure_tunnel *SecureTunnel::GetUnderlyingHandle() { return m_secure_tunnel; }
void SecureTunnel::s_OnConnectionComplete(void *user_data)
{
auto *secureTunnel = static_cast<SecureTunnel *>(user_data);
secureTunnel->m_OnConnectionComplete();
}
void SecureTunnel::s_OnConnectionShutdown(void *user_data)
{
auto *secureTunnel = static_cast<SecureTunnel *>(user_data);
secureTunnel->m_OnConnectionShutdown();
}
void SecureTunnel::s_OnSendDataComplete(int error_code, void *user_data)
{
auto *secureTunnel = static_cast<SecureTunnel *>(user_data);
secureTunnel->m_OnSendDataComplete(error_code);
}
void SecureTunnel::s_OnDataReceive(const struct aws_byte_buf *data, void *user_data)
{
auto *secureTunnel = static_cast<SecureTunnel *>(user_data);
secureTunnel->m_OnDataReceive(*data);
}
void SecureTunnel::s_OnStreamStart(void *user_data)
{
auto *secureTunnel = static_cast<SecureTunnel *>(user_data);
secureTunnel->m_OnStreamStart();
}
void SecureTunnel::s_OnStreamReset(void *user_data)
{
auto *secureTunnel = static_cast<SecureTunnel *>(user_data);
secureTunnel->m_OnStreamReset();
}
void SecureTunnel::s_OnSessionReset(void *user_data)
{
auto *secureTunnel = static_cast<SecureTunnel *>(user_data);
secureTunnel->m_OnSessionReset();
}
} // namespace Iotsecuretunneling
} // namespace Aws
|
de8a7e731a924cf2b7c7b95447eb92e79da8e40b
|
3f77efa59b547516d00f41e90860ccc79b120454
|
/OIG/Dwa słowa.cpp
|
a274f7fb5cd30653a7ef15c42aedac290951f346
|
[] |
no_license
|
markowanga/OI-OIG
|
59c5dd5d5e4e37708351b68816a32874e720e10e
|
d66430730cbe965792ffbb5cb32cc96ee1de5e9d
|
refs/heads/master
| 2022-10-15T13:02:57.082077
| 2022-10-14T12:47:45
| 2022-10-14T12:47:45
| 92,228,816
| 4
| 5
| null | 2022-10-14T12:47:47
| 2017-05-23T23:16:07
|
C++
|
UTF-8
|
C++
| false
| false
| 2,072
|
cpp
|
Dwa słowa.cpp
|
/**
* VI Olimpiada Informatyczna Gimnazjalistów
* Zadanie: Dwa słowa
* Wynik 100/100
* Wykonał: Marcin Wątroba
* http://main.edu.pl/pl/archive/oig/6/dwa
*/
#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
struct zn {
char z1;
char z2;
int por;
};
int rt(int n) {
int w = 1;
while (w < n)w *= 2;
return w;
}
int por(char a, char b) {
if ((int) a > (int) b) return 1;
else if ((int) a < (int) b) return 2;
else return 0;
}
void zam(char tab[2][1000000], int zz1, int zz2) {
char p = tab[0][zz1];
tab[0][zz1] = tab[1][zz2];
tab[1][zz2] = p;
}
void uzu(zn tab[], int rtab, int n) {
for (int b = (n + rtab) / 2; b > 0; b /= 2) {
if (tab[b + b].por != 0) {
if (tab[b].por == tab[b + b].por)return;
tab[b].por = tab[b + b].por;
} else {
if (tab[b].por == tab[b + b + 1].por)return;
tab[b].por = tab[b + b + 1].por;
}
}
return;
}
int main(int argc, char *argv[]) {
int n;
scanf("%d", &n);
int rtab = rt(n);
zn *tab = new zn[rtab * 2];
char t[2][1000000];
scanf("%s%s", &t[0], &t[1]);
for (int a = rtab + n; a < rtab * 2; a++) tab[a].por = 0;
for (int a = rtab; a < rtab + n; a++) tab[a].por = por(t[0][a - rtab], t[1][a - rtab]);
//UZUPELNIENIE WEZLOW
for (int a = rtab / 2; a > 0; a /= 2)
for (int b = a; b < a + a; b++) {
if (tab[b + b].por != 0)
tab[b].por = tab[b + b].por;
else tab[b].por = tab[b + b + 1].por;
}
int j;
scanf("%d", &j);
int zz1, zz2;
for (int i = 0; i < j; i++) {
scanf("%d%d", &zz1, &zz2);
if (t[0][zz1] != t[1][zz2]) {
zam(t, zz1, zz2);
tab[zz1 + rtab].por = por(t[0][zz1], t[1][zz1]);
tab[zz2 + rtab].por = por(t[0][zz2], t[1][zz2]);
uzu(tab, rtab, zz1);
if (zz1 != zz2)uzu(tab, rtab, zz2);
}
printf("%d\n", tab[1].por);
}
return EXIT_SUCCESS;
}
|
14e97dc547c1d9d6536bb41b1b7717e668a65d5f
|
1a2ea32fb375743e4c4c1dfce5411c569c8e4fd3
|
/hgraph_to_graph.cpp
|
ac32022f356a2f56ebb2a74f7ee3022d18d140ad
|
[] |
no_license
|
rostam/graph-exact-coloring-heuristic
|
f66b4cf114ec80da35ad49794478d67c06734c69
|
296535c2ea09b064af6fc34e0df2d679663bef10
|
refs/heads/master
| 2023-08-30T23:03:14.658658
| 2023-08-24T19:51:07
| 2023-08-24T19:51:07
| 165,992,255
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,978
|
cpp
|
hgraph_to_graph.cpp
|
//
// Created by rostam on 14.05.17.
//
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <iterator>
#include <map>
#include <algorithm>
#include <omp.h>
#include <chrono>
using namespace std;
vector<string> split(string s) {
vector<string> tokens;
istringstream iss(s);
copy(istream_iterator<string>(iss),
istream_iterator<string>(),
back_inserter(tokens));
return tokens;
}
vector<vector<int>> comb(int N, int K) {
string bitmask(K, 1); // K leading 1's
bitmask.resize(N, 0); // N-K trailing 0's
vector<vector<int>> ret;
// print integers and permute bitmask
do {
vector<int> one_perm;
for (int i = 0; i < N; ++i) // [0..N-1] integers
if (bitmask[i]) one_perm.push_back(i);
ret.push_back(one_perm);
} while (std::prev_permutation(bitmask.begin(), bitmask.end()));
return ret;
}
template <typename T>
bool is_subset(std::vector<T> A, std::vector<T> B)
{
std::sort(A.begin(), A.end());
std::sort(B.begin(), B.end());
return std::includes(A.begin(), A.end(), B.begin(), B.end());
}
template <typename T>
bool atleast_one_subset(vector<vector<T>> As, vector<T> B) {
for(int i=0;i < As.size();i++) {
if(is_subset(B,As[i])) return true;
}
return false;
}
int main() {
ifstream in("unstructured_hgraph_small_P02.txt");
string line;
getline(in, line);
getline(in, line);
vector<string> res = split(line);
map<int, vector<int>> edge_nodes;
for (int i = 0; i < stoi(res[0]); i++)
edge_nodes[i] = vector<int>();
getline(in, line);
while (in) {
getline(in, line);
istringstream iss(line);
int e, n;
iss >> e >> n;
edge_nodes[e].push_back(n);
}
in.close();
vector<pair<int, int>> edges;
omp_set_num_threads(8);
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();
#pragma omp parallel for
for (int i = 0; i < edge_nodes.size(); i++) {
//cerr << i << " " << edges.size() << endl;
vector<int> nodes = edge_nodes[i];
vector<vector<int>> combs = comb((int) nodes.size(), 3);
for (int k = i + 1; k < edge_nodes.size(); k++) {
if (atleast_one_subset(combs, edge_nodes[k])) {
#pragma omp critical
edges.push_back(make_pair(i, k));
}
}
}
end = std::chrono::system_clock::now();
//
std::chrono::duration<double> elapsed_seconds = end - start;
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
//std::cout << "finished computation at " << std::ctime(&end_time)
cerr << "elapsed time: " << elapsed_seconds.count() << "s\n";
ofstream out("unstructured_graph_small_P02.txt");
for (int i = 0; i < edges.size(); i++) {
out << edges[i].first << " " << edges[i].second << endl;
}
out.flush();
out.close();
return 0;
}
|
2a5fb3240644b02b0b053f16249e7dabf9cb9735
|
9b1639af63f7fc82f0e488b452dee0cb7ae22a3b
|
/SolarisNAVScanner/heur/ba.cpp
|
2f14b838fa8fb7a5e493d8de4cd5cf4d7a0d3a58
|
[] |
no_license
|
ExpLife/Norton_AntiVirus_SourceCode
|
af7cd446efb2f3a10bba04db8e7438092c7299c0
|
b90225233fa7930d2ef7922080ed975b7abfae8c
|
refs/heads/master
| 2017-12-19T09:15:25.150463
| 2016-10-03T02:33:34
| 2016-10-03T02:33:34
| 76,859,815
| 2
| 4
| null | 2016-12-19T12:21:02
| 2016-12-19T12:21:01
| null |
UTF-8
|
C++
| false
| false
| 1,590
|
cpp
|
ba.cpp
|
// Copyright 1995 Symantec, Peter Norton Product Group
//************************************************************************
//
// $Header: S:/HEUR/VCS/ba.cpv 1.1 04 Jun 1997 16:35:40 CNACHEN $
//
// Description:
//
// Contains code for the bloodhound behavior analyzer (boy is it simple!)
//
// Contains:
//
// See Also:
//************************************************************************
// $Log: S:/HEUR/VCS/ba.cpv $
//
// Rev 1.1 04 Jun 1997 16:35:40 CNACHEN
// Fixed bug where we return FALSE (error) when we decide not to emulate any
// more.
//
// Rev 1.0 14 May 1997 17:23:10 CNACHEN
// Initial revision.
//
//************************************************************************
#include "avtypes.h"
#include "heurapi.h"
#include "heurint.h"
BOOL BADetectVirus
(
WORD wHeurStreamLen,
LPBYTE lpbyHeurCode,
LPBEHAVE_MONITOR pstBehavior,
LPBOOL lpbFoundVirus,
LPWORD lpwVirusID
)
{
// now run the interpereter to find if we have a virus
*lpbFoundVirus = FALSE;
*lpwVirusID = 0;
// perform some checks before we do analysis
if (BMStopEmulating(pstBehavior) == TRUE)
return(TRUE);
if (InterpretStream(wHeurStreamLen,
lpbyHeurCode,
pstBehavior->m_byBehaviorArray,
lpbFoundVirus,
lpwVirusID) == FALSE)
return(FALSE);
return(TRUE);
}
|
5ff9662720346424ebf0263a3d2e94c0a8ec826e
|
95911dced9620fadcb26c64eae26b2cb98eb37b4
|
/Algorithms/towersofHanoi.cpp
|
55115ed54efb51331b85788529a2be8083c02233
|
[
"MIT"
] |
permissive
|
890popbox/cpp-data-structs-algos
|
4f692eed02011c295482760155ad0da50dfff75c
|
d9b28b16b5b2ea9e3960c53f9d4dad76933ddb91
|
refs/heads/master
| 2020-11-29T22:29:41.115737
| 2020-02-29T04:23:35
| 2020-02-29T04:23:35
| 230,230,341
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 641
|
cpp
|
towersofHanoi.cpp
|
//The minimum number of moves for the towers of hanoi problem.
//This will display the moves to take as well
//Technically A can end up at B or C, but we want it to move from A to C..
//2^n − 1
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::endl;
//hanoi recurs.. DEFAULT VALUES INCASE YOU DON'T WANT TO INPUT THAT IN MAIN
void hanoi(int n, char f='A', char h='B', char t='C') {
//base case
if (n == 0) {
return;
} else {
hanoi(n - 1, f, t, h);
cout << f << " to " << t << endl;
hanoi(n - 1, h, f, t);
}
}
int main()
{
cout << "hanoi test1-recurs" << endl;
hanoi(3);
return 0;
}
|
bd53227b1254c8054590dfd899f5892f1d731657
|
3580743a70dea62c838bcace0234cf1b57b11f1b
|
/visualizer/include/visualizer/EntityContainer.hpp
|
6ec997abca2f3ea4e383e98ece6629a48e557366
|
[] |
no_license
|
GabeRealB/visualizer-bachelor
|
b9c37272a95abc33ee886544c3959a54c2cbfcae
|
8684c39918f6441ce5cc7676bbcd186115442a2c
|
refs/heads/master
| 2023-04-13T05:40:25.038042
| 2020-12-22T15:58:49
| 2021-01-12T13:42:37
| 309,766,412
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,033
|
hpp
|
EntityContainer.hpp
|
#pragma once
#include <array>
#include <functional>
#include <memory>
#include <span>
#include <unordered_map>
#include <vector>
#include <visualizer/AlignedMemory.hpp>
#include <visualizer/Entity.hpp>
#include <visualizer/EntityArchetype.hpp>
namespace Visualizer {
constexpr std::size_t ENTITY_CHUNK_SIZE{ 32 };
constexpr std::size_t ENTITY_CHUNK_ALLOCATION_BUFFER{ 2 };
class EntityContainer;
class EntityDatabaseImpl;
struct EntityLocation {
std::size_t chunk_idx;
std::size_t entity_idx;
};
class ComponentLayout {
public:
ComponentLayout(const EntityArchetype& archetype, const EntityDatabaseImpl& entity_database);
std::size_t size() const;
bool has_component(TypeId component_type) const;
std::size_t component_idx(TypeId component_type) const;
ComponentDescriptor component_desc(std::size_t idx) const;
std::span<const ComponentDescriptor> component_descriptors() const;
EntityArchetype archetype() const;
private:
EntityArchetype m_archetype;
std::vector<ComponentDescriptor> m_component_descriptors;
};
class ComponentChunk {
public:
ComponentChunk(ComponentDescriptor component_data, std::size_t capacity);
ComponentChunk(const ComponentChunk& other) = delete;
ComponentChunk(ComponentChunk&& other) noexcept = default;
~ComponentChunk();
ComponentChunk& operator=(const ComponentChunk& other) = delete;
ComponentChunk& operator=(ComponentChunk&& other) noexcept;
std::size_t size() const;
std::size_t capacity() const;
std::size_t init();
std::size_t init_move(void* src);
std::size_t init_copy(const void* src);
void erase(std::size_t idx);
void read(std::size_t idx, void* dst) const;
void write_move(std::size_t idx, void* src);
void write_copy(std::size_t idx, const void* src);
void write_uninitialized_init(std::size_t idx);
void write_uninitialized_move(std::size_t idx, void* src);
void write_uninitialized_copy(std::size_t idx, const void* src);
void* fetch_unchecked(std::size_t idx);
const void* fetch_unchecked(std::size_t idx) const;
private:
std::size_t phantom_init();
std::size_t m_size;
std::size_t m_capacity;
ComponentDescriptor m_component_data;
std::unique_ptr<std::byte[], AlignedDeleter<std::byte>> m_data;
};
class EntityChunk {
public:
EntityChunk(const ComponentLayout& layout);
EntityChunk(const EntityChunk& other) = delete;
EntityChunk(EntityChunk&& other) noexcept = default;
EntityChunk& operator=(const EntityChunk& other) = delete;
EntityChunk& operator=(EntityChunk&& other) noexcept;
std::size_t size() const;
std::size_t capacity() const;
std::size_t component_size() const;
bool has_entity(Entity entity) const;
bool has_component(TypeId component_type) const;
std::size_t entity_idx(Entity entity) const;
std::size_t component_idx(TypeId component_type) const;
std::size_t init(Entity entity);
std::size_t init_move(Entity entity, EntityContainer& entity_container, EntityLocation entity_location);
std::size_t init_copy(Entity entity, const EntityContainer& entity_container, EntityLocation entity_location);
void erase(std::size_t entity_idx);
void read(std::size_t entity_idx, std::size_t component_idx, void* dst) const;
void write_move(std::size_t entity_idx, std::size_t component_idx, void* src);
void write_copy(std::size_t entity_idx, std::size_t component_idx, const void* src);
void* fetch_unchecked(std::size_t entity_idx, std::size_t component_idx);
const void* fetch_unchecked(std::size_t entity_idx, std::size_t component_idx) const;
std::span<const Entity> entities() const;
EntityArchetype archetype() const;
private:
std::size_t phantom_init(Entity entity);
std::size_t m_size;
std::reference_wrapper<const ComponentLayout> m_layout;
std::vector<ComponentChunk> m_component_chunks;
std::array<Entity, ENTITY_CHUNK_SIZE> m_entities;
};
class EntityContainer {
public:
EntityContainer(const EntityArchetype& archetype, const EntityDatabaseImpl& entity_database);
std::size_t size() const;
std::size_t capacity() const;
std::size_t component_size() const;
bool has_entity(Entity entity) const;
bool has_component(TypeId component_type) const;
EntityLocation entity_location(Entity entity) const;
std::size_t component_idx(TypeId component_type) const;
EntityLocation init(Entity entity);
EntityLocation init_move(Entity entity, EntityContainer& entity_container, EntityLocation entity_location);
EntityLocation init_copy(Entity entity, const EntityContainer& entity_container, EntityLocation entity_location);
void erase(EntityLocation entity_location);
void read(EntityLocation entity_location, std::size_t component_idx, void* dst) const;
void write_move(EntityLocation entity_location, std::size_t component_idx, void* src);
void write_copy(EntityLocation entity_location, std::size_t component_idx, const void* src);
void* fetch_unchecked(EntityLocation entity_location, std::size_t component_idx);
const void* fetch_unchecked(EntityLocation entity_location, std::size_t component_idx) const;
EntityChunk& entity_chunk(std::size_t chunk_idx);
const EntityChunk& entity_chunk(std::size_t chunk_idx) const;
std::span<EntityChunk> entity_chunks();
std::span<const EntityChunk> entity_chunks() const;
EntityArchetype archetype() const;
private:
struct ChunkCapacity {
std::size_t chunk_idx;
std::size_t chunk_capacity;
};
/// Returns the index of a suitable chunk and saves the entity.
std::size_t phantom_init(Entity entity);
std::size_t m_size;
std::size_t m_capacity;
std::size_t m_empty_chunks;
std::size_t m_filled_chunks;
ComponentLayout m_layout;
std::vector<EntityChunk> m_entity_chunks;
std::vector<ChunkCapacity> m_capacity_map;
std::unordered_map<Entity, std::size_t, EntityHasher> m_entity_map;
};
}
|
964d994341a9f35f9352298db5cd40732624a78f
|
a8fb0b60223be2506361b721e76394756b25a42f
|
/NetSlash/src/GameObjects/GameObject.cpp
|
5441be69dc671cc4bf4c1531bb1ee7a7d3706422
|
[] |
no_license
|
jcordial/NetSlash
|
2763d8cf81990687315c61d02913f804456bce08
|
a74298e87674bc432e52a13efd8a2cf2b7a1cd75
|
refs/heads/master
| 2021-06-01T13:11:09.622357
| 2018-10-04T02:51:28
| 2018-10-04T02:51:28
| 9,219,096
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 601
|
cpp
|
GameObject.cpp
|
//
// GameObject.cpp
// NetSlash
//
// Created by Jason Cordial on 10/17/12.
// Copyright (c) 2012 Jason Cordial. All rights reserved.
//
#include "GameObject.h"
#include "../Core/NetSlashCore.h"
using namespace cordial;
cordial::GameObject::GameObject():cordial::BaseObject(){
firstComponent = 0;
//register ourselves with the engine core
cordial::NetSlashCore::registerObjectInLoop(this);
}
cordial::GameObject::~GameObject(){
delete firstComponent;
}
void cordial::GameObject::update(){
cordial::BaseObject::update();
std::cout << "Game Object update";
}
/*//
//COMPONENT LOOP
//*/
|
18ad49fbcc7db9892a77cb8d02924efe9e63bbeb
|
7c2420e0a7c8b28a425a7ed5466b527cb4f27d9b
|
/sources/kern/include/J4VMField.hh
|
114bf9ca5f74e80882caa208cd3ddce1f03ff124
|
[] |
no_license
|
nobuchiba1006/DOUMEKI
|
d1705054b95b79f9089ec5cff427513bd9fd5745
|
7c17ba485b616df5e15764d148d4fec358d7b480
|
refs/heads/main_woroot
| 2023-07-30T15:16:59.589294
| 2021-09-30T02:52:06
| 2021-09-30T02:52:06
| 411,891,541
| 0
| 0
| null | 2021-09-30T02:52:06
| 2021-09-30T02:07:10
|
C++
|
UTF-8
|
C++
| false
| false
| 999
|
hh
|
J4VMField.hh
|
// $Id: J4VMField.hh,v 1.1.1.1 2004/08/26 07:04:26 hoshina Exp $
#ifndef __J4VMFIELD__
#define __J4VMFIELD__
//*************************************************************************
//* --------------------
//* J4VMField
//* --------------------
//* (Description)
//* This class applies magnetic field.
//* Mother class : J4Object
//*
//* (Update Record)
//* 2002/09/13 T.Aso Original version.
//*************************************************************************
#include "globals.hh"
#include "J4Object.hh"
#include "G4ThreeVector.hh"
// ====================================================================
// -----------------------
// class definition
// -----------------------
class J4VMField :public J4Object{
public:
J4VMField();
virtual ~J4VMField();
virtual void GetLocalFieldValue(G4ThreeVector& position,
G4ThreeVector& bfield,G4bool& onlyFlag );
virtual void GetLocalValidBox(G4double* lpos);
private:
};
#endif
|
fc1452d3bb11dcf3c6fd4890663ed24abfee14fe
|
5b24f3f1010c85d31c709be432b7f9122ed28389
|
/src/xmlreader.cpp
|
6ea4aa1b57e524645b17e899d89b37cfc67d1024
|
[] |
no_license
|
mazbrili/colin
|
ce3219fdb57476d0b9b2cf1093a80274ae0e0fd5
|
dbb4e348018d2335aebfc62357fbfe57f14798ac
|
refs/heads/master
| 2020-06-12T03:49:53.328571
| 2020-04-08T09:38:21
| 2020-04-08T09:38:21
| 188,362,792
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,441
|
cpp
|
xmlreader.cpp
|
/***********************************************************
* $Id$
*
* Colin
*
* Copyright (C) 2011 Matthias Rauter (matthias.rauter@student.uibk.ac.at)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details."
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see
*
* http://www.gnu.org/licenses/.
*
* Author: Matthias Rauter
*
***********************************************************/
#include "xmlreader.h"
XmlReader::XmlReader(wgv_tw *t)
{
if(t == NULL)
tw = new wgv_tw();
else
tw = t;
}
bool XmlReader::read(QIODevice *device)
{
setDevice(device);
if(readNextStartElement())
{
if(name() == "ColinStruct" && attributes().value("version") == "0.01")
readTw();
else
raiseError(QObject::tr("can't read file!"));
}
return !error();
}
bool XmlReader::read(const QByteArray &array)
{
#ifndef QT_NO_DEBUG
QTextStream debugS(stdout);
debugS << "readbing byteArray:" << endl;
debugS << array << endl << endl;
#endif
addData(array);
if(readNextStartElement())
{
QPointF translation;
if(name() == "ColinClipboard" && attributes().value("version") == "0.01")
{
translation.setX(attributes().value("translationX").toString().toDouble());
translation.setY(attributes().value("translationZ").toString().toDouble());
readTw();
for(int i=0; i<tw->node_n(); i++)
{
tw->nodes[i].setX(tw->node(i).x()-translation.x());
tw->nodes[i].setZ(tw->node(i).z()-translation.y());
}
}
else if(name() == "ColinClipboardLoad" && attributes().value("version") == "0.01")
{
wgv_load l;
l.setTyp(static_cast<wgv_load::form>(attributes().value("type").toString().toInt()));
l.setBeam(0);
l.setPx(attributes().value("Px").toString().toDouble());
l.setPz(attributes().value("Pz").toString().toDouble());
l.setM(attributes().value("M").toString().toDouble());
tw->CommandInsertLoad(tw->load_n(), l);
}
else
raiseError(QObject::tr("can't read file!"));
}
return !error();
}
void XmlReader::readTw()
{
Q_ASSERT(isStartElement() && (name() == "ColinStruct" || name() == "ColinClipboard"));
while(readNextStartElement())
{
if(name() == "node")
readNode();
else if(name() == "beam")
readBeam();
else if(name() == "load")
readLoad();
else if(name() == "material")
readMat();
else if(name() == "profile")
readProfile();
else
skipCurrentElement();
}
}
void XmlReader::readNode()
{
Q_ASSERT(isStartElement() && name() =="node");
wgv_node n(attributes().value("X").toString().toDouble(),
attributes().value("Z").toString().toDouble());
while(readNextStartElement())
{
if(name() == "bearing")
{
wgv_bearing b = readBearing();
n.setBearing(b);
}
else
skipCurrentElement();
}
tw->CommandInsertNode(tw->node_n(), n);
}
void XmlReader::readBeam()
{
Q_ASSERT(isStartElement() && name() == "beam");
wgv_beam s(tw);
s.setLeftNode(attributes().value("from").toString().toInt());
s.setRightNode(attributes().value("to").toString().toInt());
s.setMat(materialMap.value(attributes().value("material").toString()));
s.setQs(profileMap.value(attributes().value("profile").toString()));
while(readNextStartElement())
{
if(name() == "joints")
{
for(int i=0; i<6; i++)
{
if(attributes().value(QString("j%1").arg(i)).toString().toInt() == 1)
s.setJoint(i, true);
else
s.setJoint(i, false);
}
}
else if(name() == "springs")
{
for(int i=0; i<6; i++)
{
if(attributes().value(QString("s%1").arg(i)).toString().toDouble() != 0)
s.setSpring(i, attributes().value(QString("s%1").arg(i)).toString().toDouble());
}
}
skipCurrentElement();
}
tw->CommandInsertBeam(tw->beam_n(), s);
}
void XmlReader::readLoad()
{
Q_ASSERT(isStartElement() && name() == "load");
wgv_load l;
l.setTyp(static_cast<wgv_load::form>(attributes().value("type").toString().toInt()));
l.setBeam(attributes().value("position").toString().toInt());
l.setPx(attributes().value("Px").toString().toDouble());
l.setPz(attributes().value("Pz").toString().toDouble());
l.setM(attributes().value("M").toString().toDouble());
tw->CommandInsertLoad(tw->load_n(), l);
skipCurrentElement();
}
wgv_bearing XmlReader::readBearing()
{
Q_ASSERT(isStartElement() && name() == "bearing");
wgv_bearing b;
b.setForm(static_cast<wgv_bearing::bearings>(
attributes().value("form").toString().toInt()));
b.setAngle(attributes().value("angle").toString().toDouble());
while(readNextStartElement())
{
if(name() == "springs")
{
b.setCx(attributes().value("cX").toString().toDouble());
b.setCz(attributes().value("cZ").toString().toDouble());
b.setCphi(attributes().value("cPhi").toString().toDouble());
}
else
skipCurrentElement();
}
skipCurrentElement();
return b;
}
void XmlReader::readMat()
{
Q_ASSERT(isStartElement() && name() == "material");
wgv_mat m;
m.setName(attributes().value("name").toString());
m.setE(attributes().value("E").toString().toDouble());
// m.setV(attributes().value("v").toString().toDouble());
// m.setRoh(attributes().value("roh").toString().toDouble());
m.setAlphaT(attributes().value("alphaT").toString().toDouble());
//test for existing material and for existing name
QString name = m.name();
for(int i=1; i< 100000; i++)
{
int index = LIB.IndexFromMatByName(m.name());
if(index > -1)
{
if(m == LIB.mat(index))
{
skipCurrentElement();
materialMap.insert(name, index);
return;
}
else
{
m.setName(name + "("+ QString::number(i)+ ")");
}
}
else
{
break;
}
}
LIB.addMat(m);
materialMap.insert(m.name(), LIB.mats_n()-1);
skipCurrentElement();
}
void XmlReader::readProfile()
{
Q_ASSERT(isStartElement() && name() == "profile");
wgv_profile p;
p.setName(attributes().value("name").toString());
p.setA(attributes().value("A").toString().toDouble());
p.setI(attributes().value("I").toString().toDouble());
p.setH(attributes().value("h").toString().toDouble());
// p.setAq(attributes().value("Aq").toString().toDouble());
QString name = p.name();
for(int i=1; i < 100000; i++)
{
int index = LIB.IndexFromProfileByName(p.name());
if(index > -1)
{
if(p == LIB.Profile(index))
{
skipCurrentElement();
profileMap.insert(name, index);
return;
}
else
{
p.setName(name + "("+ QString::number(i)+ ")");
}
}
else
{
break;
}
}
LIB.addProfile(p);
profileMap.insert(p.name(), LIB.profiles_n()-1);
skipCurrentElement();
}
QString XmlReader::errors() const
{
return QObject::tr("%1\nLine %2, column %3")
.arg(errorString())
.arg(lineNumber())
.arg(columnNumber());
}
|
731fa1a761b4ca25fed2c02a5fce7e4c0c2ac41f
|
fc19902d085aea760b373da0fdc32e46913e6530
|
/CS 355 - Data Structures & Algorithms/Beaver Projects Portfolio/Assignment 1/Project/fractions/Fraction.h
|
87b12f9e78580b838a1328e89fb49042ea1f04ea
|
[] |
no_license
|
mbeaver502/Undergraduate-CS-Work
|
b0e9bf9042132aabcd1f1c8b15b4939854354b30
|
e821869e80c444de04a133e9f2be9eb47894bcca
|
refs/heads/master
| 2020-07-13T02:35:29.216054
| 2016-08-24T18:03:43
| 2016-08-24T18:03:43
| 66,487,518
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,786
|
h
|
Fraction.h
|
/*
Michael Beaver
CS355 Fall 2012
Assignment: Homework 1
Description: This program implements and demonstrates the usage and functionality of a Fraction class. The
Fraction class is made up of two integers (numerator and denominator). Fractions may be instantiated
as 1/1, a whole number, a custom fraction, or as a pseudo-random fraction. Binary operations
(+, -, *, /) may be performed on Fractions. This program uses several cases to test the accuracy
of the Fraction class's implementation of these operations. The Fraction class lacks the
ability to reduce fractions.
Due Date: August 28, 2012
*/
#ifndef FRACTION_H
#define FRACTION_H
class Fraction {
private:
int num; // Fraction Numerator
int den; // Fraction Denominator
public:
// Constructors
Fraction(); // Default : 1/1
Fraction(int numerator); // Overloaded : numerator/1
Fraction(int numerator, int denominator); // Overloaded : numerator/denominator
Fraction(bool random); // Overloaded : generates pseudo-random fraction
// Destructor
~Fraction();
// Overloaded Operators
Fraction operator +(const Fraction& f2) const;
Fraction operator -(const Fraction& f2) const;
Fraction& operator =(const Fraction& source);
friend Fraction operator *(const Fraction& f1, const Fraction& f2);
friend Fraction operator /(const Fraction& f1, const Fraction& f2);
friend std::ostream& operator <<(std::ostream& os, Fraction& source);
friend std::istream& operator >>(std::istream& is, Fraction& source);
// Misc.
void print(std::ostream *os) const;
};
// Misc. helper functions
int getGCD(int a, int b);
int getLCM(int a, int b);
#endif
|
b5cb10985e0d31b3067cd46ab67341cbc8a84359
|
481cf5223927b5918684cd77dc12b96101242bda
|
/include/State_SplashScreen.hpp
|
986bcc925d39f31ce814a57a37093a93127f472b
|
[] |
no_license
|
daanhenkek/Savior
|
bb6712f9f67e4d196a15e458ff90bb09fa3499a5
|
607153439927dd641a2b01ab91fd814cf211ab98
|
refs/heads/master
| 2020-03-19T23:51:10.538943
| 2018-06-12T05:42:12
| 2018-06-12T05:42:12
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 919
|
hpp
|
State_SplashScreen.hpp
|
#pragma once
#include <string.h>
#include <stdio.h>
#include <switch.h>
#include "StateMachine.hpp"
class SplashScreenState : public State {
public:
inline SplashScreenState() {
this->Name = "SplashScreen";
};
inline void Start(StateMachine* machine) {
printf(CONSOLE_ESC(2J));
printf("Savior prerelease\nUse this application at your own risk, I'm not responsible if your cat\nspontaniously combusts or you lose your saves\n\nPress A to continue\nPress B to exit");
};
inline void Execute(StateMachine* machine) {
if (hidKeysDown(CONTROLLER_P1_AUTO) & KEY_A) {
machine->SetState("MainMenuScreen");
return;
}
if (hidKeysDown(CONTROLLER_P1_AUTO) & KEY_B) {
static_cast<ApplicationState*>(machine->GetGlobalState())->IsRunning = false;
return;
}
};
inline void Stop(StateMachine* machine) {
printf("Bye...\n");
}
};
|
faaceefec2c5e5c24938c0e25732cb66a20ce604
|
c16035bcc6fb68466cade2a138ab20814c55af8a
|
/Cpp/zad8/main.cpp
|
17b67783fba715511de1084317a4e63072ecc209
|
[] |
no_license
|
kbudaj/university
|
0e20f4ab87a69d7c4e168db67cd42fdccf957ee1
|
2c5c8f65d098a7524bb28639d079a7cb6cb3e942
|
refs/heads/master
| 2021-05-31T22:02:53.899518
| 2016-05-18T15:53:18
| 2016-05-18T15:53:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 737
|
cpp
|
main.cpp
|
#include <iostream>
#include "bst.h"
using namespace std;
using namespace structures;
int main() {
BST<int> b;
b.insert(10);
b.insert(12);
b.insert(1);
b.insert(-1);
b.insert(30);
b.print();
cout << endl << "search 10: ";
cout << b.search(10) << endl;
cout << "search 12: ";
cout << b.search(12) << endl;
cout << "search 1: ";
cout << b.search(1) << endl;
cout << "search -1: ";
cout << b.search(-1) << endl;
cout << "search 29: ";
cout << b.search(29) << endl;
cout << "search 30: ";
cout << b.search(30) << endl;
cout << "delete: 1" << endl;
b.remove(1);
b.print();
cout << "search 1: ";
cout << b.search(1) << endl;
return 0;
}
|
cd962373321375fbc51ee77ddeff7d43605989b6
|
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
|
/c++/cppcheck/2016/12/project.cpp
|
03cfdb92568ff6d43132acb5d4e53823c7446b05
|
[] |
no_license
|
rosoareslv/SED99
|
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
|
a062c118f12b93172e31e8ca115ce3f871b64461
|
refs/heads/main
| 2023-02-22T21:59:02.703005
| 2021-01-28T19:40:51
| 2021-01-28T19:40:51
| 306,497,459
| 1
| 1
| null | 2020-11-24T20:56:18
| 2020-10-23T01:18:07
| null |
UTF-8
|
C++
| false
| false
| 2,688
|
cpp
|
project.cpp
|
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2016 Cppcheck team.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include <QWidget>
#include <QDialog>
#include <QFile>
#include <QMessageBox>
#include <QString>
#include <QStringList>
#include "project.h"
#include "projectfile.h"
#include "projectfiledialog.h"
Project::Project(QWidget *parent) :
QObject(parent),
mProjectFile(NULL),
mParentWidget(parent)
{
}
Project::Project(const QString &filename, QWidget *parent) :
QObject(parent),
mFilename(filename),
mProjectFile(NULL),
mParentWidget(parent)
{
}
Project::~Project()
{
delete mProjectFile;
}
QString Project::Filename() const
{
return mFilename;
}
void Project::SetFilename(const QString &filename)
{
mFilename = filename;
}
bool Project::IsOpen() const
{
return mProjectFile != NULL;
}
bool Project::Open()
{
mProjectFile = new ProjectFile(mFilename, this);
if (!QFile::exists(mFilename))
return false;
if (!mProjectFile->Read()) {
QMessageBox msg(QMessageBox::Critical,
tr("Cppcheck"),
tr("Could not read the project file."),
QMessageBox::Ok,
mParentWidget);
msg.exec();
mFilename = QString();
mProjectFile->SetFilename(mFilename);
return false;
}
return true;
}
bool Project::Edit()
{
ProjectFileDialog dlg(mFilename, mParentWidget);
dlg.LoadFromProjectFile(mProjectFile);
if (dlg.exec() != QDialog::Accepted)
return false;
dlg.SaveToProjectFile(mProjectFile);
if (!mProjectFile->Write()) {
QMessageBox msg(QMessageBox::Critical,
tr("Cppcheck"),
tr("Could not write the project file."),
QMessageBox::Ok,
mParentWidget);
msg.exec();
return false;
}
return true;
}
void Project::Create()
{
mProjectFile = new ProjectFile(mFilename, this);
}
|
d2191589824f3a99121f80d25de666738aa0e7b0
|
1ebe74309461b3b5893c39792bae7660c661ddb5
|
/Examples/ESP32_TouchDown_Battery_Demo/ESP32_TouchDown_Battery_Demo.ino
|
b350a65477dd95b982578a0d0aa91106ae9a8444
|
[
"MIT"
] |
permissive
|
louisguan/esp32-touchdown
|
0134ec85b92346d57942e94661d647da686f7d2d
|
8b1302553e294cb28392cd262a51a713fdeda2bb
|
refs/heads/main
| 2023-08-10T06:38:18.698391
| 2021-09-10T08:33:46
| 2021-09-10T08:33:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,056
|
ino
|
ESP32_TouchDown_Battery_Demo.ino
|
/* ESP32 TouchDown Battery Monitoring Demo
* by: Dustin Watts
* date: 29-10-2020
*
* !WARNING Be careful when it comes to LiPo batteries. Always use a protected cell!
*
* This demo uses the BATT_DIV pin (GPIO35) which uses the ADC that is connected to
* a 100K/100K voltage divider. It takes a number of readings that are all added to
* totalReadings, with a delay in between.
*
* After that the total of the ADC readings is divided by the number of readings to get
* an average. This is then multiplied by a multiplicationFactor to convert the analog
* readings to the voltage it represents. This voltage is then printed to serial and
* the TFT.
*
* It then waits a second and repeats.
*
* This library needs to be installed:
*
* - TFT_eSPI (available through the Library Manager)
*
* ! Don't forget to configure User_Setup.h in the TFT_eSPI library. You can use User_setup.h in "/TFT_eSPI Setup Example".
*
*/
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
uint8_t BATT_DIV = 35;
uint16_t totalReadings = 0;
uint8_t numReadings = 8;
float multiplicationFactor = 0.0017782; // Adjust this factor to report correct voltages.
/* Explanation of the multiplicationFactor:
The ADC resolution is 12-bit. Meaning that the maximum reading of the ADC is 4095. GPIO35 (BATT_DIV) is conneted to
a voltage divider of two 100K resistors. Meaning that the voltage on that pin is half of what it is on the battery.
The ADC is referenced to an internal 1.1V. The ESP32 VCC voltage is 3.3V.
To convert an ADC reading to a voltage we need to divide that reading by the maximum reading of 4095. Next we need
to double that because of the 100K/100K voltage divider. Next we multiple that by the ESP32's VCC and then multiply
that by the reference voltage.
The multiplicationFactor is the result of (3.3*1.1*2)/4095. This gives us 0.0017782... If we now multiply the ADC
reading by this value, we get a value that is in Volt.
Because the resistors are not exactly 100K, the value we read from the ADC may not be exactly half of the battery voltage.
So it is always an approximation of the battery voltage. To get a bit more accurate results we could verify the voltage on
the BATT_DIV pin against the battery voltage and adjust the multiplicationFactor accordingly. Adjust up if it reads low,
down if it reads higher.
Note: When charging (so when the board is plugged in via USB) the voltage reads higher on the BATT_DIV pin then when
the battery is supplying charge. When calibrating the multiplicationFactor, use the ADC readings when not plugged in.
You could also take an average of the ADC readings and work you way back to a multiplicationFactor. In that case, divide
the measured battery voltage by the average ADC readings. Note that you will loose some resolution!
Also note that the ADC of the ESP32 is not linear. So although the voltage may be correct at close to 4.2V it may read wrong at lower
voltages or vice versa. But we can get pretty close!
*/
uint8_t sampleTimeDelay = 250;
void setup() {
Serial.begin(9600);
// Initialise TFT
tft.init();
tft.setTextColor(TFT_WHITE,TFT_BLACK);
tft.setTextSize(2);
tft.setRotation(1);
}
void loop() {
// Measure battery voltage
for(int i=0; i < numReadings; i++)
{
uint16_t adcReading = analogRead(BATT_DIV);
totalReadings = totalReadings + adcReading;
delay(sampleTimeDelay);
}
// Average and convert to Volts
float voltage = (totalReadings/numReadings) * multiplicationFactor;
Serial.print("Average ADC reading = ");
Serial.println(totalReadings/numReadings);
Serial.print("Battery Voltage = ");
Serial.print(voltage);
Serial.println("V");
// Also Display on the screen
tft.fillScreen(TFT_BLACK);
tft.setCursor(0, 0);
tft.print("Average ADC reading = ");
tft.println(totalReadings/numReadings);
tft.print("Battery Voltage = ");
tft.print(voltage);
tft.println("V");
delay(1000);
// Empty the totalReadings for the next time it is used.
totalReadings = 0;
}
|
e5c951cc41fc252e935f07a980c59d7bf031254e
|
78315453fa344c1dad4d39a6884b9d91b21c2847
|
/uvanew/uva_10924_slf.cpp
|
bc375079c8c999565b8b5b3042a7ce7fb247d715
|
[] |
no_license
|
shunno021/hello-world
|
d59c3cc0f0b997f9f4140881064a9dee365350ce
|
d1177da26cb8130a6212751cc8f21292925bd193
|
refs/heads/master
| 2020-08-14T06:52:31.938115
| 2019-10-14T19:03:09
| 2019-10-14T19:03:09
| 215,117,059
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 756
|
cpp
|
uva_10924_slf.cpp
|
#include<bits/stdc++.h>
using namespace std;
bool IsPrime(int n)
{
if(n<1) return 0;
for(int i=2;i*i<=n;i++) {
if(n%i==0) {
return 0;
}
}
return 1;
}
int main()
{
char s[25];
int l,sm;
while(scanf("%s",s)!=EOF) {
l=strlen(s);
sm=0;
for(int i=0;i<l;i++) {
int m;
if(s[i]>='a'&& s[i]<='z') {
m=s[i]-'a'+1;
}
if(s[i]>='A'&&s[i]<='Z') {
m=s[i]-'A'+27;
}
sm=sm+m;
}
if(IsPrime(sm)) cout<<"It is a prime word."<<endl;
else cout<<"It is not a prime word."<<endl;
}
return 0;
}
|
49e30c8e057ae5686cf3c2dc47bd15639f76e772
|
70607ac8e7cb765e6ad04113af9aa0ed5b5bcac5
|
/prototypes/include/asm.hpp
|
6073347edb19638f2159478b543572c48a360ef4
|
[
"MIT"
] |
permissive
|
MasterQ32/DasOS
|
ba8e5e6e977068e2c093f31c9055a971dcf3ed97
|
349afd89488d5e4aecc652c9f5935ea6ea0277d6
|
refs/heads/master
| 2020-12-21T17:52:48.400295
| 2016-08-10T22:21:01
| 2016-08-10T22:21:01
| 58,045,947
| 1
| 1
| null | 2016-06-05T14:03:05
| 2016-05-04T11:09:20
|
C++
|
UTF-8
|
C++
| false
| false
| 1,068
|
hpp
|
asm.hpp
|
#pragma once
#include <stddef.h>
#include <stdint.h>
#define ASM_READ_REG(reg, var) asm volatile("mov %%" #reg ", %0" : "=r" (var));
#define ASM_WRITE_REG(reg, var) asm volatile("mov %0, %%" #reg : : "r" (var));
namespace ASM
{
static inline void sti()
{
__asm__ volatile ("sti");
}
static inline void cli()
{
__asm__ volatile ("cli");
}
static inline void outb(uint16_t port, uint8_t data)
{
asm volatile ("outb %0, %1" : : "a" (data), "Nd" (port));
}
static inline uint8_t inb(uint16_t port)
{
uint8_t data;
asm volatile ("inb %1, %0" : "=a" (data) : "d" (port));
return data;
}
static inline void invlpg(void* m)
{
/* Clobber memory to avoid optimizer re-ordering access before invlpg, which may cause nasty bugs. */
asm volatile ( "invlpg (%0)" : : "b"(m) : "memory" );
}
static inline void lidt(void *idt, size_t length)
{
struct {
uint16_t limit;
void* pointer;
} __attribute__((packed)) idtp = {
.limit = uint16_t(length * 8 - 1),
.pointer = idt,
};
asm volatile("lidt %0" : : "m" (idtp));
}
}
|
ed525180f1543542556faf3c08d6743e0a25972d
|
a93bb0f268cf5e2de2dd745c86a160ca60fada86
|
/源代码/Thirdparty/UGC/inc/Scene/UG3DLayers.h
|
8d9c53ad47985360ac8cf3900c2a27b4d9520fa9
|
[
"Apache-2.0"
] |
permissive
|
15831944/Fdo_SuperMap
|
ea22b74ecfc5f983f2decefe4c2cf29007b85bf6
|
3d4309d0f45fa63abcde188825a997077dd444f4
|
refs/heads/master
| 2021-05-29T09:57:19.433966
| 2015-05-22T09:03:56
| 2015-05-22T09:03:56
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 838
|
h
|
UG3DLayers.h
|
// UG3DLayers.h: interface for the UG3DLayers class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_UG3DLAYERS_H__86588036_022C_4645_8565_81526067529E__INCLUDED_)
#define AFX_UG3DLAYERS_H__86588036_022C_4645_8565_81526067529E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include"Scene/UGPrerequisites.h"
#include"Scene/UGSceneNode.h"
#include"Scene/UGQuadGridSet.h"
namespace UGC
{
class SCENE_API UG3DLayers:public UGSceneNode
{
public:
UG3DLayers(UGScene* creator);
UG3DLayers(UGScene* creator, const UGString& name);
virtual ~UG3DLayers();
virtual void Release();
public:
// 矢量四叉树,用来管理所有分块的矢量文件
UGQuadGridSet m_QuadGridSet;
};
}
#endif // !defined(AFX_UG3DLAYERS_H__86588036_022C_4645_8565_81526067529E__INCLUDED_)
|
3e1c0d8ac51a2054441ecf7f882c543cc94074d8
|
fb3fc3ed733c2417de4e7c96c94649ec68483bb6
|
/DataStructures/HeighOfBinaryTree/Source.cpp
|
8260af167bc795831edfba4f365a9979e2763c44
|
[] |
no_license
|
tedkx/HackerRankChallenges
|
c0bdb7612ae3dbab68413e442c08dd15a44f5532
|
b3a21ea87eb96201a08fd354901b0d84499d7b3d
|
refs/heads/master
| 2020-12-23T02:39:09.127683
| 2016-08-03T11:27:10
| 2016-08-03T11:27:10
| 15,845,810
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,055
|
cpp
|
Source.cpp
|
/*
* Height of a Binary Tree
* https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree
*/
#include <iostream>
using namespace std;
struct node
{
int data;
node* left;
node* right;
};
int checkHeight(node * node, int currentHeight) {
int maxHeight = currentHeight;
int tempHeight = 0;
if (node->left != NULL)
{
tempHeight = checkHeight(node->left, currentHeight + 1);
if (tempHeight > maxHeight)
maxHeight = tempHeight;
}
if (node->right != NULL)
{
tempHeight = checkHeight(node->right, currentHeight + 1);
if (tempHeight > maxHeight)
maxHeight = tempHeight;
}
return maxHeight;
}
//Method to complete
int height(node *root) {
return checkHeight(root, 0);
}
node* createNode(int data) {
node* n = new node();
n->data = data;
return n;
}
int main() {
node * root = createNode(3);
root->left = createNode(2);
root->left->left = createNode(1);
root->right = createNode(5);
root->right->left = createNode(4);
root->right->right = createNode(6);
root->right->right->right = createNode(7);
height(root);
}
|
0f98d76e93fcb72c9be88fc72707dc703f176716
|
98b94eae33267a88fc0b743126f750af37c95e39
|
/Chapter-5-Loops-and-Files/Review Questions and Exercises/Find the Errors/67.cpp
|
eeaeaead11dde6a66f7f8723962c6a5c2ce65d12
|
[
"MIT"
] |
permissive
|
ahuertaalberca/C-Plus-Plus
|
003c75b7e70cc7eb326236706eaef2b04718497c
|
bbff921460ac4267af48558f040c7d82ccf42d5e
|
refs/heads/master
| 2023-06-02T17:29:25.141650
| 2021-06-13T23:31:18
| 2021-06-13T23:31:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,254
|
cpp
|
67.cpp
|
/********************************************************************
*
* 00. Find as many errors as you can.
* // This program uses a loop to raise a number to a power.
*
* Jesus Hilario Hernandez
* March 12th 2018
*
********************************************************************/
#include <iostream>
using namespace std;
int main()
{
// ERROR:
/*
int num, bigNum, power, count;
cout << "Enter an integer: ";
cin >> num;
cout << "What power do you want it raised to? ";
cin >> power;
bigNum = num;
while (count++ < power);
bigNum *= num;
cout << "The result is << bigNum << endl;
return 0;
*/
// CORRECTION:
int num,
bigNum,
power,
count = 1; // Initialize to 1
cout << "Enter an integer: ";
cin >> num;
cout << "What power do you want it raised to? ";
cin >> power;
bigNum = num;
while (count++ < power) // Removed (;) semicolon
bigNum *= num;
cout << "The result is " << bigNum << endl; // Added (") character
// Alternative (for) loop, user controlled loop, for processing
for ( ; count < power; count++)
bigNum *= num;
cout << "The result is " << bigNum << endl;
return 0;
}
|
854787fdba89a5f1ed5a4c7df03ca99bf21ab7f2
|
1bc768c36fcc27e3d8d38a488d21bd4d04d6ca94
|
/1. VERY EASY/Luke, I Am Your/Solution.h
|
1a8f0b33d62b8b4252540344577eb5312c47fec6
|
[] |
no_license
|
ernikus/Edabit-Challenges-Cpp
|
5232a370f281419a89f5205479c4b8c30bb91242
|
2a40fa3b7f87fbbc2c07b0d8ba485d0e0905269a
|
refs/heads/main
| 2023-08-28T13:11:53.687141
| 2021-10-16T12:45:22
| 2021-10-16T12:45:22
| 374,112,331
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 546
|
h
|
Solution.h
|
//Title: Luke, I Am Your ...
//Difficulty: Very Easy
//Source: https://edabit.com/challenge/fZBR6hjwAZhspyTx3
//Soln Author: ernikus
#pragma once
#include <iostream>
#include <vector>
#include <cstdlib>
std::string relationToLuke(const std::string name)
{
std::string text = "Luke, I am your ";
if (name == "Darth Vader")
text += "father.";
else if (name == "Leia")
text += "sister.";
else if (name == "Han")
text += "brother in law.";
else if (name == "R2D2")
text += "droid.";
else
exit (-1);
return text;
}
|
cee34736d2c18af3fd400bd16cbf750125aff6c2
|
4e7760bff454ea97b3ae4f6091f145cd377bf888
|
/source/WebKit2-7601.1.46.140/UIProcess/Plugins/PlugInAutoStartProvider.cpp
|
34842d87df3230cbf49fd89f4de1bd9696370992
|
[
"Unlicense"
] |
permissive
|
extratone/i
|
774f878ae5550e7ffeebd2d2408a17075ccaf5f7
|
bf415b3d9ed120d9128379b2da2c5d83c5e9da0f
|
refs/heads/main
| 2023-08-17T10:26:27.509227
| 2023-08-15T00:27:11
| 2023-08-15T00:27:11
| 333,582,739
| 20
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,091
|
cpp
|
PlugInAutoStartProvider.cpp
|
/*
* Copyright (C) 2012-2014 Apple Inc. 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 following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "PlugInAutoStartProvider.h"
#include "APIArray.h"
#include "APIDictionary.h"
#include "WebContextClient.h"
#include "WebProcessMessages.h"
#include "WebProcessPool.h"
#include <wtf/CurrentTime.h>
using namespace WebCore;
static const double plugInAutoStartExpirationTimeThreshold = 30 * 24 * 60 * 60;
namespace WebKit {
PlugInAutoStartProvider::PlugInAutoStartProvider(WebProcessPool* processPool)
: m_processPool(processPool)
{
m_hashToOriginMap.add(SessionID::defaultSessionID(), HashMap<unsigned, String>());
m_autoStartTable.add(SessionID::defaultSessionID(), AutoStartTable());
}
static double expirationTimeFromNow()
{
return currentTime() + plugInAutoStartExpirationTimeThreshold;
}
void PlugInAutoStartProvider::addAutoStartOriginHash(const String& pageOrigin, unsigned plugInOriginHash, SessionID sessionID)
{
auto sessionIterator = m_hashToOriginMap.find(sessionID);
if (sessionIterator == m_hashToOriginMap.end()) {
if (m_hashToOriginMap.get(SessionID::defaultSessionID()).contains(plugInOriginHash))
return;
sessionIterator = m_hashToOriginMap.set(sessionID, HashMap<unsigned, String>()).iterator;
} else if (sessionIterator->value.contains(plugInOriginHash) || m_hashToOriginMap.get(SessionID::defaultSessionID()).contains(plugInOriginHash))
return;
AutoStartTable::iterator it = m_autoStartTable.add(sessionID, AutoStartTable()).iterator->value.add(pageOrigin, PlugInAutoStartOriginMap()).iterator;
double expirationTime = expirationTimeFromNow();
it->value.set(plugInOriginHash, expirationTime);
sessionIterator->value.set(plugInOriginHash, pageOrigin);
m_processPool->sendToAllProcesses(Messages::WebProcess::DidAddPlugInAutoStartOriginHash(plugInOriginHash, expirationTime, sessionID));
if (!sessionID.isEphemeral())
m_processPool->client().plugInAutoStartOriginHashesChanged(m_processPool);
}
SessionPlugInAutoStartOriginMap PlugInAutoStartProvider::autoStartOriginHashesCopy() const
{
SessionPlugInAutoStartOriginMap sessionMap;
for (const auto& sessionKeyOriginHash : m_autoStartTable) {
PlugInAutoStartOriginMap& map = sessionMap.add(sessionKeyOriginHash.key, PlugInAutoStartOriginMap()).iterator->value;
for (const auto& keyOriginHash : sessionKeyOriginHash.value) {
for (const auto& originHash : keyOriginHash.value)
map.set(originHash.key, originHash.value);
}
}
return sessionMap;
}
Ref<API::Dictionary> PlugInAutoStartProvider::autoStartOriginsTableCopy() const
{
API::Dictionary::MapType map;
double now = currentTime();
for (const auto& stringOriginHash : m_autoStartTable.get(SessionID::defaultSessionID())) {
API::Dictionary::MapType hashMap;
for (const auto& originHash : stringOriginHash.value) {
if (now <= originHash.value)
hashMap.set(String::number(originHash.key), API::Double::create(originHash.value));
}
if (hashMap.size())
map.set(stringOriginHash.key, API::Dictionary::create(WTF::move(hashMap)));
}
return API::Dictionary::create(WTF::move(map));
}
void PlugInAutoStartProvider::setAutoStartOriginsTable(API::Dictionary& table)
{
setAutoStartOriginsTableWithItemsPassingTest(table, [](double) {
return true;
});
}
void PlugInAutoStartProvider::setAutoStartOriginsFilteringOutEntriesAddedAfterTime(API::Dictionary& table, double time)
{
double adjustedTimestamp = time + plugInAutoStartExpirationTimeThreshold;
setAutoStartOriginsTableWithItemsPassingTest(table, [adjustedTimestamp](double expirationTimestamp) {
return adjustedTimestamp > expirationTimestamp;
});
}
void PlugInAutoStartProvider::setAutoStartOriginsTableWithItemsPassingTest(API::Dictionary& table, std::function<bool(double expirationTimestamp)> isExpirationTimeAcceptable)
{
ASSERT(isExpirationTimeAcceptable);
m_hashToOriginMap.clear();
m_autoStartTable.clear();
HashMap<unsigned, double> hashMap;
HashMap<unsigned, String>& hashToOriginMap = m_hashToOriginMap.add(SessionID::defaultSessionID(), HashMap<unsigned, String>()).iterator->value;
AutoStartTable& ast = m_autoStartTable.add(SessionID::defaultSessionID(), AutoStartTable()).iterator->value;
for (auto& strDict : table.map()) {
PlugInAutoStartOriginMap hashes;
for (auto& hashTime : static_cast<API::Dictionary*>(strDict.value.get())->map()) {
bool ok;
unsigned hash = hashTime.key.toUInt(&ok);
if (!ok)
continue;
if (hashTime.value->type() != API::Double::APIType)
continue;
double expirationTime = static_cast<API::Double*>(hashTime.value.get())->value();
if (!isExpirationTimeAcceptable(expirationTime))
continue;
hashes.set(hash, expirationTime);
hashMap.set(hash, expirationTime);
hashToOriginMap.set(hash, strDict.key);
}
if (!hashes.isEmpty())
ast.set(strDict.key, hashes);
}
m_processPool->sendToAllProcesses(Messages::WebProcess::ResetPlugInAutoStartOriginDefaultHashes(hashMap));
}
void PlugInAutoStartProvider::setAutoStartOriginsArray(API::Array& originList)
{
m_autoStartOrigins.clear();
for (const auto& string : originList.elementsOfType<API::String>())
m_autoStartOrigins.append(string->string());
}
void PlugInAutoStartProvider::didReceiveUserInteraction(unsigned plugInOriginHash, SessionID sessionID)
{
HashMap<WebCore::SessionID, HashMap<unsigned, String>>::const_iterator sessionIterator = m_hashToOriginMap.find(sessionID);
HashMap<unsigned, String>::const_iterator it;
bool contains = false;
if (sessionIterator != m_hashToOriginMap.end()) {
it = sessionIterator->value.find(plugInOriginHash);
contains = it != sessionIterator->value.end();
}
if (!contains) {
sessionIterator = m_hashToOriginMap.find(SessionID::defaultSessionID());
it = sessionIterator->value.find(plugInOriginHash);
if (it == sessionIterator->value.end()) {
ASSERT_NOT_REACHED();
return;
}
}
double newExpirationTime = expirationTimeFromNow();
m_autoStartTable.add(sessionID, AutoStartTable()).iterator->value.add(it->value, PlugInAutoStartOriginMap()).iterator->value.set(plugInOriginHash, newExpirationTime);
m_processPool->sendToAllProcesses(Messages::WebProcess::DidAddPlugInAutoStartOriginHash(plugInOriginHash, newExpirationTime, sessionID));
m_processPool->client().plugInAutoStartOriginHashesChanged(m_processPool);
}
} // namespace WebKit
|
0f448310b504e5cd4c9a9308866109eba400bdba
|
49eec294aa7a9fbaad9e87fbdb6f992c529f985e
|
/Tree/Buildable.cpp
|
49e18c55c9b171daa2326359f74bb75596ed8b09
|
[] |
no_license
|
chumingzhang/DataStructure
|
1928aa3f605f9e01eaa7d9d4adcf2f0d5a5eb5fd
|
c35d9c2b6a9c30325f24074de94c762ec273bd46
|
refs/heads/master
| 2020-12-10T07:01:24.094677
| 2020-01-13T07:02:42
| 2020-01-13T07:02:42
| 233,530,359
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,863
|
cpp
|
Buildable.cpp
|
#include "Buildable.hpp"
template<class Entry>
Result_code Buildable_tree<Entry>::build_tree(const list<Entry> &supply) {
Result_code ordered_data = success;
int count = 0;
Entry x, last_x;
list<Binary_node<Entry>*>last_node;
Binary_node<Entry> *none = NULL;
last_node.insert(0, none);
while(supply.retrieve(count, x) == success) {
if(count > 0 && x <= last_x) {
ordered_data = fail;
break;
}
build_insert(++count, x, last_node);
last_x = x;
}
this->root = find_root(last_node);
connect_trees(last_node);
return ordered_data;
}
template<class Entry>
void Buildable_tree<Entry>::build_insert(int count, const Entry &new_data, list<Binary_node<Entry>*> &last_node) {
int level;
for(level = 1; count % 2 == 0; ++level)
count /= 2;
Binary_node<Entry> *node1, *parent;
node1 = new Binary_node<Entry>(new_data);
last_node.retrieve(level - 1, node1->left);
if(last_node.size() <= level)
last_node.insert(level, node1);
else
last_node.replace(level, node1);
if(last_node.retrieve(level + 1, parent) == success && parent->right == NULL)
parent->right = node1;
}
template<class Entry>
Binary_node<Entry>* Buildable_tree<Entry>::find_root(list<Binary_node<Entry>*> &last_node) {
Binary_node<Entry> *high_node;
last_node.retrieve(last_node.size() - 1, high_node);
return high_node;
}
template<class Entry>
void Buildable_tree<Entry>::connect_trees(const list<Binary_node<Entry>*> &last_node) {
Binary_node<Entry> *hnode, *lnode;
int hlevel = last_node.size() - 1, llevel;
while(hlevel > 2) {
last_node.retrieve(hlevel, hnode);
if(hnode->right != NULL)
hlevel--;
else {
llevel = hlevel;
do {
last_node.retrieve(--llevel, lnode);
}while(lnode != NULL && lnode->data < hnode->data);
hnode->right = lnode;
hlevel = llevel;
}
}
}
|
e26f7f981d4d607f22328a95f59074fca2a3bf2b
|
4352b5c9e6719d762e6a80e7a7799630d819bca3
|
/tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.test.test/processor1/3.46/rho
|
5a3d8f4c6386469bb0a1bd05ca3a3fc55c9e0b80
|
[] |
no_license
|
dashqua/epicProject
|
d6214b57c545110d08ad053e68bc095f1d4dc725
|
54afca50a61c20c541ef43e3d96408ef72f0bcbc
|
refs/heads/master
| 2022-02-28T17:20:20.291864
| 2019-10-28T13:33:16
| 2019-10-28T13:33:16
| 184,294,390
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 45,328
|
rho
|
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "3.46";
object rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -3 0 0 0 0 0];
internalField nonuniform List<scalar>
5625
(
1.44943
1.44076
1.43034
1.41894
1.4072
1.39567
1.38478
1.37484
1.366
1.35818
1.35123
1.34495
1.33895
1.33281
1.32623
1.31922
1.31179
1.30385
1.29566
1.28797
1.28142
1.27629
1.27298
1.27209
1.27388
1.27805
1.28384
1.29053
1.29775
1.30536
1.31308
1.32047
1.3273
1.3338
1.3404
1.34737
1.35478
1.3627
1.37142
1.38136
1.39282
1.40566
1.41918
1.43217
1.44321
1.45104
1.45492
1.45481
1.45131
1.44546
1.43838
1.43108
1.42428
1.41837
1.41354
1.40975
1.40688
1.40479
1.40329
1.40225
1.40153
1.40104
1.40072
1.4005
1.40035
1.40025
1.40018
1.40013
1.40009
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.4522
1.4446
1.43502
1.42422
1.41289
1.40156
1.39069
1.38063
1.37157
1.36357
1.35661
1.35052
1.34496
1.33962
1.33435
1.32905
1.32349
1.3176
1.31177
1.30644
1.30176
1.29795
1.29554
1.29491
1.29604
1.2986
1.30218
1.30645
1.31132
1.31675
1.32249
1.32818
1.33376
1.33948
1.34569
1.35252
1.35994
1.368
1.37697
1.38722
1.3989
1.41171
1.42481
1.43694
1.44674
1.4531
1.4555
1.45412
1.44971
1.44334
1.43611
1.42892
1.42238
1.41682
1.41232
1.40883
1.40622
1.40432
1.40297
1.40203
1.40139
1.40095
1.40066
1.40046
1.40032
1.40023
1.40017
1.40012
1.40009
1.40006
1.40005
1.40003
1.40003
1.40002
1.40001
1.4546
1.44823
1.43963
1.42957
1.41874
1.40772
1.39697
1.38685
1.37762
1.36941
1.3623
1.35614
1.35071
1.34585
1.34142
1.33715
1.33282
1.3285
1.32444
1.32068
1.31722
1.31443
1.31271
1.31213
1.31256
1.31388
1.31593
1.31862
1.32199
1.326
1.33043
1.33503
1.33986
1.3452
1.35128
1.35811
1.36561
1.37385
1.38309
1.39359
1.40539
1.41801
1.4305
1.44157
1.44993
1.4547
1.4556
1.45299
1.44775
1.44098
1.43369
1.42669
1.42047
1.41527
1.41112
1.40794
1.40558
1.40387
1.40266
1.40183
1.40125
1.40087
1.4006
1.40042
1.4003
1.40022
1.40016
1.40012
1.40008
1.40006
1.40005
1.40003
1.40002
1.40002
1.40001
1.45651
1.45151
1.44404
1.43487
1.42468
1.41407
1.40354
1.39348
1.38415
1.37576
1.3684
1.36201
1.35652
1.35183
1.34776
1.34402
1.34048
1.33723
1.33426
1.3314
1.3288
1.3268
1.3255
1.3248
1.32469
1.32524
1.3264
1.32819
1.33068
1.33384
1.33747
1.34145
1.34593
1.35117
1.35729
1.36421
1.37184
1.38027
1.38974
1.40044
1.41221
1.42446
1.4361
1.44589
1.45266
1.45576
1.45514
1.45138
1.44544
1.43839
1.43115
1.42441
1.41855
1.41374
1.40995
1.40708
1.40496
1.40344
1.40237
1.40163
1.40113
1.40078
1.40055
1.40039
1.40028
1.4002
1.40015
1.40011
1.40008
1.40006
1.40004
1.40003
1.40002
1.40002
1.40001
1.45782
1.45431
1.44814
1.44
1.4306
1.42055
1.41036
1.40044
1.3911
1.38257
1.37497
1.36833
1.36266
1.3579
1.35382
1.35024
1.34713
1.34444
1.34199
1.33967
1.33768
1.33617
1.33503
1.33421
1.33384
1.33404
1.33479
1.33614
1.33818
1.34088
1.3441
1.34781
1.35223
1.35755
1.3638
1.37085
1.37863
1.38724
1.3969
1.40767
1.41926
1.4309
1.44146
1.44974
1.45478
1.45616
1.45409
1.44931
1.44281
1.4356
1.42852
1.42211
1.41667
1.41226
1.40884
1.40626
1.40438
1.40304
1.4021
1.40145
1.40101
1.4007
1.4005
1.40036
1.40026
1.40019
1.40014
1.4001
1.40008
1.40006
1.40004
1.40003
1.40002
1.40002
1.40001
1.4584
1.45649
1.45175
1.44483
1.43638
1.42702
1.4173
1.40764
1.39839
1.3898
1.38204
1.37518
1.36927
1.36425
1.35998
1.35636
1.35337
1.35083
1.34855
1.34655
1.34493
1.34362
1.3425
1.34168
1.34131
1.34144
1.34205
1.34324
1.34512
1.34764
1.35071
1.35441
1.35895
1.36446
1.37087
1.37804
1.38595
1.39471
1.40448
1.41519
1.42637
1.43714
1.44637
1.45294
1.45615
1.45583
1.45243
1.44677
1.43988
1.43267
1.42585
1.41984
1.41483
1.41084
1.40778
1.40549
1.40384
1.40266
1.40184
1.40128
1.40089
1.40063
1.40045
1.40032
1.40024
1.40017
1.40013
1.4001
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.45813
1.4579
1.45474
1.44918
1.44185
1.43336
1.42426
1.415
1.40596
1.39743
1.38957
1.38252
1.37636
1.37106
1.36654
1.36278
1.35966
1.35702
1.35475
1.35289
1.35138
1.3501
1.34902
1.34832
1.34807
1.34824
1.34886
1.35009
1.35199
1.3545
1.3576
1.36145
1.36622
1.37193
1.37849
1.38576
1.39376
1.40262
1.41238
1.42284
1.43336
1.44299
1.45063
1.45534
1.45668
1.45474
1.45015
1.44383
1.43672
1.42965
1.42318
1.41762
1.41307
1.4095
1.40678
1.40478
1.40334
1.40232
1.40161
1.40112
1.40079
1.40056
1.40041
1.4003
1.40022
1.40016
1.40012
1.40009
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.45695
1.45841
1.45693
1.45289
1.44685
1.4394
1.43109
1.42239
1.41371
1.40533
1.39748
1.39034
1.38399
1.37844
1.37367
1.36966
1.36631
1.36348
1.36114
1.35925
1.3577
1.3564
1.35542
1.35487
1.35474
1.35499
1.35573
1.3571
1.35911
1.36173
1.36499
1.36907
1.37408
1.37998
1.38663
1.39395
1.402
1.41085
1.42045
1.43041
1.43999
1.4482
1.45402
1.45678
1.45628
1.45287
1.44731
1.44053
1.4334
1.4266
1.42056
1.41548
1.4114
1.40824
1.40586
1.40412
1.40288
1.402
1.4014
1.40098
1.4007
1.4005
1.40036
1.40027
1.4002
1.40015
1.40011
1.40008
1.40006
1.40005
1.40003
1.40003
1.40002
1.40001
1.40001
1.45481
1.4579
1.45816
1.45577
1.45118
1.44495
1.4376
1.42964
1.42146
1.41339
1.40569
1.39857
1.39212
1.38637
1.38137
1.37712
1.37353
1.37049
1.368
1.366
1.36437
1.36307
1.3622
1.36176
1.36171
1.36209
1.363
1.36455
1.36672
1.3695
1.37298
1.3773
1.38251
1.38853
1.39522
1.40254
1.41054
1.41925
1.42847
1.43767
1.446
1.45251
1.45636
1.45714
1.45492
1.45025
1.44398
1.43697
1.42999
1.42358
1.41803
1.41346
1.40985
1.40708
1.40502
1.40353
1.40247
1.40172
1.40121
1.40085
1.40061
1.40044
1.40032
1.40024
1.40018
1.40013
1.4001
1.40008
1.40006
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.45173
1.45631
1.45829
1.45764
1.45466
1.44981
1.44361
1.43656
1.42905
1.42146
1.41407
1.40707
1.4006
1.39477
1.38964
1.3852
1.38138
1.37816
1.37553
1.37339
1.37166
1.37037
1.36957
1.3692
1.36923
1.36975
1.37086
1.3726
1.37493
1.37788
1.38158
1.38611
1.39145
1.3975
1.40414
1.41138
1.41923
1.42762
1.4362
1.44431
1.45109
1.45568
1.45748
1.45635
1.45262
1.44698
1.44025
1.43324
1.42657
1.42064
1.41563
1.41158
1.40842
1.40603
1.40427
1.403
1.4021
1.40147
1.40104
1.40074
1.40053
1.40039
1.40029
1.40022
1.40016
1.40012
1.40009
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.44779
1.45363
1.45723
1.45833
1.45705
1.45376
1.44889
1.44292
1.43627
1.42933
1.4224
1.41567
1.40935
1.40357
1.3984
1.39382
1.38985
1.3865
1.38374
1.38148
1.37969
1.37841
1.37763
1.37729
1.37742
1.37809
1.37938
1.38127
1.38374
1.38686
1.39073
1.3954
1.40077
1.40675
1.41326
1.42031
1.42786
1.43569
1.44332
1.45002
1.45498
1.45751
1.45729
1.45444
1.44948
1.44316
1.43626
1.42946
1.42323
1.41784
1.41339
1.40985
1.40712
1.40508
1.40359
1.40252
1.40177
1.40125
1.40089
1.40064
1.40046
1.40034
1.40025
1.40019
1.40014
1.40011
1.40008
1.40006
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.44315
1.4499
1.45492
1.45772
1.4582
1.45657
1.4532
1.4485
1.4429
1.43678
1.43046
1.42418
1.41817
1.41257
1.40744
1.40285
1.39883
1.39542
1.39256
1.39022
1.38841
1.38714
1.38637
1.38607
1.38629
1.3871
1.38851
1.39051
1.39309
1.39634
1.40032
1.40501
1.41031
1.41612
1.4224
1.42911
1.43613
1.44311
1.44946
1.45446
1.4574
1.45785
1.45576
1.45148
1.44562
1.43895
1.43214
1.42572
1.42003
1.41523
1.41133
1.40828
1.40596
1.40424
1.403
1.40211
1.40148
1.40105
1.40075
1.40055
1.4004
1.4003
1.40023
1.40017
1.40013
1.4001
1.40007
1.40006
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.43808
1.4453
1.4514
1.45572
1.45794
1.45805
1.45629
1.45303
1.44866
1.44355
1.43802
1.43237
1.42682
1.42151
1.41657
1.4121
1.40816
1.40475
1.40185
1.39949
1.3977
1.39643
1.39567
1.39541
1.39573
1.39664
1.39813
1.40018
1.40283
1.40615
1.41014
1.41474
1.41985
1.42538
1.43129
1.43747
1.44369
1.4495
1.45426
1.45731
1.45818
1.45667
1.45299
1.44762
1.44125
1.43453
1.42802
1.42212
1.41703
1.41283
1.40948
1.40689
1.40494
1.40351
1.40248
1.40175
1.40124
1.40088
1.40064
1.40047
1.40035
1.40026
1.4002
1.40015
1.40012
1.40009
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.43284
1.4401
1.44686
1.45238
1.45616
1.45799
1.45794
1.45626
1.45328
1.44936
1.44481
1.43995
1.43501
1.43017
1.42557
1.42135
1.41757
1.41425
1.41141
1.40911
1.40735
1.4061
1.40537
1.40518
1.40557
1.40653
1.40804
1.4101
1.41278
1.41608
1.41997
1.42436
1.42915
1.43426
1.43962
1.44503
1.45014
1.45444
1.45735
1.45837
1.45725
1.45405
1.44914
1.4431
1.43655
1.43006
1.42404
1.41874
1.41429
1.41068
1.40784
1.40567
1.40405
1.40288
1.40203
1.40144
1.40102
1.40074
1.40054
1.4004
1.4003
1.40023
1.40017
1.40013
1.4001
1.40008
1.40006
1.40005
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.42771
1.43463
1.44157
1.44785
1.45289
1.4563
1.45794
1.45792
1.45648
1.45391
1.45052
1.44663
1.44247
1.43825
1.43415
1.4303
1.42678
1.42365
1.42098
1.4188
1.41712
1.41593
1.41525
1.41512
1.41555
1.41652
1.41802
1.42006
1.42268
1.42585
1.42951
1.43355
1.43788
1.4424
1.44697
1.45131
1.455
1.45756
1.4585
1.45755
1.45469
1.45017
1.44448
1.43816
1.43176
1.42571
1.42029
1.41565
1.41182
1.40877
1.4064
1.40461
1.40329
1.40233
1.40165
1.40118
1.40084
1.40061
1.40045
1.40034
1.40026
1.4002
1.40015
1.40012
1.40009
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.42294
1.42922
1.43591
1.44247
1.44832
1.45299
1.45618
1.4578
1.45796
1.45688
1.45482
1.45207
1.44886
1.44543
1.44197
1.43863
1.4355
1.43268
1.43026
1.42826
1.4267
1.4256
1.42501
1.42495
1.42539
1.42633
1.42777
1.42973
1.4322
1.43512
1.4384
1.44195
1.44564
1.44936
1.45287
1.45585
1.45789
1.45857
1.45762
1.45495
1.45073
1.44536
1.43931
1.43308
1.42708
1.42162
1.41686
1.41288
1.40965
1.40711
1.40517
1.40371
1.40264
1.40188
1.40133
1.40095
1.40069
1.40051
1.40038
1.40028
1.40022
1.40017
1.40013
1.4001
1.40008
1.40006
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.41867
1.42415
1.43025
1.43664
1.44282
1.4483
1.4527
1.45579
1.45752
1.45798
1.45736
1.45589
1.4538
1.45133
1.44866
1.44596
1.44337
1.44098
1.43888
1.43712
1.43575
1.43481
1.43433
1.4343
1.43473
1.43561
1.43694
1.43873
1.44094
1.44347
1.44622
1.4491
1.45196
1.45463
1.45684
1.45825
1.45853
1.45742
1.45481
1.45082
1.44573
1.43996
1.43395
1.42808
1.42266
1.41787
1.4138
1.41045
1.40777
1.4057
1.40412
1.40295
1.4021
1.4015
1.40107
1.40077
1.40056
1.40042
1.40031
1.40024
1.40019
1.40014
1.40011
1.40009
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.41496
1.41959
1.42494
1.43079
1.43683
1.44263
1.44779
1.452
1.45509
1.45701
1.45785
1.45774
1.4569
1.45552
1.45379
1.45188
1.44995
1.4481
1.44642
1.445
1.44388
1.44312
1.44274
1.44275
1.44314
1.44392
1.44509
1.4466
1.4484
1.45039
1.45246
1.45449
1.45632
1.45774
1.45849
1.45828
1.45691
1.45426
1.45041
1.44557
1.44009
1.43435
1.42868
1.42337
1.41862
1.41453
1.41112
1.40835
1.40618
1.4045
1.40325
1.40232
1.40166
1.40118
1.40085
1.40062
1.40045
1.40034
1.40026
1.4002
1.40016
1.40012
1.4001
1.40008
1.40006
1.40005
1.40004
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.41181
1.41564
1.42016
1.42529
1.43083
1.43649
1.44192
1.4468
1.45087
1.454
1.45615
1.45738
1.45782
1.45761
1.45693
1.45593
1.45476
1.45355
1.4524
1.45138
1.45058
1.45003
1.44977
1.44979
1.45012
1.45075
1.45166
1.45279
1.45406
1.45537
1.45661
1.45764
1.4583
1.45838
1.45766
1.45598
1.45324
1.44949
1.44488
1.4397
1.43425
1.42884
1.42372
1.41909
1.41505
1.41163
1.40882
1.40658
1.40484
1.40352
1.40253
1.40181
1.40129
1.40093
1.40067
1.40049
1.40037
1.40028
1.40022
1.40017
1.40013
1.40011
1.40008
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.4092
1.41229
1.41602
1.42036
1.42521
1.43038
1.43564
1.4407
1.4453
1.44925
1.45243
1.4548
1.45641
1.45734
1.45773
1.45769
1.45737
1.45687
1.4563
1.45576
1.45531
1.45499
1.45485
1.45489
1.45513
1.45555
1.45611
1.45675
1.45739
1.45792
1.45824
1.45822
1.45769
1.4565
1.45453
1.45169
1.44802
1.44364
1.43876
1.43364
1.42854
1.42369
1.41924
1.41531
1.41195
1.40916
1.4069
1.40512
1.40374
1.40271
1.40194
1.40139
1.401
1.40072
1.40052
1.40039
1.4003
1.40023
1.40018
1.40014
1.40011
1.40009
1.40007
1.40006
1.40004
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40709
1.40954
1.41254
1.4161
1.42018
1.42469
1.42947
1.43431
1.43898
1.44329
1.44709
1.45028
1.45281
1.45472
1.45607
1.45695
1.45745
1.45768
1.45773
1.45768
1.4576
1.45753
1.45751
1.45755
1.45767
1.45782
1.45799
1.45809
1.45806
1.4578
1.45722
1.4562
1.45464
1.45243
1.44953
1.44597
1.44184
1.43729
1.43255
1.4278
1.42326
1.41906
1.41531
1.41207
1.40934
1.4071
1.40531
1.40392
1.40285
1.40206
1.40148
1.40106
1.40076
1.40055
1.40041
1.40031
1.40024
1.40018
1.40015
1.40012
1.40009
1.40008
1.40006
1.40005
1.40004
1.40003
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40539
1.40731
1.40968
1.41253
1.41587
1.41965
1.42378
1.42812
1.43251
1.43679
1.44078
1.44438
1.44749
1.45009
1.45218
1.45381
1.45503
1.45591
1.45653
1.45694
1.4572
1.45737
1.45746
1.45749
1.45746
1.45735
1.45712
1.45671
1.45606
1.45509
1.45375
1.45194
1.44961
1.44674
1.44334
1.43949
1.43532
1.43097
1.42663
1.42245
1.41855
1.41504
1.41197
1.40935
1.40718
1.40542
1.40403
1.40295
1.40214
1.40154
1.4011
1.40079
1.40057
1.40042
1.40032
1.40024
1.40019
1.40015
1.40012
1.4001
1.40008
1.40006
1.40005
1.40004
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40405
1.40553
1.40738
1.40962
1.41228
1.41536
1.41879
1.4225
1.42639
1.43032
1.43416
1.43779
1.44111
1.44405
1.4466
1.44873
1.45046
1.45183
1.4529
1.45369
1.45424
1.4546
1.45478
1.45479
1.45463
1.45428
1.4537
1.45287
1.45173
1.45024
1.44836
1.44606
1.44332
1.44016
1.43665
1.43288
1.42897
1.42507
1.42128
1.41774
1.41451
1.41165
1.40919
1.40712
1.40542
1.40407
1.403
1.40219
1.40158
1.40114
1.40082
1.40059
1.40043
1.40032
1.40024
1.40019
1.40015
1.40012
1.4001
1.40008
1.40007
1.40005
1.40004
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40302
1.40414
1.40556
1.4073
1.40938
1.41181
1.41458
1.41764
1.42092
1.42434
1.42779
1.43117
1.43438
1.43736
1.44003
1.44238
1.44439
1.44606
1.4474
1.44844
1.44919
1.44967
1.44991
1.4499
1.44964
1.44912
1.44831
1.44719
1.44575
1.44397
1.44183
1.43932
1.43649
1.43337
1.43005
1.42661
1.42316
1.41981
1.41664
1.41373
1.41113
1.40886
1.40693
1.40533
1.40403
1.403
1.4022
1.4016
1.40115
1.40082
1.40059
1.40043
1.40032
1.40024
1.40019
1.40015
1.40012
1.4001
1.40008
1.40007
1.40005
1.40004
1.40004
1.40003
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40223
1.40307
1.40414
1.40547
1.40707
1.40896
1.41114
1.41358
1.41625
1.4191
1.42204
1.42499
1.4279
1.43066
1.43323
1.43555
1.4376
1.43935
1.4408
1.44194
1.44279
1.44334
1.4436
1.44357
1.44325
1.44263
1.44171
1.44048
1.43893
1.43706
1.4349
1.43245
1.42978
1.42692
1.42397
1.42099
1.41809
1.41532
1.41275
1.41042
1.40837
1.40661
1.40513
1.40391
1.40293
1.40217
1.40158
1.40114
1.40082
1.40059
1.40042
1.40031
1.40023
1.40018
1.40014
1.40011
1.40009
1.40008
1.40006
1.40005
1.40004
1.40004
1.40003
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40163
1.40226
1.40306
1.40406
1.40527
1.40671
1.40839
1.4103
1.41241
1.4147
1.4171
1.41958
1.42205
1.42447
1.42676
1.42888
1.4308
1.43247
1.43387
1.435
1.43584
1.4364
1.43666
1.43662
1.43627
1.43564
1.43471
1.43349
1.43199
1.43022
1.4282
1.42599
1.42362
1.42115
1.41865
1.41619
1.41382
1.4116
1.40957
1.40776
1.40618
1.40484
1.40372
1.40282
1.4021
1.40154
1.40111
1.4008
1.40057
1.40041
1.4003
1.40022
1.40017
1.40013
1.40011
1.40009
1.40007
1.40006
1.40005
1.40004
1.40004
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40119
1.40165
1.40224
1.40299
1.40389
1.40498
1.40625
1.40771
1.40934
1.41113
1.41304
1.41502
1.41705
1.41906
1.421
1.42282
1.4245
1.42598
1.42725
1.42828
1.42905
1.42955
1.42978
1.42974
1.42942
1.42882
1.42796
1.42684
1.42548
1.42391
1.42216
1.42026
1.41826
1.41622
1.41419
1.41221
1.41034
1.4086
1.40704
1.40566
1.40447
1.40347
1.40264
1.40198
1.40146
1.40106
1.40076
1.40054
1.40039
1.40028
1.4002
1.40015
1.40012
1.4001
1.40008
1.40007
1.40006
1.40005
1.40004
1.40004
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40086
1.4012
1.40164
1.40218
1.40285
1.40366
1.40461
1.4057
1.40694
1.4083
1.40978
1.41133
1.41293
1.41453
1.41611
1.41761
1.419
1.42025
1.42133
1.42221
1.42287
1.4233
1.4235
1.42345
1.42317
1.42264
1.42189
1.42092
1.41976
1.41844
1.41697
1.41541
1.4138
1.41216
1.41056
1.40902
1.40757
1.40625
1.40507
1.40404
1.40316
1.40243
1.40183
1.40136
1.40099
1.40071
1.40051
1.40036
1.40025
1.40018
1.40014
1.4001
1.40008
1.40007
1.40006
1.40005
1.40004
1.40004
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40063
1.40087
1.40119
1.40159
1.40208
1.40266
1.40336
1.40418
1.4051
1.40612
1.40723
1.40842
1.40965
1.41089
1.41213
1.41331
1.41443
1.41543
1.4163
1.41702
1.41756
1.41791
1.41807
1.41802
1.41777
1.41733
1.41671
1.41591
1.41496
1.41388
1.41271
1.41147
1.4102
1.40893
1.40769
1.40652
1.40543
1.40445
1.40358
1.40282
1.40218
1.40166
1.40124
1.4009
1.40065
1.40046
1.40032
1.40022
1.40016
1.40012
1.40009
1.40007
1.40006
1.40005
1.40004
1.40004
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40046
1.40064
1.40086
1.40115
1.40151
1.40193
1.40244
1.40303
1.40371
1.40446
1.40529
1.40617
1.40709
1.40804
1.40898
1.40989
1.41075
1.41153
1.41221
1.41277
1.41319
1.41346
1.41358
1.41354
1.41333
1.41297
1.41246
1.41182
1.41107
1.41022
1.40931
1.40835
1.40738
1.40642
1.40549
1.40461
1.40381
1.40309
1.40246
1.40191
1.40146
1.40109
1.4008
1.40058
1.40041
1.40028
1.40019
1.40013
1.40009
1.40007
1.40005
1.40004
1.40004
1.40003
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40034
1.40047
1.40063
1.40084
1.40109
1.4014
1.40176
1.40219
1.40268
1.40323
1.40383
1.40447
1.40515
1.40585
1.40655
1.40723
1.40787
1.40846
1.40897
1.4094
1.40971
1.40992
1.41
1.40996
1.40979
1.4095
1.4091
1.4086
1.40802
1.40737
1.40667
1.40595
1.40522
1.40451
1.40382
1.40318
1.4026
1.40209
1.40164
1.40126
1.40095
1.40069
1.40049
1.40034
1.40023
1.40016
1.4001
1.40007
1.40005
1.40004
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40025
1.40035
1.40046
1.40061
1.4008
1.40101
1.40127
1.40158
1.40193
1.40232
1.40275
1.40321
1.40371
1.40421
1.40472
1.40522
1.40569
1.40612
1.40649
1.4068
1.40703
1.40717
1.40723
1.40718
1.40705
1.40682
1.40652
1.40614
1.40569
1.4052
1.40468
1.40415
1.40361
1.40309
1.4026
1.40214
1.40173
1.40136
1.40105
1.40079
1.40058
1.40041
1.40028
1.40019
1.40012
1.40008
1.40005
1.40003
1.40002
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40019
1.40026
1.40035
1.40045
1.40058
1.40074
1.40092
1.40114
1.40138
1.40166
1.40196
1.40229
1.40264
1.403
1.40336
1.40371
1.40405
1.40436
1.40463
1.40484
1.405
1.4051
1.40513
1.40509
1.40498
1.4048
1.40457
1.40428
1.40396
1.4036
1.40321
1.40282
1.40243
1.40206
1.40171
1.40139
1.4011
1.40085
1.40064
1.40047
1.40033
1.40022
1.40014
1.40009
1.40005
1.40002
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40015
1.4002
1.40026
1.40034
1.40043
1.40054
1.40067
1.40082
1.40099
1.40119
1.4014
1.40163
1.40187
1.40212
1.40238
1.40262
1.40285
1.40307
1.40325
1.4034
1.40351
1.40357
1.40358
1.40354
1.40346
1.40332
1.40314
1.40293
1.40268
1.40242
1.40215
1.40187
1.40159
1.40133
1.40109
1.40087
1.40067
1.4005
1.40036
1.40025
1.40016
1.4001
1.40005
1.40002
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40012
1.40016
1.4002
1.40026
1.40032
1.4004
1.40049
1.4006
1.40072
1.40085
1.401
1.40116
1.40133
1.40149
1.40166
1.40183
1.40199
1.40214
1.40226
1.40235
1.40242
1.40246
1.40246
1.40242
1.40235
1.40225
1.40212
1.40196
1.40178
1.40159
1.40139
1.4012
1.40101
1.40082
1.40066
1.40051
1.40038
1.40027
1.40018
1.40011
1.40006
1.40002
1.39999
1.39998
1.39997
1.39997
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40009
1.40012
1.40016
1.4002
1.40025
1.4003
1.40037
1.40044
1.40053
1.40062
1.40071
1.40082
1.40093
1.40105
1.40117
1.40128
1.40138
1.40147
1.40155
1.40161
1.40165
1.40167
1.40166
1.40163
1.40157
1.40149
1.40139
1.40127
1.40115
1.40101
1.40087
1.40074
1.4006
1.40048
1.40037
1.40027
1.40019
1.40012
1.40006
1.40002
1.39999
1.39997
1.39996
1.39996
1.39996
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40008
1.4001
1.40012
1.40015
1.40019
1.40023
1.40028
1.40033
1.40038
1.40045
1.40052
1.40059
1.40066
1.40074
1.40082
1.40089
1.40095
1.40101
1.40106
1.40109
1.40111
1.40112
1.4011
1.40107
1.40103
1.40097
1.40089
1.40081
1.40071
1.40062
1.40052
1.40043
1.40034
1.40026
1.40018
1.40012
1.40007
1.40003
1.4
1.39997
1.39996
1.39995
1.39995
1.39995
1.39995
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40006
1.40008
1.4001
1.40012
1.40015
1.40018
1.40021
1.40025
1.40029
1.40033
1.40037
1.40043
1.40048
1.40052
1.40057
1.40062
1.40066
1.40069
1.40072
1.40074
1.40074
1.40074
1.40072
1.4007
1.40066
1.40061
1.40055
1.40049
1.40043
1.40036
1.40029
1.40023
1.40017
1.40012
1.40007
1.40003
1.4
1.39997
1.39996
1.39995
1.39994
1.39994
1.39994
1.39995
1.39996
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40005
1.40007
1.40008
1.4001
1.40011
1.40014
1.40016
1.40019
1.40022
1.40025
1.40028
1.40031
1.40034
1.40038
1.40041
1.40043
1.40045
1.40047
1.40049
1.4005
1.40049
1.40048
1.40047
1.40044
1.40041
1.40038
1.40033
1.40029
1.40024
1.40019
1.40015
1.4001
1.40006
1.40003
1.4
1.39998
1.39996
1.39995
1.39994
1.39994
1.39994
1.39994
1.39994
1.39995
1.39996
1.39997
1.39997
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40004
1.40005
1.40006
1.40008
1.4001
1.4001
1.40013
1.40015
1.40017
1.40019
1.40021
1.40023
1.40025
1.40027
1.40029
1.40031
1.40032
1.40033
1.40033
1.40033
1.40032
1.40031
1.4003
1.40028
1.40025
1.40022
1.40019
1.40016
1.40012
1.40009
1.40006
1.40003
1.4
1.39998
1.39996
1.39995
1.39994
1.39994
1.39993
1.39994
1.39994
1.39994
1.39995
1.39996
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40004
1.40005
1.40005
1.40006
1.40008
1.40009
1.4001
1.40011
1.40013
1.40014
1.40016
1.40017
1.40019
1.4002
1.40021
1.40022
1.40022
1.40023
1.40023
1.40022
1.40021
1.4002
1.40019
1.40017
1.40015
1.40013
1.4001
1.40008
1.40005
1.40003
1.40001
1.39999
1.39997
1.39996
1.39995
1.39994
1.39994
1.39993
1.39994
1.39994
1.39995
1.39995
1.39996
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40003
1.40005
1.40005
1.40006
1.40007
1.40008
1.40009
1.4001
1.40011
1.40012
1.40013
1.40014
1.40015
1.40016
1.40016
1.40016
1.40016
1.40016
1.40015
1.40014
1.40013
1.40012
1.4001
1.40009
1.40007
1.40005
1.40003
1.40001
1.4
1.39998
1.39997
1.39996
1.39995
1.39995
1.39994
1.39994
1.39994
1.39994
1.39995
1.39995
1.39996
1.39996
1.39997
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40003
1.40003
1.40003
1.40004
1.40005
1.40006
1.40006
1.40007
1.40008
1.40009
1.40009
1.4001
1.40011
1.40011
1.40012
1.40012
1.40012
1.40011
1.40011
1.4001
1.4001
1.40009
1.40008
1.40006
1.40005
1.40003
1.40002
1.40001
1.39999
1.39998
1.39997
1.39996
1.39996
1.39995
1.39995
1.39994
1.39995
1.39995
1.39995
1.39996
1.39996
1.39997
1.39997
1.39998
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40003
1.40003
1.40003
1.40004
1.40005
1.40005
1.40006
1.40006
1.40007
1.40007
1.40008
1.40008
1.40009
1.40009
1.40009
1.40009
1.40008
1.40008
1.40007
1.40007
1.40006
1.40005
1.40004
1.40003
1.40001
1.4
1.39999
1.39998
1.39998
1.39997
1.39996
1.39996
1.39996
1.39995
1.39995
1.39995
1.39996
1.39996
1.39996
1.39997
1.39997
1.39998
1.39998
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40003
1.40003
1.40004
1.40004
1.40005
1.40005
1.40005
1.40006
1.40006
1.40006
1.40007
1.40007
1.40007
1.40006
1.40006
1.40006
1.40005
1.40005
1.40004
1.40003
1.40002
1.40001
1.40001
1.4
1.39999
1.39998
1.39997
1.39997
1.39996
1.39996
1.39996
1.39996
1.39996
1.39996
1.39997
1.39997
1.39997
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40003
1.40003
1.40003
1.40004
1.40004
1.40004
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40004
1.40004
1.40003
1.40003
1.40002
1.40001
1.40001
1.4
1.39999
1.39999
1.39998
1.39998
1.39997
1.39997
1.39997
1.39997
1.39997
1.39997
1.39997
1.39997
1.39997
1.39998
1.39998
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40003
1.40003
1.40003
1.40003
1.40004
1.40004
1.40004
1.40004
1.40004
1.40004
1.40004
1.40004
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.4
1.4
1.39999
1.39999
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.4
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.40001
1.40001
1.40001
1.40002
1.40002
1.40002
1.40002
1.40002
1.40003
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39999
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39999
1.39999
1.39999
1.39999
1.4
1.4
1.4
1.40001
1.40001
1.40002
1.40002
1.40002
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.39999
1.39999
1.39999
1.39999
1.39999
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39998
1.39999
1.39999
1.4
1.4
1.40001
1.40001
1.40002
1.40002
1.40003
1.40003
1.40004
1.40004
1.40004
1.40004
1.40004
1.40004
1.40004
1.40004
1.40004
1.40003
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.39999
1.39999
1.39999
1.39999
1.39998
1.39998
1.39998
1.39997
1.39997
1.39997
1.39997
1.39997
1.39997
1.39997
1.39998
1.39998
1.39999
1.39999
1.4
1.40001
1.40001
1.40002
1.40003
1.40003
1.40004
1.40004
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40005
1.40004
1.40004
1.40004
1.40003
1.40003
1.40003
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.39999
1.39999
1.39999
1.39998
1.39998
1.39998
1.39997
1.39997
1.39997
1.39997
1.39996
1.39996
1.39997
1.39997
1.39997
1.39998
1.39998
1.39999
1.4
1.4
1.40001
1.40002
1.40003
1.40004
1.40005
1.40005
1.40006
1.40006
1.40007
1.40007
1.40007
1.40007
1.40007
1.40007
1.40006
1.40006
1.40006
1.40005
1.40005
1.40004
1.40004
1.40003
1.40003
1.40002
1.40002
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
)
;
boundaryField
{
emptyPatches_empt
{
type empty;
}
top_cyc
{
type cyclic;
}
bottom_cyc
{
type cyclic;
}
inlet_cyc
{
type cyclic;
}
outlet_cyc
{
type cyclic;
}
procBoundary1to0
{
type processor;
value nonuniform List<scalar>
75
(
1.45551
1.45698
1.45797
1.45837
1.4581
1.45706
1.45521
1.45255
1.44912
1.44501
1.4404
1.4355
1.43055
1.42578
1.42138
1.41744
1.41402
1.41111
1.4087
1.40673
1.40513
1.40387
1.40289
1.40214
1.40157
1.40114
1.40083
1.4006
1.40044
1.40032
1.40024
1.40018
1.40014
1.40011
1.40008
1.40007
1.40006
1.40005
1.40004
1.40004
1.40002
1.40003
1.40002
1.40001
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.4
1.4
1.40001
1.40001
1.4
1.40001
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
1.4
)
;
}
procBoundary1to0throughoutlet_cyc
{
type processorCyclic;
value nonuniform List<scalar>
75
(
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.4
1.40001
1.4
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.4
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
)
;
}
procBoundary1to3
{
type processor;
value nonuniform List<scalar>
75
(
1.44642
1.43681
1.42568
1.41378
1.40174
1.39011
1.3793
1.36954
1.36086
1.3531
1.34599
1.33925
1.3325
1.32519
1.31686
1.30742
1.2972
1.28647
1.27535
1.26461
1.25546
1.24857
1.24423
1.24293
1.24527
1.25119
1.25977
1.26978
1.28035
1.29107
1.30161
1.31142
1.32014
1.32791
1.33525
1.34257
1.35009
1.35793
1.36642
1.37604
1.38722
1.39997
1.41373
1.42738
1.43947
1.44864
1.45393
1.45509
1.45257
1.44731
1.44048
1.43314
1.42612
1.41992
1.41476
1.41068
1.40756
1.40527
1.40362
1.40247
1.40168
1.40114
1.40078
1.40053
1.40037
1.40026
1.40018
1.40013
1.40009
1.40007
1.40005
1.40004
1.40003
1.40002
1.40002
)
;
}
procBoundary1to3throughbottom_cyc
{
type processorCyclic;
value nonuniform List<scalar>
75
(
1.39999
1.39999
1.39998
1.39998
1.39997
1.39997
1.39997
1.39996
1.39996
1.39996
1.39996
1.39996
1.39996
1.39997
1.39997
1.39998
1.39999
1.4
1.40001
1.40002
1.40003
1.40004
1.40005
1.40006
1.40007
1.40008
1.40008
1.40009
1.40009
1.40009
1.40009
1.40009
1.40009
1.40009
1.40008
1.40008
1.40007
1.40006
1.40006
1.40005
1.40005
1.40004
1.40003
1.40003
1.40003
1.40002
1.40002
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
1.40001
)
;
}
}
// ************************************************************************* //
|
|
843415068d04b228118f10c5da4b9f1c945cc2e7
|
6b22c22b2de14d5c5069cc8530a746dea9f1b9b7
|
/Scott_Sidoli Level 8 HW Submission/Section 5.1/Exercise511/Exercise511/main.cpp
|
1e96ef7b201339ca0cc1fecf8271060b3e409cb6
|
[
"MIT"
] |
permissive
|
scottsidoli/CPP-Applications-for-Financial-Engineering-Pre-MFE
|
68be095c15d85868c66e18b6b79588edf8afcce1
|
79c2fb297a85c914d5f0b8671bb17636801e3ce7
|
refs/heads/master
| 2020-06-08T19:49:38.332228
| 2019-06-23T17:27:42
| 2019-06-23T17:27:42
| 193,296,240
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,851
|
cpp
|
main.cpp
|
// Exercise 5.1.1 - Smart Pointers
//
// by Scott Sidoli
//
// Main.cpp
//
// In this exercise, we store different types of shapes in the array template class
// that we created earlier. We store pointers to shapes in the array, Shapes1. The
// boost::shared_ptr<T> class stores a pointer an will delete the object automatically
// when no one is referencing the object. So to exploit this feature we create an array
// with boost::shared_ptr<Shape>. The deletion is done automatically. We mark in the
// code when destructors are called.
#include <boost\smart_ptr.hpp>
#include "Array.hpp"
#include "Line.hpp"
#include "Circle.hpp"
using namespace ssidoli::Containers;
using namespace ssidoli::CAD;
// Typedefs to simplify code
typedef boost::shared_ptr<Shape> ShapePtr;
typedef Array<ShapePtr> ShapeArray;
int main()
{
// Create an array of shared pointers for shapes
int size = 3;
ShapeArray Shapes1(size);
// Fill the array with shape pointers
ShapePtr p(new Point(1.0, 2.0));
ShapePtr l(new Line(Point(), Point(1.0, 2.0))); // Destructors are called for point objects and shape objects
ShapePtr c(new Circle(Point(), 4.0)); // Destructors are called for point object and shape object
Shapes1[0] = p;
Shapes1[1] = l;
Shapes1[2] = c;
// Print the shapes
cout << "Shapes in the array: " << endl;
cout << "Point: " << (*Shapes1[0]).toString() << endl;
cout << "Line: " << (*Shapes1[1]).toString() << endl;
cout << "Circle: " << (*Shapes1[2]).toString() << endl;
/* Destructor calls after printing:
Circle Destructor
A point is destroyed!
Shape destructor
Shape destructor
A line is destroyed!
A point is destroyed!
Shape destructor
A point is destroyed!
Shape destructor
Shape destructor
A point is destroyed!
Shape destructor
*/
return 0;
}
|
cd5e6ce8f5129fc24043908526e7967b00bd642d
|
806b2a94df2b5699449f8b77a298cab45ee14978
|
/cs8Components/cs8ProgramComponent/common/versionInfo.h
|
c1b19bc71c628d882f7e322cb7e7343ac676d7cb
|
[] |
no_license
|
vdg1/cs8-components
|
4dd502282fce5f4f60a3d4ba45a65dbb485e1686
|
b4f7ee125c6d282e3b766e50ec2b2c6bed0b9591
|
refs/heads/master
| 2023-06-22T18:36:35.147557
| 2022-07-30T14:15:44
| 2022-07-30T14:15:44
| 41,633,666
| 1
| 0
| null | 2021-07-18T16:30:04
| 2015-08-30T15:36:56
|
C++
|
UTF-8
|
C++
| false
| false
| 390
|
h
|
versionInfo.h
|
#ifndef VERSIONINFO_H
#define VERSIONINFO_H
#include <QObject>
#include <QString>
class VersionInfo : public QObject
{
Q_OBJECT
public:
static QString GetFileDescription(const QString& filePath);
static QString GetVersionString(const QString& filePath);
};
bool getProductName(const QString & fileName, QString &productName, QString &fileVersion);
#endif // VERSIONINFO_H
|
ab14c157ce5ff70e2355cebdf0fec9e28faa5248
|
45ddcd4f3c051af5701a636e7a495fa44cbb0a73
|
/Estudo Dirigido/src/Fontes/banco.cpp
|
5c5ad4077a39de3983697d74e00ae9446fd8e0d0
|
[
"MIT"
] |
permissive
|
BrunoDalI/Simulador-de-Banco-programacao-avancada-
|
ca1cb5b25903262b55c8ebad3f90e1fcfad21893
|
dd33e0a8ceae72601bae7c4c9b6b490f04c5c45f
|
refs/heads/main
| 2023-08-07T17:55:36.614996
| 2021-09-16T23:12:32
| 2021-09-16T23:12:32
| 365,855,698
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 9,152
|
cpp
|
banco.cpp
|
#include "../Bibliotecas/Banco.h"
#include "../Bibliotecas/ContaCorrente.h"
#include "../Bibliotecas/ContaPoupanca.h"
#include "../Bibliotecas/Conta.h"
// Inicia o programa
void Banco::inicio(){
_resposta = _op.menu(_resposta);
system("cls");
switch(_resposta){
case 0:{
cout << "---> Ateh logo !!" << endl;
} break;
case 2:{
OP2();
} break;
case 3:{
OP3();
} break;
case 4:{
OP4();
} break;
case 5:{
OP5();
} break;
case 6:{
OP6();
} break;
case 7:{
OP7();
} break;
case 1:{
cout << endl;
OP2();
cout << endl;
OP3();
cout << endl;
OP4();
cout << endl;
OP5();
cout << endl;
OP6();
cout << endl;
OP7();
} break;
}
}
// Mostra em tela a resolução do ex 2 da lista
void Banco::OP2() const{
cout << endl;
cout << " -> 2. Sobrescreva o metodo aplicaJurosDiarios nas classes ContaCorrente e ContaPoupanca." << endl;
cout << setfill(' ') << setw(4) << " " << " Uma conta corrente aplica juros de 0,01% ao dia," << endl;
cout << setfill(' ') << setw(4) << " " << " enquanto uma conta poupança aplica juros de 0,08% ao dia." << endl;
cout << endl << setfill(' ') << setw(3) << " " << " Solucao:" << endl;
cout << endl << setfill(' ') << setw(3) << " " << " // Arquivo: ContaCorrente.h" << endl;
cout << setfill(' ') << setw(4) << " " << " void aplicaJurosDiarios(int dias) {" << endl;
cout << setfill(' ') << setw(6) << " " << " float juros = getSaldo();" << endl;
cout << setfill(' ') << setw(6) << " " << " juros *= ((0.01/100) * dias);" << endl;
cout << setfill(' ') << setw(4) << " " << " }" << endl;
cout << endl << endl << setfill(' ') << setw(3) << " " << " // Arquivo: ContaPoupanca.h" << endl;
cout << setfill(' ') << setw(4) << " " << " void aplicaJurosDiarios(int dias) {" << endl;
cout << setfill(' ') << setw(6) << " " << " float juros = getSaldo();" << endl;
cout << setfill(' ') << setw(6) << " " << " juros *= ((0.08/100) * dias);" << endl;
cout << setfill(' ') << setw(4) << " " << " }" << endl;
}
// Cria 2 contas Corrente/Poupanca e faz 4 operações de deposito/retirada nelas, ex 3 da lista
void Banco::OP3(){
cout << endl;
cout << " -> 3. Escreva um programa que crie 2 contas corrente e 2 contas poupanca." << endl;
cout << setfill(' ') << setw(4) << " " << " - Realize uma serie de 4 operacoes de deposito e retirada, e imprima seus extratos."<< endl;
// 1° Conta Corrente
ContaCorrente contaC1(1, new Cliente("Bruno"));
// 4 Operacoes
contaC1.deposita(1000);
contaC1.retira(500);
contaC1.deposita(2000);
contaC1.retira(1000);
contaC1.extrato();
contaC1.aplicaJurosDiarios(10);
// 2° Conta Corrente
ContaCorrente contaC2(2, new Cliente("Alice"));
// 4 Operacoes
contaC2.deposita(2000);
contaC2.retira(50);
contaC2.deposita(4000);
contaC2.retira(100);
contaC2.extrato();
contaC2.aplicaJurosDiarios(20);
cout << endl << endl;
// 1° Conta Poupanca
ContaPoupanca contaP1(1, new Cliente("Danilo"));
// 4 Operacoes
contaP1.deposita(3000);
contaP1.retira(2000);
contaP1.deposita(1000);
contaP1.retira(1000);
contaP1.extrato();
contaP1.aplicaJurosDiarios(30);
// 2° Conta Poupanca
ContaPoupanca contaP2(2, new Cliente("Maite"));
// 4 Operacoes
contaP2.deposita(4000);
contaP2.retira(3050);
contaP2.deposita(2000);
contaP2.retira(1500);
contaP2.extrato();
contaP2.aplicaJurosDiarios(40);
}
// Função que realiza o problema do o ex 4 da lista
// Realiza a tranferencia de 1000,00 de uma conta poupanca para uma corrente, aplica juros de 100 dias e imrprime o extrato
void Banco::OP4(){
cout << endl;
cout << " -> 4. Realize uma transferencia de R$ 1000,00 de uma conta poupanca para uma conta corrente. " << endl;
cout << setfill(' ') << setw(4) << " " << " - Aplique juros de 100 dias em uma conta corrente e uma conta poupanca que possuam o mesmo saldo." << endl;
cout << setfill(' ') << setw(4) << " " << " - Imprima os extratos das duas contas." << endl;
ContaCorrente CCex1(5, new Cliente("ContaCorrente exemplo1"));
CCex1.deposita(1000);
ContaPoupanca CPex2(6, new Cliente("ContaPoupanca exemplo2"));
CPex2.deposita(1000);
// Mostra extrato antes da tranferencia;
CCex1.extrato();
CPex2.extrato();
// Realize uma transferencia de R$ 1000,00 de uma conta poupança para uma conta corrente.
CCex1.transfere(&CPex2,1000);
// Imprime apenas para ver as transferencias
CCex1.extrato();
CPex2.extrato();
// Apenas para as duas contas ficarem com saldo igual;
CPex2.transfere(&CCex1,1000);
// Imprima os extratos das duas contas.
// com o juros de 100 dias
CCex1.extrato();
CCex1.aplicaJurosDiarios(100);
CPex2.extrato();
CPex2.aplicaJurosDiarios(100);
}
// Mostra em tela a resolução do ex 5 da lista;
void Banco::OP5() const{
cout << endl;
cout << " -> 5. Altere os construtores das classes ContaCorrente e ContaPoupanca para" << endl;
cout << setfill(' ') << setw(4) << " " << " imprimir a seguinte mensagem: " "Criando conta {numero} do cliente" << endl;
cout << setfill(' ') << setw(4) << " " << " {cliente}" ", onde {numero} eh o numero da conta e {cliente} eh o nome do cliente da conta." << endl;
//EX 05
// "Criando conta {numero} do cliente {cliente}"
cout << setfill(' ') << setw(4) << " " << " Criando conta _numero do cliente _nomeCliente->getNome() " << endl;
cout << setfill(' ') << setw(4) << " " << " Solucao encontrada na linha 29 do arquivo Conta.h" << endl;
cout << setfill(' ') << setw(4) << " " << " cout << endl << " "-> Criando conta" " << _numero << " "do cliente" " << _nomeCliente->getNome();"<< endl;
}
// Mostra em tela a resolução do ex 6 da lista;
void Banco::OP6(){
cout << endl;
cout << " -> 6. Crie um vetor de 100 contas correntes." << endl;
cout << setfill(' ') << setw(4) << " " << " - Analise o que aconteceu ao criar este vetor. " << endl;
cout << setfill(' ') << setw(4) << " " << " - Isto e um problema? Se sim, como pode ser resolvido? " << endl;
cout << setfill(' ') << setw(4) << " " << " - Coloque a resposta como comentario no codigo da funcao main()." << endl;
cout << endl << setfill(' ') << setw(3) << " " << " R: Sim eh um problema pois ao cria um vetor o compilador" << endl;
cout << setfill(' ') << setw(4) << " " << " cria 100 objetos, porem o construtor tem como entrada 2 paramentros e nao consegue cria os objetos." << endl;
cout << setfill(' ') << setw(4) << " " << " A solucao foi retirada das aulas 04, 06, e 05 - Matrizes de objetos, onde cria-se um vetor" << endl;
cout << setfill(' ') << setw(4) << " " << " de ponteiros para aloca-los dinamicamente todos esses objetos." << endl;
cout << endl << setfill(' ') << setw(3) << " " << " Solucao:" << endl;
cout << setfill(' ') << setw(4) << " " << " ContaCorrente** conta_corrente = new ContaCorrente*[100];" << endl;
cout << setfill(' ') << setw(4) << " " << " delete[] conta_corrente;" << endl;
// Solução retirada da aula -> 04 - "Passagem por referencia"
ContaCorrente** conta_corrente = (new ContaCorrente*[100]);
// Destroi o vetor alocado;
delete[] conta_corrente;
}
// Mostra em tela a resolução do ex 7 da lista;
void Banco::OP7(){
cout << endl;
cout << " -> 7. Crie um vetor com 100 contas." << endl;
cout << setfill(' ') << setw(4) << " " << " - Qual problema ocorreu?" << endl;
cout << setfill(' ') << setw(4) << " " << " - Como este problema pode ser solucionado?" << endl;
cout << setfill(' ') << setw(4) << " " << " - Implemente a correção do problema." << endl;
cout << setfill(' ') << setw(4) << " " << " - Coloque a resposta como comentário no codigo da funcao main()." << endl;
cout << endl << setfill(' ') << setw(3) << " " << " R: O probelma pe que o objeto 'Conta' nao aceita ponteiros do tipo 'ContaCorrente'," << endl;
cout << setfill(' ') << setw(4) << " " << " pois a classe 'Conta' eh pai da classe ContaCorrente." << endl;
cout << setfill(' ') << setw(4) << " " << " Uma solução encontrada na internet, foi converter os ponteiro " << endl;
cout << setfill(' ') << setw(4) << " " << " do tipo ContaCorrente para o tipo Conta" << endl;
cout << endl << setfill(' ') << setw(3) << " " << " Solucao:" << endl;
cout << setfill(' ') << setw(4) << " " << " Conta** conta = (Conta**) new ContaCorrente*[100];" << endl;
cout << setfill(' ') << setw(4) << " " << " delete[] conta;" << endl;
// Cria um vetor de ponteiros do tipo ContaCorrente;
Conta** conta = ((Conta**) new ContaCorrente*[100]);
// Destroi o vetor alocado;
delete[] conta;
}
|
b9ca71e26471c7cc4db77d9dc44073215b295de9
|
ec519440da1f339ddc97c10e1fc9559fcbd2b185
|
/Code/File Format/DB/CDBManager.cpp
|
a8baf00c4a776dd83849ad6adbd61a5f2ea15852
|
[] |
no_license
|
MexUK/Old-IMGF-Issues
|
b7d72b2bff768bb2a49801d591559e9d887b7522
|
30d62e3135954bd24bdb9cdc1505c0fba1b48b4c
|
refs/heads/master
| 2021-06-08T14:05:06.448069
| 2016-12-06T17:29:24
| 2016-12-06T17:29:24
| 59,851,114
| 5
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,977
|
cpp
|
CDBManager.cpp
|
#include "CDBManager.h"
#include "CDBFormat.h"
#include "CDBEntry.h"
#include "Format/RockstarGames/IMG/CIMGFormat.h"
#include "Format/RockstarGames/IMG/CIMGEntry.h"
#include "Type/String/CString2.h"
#include "Stream/CDataReader.h"
#include "Debug/CDebug.h"
using namespace std;
using namespace mcore;
CDBManager::CDBManager(void)
{
}
void CDBManager::init(void)
{
}
void CDBManager::uninit(void)
{
}
CDBFormat* CDBManager::createDBFileFromIMGFile(CIMGFormat *pIMGFile)
{
CDBFormat *pDBFile = new CDBFormat;
pDBFile->setDBVersion(0x01);
for (auto pIMGEntry : pIMGFile->getEntries())
{
CDBEntry *pDBEntry = new CDBEntry;
pDBEntry->setEntryName(pIMGEntry->getEntryName());
pDBEntry->setEntrySize(pIMGEntry->getEntrySize());
pDBEntry->setEntryDataCRC(CString2::getCRC(pIMGEntry->getEntryData()));
pDBEntry->setEntryCreationDate(pIMGEntry->getFileCreationDate());
pDBEntry->setHasIssue(false);
pDBFile->addEntry(pDBEntry);
}
return pDBFile;
}
CDBFormat* CDBManager::createBlankDBFile(void)
{
CDBFormat *pDBFile = new CDBFormat;
pDBFile->setDBVersion(0x01);
return pDBFile;
}
bool CDBManager::compareDBFiles(CDBFormat *pDBFile1, CDBFormat *pDBFile2)
{
if (pDBFile1->getDBVersion() != pDBFile2->getDBVersion())
{
return false;
}
if (pDBFile1->getEntryCount() != pDBFile2->getEntryCount())
{
return false;
}
for (uint32 i = 0, j = pDBFile1->getEntryCount(); i < j; i++)
{
if (pDBFile1->getEntryByIndex(i)->doesHaveIssue() != pDBFile2->getEntryByIndex(i)->doesHaveIssue() ||
pDBFile1->getEntryByIndex(i)->getEntryName() != pDBFile2->getEntryByIndex(i)->getEntryName() ||
pDBFile1->getEntryByIndex(i)->getEntryDataCRC() != pDBFile2->getEntryByIndex(i)->getEntryDataCRC() ||
pDBFile1->getEntryByIndex(i)->getEntryCreationDate() != pDBFile2->getEntryByIndex(i)->getEntryCreationDate() ||
pDBFile1->getEntryByIndex(i)->getEntrySize() != pDBFile2->getEntryByIndex(i)->getEntrySize())
{
return false;
}
}
return true;
}
|
a916414ba6e9aed8e237f9e893ebbace8c560339
|
c40719298c41131a24ba0a31c0c0edad1ee37059
|
/src/ASTM/VirtualSpecification.cpp
|
ec203c355afdcf697606c59851f2978a7bd5c6f1
|
[] |
no_license
|
zitmen/bachelor-thesis--sw-metrics
|
3cb543ee09d1bd4f3ccf77df84e9a074e7feb0d5
|
8fc88b4d4de6a87974a179727d5204a0f3058798
|
refs/heads/master
| 2021-01-25T05:22:10.131182
| 2013-07-04T18:04:40
| 2013-07-04T18:04:40
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 312
|
cpp
|
VirtualSpecification.cpp
|
#include "NodeId.h"
#include "VirtualSpecification.h"
VirtualSpecification::VirtualSpecification()
{
//
}
VirtualSpecification::~VirtualSpecification()
{
//
}
void
VirtualSpecification::identify(std::vector<int> &id) const
{
id.push_back(NodeId::VIRTUAL_SPECIFICATION);
OtherSyntaxObject::identify(id);
}
|
b5a6b34a74f22b315e41f378af4800eb451b79a3
|
ecd574142155d4eefa7366db0035aedef589f622
|
/Source/FBoxModel.cpp
|
0bc76d58dba27b900a2a51a2e9b0029dd6cc6315
|
[] |
no_license
|
framefactory/trackme
|
b1cb6c3c4cb06749cc0eb4944ee56f03f6b488db
|
68187aee20612dca3d1e0dfc1b26d24b5f745e0c
|
refs/heads/master
| 2021-01-03T05:55:20.216752
| 2020-02-12T07:24:31
| 2020-02-12T07:24:31
| 239,951,215
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,633
|
cpp
|
FBoxModel.cpp
|
// ----------------------------------------------------------------------------------------------------
// Title FBoxModel.cpp
// Description Implementation of class FBoxModel
// ----------------------------------------------------------------------------------------------------
// $Author: ralphw $
// $Revision: 9 $
// $Date: 2011-08-30 20:28:52 +0200 (Di, 30 Aug 2011) $
// ----------------------------------------------------------------------------------------------------
#include "FTrackMeStable.h"
#include "FBoxModel.h"
#include "FMemoryTracer.h"
// ----------------------------------------------------------------------------------------------------
// Class FBoxModel
// ----------------------------------------------------------------------------------------------------
// Constructors and destructor ------------------------------------------------------------------------
FBoxModel::FBoxModel()
: m_size(1.0f, 1.0f, 1.0f)
{
}
FBoxModel::~FBoxModel()
{
}
// Public commands ------------------------------------------------------------------------------------
void FBoxModel::setSize(float width, float height, float depth)
{
m_size.set(width, height, depth);
}
// Overrides ------------------------------------------------------------------------------------------
void FBoxModel::onCreateSolidMesh(FGLMesh& solidMesh)
{
FMeshBox m_box;
m_box.setSize(m_size);
m_box.setPivot(m_size * 0.5f);
m_box.createMesh();
solidMesh.create(m_box);
}
void FBoxModel::onCreateEdges(edgeVec_t& edges)
{
float x0 = m_size.x() * -0.5f;
float y0 = m_size.y() * -0.5f;
float z0 = m_size.z() * -0.5f;
float x1 = -x0;
float y1 = -y0;
float z1 = -z0;
edges.push_back(edge_t(x0, y1, z0, x1, y1, z0));
edges.push_back(edge_t(x1, y1, z0, x1, y0, z0));
edges.push_back(edge_t(x1, y0, z0, x0, y0, z0));
edges.push_back(edge_t(x0, y0, z0, x0, y1, z0));
edges.push_back(edge_t(x0, y1, z1, x1, y1, z1));
edges.push_back(edge_t(x1, y1, z1, x1, y0, z1));
edges.push_back(edge_t(x1, y0, z1, x0, y0, z1));
edges.push_back(edge_t(x0, y0, z1, x0, y1, z1));
edges.push_back(edge_t(x0, y0, z0, x0, y0, z1));
edges.push_back(edge_t(x1, y0, z0, x1, y0, z1));
edges.push_back(edge_t(x1, y1, z0, x1, y1, z1));
edges.push_back(edge_t(x0, y1, z0, x0, y1, z1));
/*
for (size_t e = 0; e < edges.size(); e++)
{
edge_t& ed = edges[e];
F_TRACE(QString("#%1: %2 - %3")
.arg(e).arg(ed.modelPoint[0].toString()).arg(ed.modelPoint[1].toString()));
}
*/
}
void FBoxModel::onCreateFaces(faceVec_t& faces)
{
}
// ----------------------------------------------------------------------------------------------------
|
36f0c2d8af9b52da8367982291647506c34ba2a9
|
a243534aa5ab5490b94087fa5ad5513503db4a53
|
/Platformer 1/obj_treadmill_left.cpp
|
41acb77c2f363f3ab345a5c515387debb07da74e
|
[] |
no_license
|
Lijmer/platformer_1
|
1ecdd0cb67c2432148c042bb25bdb2913cbeeddc
|
bde7287e253316b1080f571ef341fc135228dc1a
|
refs/heads/master
| 2020-05-17T01:22:41.154110
| 2013-07-03T10:16:06
| 2013-07-03T10:16:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 804
|
cpp
|
obj_treadmill_left.cpp
|
#include "obj_treadmill_left.h"
obj_Treadmill_Left::obj_Treadmill_Left(void)
{
/* EASTEREGG
* .-"-.
* .'=^=^='.
* /=^=^=^=^=\
* :^= HAPPY =^;
* |^ EASTER! ^|
* :^=^=^=^=^=^:
* \=^=^=^=^=/
* `.=^=^=.'
* `~~~`
*/
SetID(TREADMILL_LEFT);
boundUp = 0;
boundDown = 32;
boundLeft = 0;
boundRight = 32;
image = ImageManager::GetInstance().GetImage(ImageManager::IMG_TREADMILL);
frameCount = 0;
currentFrame = 0;
}
obj_Treadmill_Left::~obj_Treadmill_Left(void)
{
}
void obj_Treadmill_Left::Update()
{
frameCount+=1;
if(frameCount > frameDelay)
{
currentFrame+=1;
frameCount = 0;
}
while(currentFrame > maxFrame)
currentFrame -= maxFrame + 1;
}
void obj_Treadmill_Left::Draw()
{
al_draw_bitmap_region(image, currentFrame*32, 0, 32, 32, x, y, 0);
}
|
19141149b43d4aa739bcedef68e56f3dbc50e3fd
|
a11a124d48a94acb42ee750d03108c37a8e0aabd
|
/Hospitalizado.h
|
2e9869e02634f1fe892c6de7d61b97be1d7861d8
|
[] |
no_license
|
naominietov/project-tc1030
|
be2df390361b165230344dd401ffd4c2187b41f0
|
3e3aaba764ac5ea7d7fe3cdf08d6175a4590cbe1
|
refs/heads/master
| 2022-11-01T14:45:32.753089
| 2020-06-05T15:12:38
| 2020-06-05T15:12:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 806
|
h
|
Hospitalizado.h
|
#ifndef HOSPITALIZADO_H
#define HOSPITALIZADO_H
#include <iostream>
#include "Paciente.h"
using namespace std;
// Clase hospitalizado que hereda de clase paciente
class Hospitalizado: public Paciente {
private:
int diasEstancia;
string fechaIngreso;
public:
// Declaración del constructor 1
Hospitalizado();
Hospitalizado(string nom, string ape, int dest, string fingreso);
//getters
int get_dest(){
return diasEstancia;
}
string get_fingreso(){
return fechaIngreso;
}
};
// Desarrollo del constructor 1
// Sobrecarga
Hospitalizado::Hospitalizado(){}
//Constructor 1
Hospitalizado::Hospitalizado(string nom, string ape, int dest,
string fingreso):Paciente(nom,ape){
diasEstancia = dest;
fechaIngreso = fingreso;
}
#endif //HOSPITALIZADO_H
|
64bbcd2f5c608ca415a7a0486c049165b0bf536d
|
0610ca2cac669b37ad6c40233439868a3e752ee0
|
/modules/control/chassis_component.h
|
6ace74aa474c3ee989221f8179c6a5ae7346c898
|
[
"MIT"
] |
permissive
|
mr-d-self-driving/geek-car
|
1300293de10dd256bb7ecf815b3c04a46c2ab16e
|
719620c8a1676565e18bc4f4420027385720dc3e
|
refs/heads/master
| 2022-11-30T07:22:43.636336
| 2020-08-18T10:33:55
| 2020-08-18T10:33:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,404
|
h
|
chassis_component.h
|
/******************************************************************************
* MIT License
* Copyright (c) 2019 Geekstyle
* 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 without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
#pragma once
#include <memory>
#include "cyber/class_loader/class_loader.h"
#include "cyber/component/component.h"
#include "modules/common/global_gflags.h"
#include "modules/common/uart.h"
#include "modules/control/proto/chassis.pb.h"
#include "modules/control/proto/control.pb.h"
namespace apollo {
namespace control {
using apollo::control::Chassis;
using apollo::control::Control_Command;
using apollo::cyber::Component;
using apollo::cyber::Reader;
using apollo::cyber::Writer;
class ChassisComponent : public Component<> {
public:
bool Init() override;
void Action();
void OnChassis();
~ChassisComponent();
private:
Uart arduino_ = Uart(FLAGS_arduino_device_name.c_str());
std::shared_ptr<Reader<Control_Command>> control_reader_ = nullptr;
std::shared_ptr<Writer<Chassis>> chassis_writer_ = nullptr;
Control_Command cmd_;
uint32_t message_wait_ = 200;
std::future<void> async_action_;
std::future<void> async_feedback_;
// atomic flag for action
std::atomic<bool> action_ready_ = {false};
};
CYBER_REGISTER_COMPONENT(ChassisComponent)
} // namespace control
} // namespace apollo
|
9ef53c146b97c7b142d492a040bce08ac1e14d93
|
7683210b686df4754753ccb2245173cd03d780a4
|
/1337 - The Crystal Maze/1337 - The Crystal Maze.cpp
|
2b863b47c80fa5c3abf4aa6c7e2e69cd8d9cf883
|
[] |
no_license
|
prachisen/LightOJ
|
758e5dd97291e56a762ab694ca5c77aec2d8096a
|
7b60625f75ded5c40c303381f98e36205d37c1c7
|
refs/heads/master
| 2023-02-21T11:23:19.542088
| 2021-01-10T13:28:46
| 2021-01-10T13:28:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,380
|
cpp
|
1337 - The Crystal Maze.cpp
|
#include <bits/stdc++.h>
using namespace std;
const int sz = 1005;
const int lim = 1e9 + 1;
const int inf = 1 << 20;
int t, n, m, q, cs;
int vis[505][505];
int ans[505 * 505];
char s[505][505];
void dfs( int x, int y, int c ) {
if( x < 0 || y < 0 || x >= n || y >= m || vis[x][y] || s[x][y] == '#' ) return;
vis[x][y] = c;
ans[c] += s[x][y] == 'C';
dfs( x + 1, y, c );
dfs( x - 1, y, c );
dfs( x, y + 1, c );
dfs( x, y - 1, c );
}
int main() {
#ifdef CLown1331
freopen("in.txt","r",stdin);
#endif /// CLown1331
scanf( "%d", &t );
for( cs=1; cs<=t; cs++ ) {
scanf( "%d %d %d", &n, &m, &q );
for( int i=0; i<n; i++ ) scanf( "%s", s[i] );
memset( vis, 0, sizeof vis );
memset( ans, 0, sizeof ans );
for( int i=0,c=0; i<n; i++ ) {
for( int j=0; j<m; j++ ) {
if( s[i][j] != '#' && vis[i][j] == 0 ) dfs( i, j, ++c );
}
}
printf( "Case %d:\n", cs );
while( q-- ) {
int x, y;
scanf( "%d %d", &x, &y );
printf( "%d\n", ans[ vis[x - 1][y - 1] ] );
}
}
return 0;
}
|
1c722903a3956894a28ceaf31a36731df1f35cb7
|
ff541b27056578207cb99a286c4fb9c7a0c59577
|
/First term/Лабораторная работа № 2/Двоичные вектора/Vectors.cpp
|
7162cf0363e6e27c664c6965f5ad7f639638b9f7
|
[] |
no_license
|
MaximSlyusarenko/Discrete-math-lab
|
dcd398de4841807bc09429f5ae9229f382437fda
|
2e84ae2c0d501387e11a766081b6313558f72031
|
refs/heads/master
| 2021-01-17T13:11:52.779642
| 2016-06-18T15:15:59
| 2016-06-18T15:15:59
| 29,737,849
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 601
|
cpp
|
Vectors.cpp
|
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
string s;
int n;
vector <string> a;
void gen(string s)
{
if (s.size() == n)
a.push_back(s);
else
{
string s1 = s + "0";
gen(s1);
if (s[s.size() - 1] != '1')
{
string s2 = s + "1";
gen(s2);
}
}
}
int main()
{
freopen ("vectors.in", "r", stdin);
freopen ("vectors.out", "w", stdout);
cin >> n;
s = "";
gen(s);
cout << a.size() << endl;
for (int i = 0; i < a.size(); i++)
cout << a[i] << endl;
return 0;
}
|
ab5dfe4865f5634234cd78b0071cd6e57040d768
|
b9264aa2552272b19ca393ba818f9dcb8d91da10
|
/hashmap/lib/seqan3/test/performance/range/gap_decorator_seq_write_benchmark.cpp
|
2e8b1a6eb00d6a7ab16d7c89d677c2661787f4d8
|
[
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain",
"CC0-1.0",
"CC-BY-4.0",
"MIT"
] |
permissive
|
eaasna/low-memory-prefilter
|
c29b3aeb76f70afc4f26da3d9f063b0bc2e251e0
|
efa20dc8a95ce688d2a9d08773d120dff4cccbb6
|
refs/heads/master
| 2023-07-04T16:45:05.817237
| 2021-08-12T12:01:11
| 2021-08-12T12:01:11
| 383,427,746
| 0
| 0
|
BSD-3-Clause
| 2021-07-06T13:24:31
| 2021-07-06T10:22:54
|
C++
|
UTF-8
|
C++
| false
| false
| 5,268
|
cpp
|
gap_decorator_seq_write_benchmark.cpp
|
// -----------------------------------------------------------------------------------------------------
// Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
// Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
// -----------------------------------------------------------------------------------------------------
#include <chrono>
#include <cmath>
#include <cstring>
#include <random>
#include <utility>
#include <benchmark/benchmark.h>
#include <seqan3/alignment/aligned_sequence/aligned_sequence_concept.hpp>
#include <seqan3/alignment/exception.hpp>
#include <seqan3/alphabet/all.hpp>
#include <seqan3/range/decorator/all.hpp>
#include <seqan3/std/ranges>
#include "gap_decorator_helper.hpp"
using seqan3::operator""_dna4;
using gap_sequence_gap_decorator = seqan3::gap_decorator<const std::vector<seqan3::dna4> &>;
using gap_sequence_vector = std::vector<seqan3::gapped<seqan3::dna4>>;
// ============================================================================
// insert left to right
// ============================================================================
template <typename gap_decorator_t, bool gapped_flag>
void insert_left2right(benchmark::State & state)
{
unsigned int seq_len = state.range(0);
using size_type = typename gap_decorator_t::size_type;
using sequence_type = std::remove_cvref_t<seqan3::detail::unaligned_seq_t<gap_decorator_t>>;
sequence_type seq(seq_len, 'A'_dna4);
// vector of sampled gap lengths for each position
std::vector<size_type> gaps(seq_len, 0);
// determine sum of gaps and non-gap symbols for not exceeding targeted sequence length
if (gapped_flag)
{
sample<size_type>(gaps, seq_len, state.range(1)/100.0);
resize<size_type, sequence_type>(gaps, seq, seq_len);
}
// initialize with (truncated) sequence and insert gaps from left to right
gap_decorator_t gap_decorator;
assign_unaligned(gap_decorator, seq);
// insert gaps before starting benchmark
if (gapped_flag)
insert_gaps<gap_decorator_t>(gaps, gap_decorator, seq_len);
auto it = std::ranges::begin(gap_decorator);
for (auto _ : state)
{
if (it == std::ranges::end(gap_decorator) || it == (--std::ranges::end(gap_decorator)))
it = std::ranges::begin(gap_decorator);
it = insert_gap(gap_decorator, it, 1);
++++it;
}
}
// Insert gaps of length 1 from left to right into UNGAPPED sequence
BENCHMARK_TEMPLATE(insert_left2right, gap_sequence_gap_decorator, false)->Apply(custom_arguments);
BENCHMARK_TEMPLATE(insert_left2right, gap_sequence_vector, false)->Apply(custom_arguments);
// Insert gaps of length 1 from left to right into GAPPED sequence
BENCHMARK_TEMPLATE(insert_left2right, gap_sequence_gap_decorator, true)->Apply(custom_arguments);
BENCHMARK_TEMPLATE(insert_left2right, gap_sequence_vector, true)->Apply(custom_arguments);
// ============================================================================
// insert right to left
// ============================================================================
template <typename gap_decorator_t, bool gapped_flag>
void insert_right2left(benchmark::State & state)
{
unsigned int seq_len = state.range(0);
assert(seq_len > 0);
using size_type = typename gap_decorator_t::size_type;
using sequence_type = std::remove_cvref_t<seqan3::detail::unaligned_seq_t<gap_decorator_t>>;
sequence_type seq(seq_len, 'A'_dna4);
// vector of sample<size_type>d gap lengths for each position
std::vector<size_type> gaps(seq_len, 0);
// determine sum of gaps and non-gap symbols for not exceeding targeted sequence length
if constexpr(gapped_flag)
{
sample<size_type>(gaps, seq_len, state.range(1)/100.0);
resize<size_type, sequence_type>(gaps, seq, seq_len);
}
// initialize with (truncated) sequence and insert gaps from left to right
gap_decorator_t gap_decorator;
assign_unaligned(gap_decorator, seq);
// insert gaps before starting benchmark
if constexpr(gapped_flag)
insert_gaps<gap_decorator_t>(gaps, gap_decorator, seq_len);
// end() != begin() due to assert above on sequence length
auto it = std::ranges::end(gap_decorator);
for (auto _ : state)
{
it = insert_gap(gap_decorator, it, 1);
state.PauseTiming();
if (it == std::ranges::begin(gap_decorator))
it = std::ranges::end(gap_decorator);
--it;
state.ResumeTiming();
}
}
// Insert gaps of length 1 from left to right into UNGAPPED sequence
BENCHMARK_TEMPLATE(insert_right2left, gap_sequence_gap_decorator, false)->Apply(custom_arguments);
BENCHMARK_TEMPLATE(insert_right2left, gap_sequence_vector, false)->Apply(custom_arguments);
// Insert gaps of length 1 from left to right into GAPPED sequence
BENCHMARK_TEMPLATE(insert_right2left, gap_sequence_gap_decorator, true)->Apply(custom_arguments);
BENCHMARK_TEMPLATE(insert_right2left, gap_sequence_vector, true)->Apply(custom_arguments);
BENCHMARK_MAIN();
|
c2db8ca0fc03a5a4e559fbd4821c773c281ef2b9
|
42adcf7fee2ea59ae403fcf05239923de4ad2936
|
/chef_and_mean.cpp
|
faaa66ad817bef6cb500f34e995c9c116f8b72b1
|
[] |
no_license
|
Kushagrakmr/code_nuts
|
0ab16b57103d7008a0699f5f28026fafca7d42d0
|
a003ce286d615ec66932247846de78459bfdb768
|
refs/heads/master
| 2020-07-10T18:42:12.305832
| 2019-09-15T21:16:13
| 2019-09-15T21:16:13
| 204,338,136
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 633
|
cpp
|
chef_and_mean.cpp
|
#include<iostream>
using namespace std;
int main() {
long long T,no_of_coins;
long long int arr[200000000],i;
long double sum_of_coins=0, avg;
cin>>T;
while(T--) {
cin>>no_of_coins;
double mean;
sum_of_coins = 0;
for(i=0; i<no_of_coins; i++) {
cin>>arr[i];
sum_of_coins += arr[i];
}
avg = sum_of_coins/no_of_coins;
int flag=0;
for(i=0; i<no_of_coins; i++) {
mean = (sum_of_coins-arr[i])/(no_of_coins-1);
if(mean == avg) {
flag = 1;
cout<<i+1<<endl;
break;
}
}
if(flag == 0)
cout<<"Impossible\n";
}
return 0;
}
|
450af13eb04770623c4f074d1f6aa4e014878807
|
209bd94caa54ad6aeb9f6f208199608da8eeeb58
|
/src/utils.cpp
|
4f987cbf1692d039d6ed365d237733df87334811
|
[
"Apache-2.0"
] |
permissive
|
PuceBaboon/ESP_Zork
|
d966915e3eeaa85565ba55011170d7418fcb1def
|
6eb26cac03f112b9c7cd1c28013a4784d1308017
|
refs/heads/master
| 2021-01-19T10:26:47.419698
| 2018-02-18T00:33:54
| 2018-02-18T00:33:54
| 87,866,958
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 616
|
cpp
|
utils.cpp
|
/*
* $Id: utils.cpp,v 1.1 2017/04/04 09:03:28 gaijin Exp $
*
*/
#include "utils.h"
/*
* Add a "yield()" into non-critical delay loops to
* give the ESP some time for housekeeping operations
* (just use the normal, unmodified delay() call when
* you have very specific timing requirements).
*/
void Ydelay(ulong dcount) {
yield();
delay(dcount);
}
/* Convert MAC address to usable string. */
String macToStr(const uint8_t * mac) {
String result;
for (int i = 0; i < 6; ++i) {
result += String(mac[i], 16);
if (i < 5)
result += ':';
}
return result;
}
|
65d6bc734c316c5dca1b7f1fe2fa7f9934c3835b
|
a5f79579e599af8fbeadc7d4f8d8f20a2de06403
|
/java/jni/JniTest.cpp
|
6d8f341777e71d8ad7c0f2fe3019e88b3a44013c
|
[] |
no_license
|
zll5267/save-daily-exercise
|
a0c3cfcb41f1bcee1d5041aab7ad4593a424259e
|
795710c325700ea44b931c4da13b7205b5206f20
|
refs/heads/master
| 2021-06-28T13:16:15.866235
| 2020-11-29T15:45:06
| 2020-11-29T15:45:06
| 5,635,788
| 0
| 0
| null | 2020-11-29T15:45:07
| 2012-09-01T01:07:22
|
Jupyter Notebook
|
UTF-8
|
C++
| false
| false
| 1,021
|
cpp
|
JniTest.cpp
|
#include "JniTest.h"
#include <iostream>
JNIEXPORT void JNICALL Java_JniTest_native_1helloworld
(JNIEnv *, jclass)
{
std::cout << "native Hello World" << std::endl;
}
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
JNIEnv* env = NULL;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
std::cout << "GetEnv failed" << std::endl;
return JNI_ERR;
}
const char* kClassName = "JniTest";
char* nativeName = (char*)"native_helloworld";
char* signature = (char*)"()V";
const JNINativeMethod kJniMethods[] = {
{ nativeName, signature,
reinterpret_cast<void*>(Java_JniTest_native_1helloworld) },
};
jclass clazz = env->FindClass(kClassName);
if (!clazz) {
std::cout << "Find class:" << kClassName << " failed" << std::endl;
return JNI_ERR;
}
env->RegisterNatives(clazz, kJniMethods, 1);//NELEM(kJniMethods));
std::cout << "JNI_OnLoad OK" << std::endl;
return JNI_VERSION_1_6;
}
|
c6a01fc149ba8368ffd266a368ad4dbdcd144b8f
|
19164bf117ecb486c94311cb8b2936309b363514
|
/Leetcode/Shortest_distance_to_a_character.cpp
|
a54336d0fd22782363900d14cf6b11330c7310b1
|
[] |
no_license
|
geekyanurag/Coding-Interview-Preparation
|
10a3b5d9c2a9b71483846c0f51751cef24baa2e4
|
24f11e8ddc9c7c573aa961a9ebb3afd16234a27b
|
refs/heads/master
| 2021-05-25T13:01:20.680206
| 2021-04-27T06:41:28
| 2021-04-27T06:41:28
| 253,764,719
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 643
|
cpp
|
Shortest_distance_to_a_character.cpp
|
class Solution {
public:
vector<int> shortestToChar(string S, char C) {
vector<int>res(S.length());
int z = count(S.begin(), S.end(), C);
vector<int>ch(z);
int a = 0;
for(int i =0; i<S.length(); i++){
if(S[i] == C){
ch[a] = i;
a++;
}
}
for(int i : ch)
cout<<i<<" ";
for(int i =0; i<S.length(); i++){
int minm = INT_MAX;
for(int j = 0; j<ch.size(); j++){
minm = min(abs(ch[j] - i), minm);
}
res[i] = minm;
}
return res;
}
};
|
2146330cfde84d4d9134c5f908caea842c66a43a
|
0cd8bbc974b822c46b64712d3be53e9808a5c246
|
/10420.cpp
|
009017449dc041ed567b0b49c9eb12fd89bc791e
|
[] |
no_license
|
limon2009/ACM-UVA-Online-Judge-solution
|
b78e8f709c88e5db6fdac83a7bd5ec71f7ab00b0
|
0f86718d3c609e654a3c16a29e0f91620ac40cd1
|
refs/heads/master
| 2021-08-11T04:58:42.829356
| 2017-11-13T06:14:09
| 2017-11-13T06:14:09
| 110,505,263
| 1
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 612
|
cpp
|
10420.cpp
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char name[2009][80];
int n;
int sort_function(const void *a,const void *s)
{
return ( strcmp( (char *)a, (char *)s ) );
}
int count() {
int i,c;
char inter[80];
qsort((void *)name,n,sizeof(name[0]),sort_function);
for(i = 0; i<n; ) {
c = 1;
strcpy(inter,name[i]);
for(i ++; !strcmp(inter,name[i]) && i<n; i ++) c ++;
printf("%s %d\n",inter,c);
}
return 0;
}
int main(void ) {
char mid[100];
int i;
scanf("%d",&n);
for(i = 0; i<n; i ++){
scanf("%s",name[i]);
gets(mid);
}
count();
return 0;
}
|
44f2a484ceb95647d335740407fad47ba0494790
|
9b3c9c46a50986df99ec92edd312088f0738d6cf
|
/common/rtmp_broadcaster.cpp
|
8d208334624add6a0a69f6b599db62d13382ff3b
|
[
"MIT"
] |
permissive
|
nathanjahnke/norichan
|
504b121ba01ded35a7c7e421dd75e4abf5c0098a
|
af3b434b7606e8e3e4a7a62520ac2eb9bd36d1b5
|
refs/heads/master
| 2020-12-25T14:13:44.509098
| 2016-08-20T21:25:19
| 2016-08-20T21:25:19
| 66,168,289
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 30,951
|
cpp
|
rtmp_broadcaster.cpp
|
#include "rtmp_broadcaster.h"
RTMP_Broadcaster::RTMP_Broadcaster(QObject *parent) :
QObject(parent)
,mutex(NULL)
,sws_ctx(NULL)
,currently_streaming(false)
,broadcast_timer(this)
,input_avpicture(NULL)
,output_avframe(NULL)
,audio_frame(NULL)
,input_pixel_format(AV_PIX_FMT_BGRA)
,output_pixel_format(AV_PIX_FMT_YUV420P)
{
av_register_all();
avformat_network_init();
connect(&broadcast_timer, SIGNAL(timeout()), this, SLOT(broadcast()));
}
RTMP_Broadcaster::~RTMP_Broadcaster() {
clean_up_ffmpeg_crap();
}
/*
* Copyright (c) 2003 Fabrice Bellard
*
* 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 without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @file
* libavformat API example.
*
* Output a media file in any supported libavformat format.
* The default codecs are used.
* @example doc/examples/muxing.c
*/
/* Add an output stream. */
AVStream *RTMP_Broadcaster::add_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id) {
AVCodecContext *c;
AVStream *st;
/* find the encoder */
*codec = avcodec_find_encoder(codec_id);
if (!(*codec)) {
emit error_with_string(tr("Could not find encoder for '%1'").arg(avcodec_get_name(codec_id)));
return NULL;
}
st = avformat_new_stream(oc, *codec);
if (!st) {
emit error_with_string(tr("Could not allocate stream"));
return NULL;
}
st->id = oc->nb_streams-1;
c = st->codec;
switch ((*codec)->type) {
case AVMEDIA_TYPE_AUDIO:
st->id = 1;
c->sample_fmt = AV_SAMPLE_FMT_S16P;
c->bit_rate = audio_bitrate_kbit * 1000;
c->sample_rate = audio_sample_rate_bits;
c->channels = audio_number_of_channels;
c->channel_layout = c->channels == 2 ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
break;
case AVMEDIA_TYPE_VIDEO:
avcodec_get_context_defaults3(c, *codec);
c->codec_id = codec_id;
c->bit_rate = video_bitrate_kbit * 1000;
// c->rc_max_rate = 1024000;
// c->rc_buffer_size = 10 * 1000 * 1000;
c->width = video_width;
c->height = video_height;
c->time_base.num = 1000;
c->time_base.den = (int)(video_framerate * 1000.0);
video_frame_time_ms = ((double)c->time_base.num / (double)c->time_base.den) * 1000.0;
c->gop_size = 60; /* emit one intra frame every 60 frames at most */
c->pix_fmt = output_pixel_format;
c->thread_count = 0;
break;
default:
break;
}
/* Some formats want stream headers to be separate. */
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
return st;
}
/**************************************************************/
/* audio output */
void RTMP_Broadcaster::open_audio(AVFormatContext *oc, AVCodec *codec, AVStream *st) {
Q_UNUSED(oc);
AVCodecContext *c;
int ret;
c = st->codec;
/* open it */
if (mutex) mutex->lock();
ret = avcodec_open2(c, codec, NULL);
if (mutex) mutex->unlock();
if (ret < 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Could not open audio codec: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return;
}
if (c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)
audio_samples_per_channel = 10000;
else
audio_samples_per_channel = c->frame_size;
audio_frame_size = audio_samples_per_channel * av_get_bytes_per_sample(c->sample_fmt) * c->channels;
// if (!av_sample_fmt_is_planar(c->sample_fmt)) { //FIXME is this necessary? (20130311)
// qDebug() << "audio_frame_size *= c->channels";
// audio_frame_size *=;
// }
samples = (int16_t *)av_malloc(audio_frame_size);
if (!samples) {
emit error_with_string(tr("Could not allocate audio samples buffer"));
return;
}
audio_frame = avcodec_alloc_frame();
audio_frame->nb_samples = audio_samples_per_channel;
avcodec_fill_audio_frame(audio_frame, c->channels, c->sample_fmt,
(uint8_t *)samples,
audio_frame_size, 1);
// audio_frame->pts = 0;
}
/* Prepare a 16 bit dummy audio frame of 'frame_size' samples and
* 'nb_channels' channels. */
//void RTMP_Broadcaster::get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
//{
// int j, i, v;
// int16_t *q;
// q = samples;
// for (j = 0; j < frame_size; j++) {
// v = (int)(sin(t) * 10000);
// for (i = 0; i < nb_channels; i++)
// *q++ = v;
// t += tincr;
// tincr += tincr2;
// }
//}
void RTMP_Broadcaster::write_audio_frame(AVFormatContext *oc, AVStream *st) {
AVCodecContext *c = st->codec;
if (audio_data.size() < audio_frame_size) {
qDebug() << this << "audio underflow!";
return;
}
uint16_t *in = (uint16_t *)audio_data.data();
// QByteArray planar_temp;
// planar_temp.resize(audio_frame_size);
// uint16_t *out = (uint16_t *)planar_temp.data();
// memcpy(samples, planar_temp.data(), audio_frame_size);
//
// QFile lol("/down/lol");
// lol.open(QIODevice::WriteOnly | QIODevice::Append);
// lol.write((char *)samples, audio_frame_size);
// lol.close();
//
//would you look at this here hack
uint16_t *left_channel = (uint16_t *)audio_frame->extended_data[0];
uint16_t *right_channel = (uint16_t *)audio_frame->extended_data[1];
int top = audio_frame_size/2/2;
for (int i = 0; i < top; ++i, in += 2) {
left_channel[i] = in[0];
right_channel[i] = in[1];
}
audio_data = audio_data.mid(audio_frame_size);
int got_packet, ret;
AVPacket pkt;
av_init_packet(&pkt);
pkt.size = 0;
pkt.data = 0;
// get_audio_frame(samples, audio_input_frame_size, c->channels);
// audio_frame->pts = audio_timestamp;
ret = avcodec_encode_audio2(c, &pkt, audio_frame, &got_packet);
if (ret < 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Error encoding audio frame: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return;
}
if (!got_packet) {
// qDebug() << "audio: !got_packet";
return;
}
pkt.stream_index = st->index;
/* Write the compressed frame to the media file. */
ret = av_interleaved_write_frame(oc, &pkt);
// qDebug() << "wrote an audio frame";
if (ret != 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Error while writing audio frame: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return emergency_restart();
}
++audio_frames_encoded;
}
void RTMP_Broadcaster::close_audio(AVFormatContext *oc, AVStream *st) {
Q_UNUSED(oc);
if (mutex) mutex->lock();
avcodec_close(st->codec);
if (mutex) mutex->unlock();
av_free(samples);
}
/**************************************************************/
/* video output */
void RTMP_Broadcaster::open_video(AVFormatContext *oc, AVCodec *codec, AVStream *st) {
Q_UNUSED(oc);
int ret;
AVCodecContext *c = st->codec;
AVDictionary *opts = NULL;
QByteArray video_preset_ba = video_preset.toLocal8Bit();
const char *video_preset_pointer = video_preset_ba.constData();
av_dict_set(&opts, "preset", video_preset_pointer, 0); //this automatically sets the profile (20130313)
av_dict_set(&opts, "tune", "zerolatency", 0);
/* open the codec */
if (mutex) mutex->lock();
ret = avcodec_open2(c, codec, &opts);
if (mutex) mutex->unlock();
if (ret < 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Could not open video codec: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return;
}
// /* allocate and init a re-usable frame */
// frame = avcodec_alloc_frame();
// if (!frame) {
// emit error_with_string(tr("Could not allocate video frame"));
// return;
// }
// /* Allocate the encoded raw picture. */
// ret = avpicture_alloc(&dst_picture, c->pix_fmt, c->width, c->height);
// if (ret < 0) {
// emit error_with_string(tr("Could not allocate picture: %1").arg(av_err2str(ret)));
// return;
// }
// /* If the output format is not YUV420P, then a temporary YUV420P
// * picture is needed too. It is then converted to the required
// * output format. */
// if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
// qDebug() << "avpicture_alloc" << c->width << c->height;
// ret = avpicture_alloc(&src_picture, AV_PIX_FMT_RGB24, c->width, c->height);
// if (ret < 0) {
// emit error_with_string(tr("Could not allocate temporary picture: %1").arg(av_err2str(ret)));
// return;
// }
// }
// /* copy data and linesize picture pointers to frame */
// *((AVPicture *)frame) = dst_picture;
}
/* Prepare a dummy image. */
//static void fill_yuv_image(AVPicture *pict, int frame_index,
// int width, int height)
//{
// int x, y, i;
// i = frame_index;
// /* Y */
// for (y = 0; y < height; y++)
// for (x = 0; x < width; x++)
// pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3;
// /* Cb and Cr */
// for (y = 0; y < height / 2; y++) {
// for (x = 0; x < width / 2; x++) {
// pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2;
// pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5;
// }
// }
//}
void RTMP_Broadcaster::write_video_frame(AVFormatContext *oc, AVStream *st) {
if (!video_frames.size()) {
qDebug() << this << "video underflow!";
return;
}
int ret;
AVCodecContext *c = st->codec;
// if (frame_count >= STREAM_NB_FRAMES) {
// /* No more frames to compress. The codec has a latency of a few
// * frames if using B-frames, so we get the last frames by
// * passing the same picture again. */
// } else {
// if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
/* as we only generate a YUV420P picture, we must convert it
* to the codec pixel format if needed */
QImage input_frame = video_frames.takeFirst();
//input_frame = input_frame.convertToFormat(QImage::Format_RGB888);
// qDebug() << "memcpy:" << src_picture.linesize[0] << input_frame.byteCount();
memcpy(input_avpicture->data[0], input_frame.bits(), input_frame.byteCount());
sws_scale(sws_ctx,
input_avpicture->data, input_avpicture->linesize, 0, input_frame.height(),
output_avframe->data, output_avframe->linesize);
// sws_scale(sws_ctx,
// (const uint8_t * const *)src_picture.data, src_picture.linesize,
// 0, c->height, dst_picture.data, dst_picture.linesize);
// } else {
// fill_yuv_image(&dst_picture, frame_count, c->width, c->height);
// }
// }
// if (oc->oformat->flags & AVFMT_RAWPICTURE) {
// /* Raw video case - directly store the picture in the packet */
// AVPacket pkt;
// av_init_packet(&pkt);
// pkt.flags |= AV_PKT_FLAG_KEY;
// pkt.stream_index = st->index;
// pkt.data = dst_picture.data[0];
// pkt.size = sizeof(AVPicture);
// ret = av_interleaved_write_frame(oc, &pkt);
// } else {
/* encode the image */
AVPacket pkt;
int got_output;
av_init_packet(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
// output_avframe->pts = video_timestamp;
// video_timestamp += av_rescale_q(1, video_st->codec->time_base, video_st->time_base);
ret = avcodec_encode_video2(c, &pkt, output_avframe, &got_output);
if (ret < 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Error encoding video frame: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return;
}
/* If size is zero, it means the image was buffered. */
if (got_output) {
if (c->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index = st->index;
/* Write the compressed frame to the media file. */
ret = av_interleaved_write_frame(oc, &pkt);
// qDebug() << "wrote a video frame";
} else {
ret = 0;
}
// }
if (ret != 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Error while writing video frame: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return emergency_restart();
}
++video_frames_encoded;
}
void RTMP_Broadcaster::close_video(AVFormatContext *oc, AVStream *st) {
Q_UNUSED(oc);
if (mutex) mutex->lock();
avcodec_close(st->codec);
if (mutex) mutex->unlock();
// av_free(src_picture.data[0]);
// av_free(dst_picture.data[0]);
// av_free(frame);
}
/**************************************************************/
/* media file output */
void RTMP_Broadcaster::start(QString url, int width, int height, double framerate, QString preset, int new_video_bitrate_kbit, int new_audio_bitrate_kbit, int new_audio_sample_rate_bits, int new_audio_number_of_channels) {
if (currently_streaming) return;
current_url = url;
video_width = width;
video_height = height;
video_framerate = framerate;
video_preset = preset;
video_bitrate_kbit = new_video_bitrate_kbit;
audio_bitrate_kbit = new_audio_bitrate_kbit;
audio_sample_rate_bits = new_audio_sample_rate_bits;
audio_number_of_channels = new_audio_number_of_channels;
video_frames.clear();
audio_data.clear();
sws_flags = SWS_LANCZOS;
filename_ba = url.toLocal8Bit();
filename = filename_ba.constData();
/* allocate the output media context */
// avformat_alloc_output_context2(&oc, NULL, NULL, filename);
// if (!oc) {
//printf("Could not deduce output format from file extension: using FLV.\n");
avformat_alloc_output_context2(&oc, NULL, "flv", filename);
// }
// if (!oc) {
Q_ASSERT(oc);
// }
fmt = oc->oformat;
/* Add the audio and video streams using the default format codecs
* and initialize the codecs. */
video_st = NULL;
audio_st = NULL;
if (fmt->video_codec != AV_CODEC_ID_NONE) {
fmt->video_codec = AV_CODEC_ID_H264;
video_st = add_stream(oc, &video_codec, fmt->video_codec);
}
if (fmt->audio_codec != AV_CODEC_ID_NONE) {
fmt->audio_codec = AV_CODEC_ID_MP3;
audio_st = add_stream(oc, &audio_codec, fmt->audio_codec);
}
/* Now that all the parameters are set, we can open the audio and
* video codecs and allocate the necessary encode buffers. */
if (video_st)
open_video(oc, video_codec, video_st);
if (audio_st)
open_audio(oc, audio_codec, audio_st);
av_dump_format(oc, 0, filename, 1);
/* open the output file, if needed */
if (!(fmt->flags & AVFMT_NOFILE)) {
int ret = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE);
if (ret < 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Could not open: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return;
}
}
/* Write the stream header, if any. */
int ret = avformat_write_header(oc, NULL);
if (ret < 0) {
char ffmpeg_error_p[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(ffmpeg_error_p, AV_ERROR_MAX_STRING_SIZE, ret);
QString error_string = tr("Error occurred when opening output file: %1").arg(ffmpeg_error_p);
emit error_with_string(error_string);
return;
}
sws_ctx = sws_getContext(video_width, video_height, input_pixel_format,
video_width, video_height, output_pixel_format,
sws_flags, NULL, NULL, NULL);
if (!sws_ctx) {
emit error_with_string(tr("Could not initialize the conversion context"));
return;
}
//fill_yuv_image(&src_picture, frame_count, c->width, c->height);
input_avpicture = (AVPicture *)av_malloc(sizeof(AVPicture));
avpicture_alloc(input_avpicture, input_pixel_format, video_width, video_height);
//input_length = avpicture_get_size(PIX_FMT_RGB24, video_width, video_height);
output_avframe = avcodec_alloc_frame();
avpicture_alloc(&dst_picture, output_pixel_format, video_width, video_height);
/* copy data and linesize picture pointers to frame */
*((AVPicture *)output_avframe) = dst_picture;
// output_avframe->pts = 0;
// video_frames_added = audio_frames_added = 0;
audio_frames_encoded = video_frames_encoded = 0;
session_timer.start();
broadcast_timer.setInterval((1.0 / video_framerate) * 1000.0);
broadcast_timer.start();
currently_streaming = true;
}
void RTMP_Broadcaster::add_video_frame(QImage frame) {
// qDebug() << "add_video_frame():" << frame.size();
if (!currently_streaming) return;
Q_ASSERT(frame.width() == video_width);
Q_ASSERT(frame.height() == video_height);
// qDebug() << "add_video_frame()";
// double elapsed = session_timer.elapsed();
// if (video_frames_added * video_frame_time_ms < elapsed + video_frame_time_ms*5) {
// qDebug() << "video_frames << frame";
video_frames << frame;
// ++video_frames_added;
// }
// while (video_frames_added * video_frame_time_ms < elapsed) {
// qDebug() << "catching up video";
// video_frames << frame;
// ++video_frames_added;
// }
// qDebug() << "V" << (video_frames_added * video_frame_time_ms) - elapsed;
// last_video_jitter = (video_frames_added * video_frame_time_ms) - elapsed;
}
void RTMP_Broadcaster::add_audio_data(QByteArray data) {
if (!currently_streaming) return;
//qDebug() << "add_audio_data()";
// double audio_frame_time_ms = ((double)data.size()/2/2/44100)*1000.0;
//qDebug() << "audio_frame_time_ms" << audio_frame_time_ms;
// double elapsed = session_timer.elapsed();
// if (audio_frames_added * audio_frame_time_ms < elapsed + audio_frame_time_ms*5) {
//qDebug() << "audio_data.append(data)";
audio_data.append(data);
// ++audio_frames_added;
// }// else qDebug() << "rejecting audio frame";
// while (audio_frames_added * audio_frame_time_ms < elapsed - audio_frame_time_ms*5) {
// qDebug() << "catching up audio";
// //qDebug() << "audio_data.append(data)";
// audio_data.append(data);
// ++audio_frames_added;
// }// else qDebug() << "rejecting audio frame";
// qDebug() << "A" << (audio_frames_added * audio_frame_time_ms) - elapsed;
// last_audio_jitter = (audio_frames_added * audio_frame_time_ms) - elapsed;
}
void RTMP_Broadcaster::broadcast() {
if (!currently_streaming) return;
// static QList<double> jitter_list;
// jitter_list << last_video_jitter - last_audio_jitter;
// while (jitter_list.size() > 30) jitter_list.pop_front();
// double jitter_sum = 0;
// foreach (double jitter, jitter_list) {
// jitter_sum += jitter;
// }
// qDebug() << "avg" << jitter_sum / jitter_list.size() << "diff" << last_video_jitter - last_audio_jitter << "A" << last_audio_jitter << "V" << last_video_jitter;
// qDebug() << "broadcast()";
// while (video_frames.size() && audio_data.size() >= audio_frame_size) {
// qDebug() << video_frames.size() << audio_data.size() << audio_frame_size << "output_avframe->pts" << output_avframe->pts << "video_pts" << video_pts << "audio_pts" << audio_pts;
// /* Compute current audio and video time. */
// if (audio_st)
// audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
// else
// audio_pts = 0.0;
// if (video_st)
// video_pts = (double)video_st->pts.val * video_st->time_base.num /
// video_st->time_base.den;
// else
// video_pts = 0.0;
// // if ((!audio_st || audio_pts >= STREAM_DURATION) &&
// // (!video_st || video_pts >= STREAM_DURATION))
// // break;
// /* write interleaved audio and video frames */
//// if (!video_st || (video_st && audio_st && audio_pts < video_pts)) {
// audio_timestamp = video_timestamp = session_timer.elapsed();
while (audio_data.size() >= audio_frame_size && video_frames.size()) {
// audio_frame->pts += av_rescale_q(1 * audio_st->codec->frame_size, audio_st->codec->time_base, audio_st->time_base); //codec timebase is 1/sample rate (20130314)
double video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
//qDebug() << "video_st->pts.val is" << video_st->pts.val;
double audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
//qDebug() << audio_pts << video_pts << " " << audio_data.size() << video_frames.size();
if (audio_pts < video_pts) {
//qint64 old_pts = audio_st->pts.val;
write_audio_frame(oc, audio_st);
//qDebug() << "audio pts increased by" << audio_st->pts.val - old_pts;
}
//continue; //encode more audio if possible, otherwise wait until possible
// while (audio_data.size() >= audio_frame_size) {
// write_audio_frame(oc, audio_st);
// audio_frame->pts += av_rescale_q(1 * audio_st->codec->frame_size, audio_st->codec->time_base, audio_st->time_base); //codec timebase is 1/sample rate (20130314)
//// qDebug() << audio_st->codec->time_base.num << audio_st->codec->time_base.den << audio_st->time_base.num << audio_st->time_base.den;
// }
// while (video_frames.size()) {
else
write_video_frame(oc, video_st);
// qDebug() << "adding" << av_rescale_q(1, video_st->codec->time_base, video_st->time_base) << "to output_avframe->pts ... ";
// output_avframe->pts += av_rescale_q(1, video_st->codec->time_base, video_st->time_base);
// qDebug() << video_st->codec->time_base.num << video_st->codec->time_base.den << video_st->time_base.num << video_st->time_base.den;
// qDebug() << "now output_avframe->pts is" << output_avframe->pts;
// }
// int audio_data_max_bulge = audio_frame_size*2;
// if (audio_data.size() > audio_data_max_bulge) {
// audio_data = audio_data.mid(audio_data_max_bulge);
// }
// int video_frames_max_bulge = 2;
// while (video_frames.size() > video_frames_max_bulge) {
// video_frames.pop_front();
// }
// qDebug() << video_frames.size() << audio_data.size() << audio_data_max_bulge << (audio_data.size() > audio_data_max_bulge ? "audio_data.size() > audio_data_max_bulge" : "");
// }
}
//
//qDebug() << audio_data.size() << video_frames.size();
//return;
//
//do not allow the audio to run more than 3 frames behind - we are more slack here than with the video because we prefer to drop audio frames (20111009)
if (audio_data.size() > audio_frame_size*3) {
audio_data = audio_data.right(audio_frame_size*2);
qDebug() << this << "dropped audio frames";
}
//do not allow the video to run more than 1 frame behind the audio (20111013)
if (video_frames.size() > 1 && audio_data.size() < audio_frame_size) {
int audio_frames_per_video_frame = (audio_sample_rate_bits * 2 * 2) / video_frame_time_ms / audio_frame_size;
for (int i = 0; i < video_frames.size() - 1; i++) { //this may come up to one frame short (20111013)
qDebug() << this << "adding" << audio_frames_per_video_frame << "audio frames to audio_data";
for (int j = 0; j < audio_frames_per_video_frame; j++) {
QByteArray silence(audio_frame_size, 0);
audio_data.append(silence);
}
}
}
// } else if (0) {
// double elapsed = session_timer.elapsed();
// qint64 video_pts_gap = (elapsed / video_frame_time_ms) - video_frames_encoded;
// //qDebug() << "video_pts_gap is" << video_pts_gap;
// if (video_pts_gap > 0) {
// qint64 scaled_skew = av_rescale_q(video_pts_gap, (AVRational){1,video_framerate}, video_st->time_base);
// qDebug() << this << "adding" << scaled_skew << "to video_st->pts.val" << video_st->pts.val;
// video_st->pts.val += scaled_skew;
// video_frames_encoded += video_pts_gap;
// }
// if (0) {
// double audio_frame_time_ms = ((double)audio_st->time_base.num / (double)audio_st->time_base.den) * 1000.0;
// qint64 audio_pts_gap = (elapsed / audio_frame_time_ms) - audio_frames_encoded;
// if (audio_pts_gap > 0) {
// //qint64 scaled_skew = av_rescale_q(audio_pts_gap, (AVRational){audio_st->time_base.den,audio_st->time_base.num}, audio_st->time_base);
// qint64 scaled_skew = audio_pts_gap;
// qDebug() << this << "adding" << scaled_skew << "to audio_st->pts.val" << audio_st->pts.val;
// audio_st->pts.val += scaled_skew;
// audio_frames_encoded += audio_pts_gap;
// }
// }
// }
}
void RTMP_Broadcaster::clean_up_ffmpeg_crap() {
if (sws_ctx) {
sws_freeContext(sws_ctx);
sws_ctx = NULL;
}
if (input_avpicture) {
avpicture_free(input_avpicture);
input_avpicture = NULL;
}
if (output_avframe) {
avpicture_free(&dst_picture);
avcodec_free_frame(&output_avframe);
output_avframe = NULL;
}
if (audio_frame) {
avcodec_free_frame(&audio_frame);
audio_frame = NULL;
}
}
void RTMP_Broadcaster::stop() {
if (!currently_streaming) return;
broadcast_timer.stop();
clean_up_ffmpeg_crap();
/* Write the trailer, if any. The trailer must be written before you
* close the CodecContexts open when you wrote the header; otherwise
* av_write_trailer() may try to use memory that was freed on
* av_codec_close(). */
av_write_trailer(oc);
/* Close each codec. */
if (video_st)
close_video(oc, video_st);
if (audio_st)
close_audio(oc, audio_st);
/* Free the streams. */
for (uint i = 0; i < oc->nb_streams; i++) {
av_freep(&oc->streams[i]->codec);
av_freep(&oc->streams[i]);
}
if (!(fmt->flags & AVFMT_NOFILE))
/* Close the output file. */
avio_close(oc->pb);
/* free the stream */
av_free(oc);
currently_streaming = false;
}
void RTMP_Broadcaster::emergency_restart() {
stop();
QTimer::singleShot(5000, this, SLOT(restart()));
}
void RTMP_Broadcaster::restart() {
return start(current_url, video_width, video_height, video_framerate, video_preset, video_bitrate_kbit, audio_bitrate_kbit, audio_sample_rate_bits, audio_number_of_channels);
}
|
510f2604e08448a02e5806de0affb6752d5e6f91
|
8bc5d618f57de78ab72db052f8316d14f147f4dd
|
/chat_linux/src/str_echo.cpp
|
4c13aeb8dc002d6ecfd7f3b63f4e6eafeea5814e
|
[] |
no_license
|
fuwaandhuluwa/network-programing
|
b7ba1a28b352ab29800d9a95a68cef2e3063b734
|
32f5016eb72bf63c18681d0d4fbad71d9aa3cec9
|
refs/heads/master
| 2021-09-05T22:05:57.058121
| 2018-01-31T07:52:03
| 2018-01-31T07:52:03
| 118,699,698
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 420
|
cpp
|
str_echo.cpp
|
#include "../include/network.h"
#include "../include/Sock_rw.h"
#include <iostream>
void str_echo(int sockfd)
{
ssize_t n;
char buff[MAX];
again:
while( ( n = read(sockfd, buff, MAX)) > 0)
{
writen(sockfd, buff , n);
}
if( n < 0 && errno == EINTR)
goto again;
if( n < 0)
{
std::cout<<"read erro : " <<strerror(errno)<<std::endl;
exit(-1);
}
}
|
baaa1ed60b4d05a43f1b6ba9abed3dbb9dc8bb76
|
08de604a6e08dd7804e0f18beb170466ef5c5535
|
/trees/Connect Nodes at Same Level.cpp
|
6eb17c0986db571063e258fe6d5d23c1169d4aa1
|
[] |
no_license
|
Ritesh25696/geeksforgeeks
|
d0aef5a8506bf0ca67fc6191e71a0844996345b8
|
95abe5f13cad2af9db5d71a212701435078541fd
|
refs/heads/master
| 2021-01-22T13:51:36.832979
| 2017-11-14T19:01:21
| 2017-11-14T19:01:21
| 100,684,634
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,926
|
cpp
|
Connect Nodes at Same Level.cpp
|
Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is like following.
struct Node{
int data;
Node* left;
Node* right;
Node* nextRight;
}
Initially, all the nextRight pointers point to garbage values. Your function should set these pointers to point next right for each node.
Example:
Input Tree
10
/ \
3 5
/ \ \
4 1 2
Output Tree
10--->NULL
/ \
3-->5-->NULL
/ \ \
4-->1-->2-->NULL
Input:
The task is to complete the method which takes one argument, root of Binary Tree. There are multiple test cases. For each test case, this method will be called individually.
Output:
The function should update nextRight pointers of all nodes.
Constraints:
1 <=T<= 30
1 <=Number of nodes<= 100
1 <=Data of a node<= 1000
Example:
Input:
2
2
3 1 L 3 2 R
4
10 20 L 10 30 R 20 40 L 20 60 R
Output:
3 1 2
1 3 2
10 20 30 40 60
40 20 60 10 30
**************************************************************************************************************************************************************
{
int data;
Node *left, *right;
Node *nextRight; // This has garbage value in input trees
}; */
// Should set the nextRight for all nodes
void connect(Node *p)
{
queue<pair<Node*, int>> Q;
p->nextRight = NULL;
Node* prev = p;
int dis = 0;
if(p->left)Q.push(make_pair(p->left,1));
if(p->right)Q.push(make_pair(p->right,1));
while(!Q.empty()){
pair<Node*,int> fr;
fr = Q.front();
Q.pop();
Node* root = fr.first;
int lvl = fr.second;
if(dis == lvl){
prev->nextRight = root;
}
root->nextRight = NULL;
dis = lvl;
if(root->left)Q.push(make_pair(root->left,lvl+1));
if(root->right)Q.push(make_pair(root->right,lvl+1));
prev = root;
}
}
|
07518253a5788e2e142654d58215f75f61e733aa
|
66eaafba92160b7b66381c04ccb7f2552a1af866
|
/intro/arraySort.cpp
|
9985446554bd5579af66586ae7ddd7713c7cfba0
|
[] |
no_license
|
jk78346/CS_161_summer_2021
|
47b8d1ad17444842df3ba32a873951f71e8e27eb
|
59d12fc3ae62189f7cc2d6ec8a362e08a64b2ae2
|
refs/heads/main
| 2023-06-06T22:22:16.840782
| 2021-07-16T18:27:29
| 2021-07-16T18:27:29
| 381,244,268
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 808
|
cpp
|
arraySort.cpp
|
#include <algorithm>
#include <ctime>
#include <iostream>
#include <climits>
long long calculate_sum(int *data, unsigned int size);
int main(int argc, char **argv)
{
// generate data
const unsigned arraySize = 32768;
int data[arraySize];
int option = atoi(argv[1]);
long long sum = 0;
for (unsigned c = 0; c < arraySize; ++c)
data[c] = std::rand();
if(option)
std::sort(data, data + arraySize);
for (unsigned i = 0; i < 10000; ++i) {
sum += calculate_sum(data, arraySize);
}
std::cout << "sum = " << sum << std::endl;
}
long long calculate_sum(int *data, unsigned int size)
{
long long sum=0;
int t = std::rand();
for (unsigned i = 0; i < size; ++i) {
if (data[i] >= t)
sum ++;
}
return sum;
}
|
4b853a50265d258099cddc231a59dd2eb23cf1e6
|
ec69b0093887ee6723001e15cb250f9abf4b1f8a
|
/src/physics/ycolshape.cpp
|
554761e1a836a0c8b0f900513094b1f845556219
|
[
"MIT"
] |
permissive
|
sivarajankumar/smoothernity
|
b1562ac3e9a36a9a4d9803622f1768a758c94ba5
|
a4c7d290ca601bddf680ef040f3235dc7b029a6b
|
refs/heads/master
| 2021-01-10T03:19:13.912364
| 2014-09-20T02:58:10
| 2014-09-20T02:58:10
| 49,218,282
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,192
|
cpp
|
ycolshape.cpp
|
#include "yphysres.h"
#include "ycolshape.hpp"
#include "pmem.hpp"
struct ycolshapes_t {
int count;
ycolshape_t *pool;
};
static ycolshapes_t g_ycolshapes;
int ycolshape_init(int count) {
size_t size_max, align_max;
ycolshape_t *cs;
#define FIND_SIZES(t) \
if (sizeof(t) > size_max) size_max = sizeof(t); \
if (PMEM_ALIGNOF(t) > align_max) align_max = PMEM_ALIGNOF(t);
size_max = align_max = 0;
FIND_SIZES(btBoxShape);
FIND_SIZES(btHeightfieldTerrainShape);
FIND_SIZES(btCompoundShape);
FIND_SIZES(btSphereShape);
#undef FIND_SIZES
g_ycolshapes.count = count;
g_ycolshapes.pool = (ycolshape_t*)pmem_alloc(PMEM_ALIGNOF(ycolshape_t),
sizeof(ycolshape_t) * count);
if (!g_ycolshapes.pool)
return YPHYSRES_CANNOT_INIT;
for (int i = 0; i < count; ++i ) {
cs = ycolshape_get(i);
cs->vacant = 1;
cs->shape_box = 0;
cs->shape_sphere = 0;
cs->shape_hmap = 0;
cs->shape_comp = 0;
cs->shape_convex = 0;
cs->shape = 0;
cs->data = 0;
cs->comp = cs->comp_children = cs->comp_next = cs->comp_prev = 0;
cs->vehs = 0;
cs->rbs = 0;
}
for (int i = 0; i < count; ++i)
if (!(ycolshape_get(i)->data = (char*)pmem_alloc(align_max, size_max)))
return YPHYSRES_CANNOT_INIT;
return YPHYSRES_OK;
}
void ycolshape_done(void) {
ycolshape_t *cs;
if (!g_ycolshapes.pool)
return;
for (int i = 0; i < g_ycolshapes.count; ++i) {
cs = ycolshape_get(i);
if (cs->data) {
ycolshape_free(cs);
pmem_free(cs->data);
}
}
pmem_free(g_ycolshapes.pool);
g_ycolshapes.pool = 0;
}
ycolshape_t * ycolshape_get(int colshapei) {
if (colshapei >= 0 && colshapei < g_ycolshapes.count)
return g_ycolshapes.pool + colshapei;
else
return 0;
}
int ycolshape_free(ycolshape_t *cs) {
if (cs->vacant == 1)
return YPHYSRES_INVALID_CS;
if (cs->comp_children || cs->vehs || cs->rbs)
return YPHYSRES_CS_HAS_REFS;
cs->vacant = 1;
if (cs->comp) {
try {
cs->comp->shape_comp->removeChildShape(cs->shape);
} catch (...) {
return YPHYSRES_INTERNAL;
}
if (cs->comp->comp_children == cs)
cs->comp->comp_children = cs->comp_next;
if (cs->comp_prev)
cs->comp_prev->comp_next = cs->comp_next;
if (cs->comp_next)
cs->comp_next->comp_prev = cs->comp_prev;
cs->comp = 0;
cs->comp_prev = 0;
cs->comp_next = 0;
}
if (cs->shape) {
try {
cs->shape->~btCollisionShape();
} catch (...) {
return YPHYSRES_INTERNAL;
}
}
cs->shape = 0;
cs->shape_convex = 0;
cs->shape_box = 0;
cs->shape_hmap = 0;
cs->shape_comp = 0;
return YPHYSRES_OK;
}
int ycolshape_alloc_box(ycolshape_t *cs, float *size) {
if (!cs->vacant)
return YPHYSRES_INVALID_CS;
cs->vacant = 0;
try {
cs->shape_box = new (cs->data)
btBoxShape(btVector3(size[0], size[1], size[2]));
} catch (...) {
return YPHYSRES_INTERNAL;
}
cs->shape = cs->shape_box;
cs->shape_convex = cs->shape_box;
return YPHYSRES_OK;
}
int ycolshape_alloc_sphere(ycolshape_t *cs, float r) {
if (!cs->vacant)
return YPHYSRES_INVALID_CS;
cs->vacant = 0;
try {
cs->shape_sphere = new (cs->data) btSphereShape(r);
} catch (...) {
return YPHYSRES_INTERNAL;
}
cs->shape = cs->shape_sphere;
cs->shape_convex = cs->shape_sphere;
return YPHYSRES_OK;
}
int ycolshape_alloc_hmap(ycolshape_t *cs, float *hmap,
int width, int length, float hmin, float hmax, float *scale) {
if (!cs->vacant)
return YPHYSRES_INVALID_CS;
cs->vacant = 0;
try {
cs->shape_hmap = new (cs->data)
btHeightfieldTerrainShape(width, length, hmap, 1,
hmin, hmax, 1, PHY_FLOAT, false);
} catch (...) {
return YPHYSRES_INTERNAL;
}
cs->shape_hmap->setLocalScaling(btVector3(scale[0], scale[1], scale[2]));
cs->shape = cs->shape_hmap;
return YPHYSRES_OK;
}
int ycolshape_alloc_comp(ycolshape_t *cs) {
if (!cs->vacant)
return YPHYSRES_INVALID_CS;
cs->vacant = 0;
try {
cs->shape_comp = new (cs->data) btCompoundShape();
} catch (...) {
return YPHYSRES_INTERNAL;
}
cs->shape = cs->shape_comp;
return YPHYSRES_OK;
}
int ycolshape_comp_add(ycolshape_t *prt, float *matrix, ycolshape_t *chd) {
if (!prt->shape_comp || !chd->shape || chd->shape_comp || chd->comp)
return YPHYSRES_INVALID_CS;
chd->comp = prt;
chd->comp_next = prt->comp_children;
if (prt->comp_children)
prt->comp_children->comp_prev = chd;
prt->comp_children = chd;
try {
btTransform tm;
tm.setFromOpenGLMatrix(matrix);
prt->shape_comp->addChildShape(tm, chd->shape);
} catch (...) {
return YPHYSRES_INTERNAL;
}
return YPHYSRES_OK;
}
|
bcfeb3d6dd2fe2d4cd35a90555a4bf1c71a022f0
|
2ca3035754817668e094be49a646c6d5c94d67b2
|
/Cooing/Core/Include/Xmpp_core/XmppRoomChatAdapter.h
|
5e7e7b6cbe9ce7632d89fb7c03a135970dd8e7c3
|
[] |
no_license
|
Cooing/CooingWindows
|
24f51251371ddc15a3c6a12fec294b3ac3b6b092
|
d445651e913315b0b1405092a5a2d0ab558b26ae
|
refs/heads/master
| 2020-05-27T02:34:42.347809
| 2014-11-27T04:58:59
| 2014-11-27T04:58:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 490
|
h
|
XmppRoomChatAdapter.h
|
#ifndef _XMPP_ROOM_CHAT_ADAPTER
#define _XMPP_ROOM_CHAT_ADAPTER
#include "XmppGeneralChatAdapter.h"
namespace SecureChat
{
class XmppRoomChatAdapter : public XmppGeneralChatAdapter
{
public:
XmppRoomChatAdapter(){};
~XmppRoomChatAdapter(){};
virtual void handleMUCParticipantPresence(string jid, int status, int other) {};
virtual void handleMUCMessage(string from, string msg, bool history, bool priv) {};
virtual void handleMUCRoomCreation(string roomID) {};
};
}
#endif
|
26302cdd3184f71bd41dfcd3583a6c5a56d4b3c0
|
1f9fba78b57f7abda0261ae346822397f30d6369
|
/plots/scripts_root/detectorPlots/scripts/macro.cpp
|
aeafe3898234419105ae9d51989ad4e85eac264e
|
[] |
no_license
|
martinosal/root_selector
|
6ebf36bed8934db8ae914ee35b0405ab2266afbd
|
a9340c05cb2616d6d5e6298ee433e97ae65052fd
|
refs/heads/master
| 2023-03-31T02:16:38.565721
| 2021-03-12T17:07:34
| 2021-03-12T17:07:34
| 248,818,740
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 704
|
cpp
|
macro.cpp
|
#include "plots.cpp"
#include "plots_2.cpp"
#define N_alg 3
void macro(TFile* fData=_file0){
std::vector<std::string> alg{"JF","IP3D","SV1"};
std::vector<std::string> det{"d0sig","z0sinthsig","logpTfrac","logDR","IBLhits","NextToIBLhits","sharedIBLhits","splitIBLhits","nPixhits","sharedPixhits","splitPixhits","nSCThits","sharedSCThits"};
std::vector<int> n_p{0,0,0,0,3,4,3,3,10,6,7,19,7};
for(unsigned i=0;i<13;i++)//was 13
{
plot((det.at(i)).c_str(),n_p.at(i),fData);
for(unsigned j=0;j<N_alg;j++)
{
plot((det.at(i)).c_str(),alg.at(j),n_p.at(i),fData);
}
}
sig("sigd0",fData);
sig("sigz0",fData);
for(unsigned j=0;j<N_alg;j++)
{
orig(alg.at(j),fData);
}
return;
}
|
9464d5d54488ddeedac86ebd33a546c9a0afedd3
|
eb87da665fbd8443287d9be4093c2e16fff04969
|
/a1141.cpp
|
0c4a2949c3b220347689be9f206e6e0c871a26cb
|
[] |
no_license
|
northmachine/pat_test
|
84fe679163ba74c45d515b1745a43ee850530b2a
|
79534c79f8da168c43f87b789a2f52c4227dfacc
|
refs/heads/master
| 2020-08-01T05:09:35.401003
| 2019-09-25T15:17:02
| 2019-09-25T15:17:02
| 210,875,072
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,060
|
cpp
|
a1141.cpp
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
map<string,int> sc;
int n,scn;
struct node{
string name;
int stn;
double score;
}sclist[maxn];
bool cmp(node a,node b){
if((int)a.score!=(int)b.score)return a.score>b.score;
else if(a.stn!=b.stn) return a.stn<b.stn;
else return a.name<b.name;
}
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
string id,school;
double score;
cin>>id>>score>>school;
for(int j=0;j<school.length();j++)school[j]|=32;
if(id[0]=='T')score*=1.5;
else if(id[0]=='B')score/=1.5;
if(sc.find(school)==sc.end()){
sc[school] = scn;
sclist[scn] = {school,1,score};
scn++;
}
else{
sclist[sc[school]].stn++;
sclist[sc[school]].score+=score;
}
}
sort(sclist,sclist+scn,cmp);
cout<<scn<<endl;
int r = 1;
cout<<r<<" "<<sclist[0].name<<" "<<(int)sclist[0].score<<" "<<sclist[0].stn<<endl;
for(int i=1;i<scn;i++){
if((int)sclist[i].score!=(int)sclist[i-1].score)r=i+1;
cout<<r<<" "<<sclist[i].name<<" "<<(int)sclist[i].score<<" "<<sclist[i].stn<<endl;
}
return 0;
}
|
1833c53e47b0c3298371736e2a75cc5dcbddfd17
|
d778525e7823854ee35d92164d1e2f8c8a689f07
|
/array/3_SUM_~1.CPP
|
af2f5999a5299b4a7ba8330891e9aca5cef0feb8
|
[] |
no_license
|
manojmansukh/C
|
b695afeb55b56839cb2ea30a056dae4dcd4f5ce1
|
bfce00c64df084557f4dad864928116d2c69ed69
|
refs/heads/master
| 2020-09-04T16:25:22.817196
| 2019-11-05T17:17:51
| 2019-11-05T17:17:51
| 219,801,176
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 515
|
cpp
|
3_SUM_~1.CPP
|
#include <stdio.h>
#include<conio.h>
#define size 1000
int addarray(int arr[], int start, int len);
int main()
{
int i ,sum,arr[size],n;
printf("enter the no of array element:");
scanf("%d",&n);
printf("enter the array element:");
for(i=0;i<n;i++)
scanf("%d\t",&arr[i]);
sum=addarray(arr,0,n);
printf("sum of array:%d",sum);
getch();
}
int addarray(int arr[],int start, int len)
{
int sum=0;
if(start>=len)
return 0;
return(arr[start]+addarray(arr,start+1,len));
}
|
7256937efe47f18fbeb23361f4580c64fc7f860e
|
85b6a39ff07ac0eac7701b6b0e45f5e424fbe9a1
|
/cardfighter/InputManager.h
|
b600fbcffc1f7b5a6f1fd24d1fea463b3cc382c6
|
[] |
no_license
|
LyonsMatthew/cardfight
|
3092cc8b0151dc5361474a2704eda25b57ba582f
|
2c070a33d88d2c1d10d81906eb8cf9b5adc17a1f
|
refs/heads/master
| 2020-04-13T16:12:44.915159
| 2018-12-27T15:52:52
| 2018-12-27T15:52:52
| 163,315,398
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 453
|
h
|
InputManager.h
|
#pragma once
#include <vector>
#include "InputObserver.h"
class InputManager
{
public:
InputManager();
~InputManager();
void register_observer(InputObserver& observer);
void unregister_observer(InputObserver& observer);
virtual bool delegate(sf::Event& event) = 0;
virtual bool input_mouse_button_pressed(sf::Event& event) = 0;
virtual bool input_mouse_moved(sf::Event& event) = 0;
protected:
std::vector<InputObserver*> input_observers;
};
|
d6fa985d1163bfd8545bacb74e983190585be768
|
6709677823021ab4b23b56dd725a6e96aaa72796
|
/include/space.hpp
|
8f0bf59132c17239bdd1941a84b79aa05294cf46
|
[] |
no_license
|
rekeshali/sod-shocktube-cfd
|
ca05bcf2391fe73f854b1bee68e57c2316505bab
|
2f227433af684f42945eadf808f9e61089aa303a
|
refs/heads/master
| 2020-04-28T02:20:35.414505
| 2019-04-02T18:55:34
| 2019-04-02T18:55:34
| 174,894,829
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,026
|
hpp
|
space.hpp
|
#ifndef SPACE
#define SPACE
#include "matrix.hpp"
#include "shocktube.hpp"
class Space {
protected:
ShockTube * Sod;
const char * method;
static int dof;
Mat q, qp, qm;
Mat A, Ap, Am;
Mat T, L, Ti;
Mat f, fp, fm, fb;
// Vars for Roe average
Mat qroe;
double sql, sqr;
// Vars for HLL
Mat fl, fr;
double Sl, Sr;
public:
void spatialScheme(ShockTube&, const char *);
Mat absA(double *);
// All purpose flux splitter calls others
Mat splitFlux(int);
// StegerWarming
void StegerWarmingInit(void);
Mat StegerWarmingFlux(int);
// Roe Method
void RoeInit(void);
void RoeAverage(double *, double *);
Mat RoeFlux(int);
// HLL Method
void HLLInit(void);
Mat HLLInterFlux(int, int);
Mat HLLFlux(int);
// functions for deriving flow props from state
double rho(double *); // rho
double vel(double *); // u
double nrg(double *); // e0
double bar(double *); // P
double sos(double *); // a
double nth(double *); // h0
};
#endif
|
259d95060c74e506eea4d82a1cb19dc992c8af14
|
e26abc5004fbdcda3d36b7250f7c95f2010512c5
|
/example2/test14d/constant/triSurface/femur_left_front.eMesh
|
6ad6b28647c00341edc9bceb14e8317d1d60bbcf
|
[] |
no_license
|
rtafds/openfoam-example
|
aa2e218895bfe224edb2f49d901027fd096789a6
|
d118a36b18c9362c0405396306d9553a71b5b1ce
|
refs/heads/master
| 2020-09-07T00:15:31.949125
| 2019-11-09T06:20:02
| 2019-11-09T06:20:02
| 220,599,371
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,654
|
emesh
|
femur_left_front.eMesh
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class featureEdgeMesh;
location "constant/triSurface";
object femur_left_front.eMesh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// points:
71
(
(1.97392 3.55032 0.796602)
(1.96137 3.5533 0.536602)
(1.96147 3.55747 0.536602)
(1.84727 3.46017 0.867002)
(1.88436 3.45986 0.91838)
(1.86825 3.45658 0.896982)
(1.87397 3.45774 0.904587)
(1.83411 3.55029 0.665775)
(1.86539 3.53812 0.536602)
(1.81392 3.55032 0.796602)
(1.86331 3.45637 0.890208)
(1.86 3.45716 0.885416)
(1.93833 3.53398 0.973087)
(1.93537 3.52407 0.971659)
(1.93679 3.52883 0.972345)
(1.89429 3.46511 0.93071)
(1.88886 3.46224 0.92397)
(1.89081 3.46326 0.926385)
(1.94119 3.54924 0.97293)
(1.92335 3.49762 0.962155)
(1.93175 3.51484 0.969135)
(1.90319 3.4719 0.941193)
(1.90544 3.47437 0.943644)
(1.96078 3.55733 0.536602)
(1.86512 3.45594 0.89283)
(1.92229 3.47988 0.666455)
(1.92072 3.46081 0.796602)
(1.97198 3.52945 0.796602)
(1.96616 3.50945 0.796602)
(1.95243 3.48552 0.796602)
(1.93265 3.46718 0.796602)
(1.82368 3.54945 0.731455)
(1.92157 3.46882 0.731361)
(1.93398 3.51942 0.970989)
(1.94325 3.4755 0.796602)
(1.97047 3.52265 0.796602)
(1.96012 3.49698 0.796602)
(1.90393 3.47256 0.942042)
(1.88904 3.46203 0.924268)
(1.87455 3.45684 0.905638)
(1.86045 3.45625 0.886278)
(1.92798 3.50523 0.966506)
(1.93625 3.52631 0.972273)
(1.93178 3.55436 0.0916016)
(1.93161 3.55431 0.0916016)
(1.93165 3.54566 0.0916016)
(1.93182 3.54692 0.0916016)
(1.91924 3.49086 0.958289)
(1.93635 3.50642 0.536602)
(1.92821 3.50282 0.536602)
(1.96474 3.56111 0.666402)
(1.94365 3.51142 0.536602)
(1.95503 3.52477 0.536602)
(1.94993 3.5176 0.536602)
(1.96118 3.54504 0.536602)
(1.96109 3.54087 0.536602)
(1.96073 3.55944 0.601465)
(1.95961 3.53693 0.536602)
(1.91634 3.50042 0.536602)
(1.90479 3.501 0.536602)
(1.81951 3.49314 0.819794)
(1.83141 3.4728 0.841616)
(1.81346 3.51967 0.804142)
(1.81548 3.50565 0.811085)
(1.86951 3.52712 0.536602)
(1.88418 3.50989 0.536602)
(1.82835 3.52879 0.714116)
(1.82961 3.51835 0.721249)
(1.95415 3.5498 0.929745)
(1.92119 3.49319 0.960358)
(1.96661 3.55032 0.886513)
)
// edges:
98
(
(4 15)
(22 47)
(8 23)
(18 9)
(48 49)
(0 50)
(51 48)
(52 53)
(54 55)
(1 54)
(56 2)
(57 52)
(55 57)
(50 56)
(53 51)
(58 59)
(60 61)
(8 7)
(9 62)
(62 63)
(63 60)
(49 58)
(61 3)
(64 8)
(65 64)
(59 65)
(66 67)
(13 12)
(16 15)
(18 68)
(69 19)
(70 0)
(68 70)
(47 69)
(8 9)
(25 26)
(27 0)
(28 27)
(29 28)
(30 29)
(31 9)
(32 25)
(26 32)
(7 31)
(33 13)
(14 12)
(17 15)
(12 18)
(20 33)
(34 30)
(0 35)
(15 21)
(35 36)
(36 34)
(21 37)
(37 22)
(4 38)
(38 16)
(6 39)
(39 4)
(3 40)
(40 11)
(19 41)
(41 20)
(13 42)
(42 14)
(21 22)
(20 13)
(14 18)
(7 9)
(43 44)
(44 45)
(45 46)
(46 43)
(2 1)
(24 5)
(6 4)
(5 6)
(10 24)
(11 10)
(3 11)
(13 14)
(4 16)
(16 17)
(19 20)
(1 23)
(23 2)
(5 10)
(5 11)
(6 11)
(6 3)
(4 3)
(16 3)
(16 9)
(9 3)
(17 9)
(17 21)
(21 9)
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
|
561048943a359502a7a24d7c24a954e19db6ec5e
|
97207114d47e8b26c3388ce814c01448025b0565
|
/PeGaSys/AI/Path.cpp
|
e1364b384590db1701933cb57afd5237f1b6a7bd
|
[] |
no_license
|
akshay-k/Game-Engines
|
2a4aaf3aa86a9ba1e36813d887acc052524eb6fe
|
18212773b3eb961a6dcd073ac98d737604e58e99
|
refs/heads/master
| 2021-08-29T10:43:17.466892
| 2017-12-13T18:50:12
| 2017-12-13T18:50:12
| 103,973,008
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 699
|
cpp
|
Path.cpp
|
#pragma once
#include "stdafx.h"
#include "Path.h"
std::list<Math3D::Vector4> Path::CreateRandomPath(int NumWaypoints, double MinX, double MinY, double MaxX, double MaxY)
{
m_WayPoints.clear();
double midX = (MaxX + MinX) / 2.0;
double midY = (MaxY + MinY) / 2.0;
double smaller = min(midX, midY);
double spacing = TwoPi / (double)NumWaypoints;
for (int i = 0; i<NumWaypoints; ++i)
{
double RadialDist = RandInRange(smaller*0.2f, smaller);
Math3D::Vector4 temp(static_cast<float>(RadialDist), 0.0f, 0.0f);
//Vec2DRotateAroundOrigin(temp, i*spacing);
temp.setX(midX);
temp.setY(midY);
m_WayPoints.push_back(temp);
}
curWaypoint = m_WayPoints.begin();
return m_WayPoints;
}
|
598277abda34e1b5a218f4772a2349de4f32a64a
|
c0caed81b5b3e1498cbca4c1627513c456908e38
|
/src/core/pack/task/operation/ResFilterFactory.hh
|
b51da26b72b098b34145a47498b000da01ef49ed
|
[] |
no_license
|
malaifa/source
|
5b34ac0a4e7777265b291fc824da8837ecc3ee84
|
fc0af245885de0fb82e0a1144422796a6674aeae
|
refs/heads/master
| 2021-01-19T22:10:22.942155
| 2017-04-19T14:13:07
| 2017-04-19T14:13:07
| 88,761,668
| 0
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,861
|
hh
|
ResFilterFactory.hh
|
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
/// @file core/pack/task/operation/ResFilterFactory.hh
/// @brief
/// @author ashworth
#ifndef INCLUDED_core_pack_task_operation_ResFilterFactory_hh
#define INCLUDED_core_pack_task_operation_ResFilterFactory_hh
// Unit Headers
#include <core/pack/task/operation/ResFilterFactory.fwd.hh>
// Package Headers
#include <core/pack/task/operation/ResFilter.fwd.hh>
#include <core/pack/task/operation/ResFilterCreator.fwd.hh>
// Utility Headers
#include <utility/pointer/ReferenceCount.hh>
#include <utility/tag/Tag.fwd.hh>
#include <utility/tag/XMLSchemaGeneration.fwd.hh>
// c++ headers
#include <string>
#include <map>
#include <utility/vector0.hh>
#ifdef MULTI_THREADED
#ifdef CXX11
// C++11 Headers
#include <atomic>
#include <mutex>
#endif
#endif
namespace core {
namespace pack {
namespace task {
namespace operation {
class ResFilterFactory // singleton; no need to derive from RefCount : public utility::pointer::ReferenceCount
{
public:
//typedef utility::pointer::ReferenceCount parent;
typedef std::map< std::string, ResFilterCreatorOP > ResFilterCreatorMap;
typedef utility::tag::Tag Tag;
typedef utility::tag::TagOP TagOP;
typedef utility::tag::TagCOP TagCOP;
public:
static ResFilterFactory * get_instance();
void factory_register( ResFilterCreatorOP );
/// @brief add a prototype, using its default type name as the map key
void add_creator( ResFilterCreatorOP );
bool has_type( std::string const & ) const;
/// @brief return new ResFilter by key lookup in filter_map_; new ResFilter does not parse an input Tag
ResFilterOP newResFilter( std::string const & ) const;
/// @brief return new ResFilter by key lookup in filter_map_ new ResFilter parses Tag if provided
ResFilterOP newResFilter( std::string const &, TagCOP tag ) const;
/// @brief The %ResFilterFactory is the point of entry for the definition of the XML Schemas
/// for every ResFilter that may be instantiated from a file. It is responsible for defining
/// an xs:group named "res_filter" listing each of the residue-filter-complex types that
/// may be initialized using the %ResFilterFactory and to iterate across each of the
/// ResFilterCreator it contains asking them for the XML schema of the ResFilter they
/// are responsible for creating.
void define_res_filter_xml_schema( utility::tag::XMLSchemaDefinition & xsd ) const;
/// @brief The name given to the XML schema group of all ResFilter s.
static std::string res_filter_xml_schema_group_name();
#ifdef MULTI_THREADED
#ifdef CXX11
public:
/// @brief This public method is meant to be used only by the
/// utility::thread::safely_create_singleton function and not meant
/// for any other purpose. Do not use.
static std::mutex & singleton_mutex();
private:
static std::mutex singleton_mutex_;
#endif
#endif
private:
ResFilterFactory();
virtual ~ResFilterFactory();
/// @brief private singleton creation function to be used with
/// utility::thread::threadsafe_singleton
static ResFilterFactory * create_singleton_instance();
private:
#if defined MULTI_THREADED && defined CXX11
static std::atomic< ResFilterFactory * > instance_;
#else
static ResFilterFactory * instance_;
#endif
ResFilterCreatorMap filter_creator_map_;
};
} //namespace operation
} //namespace task
} //namespace pack
} //namespace core
#endif
|
71f10589d657bfc989f9fe9272c081cc6bb91485
|
f529bbd46e068ed57ea518468dc515b4e4e082d6
|
/src/components/Waynet.cpp
|
3305e88877c36cdc54955b2d58cfd5951ba77a67
|
[
"MIT"
] |
permissive
|
Szmyk/REGoth-bs
|
4b76bc847f01550147d9334f983b53f538c8958d
|
f953739f96a6441457287417d23812853675fb6e
|
refs/heads/master
| 2020-05-23T09:43:23.466888
| 2019-05-14T19:11:17
| 2019-05-14T19:11:17
| 186,711,827
| 4
| 0
|
MIT
| 2019-05-14T22:52:09
| 2019-05-14T22:52:08
| null |
UTF-8
|
C++
| false
| false
| 1,219
|
cpp
|
Waynet.cpp
|
#include "Waynet.hpp"
#include <Debug/BsDebugDraw.h>
#include <RTTI/RTTI_Waynet.hpp>
#include <Scene/BsSceneObject.h>
#include <components/AnchoredTextLabels.h>
#include <components/Waypoint.hpp>
namespace REGoth
{
Waynet::Waynet(const bs::HSceneObject& parent)
: bs::Component(parent)
{
}
HWaypoint Waynet::findWaypoint(const bs::String& name)
{
bs::HSceneObject waypointSO = SO()->findChild(name);
if (!waypointSO) return {};
return waypointSO->getComponent<Waypoint>();
}
void Waynet::addWaypoint(HWaypoint waypoint)
{
mWaypoints.push_back(waypoint);
}
void Waynet::debugDraw(const REGoth::HAnchoredTextLabels& textLabels)
{
bs::DebugDraw::instance().setColor(bs::Color::Red);
for (HWaypoint from : allWaypoints())
{
const bs::Transform& fromTransform = from->SO()->getTransform();
textLabels->addLabel(fromTransform.pos() + fromTransform.getUp() * 0.5f,
bs::HString(from->SO()->getName()));
for (HWaypoint to : from->allPaths())
{
bs::DebugDraw::instance().drawLine(fromTransform.pos(), to->SO()->getTransform().pos());
}
}
}
REGOTH_DEFINE_RTTI(Waynet)
} // namespace REGoth
|
7f1cb4d0cf6a790728059b9d6a0b3574bc5e1d0c
|
50fc2a6f64b5b2b352e9948ffe6772c05712287e
|
/Examples/main.cpp
|
acc8fef0089a024af96fa71432f634f9fb331b4d
|
[
"MIT"
] |
permissive
|
juantresde/Vortex2D
|
92cb8a81752409eba5a14c91981fd02c7273af66
|
ec37b98ad258ac5b68ee1caf9de3d50831f063a8
|
refs/heads/master
| 2021-01-12T01:10:19.433176
| 2017-01-03T21:00:50
| 2017-01-03T21:00:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,358
|
cpp
|
main.cpp
|
#include "Common.h"
#include "RenderWindow.h"
#include "SmokeExample.h"
#include "ObstacleSmokeExample.h"
#include "WaterExample.h"
#include "VelocitySmokeExample.h"
#include "ScaleWaterExample.h"
#include "LineIntegralConvolution.h"
#include <iostream>
#include <memory>
#include <GLFW/glfw3.h>
std::unique_ptr<BaseExample> example;
void error_callback(int error, const char* description)
{
std::cout << "GLFW erro " << error << " : " << description << std::endl;
}
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if(action != GLFW_PRESS) return;
switch(key)
{
case GLFW_KEY_1:
example.reset(new SmokeExample());
break;
case GLFW_KEY_2:
example.reset(new ObstacleSmokeExample());
break;
case GLFW_KEY_3:
example.reset(new VelocitySmokeExample());
break;
case GLFW_KEY_4:
example.reset(new WaterExample());
break;
case GLFW_KEY_5:
example.reset(new ScaleWaterExample());
break;
default:
break;
}
}
int main(int argc, const char * argv[])
{
if(!glfwInit()) { std::cout << "Could not initialize GLFW" << std::endl; exit(EXIT_FAILURE); }
glfwSetErrorCallback(error_callback);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
auto colour = glm::vec4{ 99.0f,96.0f,93.0f,255.0f } / glm::vec4(255.0f);
glm::vec2 size = {500,500};
RenderWindow mainWindow(size.x, size.y, "Vortex2D Examples");
mainWindow.SetKeyCallback(key_callback);
example.reset(new SmokeExample());
RenderWindow debugWindow(size.x, size.y, "Debug Window", &mainWindow);
Vortex2D::Fluid::LineIntegralConvolution lic(size);
while (!mainWindow.ShouldClose() && !debugWindow.ShouldClose())
{
glfwPollEvents();
mainWindow.MakeCurrent();
example->Frame();
mainWindow.Clear(colour);
example->Render(mainWindow);
mainWindow.Display();
debugWindow.MakeCurrent();
debugWindow.Clear(colour);
lic.Render(debugWindow);
debugWindow.Display();
}
glfwTerminate();
}
|
1f1610b9f87471280f66e1edadd5f15df6b9bb1f
|
f57c624e42ff546df2ad89acef9d3ea5a73bb43c
|
/csci2270/assignments/01_cpp_refresher/unit_tests.cc
|
25848b04b59c56b8a83189e47afb610b9a215eff
|
[] |
no_license
|
AThilenius/external
|
a2c026552d8624fb373252fb24c4e5c8f3490cee
|
96176b8aed6dbb67d9431eafb2884540200d033e
|
refs/heads/master
| 2021-06-07T21:47:44.397494
| 2017-09-11T01:20:20
| 2017-09-24T03:37:35
| 42,087,629
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,065
|
cc
|
unit_tests.cc
|
// Copyright 2015 Alec Thilenius
// All rights reserved.
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include <typeinfo>
#include <unordered_set>
#include "cpp_refresher.h"
#include "test_runner.h"
namespace {
bool other_uber_function_called = false;
int does_loopy_things_count = 0;
int last_new_size_ = 0;
std::unordered_set<std::string> type_call_set_;
void* last_delete_ptr_ = nullptr;
void* last_new_ptr_ = nullptr;
bool base_method_called = false;
} // namespace
void PointersTestAddCall(const std::string& type_name) {
type_call_set_.insert(type_name);
}
void DoesAwesomeLoopyThings() { does_loopy_things_count++; }
void BaseMethodCalled() { base_method_called = true; }
namespace uber_namespace {
void OtherUberFunction() { other_uber_function_called = true; }
}
int PrintHelloWorldHarness() {
std::stringstream buffer;
std::streambuf* sbuf = std::cout.rdbuf();
std::cout.rdbuf(buffer.rdbuf());
PrintHelloWorld();
int count = buffer.str().length();
std::cout.rdbuf(sbuf);
return count;
}
std::string GetRandomString() {
std::string random_string;
srand(time(NULL));
int size = 10 + (rand() % 100);
for (int i = 0; i < size; i++) {
random_string += static_cast<char>(65 + (std::rand() % 24));
}
return std::move(random_string);
}
void LoopsTestHelper(UTTestRunner* runner, int count) {
does_loopy_things_count = 0;
Loops(count);
runner->IsTrue(
does_loopy_things_count == count,
"DoesAwesomeLoopyThings called " + std::to_string(count) + " times.",
"Your loop should have run " + std::to_string(count) + " times, not " +
std::to_string(does_loopy_things_count) + " times");
}
SUITE(CPlusPlusRefresher) {
TEST("Print Hello, world", 10, 10) {
int number_of_chars_couted = PrintHelloWorldHarness();
runner->IsTrue(number_of_chars_couted > 0, "Was something printed",
"You need to print something to cout");
}
TEST("Call the UberFunction with different types", 25, 25) {
CallUberFunctions();
runner->IsTrue(
type_call_set_.find(typeid(int).name()) != type_call_set_.end(),
"Was uber function called with int",
"You need to call the "
"function \"UberFunction\" "
"with an int argument");
runner->IsTrue(
type_call_set_.find(typeid(int*).name()) != type_call_set_.end(),
"Was uber function called with int*",
"You need to call the "
"function \"UberFunction\" "
"with an int* argument");
runner->IsTrue(
type_call_set_.find(typeid(int**).name()) != type_call_set_.end(),
"Was uber function called with int**",
"You need to call the "
"function \"UberFunction\" "
"with an int** argument");
runner->IsTrue(
type_call_set_.find(typeid(char*).name()) != type_call_set_.end(),
"Was uber function called with char*",
"You need to call the "
"function \"UberFunction\" "
"with a char* argument");
runner->IsTrue(other_uber_function_called,
"Called OtherUberFunction in the uber_namespace namespace",
"You need to call the function OtherUberFunction in the "
"uber_namespace namespace");
}
TEST("Call DoesAwesomeLoopyThings N times", 20, 20) {
srand(time(NULL));
LoopsTestHelper(runner, 1);
LoopsTestHelper(runner, rand() % 100);
}
static std::string array = GetRandomString();
runner->GetConfig()->min_memory = (array.length() + 1) * sizeof(char);
runner->GetConfig()->max_memory = (array.length() + 1) * sizeof(char);
runner->GetConfig()->leak_check = true;
TEST("Copy an array to the heap", 25, 25) {
CopyArrayOnHeap(array.c_str());
std::string alloc_size =
std::to_string((array.length() + 1) * sizeof(char));
runner->IsTrue(
true, "Allocate and free " + alloc_size + " bytes using new / delete",
"");
}
TEST("Create a class method called UberMethod", 20, 20) {
base_method_called = false;
UberClass uber_c1;
UberClass uber_c2;
UberClass uber_c3;
UberClass* uber_c3_ptr = &uber_c3;
UseingObjects(uber_c1, &uber_c2, &uber_c3_ptr);
runner->IsTrue(uber_c1.method_called, "Call UberMethod on uber_class_1",
"You need to call UberMethod on the uber_class_1 instance");
runner->IsTrue(uber_c1.uber_member == 42,
"Set the uber_member on uber_class_1 to 42",
"You need to set the member uber_member to 42");
runner->IsTrue(uber_c2.method_called, "Call UberMethod on uber_class_2",
"You need to call UberMethod on the uber_class_2 instance");
runner->IsTrue(uber_c2.uber_member == 42,
"Set the uber_member on uber_class_2 to 42",
"You need to set the member uber_member to 42");
runner->IsTrue(uber_c3.method_called, "Call UberMethod on uber_class_3",
"You need to call UberMethod on the uber_class_3 instance");
runner->IsTrue(uber_c3.uber_member == 42,
"Set the uber_member on uber_class_3 to 42",
"You need to set the member uber_member to 42");
}
runner->GetConfig()->max_memory = 0;
TEST("Extra Credit: In place string reversal", 5, 0) {
std::string forward = GetRandomString();
std::string backward = forward;
char* c_buffer =
static_cast<char*>(malloc((forward.length() + 1) * sizeof(char)));
backward = forward;
std::reverse(backward.begin(), backward.end());
forward.copy(c_buffer, forward.length(), 0);
c_buffer[forward.length()] = 0;
InPlaceReverse(c_buffer);
runner->IsTrue(
std::string(c_buffer) == backward,
"Reverse the order of the string without allocating new memory",
"You need to reverse the order of the string");
}
}
int main(int argc, const char* argv[]) {
UTTestRunner runner;
runner.RunSuite("Test Name", &CPlusPlusRefresher);
}
|
20224ba0dd8fef9c100a6b47205429ce4d1fd270
|
6bb55109d41437bd4325dc61277ab11d33248dda
|
/chap3/ratios.cc
|
d190acabc3b70bd635368d161a858f59bf792683
|
[] |
no_license
|
yzliang/usaco
|
aaddc9fbcb026d1042d197557a9bd659a488d9fe
|
6b981cabba792af87e46ffe7165072f81c3be1dc
|
refs/heads/master
| 2021-01-17T13:28:06.314758
| 2018-06-03T21:02:38
| 2018-06-03T21:02:38
| 11,219,468
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,792
|
cc
|
ratios.cc
|
/*
ID: liangyi1
PROG: ratios
LANG: C++
*/
#include <iostream>
#include <fstream>
using namespace std;
int gcd(int a, int b) {
if (b == 0) {
return a;
} else {
return gcd(b, a % b);
}
}
int main() {
int a[4], b[4], c[4];
ifstream fin("ratios.in");
for (int i = 0; i < 4; ++i) {
fin >> a[i] >> b[i] >> c[i];
}
fin.close();
int min_sum = -1, bx, by, bz, bt;
for (int x = 0; x < 100; ++x) {
for (int y = 0; y < 100; ++y) {
for (int z = 0; z < 100; ++z) {
if (min_sum != -1 && x + y + z > min_sum) {
continue;
}
int sum_a = a[1] * x + a[2] * y + a[3] * z;
int sum_b = b[1] * x + b[2] * y + b[3] * z;
int sum_c = c[1] * x + c[2] * y + c[3] * z;
int t;
if (a[0] != 0) {
if (sum_a % a[0]) continue;
t = sum_a / a[0];
if (b[0] * t != sum_b || c[0] * t != sum_c) continue;
} else if (b[0] != 0) {
if (sum_b % b[0]) continue;
t = sum_b / b[0];
if (c[0] * t != sum_c) continue;
} else if (c[0] != 0) {
if (sum_c % c[0]) continue;
t = sum_c / c[0];
}
if (t == 0) continue;
min_sum = x + y + z;
bx = x;
by = y;
bz = z;
bt = t;
}
}
}
ofstream fout("ratios.out");
if (min_sum == -1) {
fout << "NONE" << endl;
} else {
fout << bx << ' ' << by << ' ' << bz << ' ';
if (a[0] != 0) {
fout << (a[1] * bx + a[2] * by + a[3] * bz) / a[0] << endl;
} else if (b[0] != 0) {
fout << (b[1] * bx + b[2] * by + b[3] * bz) / b[0] << endl;
} else if (c[0] != 0) {
fout << (c[1] * bx + c[2] * by + c[3] * bz) / c[0] << endl;
} else {
fout << '0' << endl;
}
}
fout.close();
return 0;
}
|
33a0f4f97c315481882c9693816808f71d46cec5
|
5fe9fb23e5df770cd15ead80cb48808288d6da75
|
/x_con.cpp
|
865eea0f8f5b5b0dffbd5905fb0d88ec7c12c556
|
[] |
no_license
|
DennisStanistan/stevens
|
bd3788f2ae74815036794a53e15e92edbacbe54b
|
caf92c4bf3cfce0f5461e3f22f60753593cec410
|
refs/heads/master
| 2022-04-06T21:27:03.051608
| 2020-02-26T09:55:46
| 2020-02-26T09:55:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,110
|
cpp
|
x_con.cpp
|
#include "xentax.h"
#include "x_con.h"
void test_map_deque(void)
{
// Test #1
// Basic Usage
typedef map_deque<uint32, std::string> map_type;
map_deque<uint32, std::string> m1;
m1.insert(map_type::value_type(15, "15 - 1"));
m1.insert(map_type::value_type(15, "15 - 2"));
m1.insert(map_type::value_type(15, "15 - 3"));
m1.insert(map_type::value_type(16, "16 - 1"));
m1.insert(map_type::value_type(16, "16 - 2"));
m1.insert(map_type::value_type(16, "16 - 3"));
for(auto miter = m1.begin(); miter != m1.end(); miter++)
for(auto diter = miter->second.begin(); diter != miter->second.end(); diter++)
std::cout << *diter << std::endl;
}
void test_frequency_map(void)
{
// Test #1
// Basic Usage
typedef frequency_map<std::string> map_type;
map_type m1;
m1.increment("how");
m1.increment("now");
m1.increment("brown");
m1.increment("cow");
m1.increment("how");
m1.increment("now");
m1.increment("?");
for(auto iter = m1.begin(); iter != m1.end(); iter++)
std::cout << iter->first << ": " << iter->second << " occurrences." << std::endl;
}
|
505fb16844a7c1e7f98ce6b7b7667eaee33ed963
|
59e533ca95cae49fb0e75e20e7d18c66cb1b14d6
|
/Exceptions/BadHttpResponseException.h
|
5e11c6e412c2c4d58561e947f21232af4ea50509
|
[] |
no_license
|
AstarProxy/server-qt
|
323e9920d186d9a753e69ccdb01ec6b9d4a68be7
|
69d1c6e271e45ec095450a6ff15383d66b54f9e2
|
refs/heads/master
| 2020-03-17T23:43:09.485227
| 2018-05-19T11:52:32
| 2018-05-19T11:52:32
| 134,057,215
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 251
|
h
|
BadHttpResponseException.h
|
#ifndef BADHTTPRESPONSEEXCEPTION_H
#define BADHTTPRESPONSEEXCEPTION_H
#include "./Exception.h"
class BadHttpResponseException : public Exception
{
public:
BadHttpResponseException(const QString &message);
};
#endif // BADHTTPRESPONSEEXCEPTION_H
|
4484bc8f18ad015e31637658d17cdcb3ac3b443b
|
7aa1743c918b482a27dc843173b6bab05b511e21
|
/C++_5/3_qualifier.cpp
|
7372168850b2a29491e169699114e3f784ec04a0
|
[] |
no_license
|
RealChaser/Cpp_Lecture
|
7021be1b1f02c9f62f83db5a14885b8d8f34ebbb
|
b947bb6defdad4bb1c598c2c39a4d7f05cfc50de
|
refs/heads/master
| 2021-06-24T18:20:14.247040
| 2020-02-22T14:11:24
| 2020-02-22T14:11:24
| 91,180,286
| 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 734
|
cpp
|
3_qualifier.cpp
|
// 3_qualifier
#include <iostream>
using namespace std;
class Test
{
public:
/*
// C++98 의 예외 표시
//void goo() throw(int) // int 예외가 나올수 있다.
//void goo() throw() // 예외가 없다.
void goo() // 어떤 종류의 예외라도 나올수 있다.
{
}
// C++11 : 예외의 종류가 중요하지 않고, 예외가 있다/없다는 사실이 중요하다
// 그래서 noexcept 키워드가 생김
// 멤버 함수 뒤에 붙을수 있는 지시어 정리
void foo() const override final noexcept volatile
{
}
*/
// & 와 &&
void hoo() & { cout << "&" << endl; }
void hoo() && { cout << "&&" << endl; }
};
int main()
{
Test t;
t.hoo(); // &
Test().hoo(); // &&
}
|
14293ef95093fc6eae3b6894c4243e674a484ba5
|
774ed33284b868da6d2837c64e63eefa116fc130
|
/CCLogic.cpp
|
d7267b50f48eb60e262817dc5bb7a711ce51f098
|
[] |
no_license
|
SimulationEverywhere-Models/CDPP-ALFA1
|
6a34f87dcc4fd1f4b5ca629c99c8d1f839a5cdc2
|
c82388e8a44632fd2fd913ea229ec5e51e0fabbe
|
refs/heads/master
| 2022-12-29T15:06:33.545485
| 2020-09-30T19:24:18
| 2020-09-30T19:24:18
| 300,035,339
| 0
| 0
| null | null | null | null |
WINDOWS-1250
|
C++
| false
| false
| 4,845
|
cpp
|
CCLogic.cpp
|
/*******************************************************************
*
* DESCRIPTION: Atomic Model CCLogic
*
* AUTHOR: Deborah Grinberg & Marcos Nu¤ez Cort‚s
*
* EMAIL: mailto://dgrinber@dc.uba.ar
* mailto://jnuniez@dc.uba.ar
*
* DATE: 27/9/1998
*
*
*
*
* MODIFICADO POR: Pablo L. Cremona
* Pablo S. Sor
*
* DATE: 28/01/1999
*
*******************************************************************/
/** include files **/
#include <string>
#include <iostream>
/** my include files **/
#include "CCLogic.h" // class CCLogic
#include <message.h> // class ExternalMessage, InternalMessage
#include <mainsimu.h> // MainSimulator::Instance().getParameter( ... )
/** public functions **/
/*******************************************************************
* Function Name: CCLogic
* Description: Constructor del modelo (&name ser su nombre)
********************************************************************/
CCLogic::CCLogic( const string &name )
: Atomic( name )
, C( this->addInputPort( "C" ) )
, N( this->addInputPort( "N" ) )
, Z( this->addInputPort( "Z" ) )
, V( this->addInputPort( "V" ) )
, RES( this->addOutputPort( "RES" ) )
, preparationTime( 0, 0, 10, 0 )
{
COND = addPorts( ptInput, "COND", 4, *this);
if( MainSimulator::Instance().existsParameter( this->description(),"response" ) )
{
string time( MainSimulator::Instance().getParameter( this->description(), "response" ) ) ;
if( time != "" )
preparationTime = time ;
}
}
CCLogic::~CCLogic(){
delete [] COND;
}
/*******************************************************************
* Function Name: initFunction
* Description: Pone a cero todas las variables internas
Por convencion pone a cero el puerto de salida al inicio
* Precondition: El tiempo del proximo evento interno es Infinito
********************************************************************/
Model &CCLogic::initFunction()
{
c = n = z = v = cond[0] = cond[1] = cond[2] = cond[3] = res.val = 0;
return *this ;
}
/*******************************************************************
* Function Name: externalFunction
* Description: Almacena los datos de las entradas
********************************************************************/
Model &CCLogic::externalFunction( const ExternalMessage &msg )
{
if( msg.port() == C ) c = bit(msg.value());
else if( msg.port() == N ) n = bit(msg.value());
else if( msg.port() == Z ) z = bit(msg.value());
else if( msg.port() == V ) v = bit(msg.value());
else
{
string portName;
int portNum;
nameNum(msg.port().name(), portName, portNum);
if(portName == "cond")
cond[portNum] = bit( msg.value() );
}
this->holdIn( active, preparationTime );
return *this;
}
/*******************************************************************
* Function Name: internalFunction
* Description: Pasiva el modelo
********************************************************************/
Model &CCLogic::internalFunction( const InternalMessage & )
{
this->passivate();
return *this ;
}
/*******************************************************************
* Function Name: outputFunction
* Description: Envia el calculo de la salida al puerto RES
********************************************************************/
Model &CCLogic::outputFunction( const InternalMessage &msg )
{
unsigned long lCond;
lCond = fromBits(cond, 4);
switch (lCond){
case 0: res.val = 0;
break;
case 1: res.val = z;
break;
case 2: res.val = z || ((n || v) && !(n == v)); // Z v (N xor V)
break;
case 3: res.val = (n || v) && !(n == v);
break;
case 4: res.val = c || z;
break;
case 5: res.val = c;
break;
case 6: res.val = n;
break;
case 7: res.val = v;
break;
case 8: res.val = 1;
break;
case 9: res.val = !z;
break;
case 10: res.val = !(z || ((n || v) && !(n == v)));
break;
case 11: res.val = !((n || v) && !(n == v));
break;
case 12: res.val = !(c || z);
break;
case 13: res.val = !c;
break;
case 14: res.val = !n;
break;
case 15: res.val = !v;
break;
default: res.val = lCond;
break;
}
if (needSend( res ))
this->sendOutput( msg.time(), RES, res.val ) ;
return *this ;
}
|
f7bd4e5295b492ce19c341d6686f3fb76ac50662
|
935bce4bdacd68c4c7bf32917775b18138fa3886
|
/bresenham.h
|
a36a4682bd38bf71a3a0af601e6c0f63c0be0931
|
[] |
no_license
|
Jitesh-Khuttan/Computer-Graphics
|
c42e87dd221c08ae8ea932f72354eec4ed2e6417
|
ccc60bf4afc01d5e6001c3fbd906b5e15f5810db
|
refs/heads/master
| 2021-08-11T04:58:04.096060
| 2017-11-13T06:11:23
| 2017-11-13T06:11:23
| 103,011,024
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 572
|
h
|
bresenham.h
|
#ifndef BRESENHAM
#define BRESENHAM
#include<bits/stdc++.h>
#include<GL/glut.h>
#include "object.h"
using namespace std;
class Bresenham : public Object
{
public:
Bresenham(GLubyte* color,int thickness,string pattern);
void BslopeGT1(int steps, int x, int y, int dx, int dy,int startX,int endX,int startY,int endY);
void BslopeLT1(int steps, int x, int y, int dx, int dy,int startX,int endX,int startY,int endY);
void draw(int startX,int endX,int startY,int endY,int width,int height);
void reDrawSelectedObject(GLubyte*,int);
};
#endif // BRESENHAM
|
0c8164fa55ab9c9a52e3dc6093c2c38387064463
|
7993f562d912c37c8d419622793d732c567df8d2
|
/user_search_book.h
|
7861260761ca480d4e8d6c1ad0370787ac8d247c
|
[] |
no_license
|
tazbid/OnlineBookStore
|
e71fc2dd148d52fc69f7470d2a5e66af09666f4b
|
56f0a3d701be2f25099c8e37a005e1de71548cca
|
refs/heads/master
| 2022-09-16T16:50:37.386849
| 2020-06-01T07:12:38
| 2020-06-01T07:12:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 440
|
h
|
user_search_book.h
|
#ifndef USER_SEARCH_BOOK_H
#define USER_SEARCH_BOOK_H
#include <QDialog>
#include<QtSql>
#include<QFileInfo>
namespace Ui {
class user_search_book;
}
class user_search_book : public QDialog
{
Q_OBJECT
public:
explicit user_search_book(QWidget *parent = nullptr);
~user_search_book();
private slots:
void on_pushButton_user_search_book_clicked();
private:
Ui::user_search_book *ui;
};
#endif // USER_SEARCH_BOOK_H
|
efccb0b187dc14f014438b83003aa63c39603bad
|
6c2a2cb3884310a84b675327db107208d7067f83
|
/Orz3D/PointLight.h
|
275c33f8937779cf1788033dd2184cedf94f5d2c
|
[
"MIT"
] |
permissive
|
bzhou830/Orz3D
|
6a9456bd593b3ea66b86ba730f2f355f5f852891
|
95d419446811e837c56bbed48d215b181edd4bfa
|
refs/heads/main
| 2023-08-27T21:17:15.585821
| 2021-11-11T03:18:19
| 2021-11-11T03:18:19
| 397,168,013
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 474
|
h
|
PointLight.h
|
#pragma once
#include "Graphics.h"
#include "./Bindable/ConstantBuffers.h"
#include "./Drawable/SolidSphere.h"
class PointLight
{
public:
PointLight(Graphics& gfx, float radius = 0.5f);
void SpawnControlWindow();
void Reset();
void Draw(Graphics& gfx);
void Bind(Graphics& gfx);
private:
struct PointLightCBuf
{
dx::XMFLOAT4 pos;
};
dx::XMFLOAT4 pos = { 0.0f, 0.0f, 0.0f, 0.0f };
mutable SolidSphere mesh;
mutable PixelConstantBuffer<PointLightCBuf> cbuf;
};
|
3f5ef02f655aa3cc8b4874b51ce981cd689b7247
|
9c5178db121dc5a27c1f81907a4794ede0a187c0
|
/contest5/6.6.cpp
|
d9e367fa388ec476fa871704db1dc7ffc5c1d33a
|
[] |
no_license
|
huynguyen1212/contest
|
63dbfc70078d8c1cf37cd9d46d2a8590d38d4a35
|
7d3fff7f65b10c83cc6f1151d4c7873f0001027d
|
refs/heads/master
| 2023-01-06T14:18:51.220264
| 2020-11-01T19:06:50
| 2020-11-01T19:06:50
| 272,675,836
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 917
|
cpp
|
6.6.cpp
|
#include <bits/stdc++.h>
using namespace std;
// thuat toan
int dp[1005][1005];
void Solve() {
string s;
cin >> s;
int n = s.size();
memset(dp, 0, sizeof(dp));
int ans = 1;
for (int i = 0; i < n; i++) {
dp[i][i] = 1; // cho duong cheo chinh cua dp bang 1
}
// neu s co hai phan tu
for (int i = 0; i < n - 1; i++) { // i < n - 1 do neu chay den phan tu cuoi thi cung la phan tu cuoi cua duong cheo chinh da = 1
if (s[i] == s[i + 1]) {
dp[i][i + 1] = 1;
ans = 2;
}
}
// s >= 3 phan tu
for (int k = 3; k <= n; k++) {
for (int i = 0; i < n - k + 1; i++) {
int j = i + k - 1;
if (s[i] == s[j] && dp[i + 1][j - 1]) { // dp[i+1][j-1] == 1 la phan tu giua
dp[i][j] = 1; // danh dau 1 cho dp tu trong ra
ans = k;
}
}
}
cout << ans << endl;
}
int main() {
int t;
cin >> t;
while (t--) {
Solve();
}
return 0;
}
|
1206ed7e3c1ad611921362a7461a9221d241401f
|
ac344c0e1f4af8491f59ab3de42dcde37bc09867
|
/Astero/AsteroMath.h
|
5267b86b9507eaf2f0dc8a9dd4401eb5eba1d0b6
|
[] |
no_license
|
izewang/Astero
|
1f5f994201a47d917659955a3818ccb03f42c403
|
9e8e13b5c5d3b69076e5f511bd9ac0f9d627e83e
|
refs/heads/master
| 2021-07-21T07:00:16.285519
| 2017-10-30T05:08:30
| 2017-10-30T05:08:30
| 107,758,680
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 260
|
h
|
AsteroMath.h
|
//
// AsteroMath.h
// Astero
//
// Created by Yuzhe Wang on 8/10/17.
// Copyright © 2017 Yuzhe Wang. All rights reserved.
//
#ifndef AsteroMath_h
#define AsteroMath_h
#include <cmath>
namespace Astero {
} // namespace Astero
#endif // AsteroMath_h
|
390a819d559567e601ca55c298369807e1e7cf5d
|
7bb0597bbf095bafec5d44d72957b109a2be92cf
|
/CS2028Sec4Lab5Grp11/tasks1To3/GameShelf.h
|
998a0af1ae5c9e2d88e4d69a644a9d603d806913
|
[] |
no_license
|
nathandraper/DSLabs
|
d0fa887522f69ecea740924a48ea8ab4255c23f5
|
e045a96dda196c146fd61d30db6e04d2e406e648
|
refs/heads/master
| 2020-07-25T01:20:07.309301
| 2019-10-21T01:40:12
| 2019-10-21T01:40:12
| 208,110,035
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 552
|
h
|
GameShelf.h
|
#pragma once
#include "BoardGame.h"
#include "FullShelf.h"
#include "EmptyShelf.h"
#define shelfsize 10
class GameShelf
{
private:
int size;
BoardGame* shelf[shelfsize];
public:
int getSize() {
return size;
}
void addGame(BoardGame* g) {
if (size >= shelfsize) {
throw FullShelf();
}
shelf[size] = g;
size++;
}
BoardGame* removeGame() {
if (size <= 0) {
throw EmptyShelf();
}
BoardGame* temp = shelf[size - 1];
shelf[size - 1] = nullptr;
size--;
return temp;
}
GameShelf() {
size = 0;
}
~GameShelf() {}
};
|
5599ed2fe6e8b71230b3e8e93fd9cf3a66d07f91
|
877fff5bb313ccd23d1d01bf23b1e1f2b13bb85a
|
/app/src/main/cpp/dir7941/dir29315/dir29712/dir30926/dir32551/dir32552/file33079.cpp
|
93709bd01991150ba1124e34d4c7fadf627b4a66
|
[] |
no_license
|
tgeng/HugeProject
|
829c3bdfb7cbaf57727c41263212d4a67e3eb93d
|
4488d3b765e8827636ce5e878baacdf388710ef2
|
refs/heads/master
| 2022-08-21T16:58:54.161627
| 2020-05-28T01:54:03
| 2020-05-28T01:54:03
| 267,468,475
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 115
|
cpp
|
file33079.cpp
|
#ifndef file33079
#error "macro file33079 must be defined"
#endif
static const char* file33079String = "file33079";
|
b19d7187b71bc49924338f37c252cc33067a3296
|
ca3a1b0eeb988a911a260f848ab26b501bce26dd
|
/Source_Code/general.h
|
3c5df770c35f968befa2e2ae4fa4dd0a629e4979
|
[] |
no_license
|
wyjwl/Winter_Homework
|
1474c0d5dde1e7a1e32a7aab9b6216fe54cd62af
|
b7f1065a04568c2f3e664497b46480e251e2950a
|
refs/heads/master
| 2016-08-08T20:39:44.157300
| 2016-02-12T05:28:05
| 2016-02-12T05:28:05
| 51,195,706
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 593
|
h
|
general.h
|
#ifndef GENERAL_H
#define GENERAL_H
#include <QString>
#include "city.h"
#include "player.h"
class Player;
class City;
class General
{
public:
General(QString n, int a=10);
void setAttack(int a);
int getSelfAttack();
int getTotalAttack();
QString getName();
void setHoldCity(City *city);
City* getHoldCity();
void setOwner(Player *p);
Player* getOwner();
void setWeapon(QString w);
QString getWeapon();
private:
QString name;
int attack;
City* holdCity;
Player* ownedByPlayer;
QString weapon;
};
#endif // GENERAL_H
|
d8fbe17360645fc03d775ba6a164eddf0439a701
|
fd911fe124408f4f6e300b084b6f1d30f5da30ba
|
/libs/opengl/include/mrpt/opengl/CCylinder.h
|
f2b3454ce7335e9bde2ee0ebe5272d8ecc17900a
|
[
"BSD-3-Clause"
] |
permissive
|
tg1716/SLAM
|
5710024e34f83687c6524cfb947479951d67941e
|
b8583fb98a4241d87ae08ac78b0420c154f5e1a5
|
refs/heads/master
| 2021-01-02T09:11:41.110755
| 2017-07-30T16:04:31
| 2017-07-30T16:04:31
| 99,160,224
| 5
| 2
| null | 2017-08-02T21:13:21
| 2017-08-02T20:57:07
| null |
UTF-8
|
C++
| false
| false
| 5,838
|
h
|
CCylinder.h
|
/* +------------------------------------------------------------------------+
| Mobile Robot Programming Toolkit (MRPT) |
| http://www.mrpt.org/ |
| |
| Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
| See: http://www.mrpt.org/Authors - All rights reserved. |
| Released under BSD License. See details in http://www.mrpt.org/License |
+------------------------------------------------------------------------+ */
#ifndef opengl_CCylinder_H
#define opengl_CCylinder_H
#include <mrpt/opengl/CRenderizableDisplayList.h>
namespace mrpt
{
namespace opengl
{
class OPENGL_IMPEXP CCylinder;
/** A cylinder or cone whose base lies in the XY plane.
* \sa opengl::COpenGLScene,opengl::CDisk
*
* <div align="center">
* <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
* border-style: solid;">
* <tr> <td> mrpt::opengl::CCylinder </td> <td> \image html
* preview_CCylinder.png </td> </tr>
* </table>
* </div>
*
* \ingroup mrpt_opengl_grp
*/
class OPENGL_IMPEXP CCylinder : public CRenderizableDisplayList
{
DEFINE_SERIALIZABLE(CCylinder)
protected:
/**
* Cylinder's radii. If mBaseRadius==mTopRadius, then the object is an
* actual cylinder. If both differ, it's a truncated cone. If one of the
* radii is zero, the object is a cone.
*/
float mBaseRadius, mTopRadius;
/**
* Cylinder's height
*/
float mHeight;
/**
* Implementation parameters on which depend the number of actually
* rendered polygons.
*/
uint32_t mSlices, mStacks;
/**
* Boolean parameters about including the bases in the object. If both
* mHasTopBase and mHasBottomBase are set to false, only the lateral area is
* displayed.
*/
bool mHasTopBase, mHasBottomBase;
public:
/** Render
* \sa mrpt::opengl::CRenderizable
*/
void render_dl() const override;
/**
* Ray tracing.
* \sa mrpt::opengl::CRenderizable
*/
bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
/**
* Configuration of the cylinder's bases display.
*/
inline void setHasBases(bool top = true, bool bottom = true)
{
mHasTopBase = top;
mHasBottomBase = bottom;
CRenderizableDisplayList::notifyChange();
}
/**
* Check whether top base is displayed.
* \sa hasBottomBase
*/
inline bool hasTopBase() const { return mHasTopBase; }
/**
* Check whether bottom base is displayed.
* \sa hasTopBase
*/
inline bool hasBottomBase() const { return mHasBottomBase; }
/**
* Sets both radii to a single value, thus configuring the object as a
* cylinder.
* \sa setRadii
*/
inline void setRadius(float radius)
{
mBaseRadius = mTopRadius = radius;
CRenderizableDisplayList::notifyChange();
}
/**
* Sets both radii independently.
* \sa setRadius
*/
inline void setRadii(float bottom, float top)
{
mBaseRadius = bottom;
mTopRadius = top;
CRenderizableDisplayList::notifyChange();
}
/**
* Chenges cylinder's height.
*/
inline void setHeight(float height)
{
mHeight = height;
CRenderizableDisplayList::notifyChange();
}
/**
* Gets the bottom radius.
*/
inline float getBottomRadius() const { return mBaseRadius; }
/**
* Gets the top radius.
*/
inline float getTopRadius() const { return mTopRadius; }
/**
* Gets the cylinder's height.
*/
inline float getHeight() const { return mHeight; }
/**
* Gets how many slices are used in the cylinder's lateral area and in its
* bases.
*/
inline void setSlicesCount(uint32_t slices)
{
mSlices = slices;
CRenderizableDisplayList::notifyChange();
}
/**
* Gets how many stacks are used in the cylinder's lateral area.
*/
inline void setStacksCount(uint32_t stacks)
{
mStacks = stacks;
CRenderizableDisplayList::notifyChange();
}
/**
* Sets the amount of slices used to display the object.
*/
inline uint32_t getSlicesCount() const { return mSlices; }
/**
* Sets the amount of stacks used to display the object.
*/
inline uint32_t getStacksCount() const { return mStacks; }
/** Evaluates the bounding box of this object (including possible children)
* in the coordinate frame of the object parent. */
void getBoundingBox(
mrpt::math::TPoint3D& bb_min,
mrpt::math::TPoint3D& bb_max) const override;
/**
* Basic empty constructor. Set all parameters to default.
*/
CCylinder()
: mBaseRadius(1),
mTopRadius(1),
mHeight(1),
mSlices(10),
mStacks(10),
mHasTopBase(true),
mHasBottomBase(true){};
/**
* Complete constructor. Allows the configuration of every parameter.
*/
/** Constructor with two radii. Allows the construction of any cylinder. */
CCylinder(
const float baseRadius, const float topRadius, const float height = 1,
const int slices = 10, const int stacks = 10)
: mBaseRadius(baseRadius),
mTopRadius(topRadius),
mHeight(height),
mSlices(slices),
mStacks(stacks),
mHasTopBase(true),
mHasBottomBase(true){};
/**
* Destructor.
*/
virtual ~CCylinder(){};
private:
/**
* Gets the radius of the circunference located at certain height,
* returning false if the cylinder doesn't get that high.
*/
inline bool getRadius(float Z, float& r) const
{
if (!reachesHeight(Z)) return false;
r = (Z / mHeight) * (mTopRadius - mBaseRadius) + mBaseRadius;
return true;
}
/**
* Checks whether the cylinder exists at some height.
*/
inline bool reachesHeight(float Z) const
{
return (mHeight < 0) ? (Z >= mHeight && Z <= 0)
: (Z <= mHeight && Z >= 0);
}
};
DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(
CCylinder, CRenderizableDisplayList, OPENGL_IMPEXP)
}
}
#endif
|
489a316f81861907f53bc6280db90ee067f99951
|
23d8c808af687ef3952c2d607243506d48b52c3e
|
/Meeting_13/Meeting_14/vectoranalysis.cpp
|
ab590fdf4426125a3ef75fbdb5411a9ceddef25c
|
[] |
no_license
|
AlonzoRon/EEE-121
|
574203bd7dd4b72957960b92e06da6bf2004cc1a
|
9f83b1760a315afd1bf87bb20c2a703a062c5094
|
refs/heads/master
| 2022-04-12T01:33:37.261137
| 2020-03-01T02:48:25
| 2020-03-01T02:48:25
| 166,696,811
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 359
|
cpp
|
vectoranalysis.cpp
|
#include<iostream>
#include<vector>
#include<fstream>
using namespace std;
int main(){
vector<int> v;
ofstream csv_file("vector_mem.csv");
csv_file << "i,v.size(),v.capacity()" << endl;
for(int i = 1;i <= 100000; i++){
csv_file << i << "," << v.size() << "," << v.capacity() << endl;
v.push_back(i);
}
}
|
99d948927a753eb06e6d85f2d0c0880de193a3e8
|
199f13316e98f990874dbae179170f5cb6eb6dd3
|
/cs235 - Data Structures/lesson11/hash.h
|
ce4c1e3caee41b4aa9d827d4d0ac233e199dba20
|
[] |
no_license
|
drrezeau/School-Projects
|
7144abf442e7ca8c3259abacb15147bfe366f1f9
|
4a4ba8314b3de9342bed7139a6bc6ec3c6d009e7
|
refs/heads/master
| 2021-01-21T04:26:13.468680
| 2016-08-03T00:32:53
| 2016-08-03T00:32:53
| 45,993,344
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,222
|
h
|
hash.h
|
/***********************************************************************
* Program:
* Lesson 11, Hash
* Brother Helfrich, CS 235
* Author:
* David Lambertson and Derek Calkins
* Summary:
* This is the class structure and functions for our hash abstract class.
* It then is used in creating another class that is-a hash.
************************************************************************/
#include "list.h"
#include <iostream>
using namespace std;
/*************************************************************
* Abstract Hash class to be used when creating other hash classes.
***********************************************************/
template< class T>
class Hash
{
public:
//Non-default constructor
Hash(int num) throw (const char *)
{
buckets = num;
try
{
array = new List<T>[buckets];
}
catch(...)
{
throw "Error: Unable to allocate a new buffer.";
}
numItems = 0;
}
//Copy Constructor
Hash(const Hash & rhs)
{
array = rhs.array;
numItems = rhs.numItems;
buckets = rhs.buckets;
}
//Destructor
~Hash() {}
// Assignment operator overloaded
Hash & operator =(const Hash & rhs)
{
array = rhs.array;
numItems = rhs.numItems;
buckets = rhs.buckets;
return *this;
}
//simple functions to check if hash is empty, the size of hash and
//the capacity of hash
bool empty() { return numItems == 0; }
int size() const { return numItems; }
int capacity() const { return buckets; }
//checks to see if the passed in value is in the hash
//if so, returns true else return false.
bool find(const T & value)
{
for (ListIterator<T> it = array[hash(value)].begin();
it != array[hash(value)].end(); ++it)
if (*it == value)
return true;
return false;
}
//inserts the passed in value into the hash
void insert(const T & value)
{
array[hash(value)].push_back(value);
++numItems;
}
//pure virtual function for the hash algorithm
virtual int hash (const T & value) const = 0 ;
private:
int numItems;
int buckets;
List<T> *array;
};
|
affede9764ce16b3b015e57ef40394c4619cbf4b
|
29fea13266b11bb33de502407065665077213466
|
/mainwindow.cpp
|
ab9426323407b411f451e2a6da122e682340f540
|
[] |
no_license
|
Skau/OpenSky
|
e10ddc6c0ecdf2e582fd3b0f44b49408689c4676
|
5072c137748e2907f6546f9a9f720613f525cdfc
|
refs/heads/master
| 2022-04-02T21:45:23.242372
| 2020-02-03T19:46:03
| 2020-02-03T19:46:03
| 162,043,847
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,124
|
cpp
|
mainwindow.cpp
|
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QUrl>
#include <QDesktopServices>
#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/QNetworkReply>
#include <qjsondocument.h>
#include <qjsonobject.h>
#include <qjsonarray.h>
#include <vector>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow), callsign_{""}, myPosition_{QGeoCoordinate(0,0)}
{
ui->setupUi(this);
ui->latitudeLineEdit->setValidator(new QDoubleValidator(-90, 90, 6, this));
ui->longitudeLineEdit->setValidator(new QDoubleValidator(-180, 180, 6, this));
ui->latitudeLineEdit->setText("59.744473");
ui->longitudeLineEdit->setText("10.214885");
setWindowTitle("Get nearest flight");
ui->goToFlightButton->setEnabled(false);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::updateData()
{
ui->listWidget->clear();
ui->goToFlightButton->setEnabled(false);
double latitude = ui->latitudeLineEdit->text().toDouble();
double longitude = ui->longitudeLineEdit->text().toDouble();
if(!ui->latitudeLineEdit->text().size() || latitude <= -90 || latitude >= 90)
{
ui->statusBar->showMessage("Latitude invalid! (Min -90° and max 90°", 2000);
return;
}
else if(!ui->longitudeLineEdit->text().size() || longitude <= -180 || longitude >= 180)
{
ui->statusBar->showMessage("Longitude invalid! (Min -180° and max 180°", 2000);
return;
}
myPosition_ = QGeoCoordinate(latitude, longitude);
QString url = "https://opensky-network.org/api/states/all?";
url +=
"lamin=" + QString::number(clamp(latitude-2, -90, 90)) +
"&lomin=" + QString::number(clamp(longitude-4, -180, 180)) +
"&lamax=" + QString::number(clamp(latitude+2, -90, 90)) +
"&lomax=" + QString::number(clamp(longitude+4, -180, 180));
QNetworkAccessManager* manager = new QNetworkAccessManager(this);
reply_ = manager->get(QNetworkRequest(QUrl(url)));
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onResult(QNetworkReply*)));
manager = nullptr;
}
void MainWindow::onResult(QNetworkReply* reply)
{
if(reply_->error() != QNetworkReply::NoError)
{
qDebug() << reply_->errorString();
return;
}
QString data = static_cast<QString>(reply->readAll());
QJsonDocument doc = QJsonDocument::fromJson(data.toUtf8());
QJsonObject jsonObject = doc.object();
auto it = jsonObject.find("states");
QJsonArray flights = it->toArray();
QJsonArray closestFlight = getClosestFlight(flights);
callsign_ = closestFlight[1].toString();
addClosestFlightDetailsToListWidget(closestFlight);
if(callsign_ != "")
{
ui->goToFlightButton->setEnabled(true);
}
}
const QJsonArray MainWindow::getClosestFlight(const QJsonArray& flights) const
{
std::vector<IndexDistancePair> foundFlights;
for(int i = 0; i < flights.size(); ++i)
{
QJsonArray flight = flights[i].toArray();
if(flight[1].toString().size())
{
if(flight[5].toDouble() > 0 && flight[6].toDouble() > 0)
{
QGeoCoordinate flightPosition(flight[6].toDouble(), flight[5].toDouble());
foundFlights.push_back(std::make_pair(i, flightPosition.distanceTo(myPosition_)));
}
}
}
auto it = std::min_element(foundFlights.begin(), foundFlights.end(), compare);
return flights[it->first].toArray();
}
void MainWindow::addClosestFlightDetailsToListWidget(const QJsonArray& flight) const
{
QGeoCoordinate position(flight[6].toDouble(), flight[5].toDouble(), flight[7].toDouble());
QString string;
string = "Approx. closest flight is " + flight[1].toString();
ui->listWidget->addItem(string);
string = "Latitude: " + QString::number(position.latitude()) + "°, longitude: " + QString::number(position.longitude()) + "°";
ui->listWidget->addItem(string);
string = "Altidude: " + QString::number(position.altitude()) + "m";
ui->listWidget->addItem(string);
string = "Current speed: " + QString::number((flight[9].toDouble() * 18) / 5) + " km/h";
ui->listWidget->addItem(string);
string = "Origin Country: " + flight[2].toString();
ui->listWidget->addItem(string);
std::time_t time = flight[3].toInt();
string = "Position last updated: " + QString(std::asctime(std::localtime(&time)));
ui->listWidget->addItem(string);
}
double MainWindow::clamp(double value, double low, double high)
{
if(value < low)
{
value = low;
}
else if(value > high)
{
value = high;
}
return value;
}
void MainWindow::on_updateButton_clicked()
{
updateData();
}
void MainWindow::on_goToFlightButton_clicked()
{
if(callsign_.size())
{
callsign_ = callsign_.simplified();
callsign_.replace(" ", "");
QString link = "https://www.flightradar24.com/" + callsign_;
QDesktopServices::openUrl(QUrl(link));
}
}
|
067de62587ccbced6b030ef65ac4c5e7b67032f0
|
f465a1592674213da50606597073124fcf80c1cc
|
/src/c_socket.cpp
|
3201a2ce72cb9be62117a33fb59d2b4b8ac933bc
|
[
"MIT"
] |
permissive
|
tricktux/assistant
|
854525d452d1ff8da2f8462adfac4b5b246701f0
|
a7a12b5d32e6b4e237e0f6b3564ce523983290ea
|
refs/heads/master
| 2022-12-30T06:35:55.717308
| 2020-10-22T04:04:31
| 2020-10-22T04:04:31
| 306,211,902
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,190
|
cpp
|
c_socket.cpp
|
#include <errno.h>
#include <glog/logging.h>
#include <iostream>
#include <unordered_map>
#include <string.h>
#include <string>
#include "c_socket.hpp"
int c_socket_server::connect(int port) {
int rc, yes = 1, sock_fd;
if (descriptor > -1) {
DLOG(WARNING) << "Socket already initialized and connected";
return 0;
}
if (port <= 0) {
DLOG(ERROR) << "Invalid input port: " << port << "\n";
return -1;
}
struct addrinfo hints, *add_info;
memset(&hints, 0, sizeof hints); /*clear sockaddr structure*/
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE; // use my IP
if ((rc = getaddrinfo(nullptr, std::to_string(port).c_str(), &hints,
&add_info)) != 0) {
DLOG(ERROR) << "Failed to get address information. " << gai_strerror(rc);
return -2;
}
for (struct addrinfo *ptr = add_info; (ptr != nullptr); ptr = ptr->ai_next) {
if ((sock_fd = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol)) <
0) {
PLOG(WARNING) << "Failed to created socket.";
continue;
}
// Set socket option SO_REUSEADDR to 1
if (setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) ==
-1) {
PLOG(ERROR) << "Failed to set socket option.";
freeaddrinfo(add_info);
return -3;
}
if ((bind(sock_fd, ptr->ai_addr, ptr->ai_addrlen) < 0) || (ptr == NULL) ||
(ptr == nullptr)) {
PLOG(ERROR) << "Failed to bind address.";
continue;
}
descriptor = sock_fd;
freeaddrinfo(add_info);
break;
}
if (listen(descriptor, SOMAXCONN) < 0) {
PLOG(ERROR) << "Failed to listen to socket.";
return -5;
}
return 1;
}
int c_socket_server::wait_for_incoming_connection(void) {
std::string buff;
int inc_descriptor = -1, visits = 0;
struct sockaddr_in client_addr;
memset((char *)&client_addr, 0,
sizeof(client_addr)); /*clear sockaddr structure*/
socklen_t c_add_len = 0;
c_add_len = sizeof(client_addr);
if (descriptor < 0) {
DLOG(ERROR) << "Socket hasn't being connected\n";
return 0;
}
if (c_add_len < 1) {
DLOG(ERROR) << "Failed to get size of sockaddr_in c_add\n";
return -1;
}
DLOG(INFO) << "Server: waiting for connections on descriptor = "
<< descriptor;
while (1) {
inc_descriptor = -1;
if ((inc_descriptor = accept(descriptor, (struct sockaddr *)&client_addr,
&c_add_len)) < 0) {
PLOG(ERROR) << "Failed to accept incoming socket";
return -2;
}
buff =
"This server has been contacted " + std::to_string(++visits) + " time";
buff.append(visits == 1 ? "." : "s.");
DLOG(INFO) << buff << "\n";
if (send(inc_descriptor, buff.c_str(), buff.length(), 0) < 0) {
PLOG(ERROR) << "Failed to send message.";
return -3;
}
conn_fd = inc_descriptor;
break;
}
if (conn_fd < 1) {
DLOG(ERROR) << "Failed to obtain connection file descriptor";
return -4;
}
return 1;
}
int c_socket_server::recv_info() {
int rc, num_bytes;
char buff[MAXDATASIZE];
while (1) {
buff[0] = '\0';
if ((num_bytes = recv(conn_fd, buff, MAXDATASIZE - 1, 0)) < 0) {
PLOG(ERROR) << "Failed to connect to socket address.";
return -6;
}
buff[num_bytes] = '\0';
DLOG_IF(INFO, num_bytes > 0) << "Server: Recv'd = " << buff;
}
return 1;
}
int c_socket_client::connect(const std::string &host, int port) {
int rc, num_bytes;
char buff[MAXDATASIZE];
if (host.empty()) {
DLOG(ERROR) << "Invalid host name\n";
return -1;
}
if (port <= 0) {
DLOG(ERROR) << "Invalid input port: " << port << "\n";
return -2;
}
struct addrinfo hints, *add_info = nullptr;
memset((char *)&add_info, 0, sizeof(add_info)); /*clear sockaddr structure*/
memset((char *)&hints, 0, sizeof(hints)); /*clear sockaddr structure*/
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if ((rc = getaddrinfo(host.c_str(), std::to_string(port).c_str(), &hints,
&add_info)) != 0) {
DLOG(ERROR) << "Failed to get address information. " << gai_strerror(rc);
return -3;
}
if (add_info == nullptr) {
PLOG(ERROR) << "Invalid address information returned.";
return -4;
}
int s_desc = -1;
for (struct addrinfo *ptr = add_info; ((ptr != nullptr) && (ptr != 0));
ptr = ptr->ai_next, s_desc = -1) {
if ((s_desc = socket(ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol)) <
0) {
PLOG(ERROR) << "Failed to created socket.";
continue;
}
if (::connect(s_desc, ptr->ai_addr, ptr->ai_addrlen) < 0) {
PLOG(ERROR) << "Failed to connect to socket address.";
closesocket(s_desc);
continue;
}
DLOG(INFO) << "Connected to socket.";
descriptor = s_desc;
break;
}
if (descriptor <= 0) {
DLOG(ERROR) << "Failed to created socket\n";
freeaddrinfo(add_info);
return -5;
}
if ((num_bytes = recv(descriptor, buff, MAXDATASIZE - 1, 0)) < 0) {
PLOG(ERROR) << "Failed to connect to socket address.";
return -6;
}
buff[num_bytes] = '\0';
DLOG(INFO) << "Client: Recv'd = " << buff;
freeaddrinfo(add_info);
return 1;
}
int c_socket_client::send_info() {
const std::unordered_map<std::string, std::string> data = {
{"StudID: ", "1111"},
{"Name: ", "Bob Smith"},
{"SSN: ", "222-333-1111"},
{"EmailAddress: ", "bsmith@yahoo.com"},
{"HomePhone: ", "215-777-8888"},
{"HomeAddr: ", "123 Tulip Road, Ambler, PA 19002"},
{"LocalAddr: ", "321 Maple Avenue, Lion Town, PA 16800"},
{"EmergencyContact: ", "John Smith (215-222-6666)"},
{"ProgramID: ", "206"},
{"PaymentID: ", "1111-206"},
{"AcademicStatus: ", "1"}};
for (auto &info : data) {
if (send(descriptor, info.first.c_str(), info.first.length(), 0) < 0) {
PLOG(ERROR) << "Failed to send message.";
return -1;
}
if (send(descriptor, info.second.c_str(), info.second.length(), 0) < 0) {
PLOG(ERROR) << "Failed to send message.";
return -2;
}
sleep(1);
}
return 1;
}
|
0eef2b4cf0321a1216c953d3e258a0a88b502814
|
8d782214cc09f43db64c49d5d646509de3e86b64
|
/Pc/nodes/CallNode.h
|
564f624852df6bcc42b92929bdcbe6ee9e09ad5e
|
[] |
no_license
|
Aardvajk/OPx
|
f8c39a9b3d2a3c7edae8d48d29480cee01aaf9f6
|
1f450602a5f0e69c1956e48e915c0a893a31aa29
|
refs/heads/master
| 2022-03-26T08:28:14.561146
| 2019-12-14T08:31:43
| 2019-12-14T08:31:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 397
|
h
|
CallNode.h
|
#ifndef CALLNODE_H
#define CALLNODE_H
#include "nodes/Node.h"
class CallNode : public Node
{
public:
CallNode(Location location, NodePtr target) : Node(location), target(target) { }
virtual void accept(Visitor &v) override;
virtual std::string classname() const override;
virtual Node *clone() const override;
NodePtr target;
NodeList params;
};
#endif // CALLNODE_H
|
b8258f413193caed35137e60f76f15739c474b3c
|
3a39b41a8f76d7d51b48be3c956a357cc183ffae
|
/Codeforces/RegularRound/R585_D2/D.cpp
|
dbc3314fc718341161efea76c56405201900682f
|
[] |
no_license
|
Acka1357/ProblemSolving
|
411facce03d6bf7fd4597dfe99ef58eb7724ac65
|
17ef7606af8386fbd8ecefcc490a336998a90b86
|
refs/heads/master
| 2020-05-05T10:27:43.356584
| 2019-11-07T06:23:11
| 2019-11-07T06:23:11
| 179,933,949
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 731
|
cpp
|
D.cpp
|
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <utility>
#include <functional>
#include <cstdlib>
#include <cmath>
#include <string>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
char s[200005];
int main()
{
int L; scanf("%d %s", &L, s);
int lsum = 0, rsum = 0, lcnt = 0, rcnt = 0;
for(int i = 0; i < L / 2; i++){
if(s[i] == '?') lcnt++;
else lsum += s[i] - '0';
}
for(int i = L / 2; i < L; i++){
if(s[i] == '?') rcnt++;
else rsum += s[i] - '0';
}
if(lsum + 9 * lcnt / 2 < rsum + 9 * rcnt / 2) printf("Monocarp\n");
else if(lsum + 9 * lcnt / 2 > rsum + 9 * rcnt / 2) printf("Monocarp\n");
else printf("Bicarp\n");
return 0;
}
|
80919fe07a8a069133c6f43e93c9c2473a4f7aa7
|
ddf55d47a8761c4216f9a010c837431c1e932944
|
/Unidad3/otrosejercicios/PracticaLab5.cpp
|
fd557174c4a8b92bde973ab396ba6d4587fee7e8
|
[] |
no_license
|
santy10e/CProject
|
7ba9cef2900890e79e201421b83b3ba81c70d899
|
b25ff22de83306992c556f797fbb75594ef7eb6c
|
refs/heads/main
| 2023-06-20T18:32:26.627019
| 2021-07-21T05:36:58
| 2021-07-21T05:36:58
| 388,004,756
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,834
|
cpp
|
PracticaLab5.cpp
|
//Autor: Santiago Tene
#include <iostream>
#include <cstdlib>
#include<ctime>
using namespace std;
using std::rand;
using std::srand;
int tirarDados(){//no me funciona con class
int dado1= 1+rand()%6;
int dado2= 1+rand()%6;
int suma=dado1+dado2;
cout<<"El jugador tiro "<<dado1<<" + "<<dado2<<" = "<<suma<<endl;
return suma;
}
int main(){
system("@cls||clear");
string repetir ="s";
cout << "**********************************************************"<< endl;
cout << "******** BIENVENIDO AL CASINO DE PRIMERO B ********"<< endl;
cout << "********* RECUERDA QUE: EL CASINO NUNCA PIERDE ******"<< endl;
cout << "**********************************************************"<< endl;
while (repetir == "s" || repetir == "S"){
string estado="";
int miPunto, newtotal;
srand(time(0));
int Apuestas();
int apuesta,casa = 20, total;
cout<<"Ingrese la Apuesta que quiere realizar"<<endl;
cin>>apuesta;
cout<<"Su apuesta es: "<<apuesta<<endl;
cout<<"La casa apuesta 20$" <<endl;
total = apuesta + casa;
cout<<"EL POZO TOTAL ES: "<<total<<endl;
int guarda = total;
int sumaDeDados=tirarDados();
if(sumaDeDados==7){
estado="gano";
} else
if(sumaDeDados==miPunto){
estado="perdio";
}
if(estado=="gano"){
cout<<"El jugador gana"<<endl;
}else{
cout<<"El jugador pierde"<<endl;
}
if (estado=="gano"){
cout<<"Usted gana y se lleva el pozo de: "<<total<<endl;
newtotal = 0;
}else{
cout<<"Usted pierde y gana la casa"<<endl;
newtotal = guarda + total;
cout<<"El pozo acumulado es: "<<newtotal<<endl;
}
cout<<"Quieres Volver a Jugar Presiona (s) para continuar o (n) para salir" <<endl;
cin>>repetir;
while (repetir == "n" || repetir == "N"){
cout<<"Gracias por jugar"<<endl;
break;
}
}
}
|
3c5efaf66256c1175fb123c7144221e25a311af4
|
8a4f1bc7eef8879ccfc5efb5963c088aad8761f7
|
/engine/base2/xml/xml_parser_module.cc
|
3f1a28e3db7d2be0863a4a174d4adb5399a9b669
|
[
"Apache-2.0"
] |
permissive
|
live0717/zengine
|
dad07be0e0f8b634b80c3d6681b8a11591d53f5c
|
11619d5923f4a52dee8dc252f0fe64a4d882678c
|
refs/heads/master
| 2020-12-11T07:45:10.834924
| 2014-01-06T14:46:25
| 2014-01-06T14:46:25
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 1,452
|
cc
|
xml_parser_module.cc
|
// Copyright (C) 2012 by wubenqi
// Distributable under the terms of either the Apache License (Version 2.0) or
// the GNU Lesser General Public License, as specified in the COPYING file.
//
// By: wubenqi<wubenqi@gmail.com>
//
// 参考CEGUI的部分代码
//
#define USE_TINYXML_PARSER
//#define USE_EXPAT_PARSER
//#define USE_MARKUPSTL_PARSER
#include "base2/xml/xml_parser_module.h"
#if defined(USE_EXPAT_PARSER)
#include "base2/xml/expat_parser.h"
#endif
#if defined(USE_TINYXML_PARSER)
#include "base2/xml/tinyxml_parser.h"
#endif
#if defined(USE_MARKUPSTL_PARSER)
#include "base2/xml/markupstl_parser.h"
#endif
#if !defined(USE_MARKUPSTL_PARSER) && !defined(USE_TINYXML_PARSER) && !defined(USE_MARKUPSTL_PARSER)
#include "base2/xml/tinyxml_parser.h"
#endif
base::XMLParser* CreateParser(base::XMLParser::XmlParserType xml_type) {
base::XMLParser* xml_parser = NULL;
#if defined(USE_EXPAT_PARSER)
if (xml_type==base::XMLParser::EXPAT_XMLPARSER) {
xml_parser = new base::ExpatParser();
}
#endif
#if defined(USE_TINYXML_PARSER)
if (xml_type==base::XMLParser::TINYXML_XMLPARSER) {
xml_parser = new base::TinyxmlParser();
}
#endif
#if defined(USE_MARKUPSTL_PARSER)
if (xml_type==base::XMLParser::MARKUPSTL_XMLPARSER) {
xml_parser = new base::MarkupstlParser();
}
#endif
if (!xml_parser) {
xml_parser = new base::TinyxmlParser();
}
return xml_parser;
}
void DestroyParser(base::XMLParser* parser) {
delete parser;
}
|
f42c5ed771d90c0985c1cfc018d82b616e2dcd15
|
da79e4e4e5ea2cf6d0e8b9dbfd3d22d13723a4ee
|
/middleware/bodyParser.h
|
bc2046319f7480b545d6f5368691de3da8403200
|
[] |
no_license
|
blkshdw/BooShelf-API
|
f9e044902d930302fe0ac4facebe1c2c0376cb72
|
be0f8b554fe3267efbf11460bee1919e1241ada1
|
refs/heads/master
| 2021-01-12T13:26:17.566961
| 2016-05-11T21:12:50
| 2016-05-11T21:12:50
| 54,849,309
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 683
|
h
|
bodyParser.h
|
//
// Created by tetofag on 11.04.16.
//
#include "../crow_all.h"
#include <rapidjson/stringbuffer.h>
#include <rapidjson/document.h>
#ifndef BOOSHELF_SERVER_MIDDLEWARE_BODYPARSER_H
#define BOOSHELF_SERVER_MIDDLEWARE_BODYPARSER_H
namespace BooShelf {
namespace Middleware {
struct bodyParser {
public:
bodyParser();
rapidjson::Document getDocument();
struct context {
};
void before_handle(crow::request& req, crow::response& res, context& ctx);
void after_handle(crow::request& req, crow::response& res, context& ctx);
};
}
}
#endif //BOOSHELF_SERVER_MIDDLEWARE_BODYPARSER_H
|
5dda4edd05d5b12c57adfe26d2e30e7fd948612b
|
56b8b3eb6011e54c16b7211224b79f8daa33139a
|
/Algorithms/Tasks.0001.0500/0111.MinimumDepthOfBinaryTree/solution.cpp
|
5f25a3b8699df486c21ff176d66f8ec1e5c6fc35
|
[
"MIT"
] |
permissive
|
stdstring/leetcode
|
98aee82bc080705935d4ce01ff1d4c2f530a766c
|
60000e9144b04a2341996419bee51ba53ad879e6
|
refs/heads/master
| 2023-08-16T16:19:09.269345
| 2023-08-16T05:31:46
| 2023-08-16T05:31:46
| 127,088,029
| 0
| 0
|
MIT
| 2023-02-25T08:46:17
| 2018-03-28T05:24:34
|
C++
|
UTF-8
|
C++
| false
| false
| 964
|
cpp
|
solution.cpp
|
#include <algorithm>
#include "TreeNode.h"
#include "TreeNodeUtils.h"
#include "gtest/gtest.h"
using CommonLib::TreeNode;
namespace
{
class Solution
{
public:
int minDepth(TreeNode* root) const
{
if (root == nullptr)
return 0;
if (root->left == nullptr && root->right != nullptr)
return minDepth(root->right) + 1;
if (root->left != nullptr && root->right == nullptr)
return minDepth(root->left) + 1;
return std::min(minDepth(root->left), minDepth(root->right)) + 1;
}
};
}
using CommonLib::Codec;
namespace MinimumDepthOfBinaryTreeTask
{
TEST(MinimumDepthOfBinaryTreeTaskTests, Examples)
{
const Solution solution;
ASSERT_EQ(2, solution.minDepth(Codec::createTree("[3,9,20,null,null,15,7]").get()));
}
TEST(MinimumDepthOfBinaryTreeTaskTests, FromWrongAnswers)
{
const Solution solution;
ASSERT_EQ(2, solution.minDepth(Codec::createTree("[1,2]").get()));
}
}
|
2a0860788d53ff9cea6e582a64fa12b216962a1d
|
8cb7d2f82a5a6876a4ce16c79618170e453d89b3
|
/UI/hackrf_controller.h
|
3b1087071711d592ae97268c9760bc12e35a9a2d
|
[] |
no_license
|
serebbb/GBN_SDR
|
20c8357e1dfd86b9b6c6851f3632924f71925f7b
|
76c8ec9bdc74c5421a357fe58e703184d64a7ce1
|
refs/heads/master
| 2023-03-17T18:23:51.284346
| 2021-03-05T18:53:05
| 2021-03-05T18:53:05
| 344,865,237
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 916
|
h
|
hackrf_controller.h
|
#ifndef HACKRF_CONTROLLER_H
#define HACKRF_CONTROLLER_H
#include <QWidget>
namespace Ui {
class HackRF_Controller;
}
class HackRF_Controller : public QWidget
{
Q_OBJECT
public:
explicit HackRF_Controller(QWidget *parent = nullptr);
~HackRF_Controller();
void addItemToSampleRateList(double val);
double getSampleRateCurrentVal();
int getLnaGainCurrentVal();
int getVgaGainCurrentVal();
int getAmpCurStatus();
Ui::HackRF_Controller *ui;
signals:
void lna_gain_changed(int);
void vga_gain_changed(int);
void sampleRate_changed(double);
void amp_gain_stateChanged(bool);
private slots:
void on_pb_close_clicked();
void on_lna_gain_valueChanged(int value);
void on_vga_gain_valueChanged(int value);
void on_cb_amp_gain_stateChanged(int arg1);
void on_cb_sampleRate_currentTextChanged(const QString &arg1);
};
#endif // HACKRF_CONTROLLER_H
|
f8351176c952d5e1ca69d34c7011beb7262e0e70
|
0f0b2c5e9095ba273992ab0b74a82f986b4f941e
|
/opengl/libs/EGL/egl_layers.cpp
|
ea86c9a05bd67bc1ee7e356f7d367988c85b8f72
|
[
"LicenseRef-scancode-unicode",
"Apache-2.0"
] |
permissive
|
LineageOS/android_frameworks_native
|
28274a8a6a3d2b16150702e0a34434bc45090b9a
|
c25b27db855a0a6d749bfd45d05322939d2ad39a
|
refs/heads/lineage-18.1
| 2023-08-04T11:18:47.942921
| 2023-05-05T12:54:26
| 2023-05-05T12:54:26
| 75,639,913
| 21
| 626
|
NOASSERTION
| 2021-06-11T19:11:21
| 2016-12-05T15:41:33
|
C++
|
UTF-8
|
C++
| false
| false
| 17,839
|
cpp
|
egl_layers.cpp
|
/*
** Copyright 2018, The Android Open Source Project
**
** 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, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#include "egl_layers.h"
#include <EGL/egl.h>
#include <android-base/file.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android/dlext.h>
#include <dlfcn.h>
#include <graphicsenv/GraphicsEnv.h>
#include <log/log.h>
#include <nativebridge/native_bridge.h>
#include <nativeloader/native_loader.h>
#include <sys/prctl.h>
namespace android {
// GLES Layers
//
// - Layer discovery -
// 1. Check for debug layer list from GraphicsEnv
// 2. If none enabled, check system properties
//
// - Layer initializing -
// - AndroidGLESLayer_Initialize (provided by layer, called by loader)
// - AndroidGLESLayer_GetProcAddress (provided by layer, called by loader)
// - getNextLayerProcAddress (provided by loader, called by layer)
//
// 1. Walk through defs for egl and each gl version
// 2. Call GetLayerProcAddress passing the name and the target hook entry point
// - This tells the layer the next point in the chain it should call
// 3. Replace the hook with the layer's entry point
// - All entryoints will be present, anything unsupported by the driver will
// have gl_unimplemented
//
// - Extension layering -
// Not all functions are known to Android, so libEGL handles extensions.
// They are looked up by applications using eglGetProcAddress
// Layers can look them up with getNextLayerProcAddress
const int kFuncCount = sizeof(platform_impl_t) / sizeof(char*) + sizeof(egl_t) / sizeof(char*) +
sizeof(gl_hooks_t) / sizeof(char*);
typedef struct FunctionTable {
EGLFuncPointer x[kFuncCount];
EGLFuncPointer& operator[](int i) { return x[i]; }
} FunctionTable;
// TODO: Move these to class
std::unordered_map<std::string, int> func_indices;
// func_indices.reserve(kFuncCount);
std::unordered_map<int, std::string> func_names;
// func_names.reserve(kFuncCount);
std::vector<FunctionTable> layer_functions;
const void* getNextLayerProcAddress(void* layer_id, const char* name) {
// Use layer_id to find funcs for layer below current
// This is the same key provided in AndroidGLESLayer_Initialize
auto next_layer_funcs = reinterpret_cast<FunctionTable*>(layer_id);
EGLFuncPointer val;
ALOGV("getNextLayerProcAddress servicing %s", name);
if (func_indices.find(name) == func_indices.end()) {
// No entry for this function - it is an extension
// call down the GPA chain directly to the impl
ALOGV("getNextLayerProcAddress - name(%s) no func_indices entry found", name);
// Look up which GPA we should use
int gpaIndex = func_indices["eglGetProcAddress"];
ALOGV("getNextLayerProcAddress - name(%s) gpaIndex(%i) <- using GPA from this index", name, gpaIndex);
EGLFuncPointer gpaNext = (*next_layer_funcs)[gpaIndex];
ALOGV("getNextLayerProcAddress - name(%s) gpaIndex(%i) gpaNext(%llu) <- using GPA at this address", name, gpaIndex, (unsigned long long)gpaNext);
// Call it for the requested function
typedef void* (*PFNEGLGETPROCADDRESSPROC)(const char*);
PFNEGLGETPROCADDRESSPROC next = reinterpret_cast<PFNEGLGETPROCADDRESSPROC>(gpaNext);
val = reinterpret_cast<EGLFuncPointer>(next(name));
ALOGV("getNextLayerProcAddress - name(%s) gpaIndex(%i) gpaNext(%llu) Got back (%llu) from GPA", name, gpaIndex, (unsigned long long)gpaNext, (unsigned long long)val);
// We should store it now, but to do that, we need to move func_idx to the class so we can
// increment it separately
// TODO: Move func_idx to class and store the result of GPA
return reinterpret_cast<void*>(val);
}
int index = func_indices[name];
val = (*next_layer_funcs)[index];
ALOGV("getNextLayerProcAddress - name(%s) index(%i) entry(%llu) - Got a hit, returning known entry", name, index, (unsigned long long)val);
return reinterpret_cast<void*>(val);
}
void SetupFuncMaps(FunctionTable& functions, char const* const* entries, EGLFuncPointer* curr,
int& func_idx) {
while (*entries) {
const char* name = *entries;
// Some names overlap, only fill with initial entry
// This does mean that some indices will not be used
if (func_indices.find(name) == func_indices.end()) {
ALOGV("SetupFuncMaps - name(%s), func_idx(%i), No entry for func_indices, assigning now", name, func_idx);
func_names[func_idx] = name;
func_indices[name] = func_idx;
} else {
ALOGV("SetupFuncMaps - name(%s), func_idx(%i), Found entry for func_indices", name, func_idx);
}
// Populate layer_functions once with initial value
// These values will arrive in priority order, starting with platform entries
if (functions[func_idx] == nullptr) {
ALOGV("SetupFuncMaps - name(%s), func_idx(%i), No entry for functions, assigning (%llu)", name, func_idx, (unsigned long long) *curr);
functions[func_idx] = *curr;
} else {
ALOGV("SetupFuncMaps - name(%s), func_idx(%i), Found entry for functions (%llu)", name, func_idx, (unsigned long long) functions[func_idx]);
}
entries++;
curr++;
func_idx++;
}
}
LayerLoader& LayerLoader::getInstance() {
// This function is mutex protected in egl_init_drivers_locked and eglGetProcAddressImpl
static LayerLoader layer_loader;
if (!layer_loader.layers_loaded_) layer_loader.LoadLayers();
return layer_loader;
}
const char kSystemLayerLibraryDir[] = "/data/local/debug/gles";
std::string LayerLoader::GetDebugLayers() {
// Layers can be specified at the Java level in GraphicsEnvironment
// gpu_debug_layers_gles = layer1:layer2:layerN
std::string debug_layers = android::GraphicsEnv::getInstance().getDebugLayersGLES();
if (debug_layers.empty()) {
// Only check system properties if Java settings are empty
debug_layers = base::GetProperty("debug.gles.layers", "");
}
return debug_layers;
}
EGLFuncPointer LayerLoader::ApplyLayer(layer_setup_func layer_setup, const char* name,
EGLFuncPointer next) {
// Walk through our list of LayerSetup functions (they will already be in reverse order) to
// build up a call chain from the driver
EGLFuncPointer layer_entry = next;
layer_entry = layer_setup(name, layer_entry);
if (next != layer_entry) {
ALOGV("We succeeded, replacing hook (%llu) with layer entry (%llu), for %s",
(unsigned long long)next, (unsigned long long)layer_entry, name);
}
return layer_entry;
}
EGLFuncPointer LayerLoader::ApplyLayers(const char* name, EGLFuncPointer next) {
if (!layers_loaded_ || layer_setup_.empty()) return next;
ALOGV("ApplyLayers called for %s with next (%llu), current_layer_ (%i)", name,
(unsigned long long)next, current_layer_);
EGLFuncPointer val = next;
// Only ApplyLayers for layers that have been setup, not all layers yet
for (unsigned i = 0; i < current_layer_; i++) {
ALOGV("ApplyLayers: Calling ApplyLayer with i = %i for %s with next (%llu)", i, name,
(unsigned long long)next);
val = ApplyLayer(layer_setup_[i], name, val);
}
ALOGV("ApplyLayers returning %llu for %s", (unsigned long long)val, name);
return val;
}
void LayerLoader::LayerPlatformEntries(layer_setup_func layer_setup, EGLFuncPointer* curr,
char const* const* entries) {
while (*entries) {
char const* name = *entries;
EGLFuncPointer prev = *curr;
// Pass the existing entry point into the layer, replace the call with return value
*curr = ApplyLayer(layer_setup, name, *curr);
if (prev != *curr) {
ALOGV("LayerPlatformEntries: Replaced (%llu) with platform entry (%llu), for %s",
(unsigned long long)prev, (unsigned long long)*curr, name);
} else {
ALOGV("LayerPlatformEntries: No change(%llu) for %s, which means layer did not "
"intercept",
(unsigned long long)prev, name);
}
curr++;
entries++;
}
}
void LayerLoader::LayerDriverEntries(layer_setup_func layer_setup, EGLFuncPointer* curr,
char const* const* entries) {
while (*entries) {
char const* name = *entries;
EGLFuncPointer prev = *curr;
// Only apply layers to driver entries if not handled by the platform
if (FindPlatformImplAddr(name) == nullptr) {
// Pass the existing entry point into the layer, replace the call with return value
*curr = ApplyLayer(layer_setup, name, *prev);
if (prev != *curr) {
ALOGV("LayerDriverEntries: Replaced (%llu) with platform entry (%llu), for %s",
(unsigned long long)prev, (unsigned long long)*curr, name);
}
} else {
ALOGV("LayerDriverEntries: Skipped (%llu) for %s", (unsigned long long)prev, name);
}
curr++;
entries++;
}
}
bool LayerLoader::Initialized() {
return initialized_;
}
void LayerLoader::InitLayers(egl_connection_t* cnx) {
if (!layers_loaded_) return;
if (initialized_) return;
if (layer_setup_.empty()) {
initialized_ = true;
return;
}
// Include the driver in layer_functions
layer_functions.resize(layer_setup_.size() + 1);
// Walk through the initial lists and create layer_functions[0]
int func_idx = 0;
char const* const* entries;
EGLFuncPointer* curr;
entries = platform_names;
curr = reinterpret_cast<EGLFuncPointer*>(&cnx->platform);
SetupFuncMaps(layer_functions[0], entries, curr, func_idx);
ALOGV("InitLayers: func_idx after platform_names: %i", func_idx);
entries = egl_names;
curr = reinterpret_cast<EGLFuncPointer*>(&cnx->egl);
SetupFuncMaps(layer_functions[0], entries, curr, func_idx);
ALOGV("InitLayers: func_idx after egl_names: %i", func_idx);
entries = gl_names;
curr = reinterpret_cast<EGLFuncPointer*>(&cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl);
SetupFuncMaps(layer_functions[0], entries, curr, func_idx);
ALOGV("InitLayers: func_idx after gl_names: %i", func_idx);
// Walk through each layer's entry points per API, starting just above the driver
for (current_layer_ = 0; current_layer_ < layer_setup_.size(); current_layer_++) {
// Init the layer with a key that points to layer just below it
layer_init_[current_layer_](reinterpret_cast<void*>(&layer_functions[current_layer_]),
reinterpret_cast<PFNEGLGETNEXTLAYERPROCADDRESSPROC>(
getNextLayerProcAddress));
// Check functions implemented by the platform
func_idx = 0;
entries = platform_names;
curr = reinterpret_cast<EGLFuncPointer*>(&cnx->platform);
LayerPlatformEntries(layer_setup_[current_layer_], curr, entries);
// Populate next function table after layers have been applied
SetupFuncMaps(layer_functions[current_layer_ + 1], entries, curr, func_idx);
// EGL
entries = egl_names;
curr = reinterpret_cast<EGLFuncPointer*>(&cnx->egl);
LayerDriverEntries(layer_setup_[current_layer_], curr, entries);
// Populate next function table after layers have been applied
SetupFuncMaps(layer_functions[current_layer_ + 1], entries, curr, func_idx);
// GLES 2+
// NOTE: We route calls to GLESv2 hooks, not GLESv1, so layering does not support GLES 1.x
// If it were added in the future, a different layer initialization model would be needed,
// that defers loading GLES entrypoints until after eglMakeCurrent, so two phase
// initialization.
entries = gl_names;
curr = reinterpret_cast<EGLFuncPointer*>(&cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl);
LayerDriverEntries(layer_setup_[current_layer_], curr, entries);
// Populate next function table after layers have been applied
SetupFuncMaps(layer_functions[current_layer_ + 1], entries, curr, func_idx);
}
// We only want to apply layers once
initialized_ = true;
}
void LayerLoader::LoadLayers() {
std::string debug_layers = GetDebugLayers();
// If no layers are specified, we're done
if (debug_layers.empty()) return;
// Only enable the system search path for non-user builds
std::string system_path;
if (android::GraphicsEnv::getInstance().isDebuggable()) {
system_path = kSystemLayerLibraryDir;
}
ALOGI("Debug layer list: %s", debug_layers.c_str());
std::vector<std::string> layers = android::base::Split(debug_layers, ":");
// Load the layers in reverse order so we start with the driver's entrypoint and work our way up
for (int32_t i = layers.size() - 1; i >= 0; i--) {
// Check each layer path for the layer
std::vector<std::string> paths =
android::base::Split(android::GraphicsEnv::getInstance().getLayerPaths().c_str(),
":");
if (!system_path.empty()) {
// Prepend the system paths so they override other layers
auto it = paths.begin();
paths.insert(it, system_path);
}
bool layer_found = false;
for (uint32_t j = 0; j < paths.size() && !layer_found; j++) {
std::string layer;
ALOGI("Searching %s for GLES layers", paths[j].c_str());
// Realpath will return null for non-existent files
android::base::Realpath(paths[j] + "/" + layers[i], &layer);
if (!layer.empty()) {
layer_found = true;
ALOGI("GLES layer found: %s", layer.c_str());
// Load the layer
//
// TODO: This code is common with Vulkan loader, refactor
//
// Libraries in the system layer library dir can't be loaded into
// the application namespace. That causes compatibility problems, since
// any symbol dependencies will be resolved by system libraries. They
// can't safely use libc++_shared, for example. Which is one reason
// (among several) we only allow them in non-user builds.
auto app_namespace = android::GraphicsEnv::getInstance().getAppNamespace();
if (app_namespace && !android::base::StartsWith(layer, kSystemLayerLibraryDir)) {
char* error_message = nullptr;
dlhandle_ = OpenNativeLibraryInNamespace(
app_namespace, layer.c_str(), &native_bridge_, &error_message);
if (!dlhandle_) {
ALOGE("Failed to load layer %s with error: %s", layer.c_str(),
error_message);
android::NativeLoaderFreeErrorMessage(error_message);
return;
}
} else {
dlhandle_ = dlopen(layer.c_str(), RTLD_NOW | RTLD_LOCAL);
}
if (dlhandle_) {
ALOGV("Loaded layer handle (%llu) for layer %s", (unsigned long long)dlhandle_,
layers[i].c_str());
} else {
// If the layer is found but can't be loaded, try setenforce 0
const char* dlsym_error = dlerror();
ALOGE("Failed to load layer %s with error: %s", layer.c_str(), dlsym_error);
return;
}
// Find the layer's Initialize function
std::string init_func = "AndroidGLESLayer_Initialize";
ALOGV("Looking for entrypoint %s", init_func.c_str());
layer_init_func LayerInit = GetTrampoline<layer_init_func>(init_func.c_str());
if (LayerInit) {
ALOGV("Found %s for layer %s", init_func.c_str(), layer.c_str());
layer_init_.push_back(LayerInit);
} else {
ALOGE("Failed to dlsym %s for layer %s", init_func.c_str(), layer.c_str());
return;
}
// Find the layer's setup function
std::string setup_func = "AndroidGLESLayer_GetProcAddress";
ALOGV("Looking for entrypoint %s", setup_func.c_str());
layer_setup_func LayerSetup = GetTrampoline<layer_setup_func>(setup_func.c_str());
if (LayerSetup) {
ALOGV("Found %s for layer %s", setup_func.c_str(), layer.c_str());
layer_setup_.push_back(LayerSetup);
} else {
ALOGE("Failed to dlsym %s for layer %s", setup_func.c_str(), layer.c_str());
return;
}
}
}
}
// Track this so we only attempt to load these once
layers_loaded_ = true;
}
} // namespace android
|
6b18204172d09fd548be328cb8220d1f52c9591b
|
6714d57d3f5f1706dba8236e4e884245db05dc00
|
/scheduler.h
|
3e3e2036b967d348db5139d654598574de33faea
|
[] |
no_license
|
WCTP/CSI-240-06-PA5
|
dd05226c1faccf1986ea2e9c14a864d06101ff40
|
0da1f5eaa3207daa0ce90a0815d4a16f2caff2fb
|
refs/heads/master
| 2021-01-19T03:31:29.967819
| 2017-04-13T15:01:47
| 2017-04-13T15:01:47
| 87,322,474
| 0
| 1
| null | 2017-04-13T15:01:48
| 2017-04-05T14:56:44
|
C++
|
UTF-8
|
C++
| false
| false
| 1,154
|
h
|
scheduler.h
|
#ifndef SCHEDULER_H
#define SCHEDULER_H
#include <iostream>
#include <iomanip>
#include <string>
#include "doctor.h"
#include "patient.h"
#include "doctorOperations.h"
#include "patientOperations.h"
#include "constants.h"
using namespace std;
void addAppointment(Patient **&patients, Doctor doctors[], int numberOfDoctor,
Patient ***&scheduler);
void changeAppointment(Patient **&patients, Doctor doctors[], int numberOfDoctor,
Patient ***&scheduler);
int convertDayToInt(string day);
int convertTimeToInt(string time);
void displaySchedule(int doctorIndex, Patient ***&scheduler);
void loadSchedule(Patient ***&scheduler, Doctor doctor[], int numberOfDoctor);
void removeAppointment(Patient **&patients, Doctor doctors[], int numberOfDoctor,
Patient ***&scheduler);
int schedulerMenu();
void schedulerOperations(Patient **&patients, Doctor doctors[], int numberOfDoctor,
Patient ***&scheduler);
void storeSchedule(Patient ***&scheduler, int numberOfDoctor);
void viewSchedule(Doctor doctors[], int numberOfDoctor, Patient ***&scheduler);
#endif
|
3708bc21fa85a183c204c23362bf1406509c8326
|
f2ea17efcc1be929ef692369551e25f55fe3a05b
|
/exp_value.cpp
|
e4e693b5077275d760dde760060c274a09c1af8a
|
[] |
no_license
|
HugoAhoy/Algorithm
|
36ecf22538044e6ad1029565073704722141f5bd
|
e5b08eeb525b438da36b282a1fbbb622fc919626
|
refs/heads/master
| 2020-04-20T01:42:00.239143
| 2019-03-13T01:11:53
| 2019-03-13T01:11:53
| 150,076,231
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,978
|
cpp
|
exp_value.cpp
|
//using stack to calculate the
//value of arithmatic expression
#include"stack"
#include"algorithm"
#include"iostream"
#include"string"
#include"map"
#include"cmath"
using namespace std;
stack<char> ops;
stack<int> oprands;
map<char,int> prior;
inline void calculation(char op, int left , int right, stack<int> &oprand) {
switch(op) {
case '+':oprand.push(left + right);break;
case '-':oprand.push(left - right);break;
case '*':oprand.push(left * right);break;
case '/':oprand.push(left / right);break;
case '^':
{
int ans = pow(left, right);
oprand.push(ans);break;
}
}
}
inline void gen_num(string &exp, int &index, int &ans);
inline bool isNum(char ch);
int exp_value(stack<char> &ops, stack<int> &oprand, map<char,int> &prior, string &exp, int strlen,int index = 0);
stirng addBracket(string exp);
void init_PriorMap(map<char,int> &temp) {
temp.insert(make_pair('+',1));
temp.insert(make_pair('-',1));
temp.insert(make_pair('*',2));
temp.insert(make_pair('/',2));
temp.insert(make_pair('^',3));
temp.insert(make_pair('(',0));
return;
}
int main() {
init_PriorMap(prior);
while(true) {
string exp;
cin >> exp;
exp_value(ops, oprands, prior, exp, exp.length());
cout << oprands.top() << endl;
}
return 0;
}
//function implementaion
bool isNum(char ch) {
return((ch >= '0')&&(ch <= '9'));
}
void gen_num(string &exp, int &index, int &ans) {
ans = 0;
int len = exp.length();
for(; index < len; index++) {
if(!isNum(exp[index])) {
break;
}
ans = ans*10 + (exp[index] - '0');
}
}
int exp_value(stack<char> &ops, stack<int> &oprand, map<char,int> &prior, string &exp, int len, int index) {
int left, right;
char op;
for(; index < len; index++) {
if(isNum(exp[index])) {
int ans;
gen_num(exp, index, ans);
oprand.push(ans);
}
if(exp[index] == '(') {
ops.push('(');
index++;
index = exp_value(ops, oprand, prior, exp, len, index);
}
else if(exp[index] == ')' || index == len) {
break;
}
else {
char op = exp[index];
if(ops.empty() || prior[op] >= prior[ops.top()]) {
ops.push(op);
}
else {
int left, right;
right = oprand.top();
oprand.pop();
left = oprand.top();
oprand.pop();
calculation(ops.top(), left, right, oprand);
ops.pop();
ops.push(op);
}
}
}
if(ops.empty()) {
return index;
}
while((!ops.empty())&&(op = ops.top(), op != '(')) {
ops.pop();
right = oprand.top();
oprand.pop();
left = oprand.top();
oprand.pop();
calculation(op, left, right, oprand);
}
if(op == '(') {
ops.pop();
}
return index;
}
string addBracket(string exp) {
string newstr = "";
int len = exp.length();
for(int i = 0; i < len; i++) {
if(exp[i] == '-' || exp[i] == '+') {
if(i == 0 || exp[i-1] == '('|| exp[i-1] == '*' || exp[i-1] == '/'|| exp[i-1] == '^'|| exp[i-1] == '+'|| exp[i-1] == '-') {
newstr = newstr + "(0" + exp[i++];
if((exp[i] == '+' || exp[i] == '-')&& i != len - 1) {
i--;
continue;
}
while(exp[i] <= '9' && exp[i] >='0') {
newstr = newstr + exp[i++];
if(i == len) {
newstr = newstr + ')';
break;
}
}
newstr =newstr + ')';
i--;
}
else {
newstr = newstr + exp[i];
}
}
else {
newstr = newstr + exp[i];
}
}
return newstr;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.