blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 117 | path stringlengths 3 268 | src_encoding stringclasses 34
values | length_bytes int64 6 4.23M | score float64 2.52 5.19 | int_score int64 3 5 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | text stringlengths 13 4.23M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
94078993fa81377f659d9139a5e2a0e8377d14db | C++ | Morzkat/AgendaOfContact | /main.cpp | UTF-8 | 7,392 | 3.8125 | 4 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
// struct basic for a contact
struct contact
{
string name;
string lastName;
string phoneNumer;
struct contact* next;
};
// first and last contact objects
contact* firstItem = NULL;
contact* lastItem = NULL;
//file
fstream file;
// class ... | true |
a738023f5d3e405091e941cd07908416c7db8148 | C++ | dacaraway/coin_collector | /thing.h | UTF-8 | 1,440 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef THING_H
#define THING_H
#include <QGraphicsPixmapItem>
#include <QKeyEvent>
#include <QPixmap>
/** The Thing class is the base class for all of the objects in the game
@author Daria Caraway
@post BlueShell
@post RedShell
@post GreenShell
@post Coin
@post GreenMush */
class Thing: public QGraphicsPixmapItem
... | true |
e279772a5ba63d460028526aa6543f9c7749f2e5 | C++ | clivic/C-code-examples | /_Course Assignments/_Data Structures and Algorithm/Integral and Float TypeSize/Integral and Float TypeSize.cpp | UTF-8 | 1,616 | 3.671875 | 4 | [
"MIT"
] | permissive | //******************************************************************
// AllTypeSize program
// This program can get the size of nearly all of integral and float data types
// in the computer which executes the program
// and the output results are aligned
//*************************************************************... | true |
8b1525d389cac28394f9a2ae8cc5bea7e9d9fd16 | C++ | dchodge1/pair-programming | /CISP1010/pp2/2c.cpp | UTF-8 | 491 | 3.515625 | 4 | [] | no_license | /*
* File: 2c.cpp
* Author: David Hodge
* Date: 2019/02/01
* Conditionals to print various life milestones
*/
#include <iostream>
using namespace std;
int main() {
int age;
cout << "Please enter your age: ";
cin >> age;
if (age < 18) {
cout << "Nothing\n";
} else {
if (age >= 18) cout << "You can vote... | true |
c458ca84858536909dcb334cfda1e303e6a5bc2b | C++ | Leputa/Leetcode | /cpp/1.Two Sum.cpp | UTF-8 | 578 | 2.953125 | 3 | [] | no_license | #include <vector>
#include <unordered_map>
#include <iostream>
using namespace std;
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int>ret;
unordered_map<int, int>map;
for(int i=0; i<nums.size(); i++){
map[target- nums[i]] = i;
}
... | true |
7070f410b8e96faa86a4642455eb6d8990c6655e | C++ | laurent-xu/CLFTPL | /tests/thread_bomb.hh | UTF-8 | 1,221 | 2.859375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <future>
#include <functional>
#include <thread>
namespace thread_bomb
{
class thread_pool
{
public:
thread_pool(int) {}
template <class Function, class... Args>
std::future<typename std::result_of<Function(int, Args...)>::type>
push(Function&& f, Args&&... args)
... | true |
1a8e96adf9cc14d2227a0cf28fd72d634dfedf2b | C++ | jaylamb/picolibrary-microchip-megaavr | /include/picolibrary/microchip/megaavr/asynchronous_serial.h | UTF-8 | 6,946 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | /**
* picolibrary-microchip-megaavr
*
* Copyright 2020-2021, Andrew Countryman <apcountryman@gmail.com> and the
* picolibrary-microchip-megaavr contributors
*
* 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... | true |
4815c1d1f10c5f52b00ef8cab6767fcf63faba17 | C++ | dek-an/Step-Diploma | /core/src/YUVImage.cpp | UTF-8 | 11,175 | 2.796875 | 3 | [] | no_license | #include "../include/core/YUVImage.h"
#include "../include/core/typedefs.h"
#include <cassert>
#include <memory>
namespace core
{
// ----------------------------------------------------------
// -------------- YUVImage::iterator ------------------------
// -------------------------------------------------... | true |
3db84b5ec6d6ec4e540dc6e6820b1ce773146ada | C++ | cathreya/DS2 | /A8/binSearch.h | UTF-8 | 753 | 3.328125 | 3 | [] | no_license | #include <string.h>
#include <vector>
using namespace std;
class binSearch{
public:
template <class T>
int binarySearch(const T obj, const vector<T> arr, int n){
int high= n-1;
int low = 0;
while(high>=low){
int mid = low + (high-low)/2;
if(obj == arr[mid]){
return mid;
}
else if(obj... | true |
49a7ddb654bbdafb9424cc05d6b51e6155096515 | C++ | gal-rahamim/Dungeons-and-Dragons | /src/fightable/player/player.cpp | UTF-8 | 10,700 | 2.71875 | 3 | [] | no_license | #include <random>
#include "player.hpp"
#include "sword.hpp"
namespace d_d {
std::unordered_map<std::string, Player::MF_ONE_ARG> Player::s_mf_dict_one_arg;
std::unordered_map<std::string, Player::MF_ONE_ARG_CONST> Player::s_mf_dict_one_arg_const;
std::unordered_map<std::string, Player::MF_TWO_ARG> Player::s_mf_dict_t... | true |
a0bede8c0df1c91a34e99eca0d449dd7a432ff04 | C++ | Mamama22/Framework-C- | /learnopenGL/Source/EntityManager.h | UTF-8 | 2,051 | 2.984375 | 3 | [] | no_license | #ifndef ENTITY_MANAGER_H
#define ENTITY_MANAGER_H
#include "Entity.h"
/*************************************************************
Entity manager. Only stores entities. DOES NOT UPDATE THEM
Type: manager class
Usage: Entity adds itself to this and gets a handle
Author: Tan Yie Cher
Date: 12/7/2016
/**************... | true |
f6924f25ce9db2b55870a9d8d47fb02115408933 | C++ | PapamichMarios/Crypto-Recommendation | /recommendation.cpp | UTF-8 | 3,585 | 2.546875 | 3 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
#include "utilities.h"
#include "recommendationLSH.h"
#include "recommendationClustering.h"
#include "hash_table.h"
#include "clustering.h"
#include "validation.h"
#define ARGS 7
using namespace std;
int main(int argc, char** argv)
{
short int... | true |
767fb91c2a7d8b13e80904658650860d0946d6df | C++ | pytorch/pytorch | /c10/test/core/impl/SizesAndStrides_test.cpp | UTF-8 | 10,582 | 3.140625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-secret-labs-2011",
"LicenseRef-scancode-generic-cla",
"BSL-1.0",
"Apache-2.0"
] | permissive | #include <gtest/gtest.h>
#include <c10/core/impl/SizesAndStrides.h>
#include <c10/util/irange.h>
#ifdef __clang__
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
using namespace c10;
using namespace c10::impl;
static void checkData(
const SizesAndStrides& sz,
IntArrayRef sizes,
IntArr... | true |
4fb8a9ed5923213b0adf6e6d06f17635c84328f2 | C++ | eder-matheus/programming_challenges | /data_structs/training_dragon.cpp | UTF-8 | 1,982 | 3.53125 | 4 | [
"BSD-3-Clause"
] | permissive | // training dragon
#include <iostream>
#include <algorithm>
#include <vector>
struct Dragon {
long long int days_to_train_;
long long int fee_per_day_;
int curr_day_;
Dragon(long long int days_to_train, long long int fee_per_day, int curr_day) {
days_to_train_ = days_to_train;
fee_per_day_ = fee_per_... | true |
818c973c0355f32ce3a587dc55dcc73cfca425d6 | C++ | leyicai/LeetCode-Solution | /cpp/260_SingleNumberIII.cpp | UTF-8 | 1,116 | 3.78125 | 4 | [] | no_license | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
vector<int> res = {0, 0};
int diff = 0;
for (auto i : nums) {
diff ^= i;
}
diff &= -diff;
cout << diff << endl;
for (auto i : nums) {
if (i & diff) {
res[0] ^= i;
}
else {
res[1] ^= i;
}
}
return res;
}
};
... | true |
8fa4934ac6de276f84e4d1d9f45136fc9d0587a4 | C++ | Lumbi/cookie | /Cookie/AnimBlock.cpp | UTF-8 | 1,887 | 2.828125 | 3 | [
"MIT"
] | permissive | //
// AnimBlock.cpp
// Cookie
//
// Created by Gabriel Lumbi on 2014-10-20.
// Copyright (c) 2014 Gabriel Lumbi. All rights reserved.
//
#include "AnimBlock.h"
Cookie::AnimBlock::AnimBlock(Cookie::Renderer* renderer) : Cookie::DrawBlock(renderer)
{
current_anim_ = NULL;
}
Cookie::AnimBlock::~AnimBlock()
{
... | true |
664344d83348da5b672a06f1d1719fc8ffd8551f | C++ | akrabulislam/UVA | /383.cpp | UTF-8 | 1,820 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define mx 500
int main()
{
//freopen ("input.txt","r",stdin);
//freopen ("output.txt","w",stdout);
int t,test=1;
cin>>t;
cout<<"SHIPPING ROUTES OUTPUT"<<endl;
while(t--)
{
cout<<endl;
printf("DATA SET %d\n", tes... | true |
4ffb9965b96380acf7a1a532702a36461b32a92c | C++ | richard-hajek/pa2-semestralka | /src/units/Tile.h | UTF-8 | 1,017 | 3.234375 | 3 | [] | no_license | #ifndef PROGTEST_PROJECT_TILE_H
#define PROGTEST_PROJECT_TILE_H
#include "Drawable.h"
/**
* Basic tile, goes on the map
*/
class Tile : public Drawable
{
public:
/**
* Must be constructed with initial coordinates and symbol to draw on the map
*/
Tile(int x, int y, char c);
/**
* Use this... | true |
41d114442aaea81275102844238638132bec2846 | C++ | MCBell/Senior-Project | /Project/Source/aSprite.cpp | UTF-8 | 2,370 | 2.859375 | 3 | [] | no_license | #include "asprite.h"
#include "graphic.h"
#include "sprite.h"
ASprite::ASprite(){}
ASprite::ASprite(Graphic &graphic, const std::string &filePath, int sourceX, int sourceY, int width,
int height, float posX, float posY, float timeToUpdate):
Sprite(graphic, filePath, sourceX, sourceY, width, height, posX, posY... | true |
a0fc136f957cb3bf3380dbd9a8058471af3902c2 | C++ | hjkwok/practise | /dlList.cpp | UTF-8 | 1,747 | 3.546875 | 4 | [] | no_license | #include "dlList.h"
node_t* CreateList(int array[], int len)
{
int idx = 0;
node_t *node;
node_t *head;
node_t *pre = 0;
if(len == 1)
{
head = (node_t *)malloc(sizeof(node_t));
head->value = array[idx];
head->pre = 0;
head->next = 0;
return head;
}
for(idx = 0; idx < len; idx++)
{
node = (node_t *... | true |
cb1fb5f2aaf9a4829e2f57e3b135fa9c078ac59e | C++ | flexboni/algorithm_c | /7강/simpleSort.cpp | UTF-8 | 835 | 3.5 | 4 | [] | no_license | #include <stdio.h>
// 문제 : https://www.acmicpc.net/problem/2750
int array[1001]; // 주어진 수의 갯수보다 +1 된 배열을 선언하는게 좋다.
int main(void)
{
int number, i, j, min, index, temp;
scanf("%d", &number);
for (i = 0; i < number; i++)
{
scanf("%d", &array[i]);
}
for (size_t i = 0; i < number; i++)
... | true |
1db04391b6bad7c3dcd4ceedee788d857e9a797c | C++ | Mahmood-Darwish/CodeForces-Problem-Solutions | /Problems/Minimal string/Minimal string.cpp | UTF-8 | 1,469 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int I, letter;
string s, temp, ans;
int arr[27];
int a[27];
int b[27];
int main()
{
cin >> s;
for(int i = 0; i < s.size() ; i++){
a[s[i] - 'a']++;
arr[s[i] - 'a']++;
}
while(I < s.size() || temp.size()){
if(!a[letter])... | true |
18e31537b7e019352faf0548d22e5118fe041a86 | C++ | Cyvid7-Darus10/C-plus-plus | /Bigfactorial.cpp | UTF-8 | 627 | 3.546875 | 4 | [] | no_license | #include <iostream>
using namespace std;
void factorial(int);
int multiply(int[], int, int);
int main() {
int N;
cin >> N;
factorial(N);
}
void factorial(int N) {
int holder[500];
holder[0] = 1;
int size = 1;
for (int i = 2; i <= N; i++) {
size = multiply(holder, size, i);
}
for (int i = size - 1; i >... | true |
f82916e24e1e44aff0675b8d381901b7fafa4ac4 | C++ | vitkarpov/dcp | /codeforces/contest-1237/b.cpp | UTF-8 | 562 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> in(n + 1);
vector<int> out(n + 1);
vector<bool> visited(n + 1);
for (int i = 1; i <= n; i++) {
cin >> in[i];
}
for (int i = 1; i <= n; i++) {
cin >> out[i];
}
int i = n;
int j = n;
in... | true |
31568ebaba1b200eca1f3e6ae6212ca9d09e4a70 | C++ | DeathGodBXX/learn_new_cpp | /LeetCode/Test/testmultimap.cpp | UTF-8 | 3,758 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <unordered_map>
#include <string>
#include <utility>
#include <queue>
#include <cstdio>
#include <vector>
using std::cout;
using std::endl;
using std::queue;
using std::snprintf;
using std::string;
using std::unordered_multimap;
using std::vector;
int main()
{
unordered_multimap<std::... | true |
b70b7959a0d5e3a4016c21cbbb5b352cdba9a64a | C++ | furkanyildiz/Data_Glass_Project_Bil396 | /Old Versions/Pong__/gameplay.cpp | UTF-8 | 11,301 | 2.5625 | 3 | [] | no_license | #include "gameplay.h"
#include<iostream>
#include <QGraphicsItem>
#include <QDebug>
#include <QTimer>
#include <QEvent>
#include <QKeyEvent>
#include <math.h>
#include"mythread.h"
#include "resultwindow.h"
int x_pos_of_ball;
int y_pos_of_ball;
Gameplay::Gameplay(QGraphicsScene & scene, QGraphicsRectItem *p1, QGraphic... | true |
17e0976522ce495de889731a77d5a1c8816b0760 | C++ | jo-va/hop | /src/util/stop_watch.h | UTF-8 | 404 | 2.53125 | 3 | [] | no_license | #pragma once
#include <time.h>
namespace hop {
class StopWatch
{
public:
StopWatch();
~StopWatch();
void start();
void stop();
double get_elapsed_time_s();
double get_elapsed_time_ms();
double get_elapsed_time_us();
double get_elapsed_time_ns();
private:
struct timespec m_start... | true |
1ad46c64ba8670c4a3f123b511273785f2b3338a | C++ | Dahlia-Chehata/Coursera | /Data Structures and Algorithms Specialization/Algorithmic Toolbox/week 3/different_summands.cpp | UTF-8 | 663 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
vector <long long> summands;
vector <long long> solve (long long k,long long l)
{
/**recursion**/
/* if (k<=2*l)
{ summands.push_back(k);
return summands;
}
summands.push_back(l);
solve (k-l,l+1);*/
while (k>2*l)
{
s... | true |
658e8c965af23ac3d00b802fad0852cb46a25aa1 | C++ | yhzhm/Practice | /OJ/OpenJudge/1.7 字符串/1.7-21 单词替换.cpp | UTF-8 | 1,092 | 3.359375 | 3 | [] | no_license | /*21:单词替换
查看 提交 统计 提问
总时间限制: 1000ms 内存限制: 65536kB
描述
输入一个字符串,以回车结束(字符串长度<=100)。该字符串由若干个单词组成,单词之间用一个空格隔开,所有单词区分大小写。现需要将其中的某个单词替换成另一个单词,并输出替换之后的字符串。
输入
输入包括3行,
第1行是包含多个单词的字符串 s;
第2行是待替换的单词a(长度 <= 100);
第3行是a将被替换的单词b(长度 <= 100).
s, a, b 最前面和最后面都没有空格.
输出
输出只有 1 行,将s中所有单词a替换成b之后的字符串。
样例输入
You want someone to help you
You
I... | true |
f319f567146b61b8fd23aaeb7b3c6f54a05dd0b3 | C++ | dpkkumr/J-Pet_Code | /code/SignalExtraction.cpp | UTF-8 | 7,926 | 2.515625 | 3 | [] | no_license | #include "signalDataTree.h"
#include "SignalAnalysisTools.h"
#include "SignalExtraction.h"
const int chNb = 2; // there are 3 channels on the scope
// /home/szymon/data/srodek/
// /home/szymon/data/srodek.root
int SignalExtraction( std::string path, int signalsToProcess = 0, bool toPlot = false )
{
std::string... | true |
3185465c97237997cc0d37eec8dd69df813c0bd5 | C++ | BekzhanKassenov/olymp | /NSUTS/2014/H/Main.cpp | UTF-8 | 3,163 | 2.609375 | 3 | [] | no_license | /****************************************
** Solution by NU #2 **
****************************************/
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define MP make_pair
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef unsigned long long ull... | true |
a9041e18b255516d14cbf20eba434754de8af581 | C++ | Reintjuu/GamesProgramming | /CPP/Lecture4Stack/main.cpp | UTF-8 | 1,200 | 3.375 | 3 | [] | no_license | #include "MyStack.h"
#include <iostream>
using namespace std;
void main()
{
MyStack stack;
stack.push(8);
stack.push(6);
stack.push(7);
stack.push(5);
stack.push(3);
stack.push(0);
stack.push(9);
stack.print();
cout << "The size is: " << stack.size() << endl;
cout << "The sum is: " << stack.sum() << endl... | true |
507fead90b963e566359fb411ea87a33942b8134 | C++ | Gospodzin/edami-project | /clustering/src/EpsNeighborhood.h | UTF-8 | 1,963 | 3.171875 | 3 | [] | no_license | #ifndef _EPSNEIGHBORHOOD_H
#define _EPSNEIGHBORHOOD_H
#include "Neighborhood.h"
#include "Point.h"
template<class T>
class EpsNeighborhood : public Neighborhood<T>
{
private:
vector<double> subspacePreferenceVector;
int subspacePreferenceDimensionality;
public:
EpsNeighborhood(){}
EpsNeighborhood(T * thePoint, v... | true |
2d6e1c7934079d140900ec7f8d479536ef5c773d | C++ | wangfuli217/ld_note | /cheatsheet/ops_doc-master/Service/cfaq/example_c/std_copy/main.cpp | UTF-8 | 818 | 3.15625 | 3 | [] | no_license | #include <stdio.h>
#include <algorithm>
#include <vector>
int main(int argc, char **argv)
{
std::vector<int> v1;
int ia[] = {1, 2, 3, 4, 5};
std::vector<int> v2;
v1.resize(sizeof ia / sizeof(int)); // 这里必须保证目的verctor有足够的空间,copy不会自动增加verctor的空间
std::copy(ia, ia + 5, v1.begin()); // input_last 是最后一个元素+1的位置... | true |
98dcd49056859fddf21e767457d530c666c58995 | C++ | newmen/qt_cellularDiamondBuilder | /cellsclearer.h | UTF-8 | 369 | 2.5625 | 3 | [] | no_license | #ifndef CELLSCLEARER_H
#define CELLSCLEARER_H
#include "cellsvisitor.h"
class CellsClearer : public CellsVisitor
{
public:
CellsClearer() {}
void visitComplexCell(ComplexCell &cell);
void visitSimpleCell(SimpleCell &cell);
private:
CellsClearer(const CellsClearer &);
CellsClearer &operator= (con... | true |
848a4eeef0d41b5728d0d1d2496f734fa144eb1a | C++ | OnlyCaptain/leetcode | /1362. Closest Divisors.cpp | UTF-8 | 649 | 3.234375 | 3 | [] | no_license | #include <math.h>
#include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
vector<int> closestDivisors(int num) {
int ex = (int)sqrt(num+2);
vector<int> ans;
for (int i = ex; i > 0; i --) {
if ((num+2) % i == 0) {
ans.push_back(i);
... | true |
f53c3c7c8dd92a780f29c557c742a36ff882fb66 | C++ | GuilhermeSaito/UsingCppToGenerateJS | /main.cpp | UTF-8 | 1,055 | 3.109375 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <iomanip>
using std::ofstream;
#include "nlohmann/json.hpp"
using json = nlohmann::json;
void createHTML();
int main()
{
createHTML();
return 0;
}
void createHTML()
{
ofstream out("func.js", std::ios::trunc);
json j;
j["pers... | true |
b5dd703dd5e71567be67401d15b86236d1cea0be | C++ | cuxxie/mycjam | /cj2017qualC.cpp | UTF-8 | 1,645 | 3 | 3 | [] | no_license | //codejam2017qualificationC
#include <iostream>
#include <math.h>
#include <vector>
#include <stdio.h>
#include <time.h>
#define LOG2(X) ((unsigned) (8*sizeof (unsigned long long) - __builtin_clzll((X)) - 1))
using namespace std;
void calculate(unsigned long long n, unsigned long long k, unsigned long long ... | true |
364dd16de615a14673afa2b2881bd09cd662f85c | C++ | wengsht/USACO-Acceptor | /section4/section4.1/1.cpp | UTF-8 | 2,497 | 2.9375 | 3 | [] | no_license |
/*
ID: wengsht1
LANG: C++
TASK: cryptcow
*/
#include <iostream>
#include <memory.h>
#include <fstream>
#include <string>
using namespace std;
const int MAX = 100;
const int MOD = 131071;
const int LEN = 47;
const string plaintext = "Begin the Escape execution at the Break of Dawn";
ifstream fin("cryptcow.in");
ofst... | true |
36a1a574cfb827a6049b035468f49c63595618cb | C++ | elfmedy/vvdn_tofa | /mdk_release_18.08.10_general_purpose/mdk/common/components/kernelLib/MvISP/kernels/localTM/shave/src/cpp/localTM.cpp | UTF-8 | 2,303 | 2.515625 | 3 | [] | no_license | ///
/// @file localTM.cpp
/// @copyright All code copyright Movidius Ltd 2013, all rights reserved.
/// For License Warranty see: common/license.txt
///
/// @brief Applies a tone mapping function to the Luma channel.
/// The mapping function is based on both the original Luma value,
/// ... | true |
90bb40b874a8068db205420dba5ed91973549d20 | C++ | joemlevin/LevinJoseph_CSC17a_43950 | /Hmwk/Assignment 4/Assignment 4/Circle.h | UTF-8 | 491 | 2.78125 | 3 | [] | no_license | /* File: Circle.h
* Author: Joseph Levin
* Assignment: C++ Assignment 4 - Spring 2015 43950
* Created on May 11, 2015, 3:15 PM
*/
#ifndef CIRCLE_H
#define CIRCLE_H
class Circle{
private:
float radius;
const static float pi = 3.14159f;
public:
Circle();
Circle(float);
... | true |
ca30bdc3a5d2fc27f61e6bda1a3d8be055c4d737 | C++ | Aehcaoiggc/notes-of-learning-with-luogu | /主题库/入门/P1047 [NOIP2005 普及组] 校门外的树.cpp | UTF-8 | 482 | 2.65625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int a[10001];
int main()
{
int l, m;
cin >> l >> m;
for (int i = 0; i <= l; ++i)
{
a[i] = 1;
}
int x, y;
for (int i = 1; i <= m; ++i)
{
cin >> x >> y;
for (int j = x; j <= y; ++j)
{
a[j] = 2;
}
... | true |
8751cd3c2284cea14835d14115547b71062c5f5f | C++ | joscame/Bingo | /bingogame.h | UTF-8 | 1,548 | 2.6875 | 3 | [] | no_license | #ifndef BINGOGAME_H
#define BINGOGAME_H
#include <vector>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include "singing_square.h"
class BingoGame
{
private:
size_t numero_cartones;
size_t contador_de_impresos = 0;
size_t winners = 0;
std::string name;
std::vector < std::string > words;
std::... | true |
4af76319b84d349639a496d4835d624ef8857e7a | C++ | Ronak786/helloworld | /third_party/algorithm/tree/findMaxLen/max_len5.cpp | UTF-8 | 1,879 | 3.421875 | 3 | [] | no_license | #include<iostream>
using namespace std;
typedef struct BiTNode
{
BiTNode *left;
BiTNode *right;
}BiTNode, *BiTree;
int maxDis = 0;
void createTree(BiTree &root)
{
BiTree left1 = new(BiTNode);
BiTree right1 = new(BiTNode);
left1->left = NULL;
left1->right = NULL;
right1->left = NULL;
r... | true |
d7dbb34640314165614c0cbd5fb38deab8ad7dc9 | C++ | kinochen/MultiTrigger | /multitrigger/libraries/ICGroup.cpp | UTF-8 | 2,200 | 2.640625 | 3 | [] | no_license | //
// ICGroup.cpp
// ICGroup
//
// Created by kinochen on 12/3/19.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#include "ICGroup.h"
#include "Arduino.h"
ICGroup::ICGroup(int latch, int clock, int data){
latchPin = latch;
clockPin = clock;
dataPin = data;
}
void ICGroup::setu... | true |
cf3fa71a5e549f7246dea1bfa93020e9f1ae20ac | C++ | Liusihan-1/c100 | /兔子繁殖问题.cpp | UTF-8 | 339 | 2.96875 | 3 | [] | no_license | #include<stdio.h>
long fun(int month)
{
if(month==1||month==2)
{
return 1;
}
else
{
return fun(month-1)+fun(month-2);
}
}
int main()
{
int n,sum=0,mon=0;
scanf("%d",&n);
do
{
mon++;
if(mon==1||mon==2)
{
sum=1;
}
else
{
sum=fun(mon-1)+fun(mon-2);
}
}
while(sum<n);
printf("%d\n",mo... | true |
bdb2965d41be1b930daecc2d4d78c956fe4e7b91 | C++ | KartikDholakia/CP-KartikDholakia | /Contests/FB HackerCup 2020/Qualification Round/Problem A Travel Restrictions.cpp | UTF-8 | 1,545 | 2.609375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef short int st;
#define mod 1000000007
#define MAX 1000001
//Problem A: Travel Restrictions
void solve() {
st n, i, j;
cin >> n;
vector<char> I(n);
vector<char> O(n);
vector<vector<char>> ans;
for (i = 0; i < n; i++) {
cin >> I... | true |
8b5a6fb82fd4d0ce119b1dd0f883502d86fa7c5c | C++ | ertugrulaypek-zz/METU-Computer-Engineering | /CENG213-Data Structures/HW2/title_comparator.hpp | UTF-8 | 366 | 2.671875 | 3 | [
"MIT"
] | permissive | #ifndef _title_h__
#define _title_h__
#include "book.hpp"
#include <cstring>
class TitleComparator
{
public:
bool operator( ) (const Book::SecondaryKey & key1,
const Book::SecondaryKey & key2) const
{
//if key1 is less than key2 wrt specifications
//return true
//oth... | true |
06074e67f7fb4ad68c9437e271bb3fa8a009f0f1 | C++ | AndroidHot/CppPrimer5 | /ch17/ex17_35.cpp | UTF-8 | 271 | 2.5625 | 3 | [] | no_license | #include <cmath>
#include <iostream>
int main(int argc, char const *argv[]) {
std::cout << std::showbase << std::hexfloat << std::uppercase << std::sqrt(2)
<< std::noshowbase << std::defaultfloat << std::nouppercase
<< std::endl;
return 0;
}
| true |
e2ecc12da18f59d332648b93881b39ea9439cc6d | C++ | ArturoBurela/DataStructures | /LinkedLists/test_vector_list.cpp | UTF-8 | 850 | 3.53125 | 4 | [] | no_license | #include<iostream>
#include<string>
#include "LinkedList.h"
#include "Vector3D.h"
void listTest();
Vector3D vectorAddition(const LinkedList<Vector3D> & vector_list);
int main(){
listTest();
return 0;
}
void listTest(/* arguments */) {
Vector3D result;
//Create the list that holds the vectors
LinkedList<Vec... | true |
605ee17bfabec94a977742acc37fd6fcc0086831 | C++ | solomonwzs/leetcode | /cpp/src/recover_binary_search_tree.cpp | UTF-8 | 1,160 | 3.0625 | 3 | [] | no_license | #include <vector>
#include "leetcode.h"
using namespace std;
using namespace leetcode;
#define xor_swap(_a, _b) do{\
_a=_a xor _b;\
_b=_a xor _b;\
_a=_a xor _b;\
} while(0)
class Solution{
public:
void recoverTree(TreeNode *root){
vector<TreeNode *> sort;
inorder_traversal(root, sort);
int a=-... | true |
6b4e982938dab80ddb5624f6a0f2e92e8102e3f2 | C++ | KhanShaheb34/Solved-OJ-Problems | /LightOJ/1028 - Trailing Zeroes (I).cpp | UTF-8 | 1,316 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
const ll MAX_SIZE = 1000010;
vector<ll> isprime(MAX_SIZE, true);
vector<ll> primes;
vector<ll> SPF(MAX_SIZE);
v... | true |
2f7557d9c5c347fc11bf768988588c5c2446f738 | C++ | lcsszz/Samples | /build/lcore/Sort.h | UTF-8 | 4,992 | 2.796875 | 3 | [] | no_license | #ifndef INC_LCORE_SORT_H__
#define INC_LCORE_SORT_H__
/**
@file Sort.h
@author t-sakai
@date 2011/12/31 create
*/
#include "lcore.h"
namespace lcore
{
template<class T>
struct SortCompFuncType
{
typedef bool(*SortCmp)(const T& lhs, const T& rhs);
};
template<class T>
bool less(const T... | true |
282d78a74aabfe18d61121bf8bbb2ce3e80d9ffd | C++ | itewqq/myCpp | /math/所有因子之和,快速幂溢出,素因子分解,逆元.cpp | UTF-8 | 1,916 | 2.671875 | 3 | [] | no_license | 第一个错误是没有分清每一步里是对谁取模,实际上利用逆元的时候是对mb取模,而其他运算的时候则是对MOD取模,这个是第一个错误
另外,需要对取模的结果加上模(为什么?
第二个就是没想到快速幂会中间结果会超出int64,因为这时候的模是mb,而mb可能相当大,即mb的平方是有可能超出int64的
记住模值超过int的话平方快速幂就可能超过int64!
此时用了一种神奇的类似于快速幂的二分乘法算法,解决了
//poj1845
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<vec... | true |
9fc44ec92a4b336443a307a7084c900d0966dd74 | C++ | 40174030/AGE-Week-1-Project | /src/SettingsMenu.cpp | UTF-8 | 3,473 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | #include "stdafx.h"
#include "SettingsMenu.h"
#include "Game.h"
SettingsMenu::MenuOptions SettingsMenu::Show(sf::RenderWindow& window)
{
selection = Back_to_Main;
sf::Texture image;
if (image.loadFromFile("res/img/Settings_Temp.png") != true)
{
throw std::invalid_argument("FAILED TO LOAD: SettingsMenu");
}
... | true |
328d19f7cc42edb2f8d21b5775e0940d8d7fa66f | C++ | CyberSmart02/competitive-programming | /Interview Bit/Spiral Order Matrix II.cpp | UTF-8 | 589 | 2.984375 | 3 | [] | no_license | vector<vector<int> > Solution::generateMatrix(int n) {
vector<vector<int>> sol;
for(int i=0;i<n;i++)
{
vector<int> arr(n,0);
sol.push_back(arr);
}
int val=1;
for(int r1=0,r2=n-1,c1=0,c2=n-1;r1<=r2;)
{
for(int i=c1;i<=c2;i++)
sol[r1][i]=val+... | true |
fa7b2d4fe06c0a6c8974c8a0a5893ab3f59eac17 | C++ | abufarhad/Programming | /AAA (CODE) Programming tools(Fuad)/dfs_component.cpp | UTF-8 | 651 | 2.84375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool vis[100];
vector<int>v[100];
void dfs(int source)
{
if(vis[source]==false){
vis[source]=true;
for(int i=0;i<v[source].size();i++){
dfs(v[source][i]);
}
}
}
int main()
{
int n_node,n_edge;
cin>>n_node>>n_edge;
in... | true |
a5d291c7326ad172ab3a294847de665c6c60b16f | C++ | SnaebjornB/MainAssignment | /MainAssignment/include/Services/salesperson_service.h | UTF-8 | 942 | 2.515625 | 3 | [] | no_license | #ifndef SALESPERSON_SERVICE_H
#define SALESPERSON_SERVICE_H
#include <vector>
#include <iostream>
#include <string>
#include "vectors.h"
#include "salesperson_repo.h"
#include "pizza.h"
#include "orders.h"
#include "InvalidNameEx.h"
#include "InvalidPhonenumberEx.h"
using namespace std;
class Salesperson_service
{
... | true |
9d18a96ac1be2d9cb5b90fb3704044e981ba11c8 | C++ | DengHaoyu/OI | /P4147.cpp | UTF-8 | 1,523 | 2.53125 | 3 | [] | no_license | //
// Created by dhy on 19-2-13.
//
#include <cstring>
#include <cstdio>
int read(){
int x = 0,f = 1;
static char c = getchar();
while(c<'0'||c>'9'){ if(c=='-')f = -1;c = getchar(); }
while(c>='0'&&c<='9'){ x = (x<<1)+(x<<3)+c-'0';c = getchar(); }
return x*f;
}
const int MAXN = 1010;
int up[MAXN][MA... | true |
d95459e73bc3dfbe106f8e0fa503f4eca7c83a49 | C++ | HekpoMaH/Olimpiads | /Shumen AiB/nadahva6to/g.cpp | UTF-8 | 541 | 2.8125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct forma{
int sum;
char name;
};
forma f[9];
bool cmp(forma fi,forma se){
return fi.sum<se.sum;
}
int main(){
int a,b,c;
cin>>a>>b;
f[1].sum=a+b;
f[1].sum*=2;
f[1].name='P';
cin>>a>>b>>c;
f[2].sum=a+b+c;
f[2].name='T';
cin>>a;
f[3].... | true |
924cda3682367ec1cd99632cb072745d3245542d | C++ | Li-Crazy/-Image-Processing- | /9/2d_dft.cpp | UTF-8 | 1,341 | 2.859375 | 3 | [] | no_license | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define M 128
#define N 128
#define Maxgray 255
double Pi;
struct Complex
{
double real;
double img;
};
void setimage(int data[M][N])
{
srand((int)time(0));
for(int i=0;i<M;i++)
for(int j=0;j<N;j++)
data[i][j]=rand()%Maxgray;
}
void ... | true |
181543b237978d4ba26d41b0bf6623d72343e7f1 | C++ | jqk6/CodeArchive | /Kattis/racingalphabet.cpp | UTF-8 | 602 | 2.671875 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
string ring="ABCDEFGHIJKLMNOPQRSTUVWXYZ \'";
double dis(char a,char b){
double aa=ring.find(a),bb=ring.find(b);
if(aa>bb)swap(aa,bb);
return min(bb-aa,aa+28-bb)/28*4*M_PI;
}
int main(){
ios_base::sync_with_stdio(0);
cin... | true |
018b86ea84eb0e217cb8faed2bced38818a8d0c9 | C++ | rcore-os-infohub/ossoc2020-VitalyAnkh-daily | /Notebook/cpp_primer/ch5/ex_5_23_add_and_divide_tuned.cpp | UTF-8 | 460 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <stdexcept>
int main()
{
int a, b;
std::cout << "请输入两个数字: " << std::endl;
std::cin >> a >> b;
int q;
// try
// {
// 不要写成 b = 0
if (b == 0)
{
throw std::runtime_error("The second argument must not be 0!");
}
else
{
q = a / b;
... | true |
ab95f5bb26cc1e52d79abefde12ea4abd049a06a | C++ | zxy0728/gitProject | /BinaryTree.cpp | UTF-8 | 5,542 | 3.421875 | 3 | [] | no_license | #include <iostream> //树
#include <cstring>
#include <stack>
#include <queue>
using namespace std;
int i=0;
struct BinaryNode
{
int data;
BinaryNode *left;
BinaryNode *right;
};
class BinaryTree
{
private:
BinaryNode *root;
public:
explicit BinaryTree();
BinaryNode * createBTree();
virtual ~BinaryTr... | true |
9bc4227f6eb0a1e3dc2e208205e9b77967513ae6 | C++ | lpc0503/UVA | /UVA1610/UVA1610.cpp | UTF-8 | 704 | 2.578125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define PROBLEM "1610"
#define String string
int main(void){
#ifdef DBG
freopen(PROBLEM ".in", "r", stdin);
freopen(PROBLEM ".out", "w", stdout);
#endif
int n;
String str[1005];
String str1, str2;
while(scanf("%d", &n) && n){
for(int i = 0 ; i < n ; i++)
... | true |
7b93e78fef64c4455ec91b3281f85d37b7879c0f | C++ | Eunomia2016/EunomiaTree | /persistent/log_test.cc | UTF-8 | 797 | 2.578125 | 3 | [] | no_license | #include "log.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "log.h"
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define COUNT 4*4096
int main() {
char * path = "test.txt";
printf("path %s... | true |
b8445fe96292df4eff4de85863f905c4a3adddbe | C++ | xih108/LeetCode | /112.cpp | UTF-8 | 1,495 | 4 | 4 | [] | no_license | // 112. Path Sum
// Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
// Note: A leaf is a node with no children.
// Use a queue, each element is a pair of TreeNode and the updated sum.
// Everytime get the front of th... | true |
f1935d9e8d90892842faec513c915ea8d54d2588 | C++ | jeevita06/LeetCode | /array/Valid Mountain Array.cpp | UTF-8 | 282 | 2.734375 | 3 | [] | no_license | /*
https://leetcode.com/problems/valid-mountain-array/
*/
class Solution {
public:
bool validMountainArray(vector<int>& A) {
int n=A.size(),i=0,j=n-1;
while(i+1<n&&A[i]<A[i+1]) ++i;
while(j>0&&A[j-1]>A[j]) --j;
return i>0&&i==j&&j<n-1;
}
};
| true |
70a1ce35c964e466cd03c295aff6bcb98d7a0e76 | C++ | ZhenyingZhu/ClassicAlgorithms | /src/CPP/src/leetcode/RotateArray.cpp | UTF-8 | 1,087 | 3.65625 | 4 | [] | no_license | /*
* [Source] https://leetcode.com/problems/rotate-array/
* [Difficulty]: Easy
* [Tag]: Array
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// [Solution]: Use O(k) space
// [Corner Case]:
class SolutionCopyToTmp {
public:
void rotate(vector<int>& nums, int k) {
in... | true |
805704e4888100ff12aba8f184188785bc2ca3ee | C++ | mdemirst/Model-Predictive-Control | /src/vehicle.h | UTF-8 | 653 | 2.703125 | 3 | [] | no_license | #ifndef VEHICLE_H
#define VEHICLE_H
#include "Eigen-3.3/Eigen/Core"
class Vehicle {
public:
Vehicle();
Vehicle(const double lf);
void Drive(const double dt);
void Drive2(const double dt);
double& X();
double& Y();
double& Psi();
double& V();
double& Steer();
double& Acc();
double& Cte();
dou... | true |
f7b65d579b8f80a16f2bb45955a62bac9cab77e3 | C++ | toha993/my-code | /diehard3.cpp | UTF-8 | 340 | 2.78125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
int main()
{
int t;
cin>>t;
while(t--)
{
int a,b,c,d;
cin >> a >> b >> c;
if(a<b)
swap(a,b);
d=gcd(a,b);
if(c<=a && c%d==0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
... | true |
782021fff0f29e9bab92d3ebf159c9014ef41150 | C++ | vkurbatov/mcu_remake | /liblargo/core/media/video/video_frame_rect.h | UTF-8 | 2,682 | 2.625 | 3 | [] | no_license | #ifndef VIDEO_FRAME_RECT_H
#define VIDEO_FRAME_RECT_H
#include "video_frame_point.h"
#include "video_frame_size.h"
namespace core
{
namespace media
{
namespace video
{
template<typename T>
struct frame_rect_base_t
{
frame_point_base_t<T> point;
frame_size_base_t<T> size;
frame_rect_base_t(const f... | true |
89ef07edb3eca42d5137f0df94bf18fbffc6847a | C++ | yinyanghu/OI | /OJ/usaco/cpp/msquare.cpp | UTF-8 | 3,146 | 2.703125 | 3 | [] | no_license | /*
ID:oifox20071
LANG:C++
PROG:msquare
*/
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
const int n = 8;
const int limitsize = 50000;
ifstream fin("msquare.in");
ofstream fout("msquare.out");
struct queuenode
{
int num[n], len, father;
char last;
} queue[limitsize];
... | true |
ef65a31c3304fd5bb59d1f0c4496246543c6453b | C++ | 2swap/AbStrat | /walletbox.cpp | UTF-8 | 850 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string>
#include <random>
using namespace std;
const int BOXES = 100;
int boxes[BOXES];
void randomize(){
for(int i = 0; i < BOXES; i++) {
boxes[i]=-1;
}
for(int i = 0; i < BOXES; i++) {
int r = rand()%BOXES;
while(true)... | true |
317b414aac20ecdbb91605b5e6492eb3db590ada | C++ | jzhang1901/lintcode | /solutions/586. Sqrt(x) II.cpp | UTF-8 | 883 | 3.671875 | 4 | [] | no_license | /*
Description
Implement double sqrt(double x) and x >= 0.
Compute and return the square root of x.
You do not care about the accuracy of the result, we will help you to output results.
Have you met this question in a real interview?
Example
Given n = 2 return 1.41421356
*/
class Solution {
public:
/*
... | true |
949c9c3f54f360f62a63c2985c9144154f9bb95a | C++ | isliulin/JFC-Tools | /Atelier Courrier/Jmtfr03/JMTFR03/Source/JMTFR03Logs.cpp | ISO-8859-1 | 617 | 2.578125 | 3 | [] | no_license | //
// Fichier: JMTFR03Logs.cpp
// Auteur: Sylvain SAMMURI
// Date: 02/12/2003
//
// on inclut les dfinitions ncessaires
#include "JMTFR03Logs.h"
////////////////////
// les constructeurs
JMTFR03Logs::JMTFR03Logs()
{
// on ne fait rien
}
JMTFR03Logs::JMTFR03Logs(const JMTFR03Logs & Source)
{
// on ne fait rien... | true |
e3cf6565a91cc9059c3698007d9198f022a53f2e | C++ | wooken/cpp_practice | /split/main.cpp | UTF-8 | 2,833 | 3.90625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <algorithm> // find_if
using std::cin;
using std::cout;
using std::endl;
using std::find_if;
using std::string;
using std::vector;
// split_func1() code ---------------------------------------------------------
vector<string> split_func1_helper(const st... | true |
d01be2200095018e2e4ee4f7e2d9120b8c396542 | C++ | sh999/Cplusplus-Study-Snippets | /PointersToPointers/PointersToPointers/main.cpp | UTF-8 | 471 | 3.421875 | 3 | [] | no_license | /*
Create pointers to pointers (and beyond)
*/
#include <iostream>
using namespace std;
int main(){
int a = 20;
int &b = a;
int *p = &a;
int **p2 = &p;
int ***p3 = &p2;
cout << "a = " << a;
cout << "\nb = " << b;
cout << "\np = " << p;
cout << "\nvalue pointed by p = " << *p;
... | true |
0769f748aa6b224830bc79f5f626e98384ca38f8 | C++ | walkccc/LeetCode | /solutions/0008. String to Integer (atoi)/0008.cpp | UTF-8 | 596 | 3.125 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int myAtoi(string s) {
trim(s);
if (s.empty())
return 0;
const int sign = s[0] == '-' ? -1 : 1;
if (s[0] == '+' || s[0] == '-')
s = s.substr(1);
long num = 0;
for (const char c : s) {
if (!isdigit(c))
break;
num = num * 10 + (c - '0'... | true |
1ca3ee5a05dcae11177fd2a0d4fb7184232cf0bd | C++ | doraneko94/AtCoder | /ABS/049C.cpp | UTF-8 | 744 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main() {
string S;
cin >> S;
reverse(S.begin(), S.end());
for (int i=0; i<4; ++i) reverse(divide[i].begin(), divide[i].end());
bool can = true;
int ... | true |
bb6610f65a79204c5fe3b1431da7ba2b98b557d0 | C++ | JudsonSS/Compiladores | /Labs/Lab08/symtable.h | UTF-8 | 398 | 3.015625 | 3 | [
"MIT"
] | permissive | #include <unordered_map>
#include <string>
using std::unordered_map;
using std::string;
// modelo para símbolos
struct Symbol
{
string var;
string type;
};
// tabela de símbolos
class SymTable
{
private:
unordered_map<string,Symbol> table;
SymTable * prev;
public:
SymTable();
SymTable(SymTable ... | true |
2edc18695269a404221b705a0e7c657fc5d7391b | C++ | dtbinh/M1S2 | /Prog3D/TP1/Point.cpp | UTF-8 | 1,496 | 3.484375 | 3 | [] | no_license | #include "Point.h"
Point::Point(void){
x = 0;
y = 0;
z = 0;
}
Point::Point(long double x1, long double y1, long double z1){
x = x1;
y = y1;
z = z1;
}
Point::Point(const Point& p){
x = p.x;
y = p.y;
z = p.z;
}
Point::~Point(void){
}
long double Point::getX(void) const{
return x;
}
long double Point::get... | true |
c891363db04116e10309e0cd382cd73202f36a71 | C++ | tudinfse/intel_mpx_explained | /src/parsec/raytrace/src/RTTL/common/MapOptions.cxx | UTF-8 | 20,022 | 2.921875 | 3 | [
"GPL-3.0-only",
"GPL-2.0-only",
"MIT"
] | permissive | #include <cstring>
#include "RTTL/common/MapOptions.hxx"
namespace RTTL {
/// Instantiates MapOptions entry which is visible in any file which includes MapOptions.hxx.
/// \note The preferred way to parse command line parameters is to add them to options as
/// <b>options.parse(argc-1, argv+1);</b>
/// In this cas... | true |
96a8b3fa7a5cfb124301c819c46299e7ec50031c | C++ | tomjn/ntai | /AI/NTai/Helpers/CWorkerThread.h | UTF-8 | 7,669 | 2.71875 | 3 | [] | no_license | #ifndef CWORKERTHREAD_H_INCLUDED
#define CWORKERTHREAD_H_INCLUDED
/*class CWorkerThread{// : public IModule{
public:
CWorkerThread();//{workerthreads = 0;}
~CWorkerThread();
void NextThread();
bool HasNext();
void operator()();
//void RecieveMessage(CMessage &message){}
//bool Init(boost::s... | true |
faaef8824d633ec9a563f02f3c4a38457ea6a077 | C++ | AkasLiu/KoaliEngine | /KoaliEngine/src/KoaliMaterial.cpp | UTF-8 | 4,034 | 2.78125 | 3 | [] | no_license | #include "../include/KoaliMaterial.h"
KoaliMaterial::~KoaliMaterial(void)
{
}
KoaliMaterial::KoaliMaterial()
{
// Set a default material (white)
ZeroMemory(&m_Material, sizeof(D3DMATERIAL9));
SetDiffuseColor(255, 255, 0);
SetAmbientColor(255, 255, 0);
//SetSpecularColor(255,255,255);
//SetEmissiveColor(0,0,0);
... | true |
a6a2ad56c587f7d1a6acdbf327fd9b973c3339be | C++ | heavenlybilly/olympiad | /P/acmp/Решение олимпиадных задач/2. Целочисленная арифметика/Числа Смита.cpp | UTF-8 | 1,265 | 3.34375 | 3 | [] | no_license | /*
* ------------ ЧИСЛА ФИБОНАЧЧИ - 3 ------------
& целые числа
~ факторизация ~ простые_числа
? ничего сложного, просто нужно прочитать внимательно условие и обратить внимание на то, что числом Смита может быть только
? простое число.
*/
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
usi... | true |
83389ab23f569d8a1f37abd12061a82ee7ef780c | C++ | NiveditaRashmi/Programming_Basics | /C++ Basics/Four - Constant&Literals.cpp | UTF-8 | 530 | 3.484375 | 3 | [
"MIT"
] | permissive | /*
CONSTANTS - Value remains the same throughout the program
LITERALS - Value assigned to each constant variable.
Constants can be defined in two ways:
a) using #define preprocessor directive
b) using const keyword.
*/
#include<iostream>
using namespace std;
#define val 10
#define charVal 'G'
#define floatVal 3.4
... | true |
e969993484c892fac70c1c0049b575bab80da777 | C++ | zschaefle/CS325_final_project | /EPFleury.cpp | UTF-8 | 3,849 | 3.421875 | 3 | [] | no_license |
#include "EPFleury.hpp"
EPFleury::EPFleury() {
count = 0;
adjacent = new std::list<int>[0];
path = new std::vector<int>;
}
EPFleury::EPFleury(int count){
this->count = count;
adjacent = new std::list<int>[count];
path = new std::vector<int>;
}
EPFleury::~EPFleury() {
delete[] this->adjacent;
delete this->pa... | true |
3ef763fe99f857c5ea44c62f9d2feb0ca942b2c1 | C++ | ShivamNegi/Coding-Practice | /CodeChef/Easy/adjlistusingstl.cpp | UTF-8 | 478 | 3 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int x, y, n;
cout<<"How many edges?";
cin>>n;
vector< vector< pair<int, int> > > g(n);
for(int i = 0; i < n; i++)
{
cin>>x>>y;
g[x].push_back(make_pair(y, 1));
}
for(int i = 0; i < g.size(); i++)... | true |
3255b33e79a122dc687a297d5dc87cdb2db4cfc4 | C++ | Lucky2307/DrawLine | /DrawLine/src/Main.cpp | UTF-8 | 7,960 | 2.578125 | 3 | [] | no_license | #include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include "Shader.h"
#include "Line.h"
#include "vendor/imgui/imgui.h"
#include "vendor/imgui/imgui_impl_opengl3.h"
#include "vendor/imgui/imgui_impl_glfw.h"
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput... | true |
7e60b93cb11140f85cc518e0f4bc0a9b219033fb | C++ | Rosein/SnakeGameNokia | /ut/TestSnake.cpp | UTF-8 | 1,572 | 3.21875 | 3 | [] | no_license | #include <gtest/gtest.h>
#include "../include/Snake.hpp"
class SnakeTest : public ::testing::Test
{
protected:
// SnakeTest(){}
// ~SnakeTest(){}
// void SetUp(){}
Snake snake{100,100};
};
TEST_F (SnakeTest, newSnakeStartingPosition)
{
coord p {100, 100};
EXPECT_EQ( p , snake.getHead());
}
T... | true |
2e28e1507247034f403ebfc03615bc04c9b8a35d | C++ | Surflyan/Code-Set | /C++/work/main.cpp | GB18030 | 1,636 | 2.96875 | 3 | [] | no_license | //Ϊļ飬
#include <iostream>
#include <fstream>
#include"Curve3D.h"
using namespace std;
int main()
{
Point3D p1(1, 2, 3),p2(2, 3, 4), p3(4, 5, 6), p4(5, 6, 7), p5(6, 7, 8), p6(7, 8, 9), p7(8, 9, 10);
Curve3D L1(0,0,0);
Curve3D L2, L3, L4, L5, L6, L7;
cout << "_________________"<<endl;
L2 = L1 + ... | true |
3ca6838f4c4821d460d191a837be39d7b3a8a390 | C++ | alexandraback/datacollection | /solutions_5631989306621952_0/C++/x7903/A.cpp | UTF-8 | 518 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>'
#include <fstream>
using namespace std;
string s,ans;
int t;
int main()
{
ofstream fp("A.out");
scanf("%d",&t);
for (int cas=1;cas<=t;++cas)
{
cin>>s;
ans=s[0];
f... | true |
20f4de6f3fedc5b024ad7c1981f5bf65d0b35a2b | C++ | Balzu/Parallel-Jacobi | /jacobi_seq.cpp | UTF-8 | 7,062 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include <ff/farm.hpp>
using namespace ff;
void init_rand_matrix(std::vector<std::vector<float>>& a, int n, int max, bool diag_dominant){
if (diag_dominant == false){ // Build a completely random matrix
for (int i=0; i<n ; i++){
for (i... | true |
252291eb0732b08eecc72d3390e421f98f3066ca | C++ | lriki/Lumino.Core | /include/Lumino/IO/File.h | UTF-8 | 2,850 | 3.203125 | 3 | [
"Zlib",
"MIT"
] | permissive | /**
@file File.h
*/
#pragma once
#include "../Base/RefObject.h"
#include "../Base/String.h"
#include "PathName.h"
#include "FileStream.h"
LN_NAMESPACE_BEGIN
/**
@brief ファイル操作を行うクラスです。
*/
class File
: public Stream
{
public:
/**
@brief ファイル名を指定してインスタンスを初期化します。
@details このコンストラクタは、実際にファイルストリームを開きません。
... | true |
1c26d3d1764badcb403ace0e8608bc4f7938a346 | C++ | dream-overflow/o3d | /include/o3d/core/radixsort.h | UTF-8 | 2,288 | 2.671875 | 3 | [] | no_license | /**
* @file radixsort.h
* @brief Thanks to Pierre Terdiman for its revisited RadixSort.
* @author Frederic SCHERMA (frederic.scherma@dreamoverflow.org)
* @date 2002-03-04
* @copyright Copyright (c) 2001-2017 Dream Overflow. All rights reserved.
* @details
*/
#ifndef _O3D_RADIXSORT_H
#define _O3D_RADIXSORT_H
#... | true |
4063585f7333cc9f26250b981a5bbe52cd62ab13 | C++ | dotdecimal/open-cradle | /cradle/tests/geometry/angle.cpp | UTF-8 | 992 | 2.71875 | 3 | [
"MIT"
] | permissive | #include <boost/assign/std/vector.hpp>
#include <cradle/geometry/angle.hpp>
#define BOOST_TEST_MODULE angle
#include <cradle/test.hpp>
using namespace cradle;
using namespace boost::assign;
BOOST_AUTO_TEST_CASE(angle_test)
{
angle<double,radians> r(7 * pi / 2);
angle<double,degrees> d(r);
d.normalize();
... | true |
8e6b0d3ffa3e2b9548a2590395079a03aad95e11 | C++ | jonathan-j-lee/pie-central-fork | /smart-devices/SmartDevice/src/Hub.hpp | UTF-8 | 2,480 | 3.25 | 3 | [] | no_license | #ifndef HUB_H_
#define HUB_H_
#include <stdint.h>
#include "message.hpp"
#include "SmartDevice.hpp"
typedef uint8_t pin_t;
template <typename T>
class Spoke {
protected:
pin_t pin;
T value;
public:
Spoke(pin_t pin) {
this->pin = pin;
}
void setup(void) {
pinMode(this->pin, INPUT);... | true |
afe6e772c878d9fa7a94437bbea545fe4c15c1a0 | C++ | perfcv/LearnAndTry | /leetcode/sword/链表-从尾到头打印链表.cpp | UTF-8 | 1,179 | 3.28125 | 3 | [] | no_license | //page 58
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
struct ListNode
{
int val;
struct ListNode *next;
ListNode(int x) : val(x), next(NULL)
{
}
};
// vector<int> printListFromTailToHead(ListNode *head)
// {
// if (head != nullptr)
// {
// if (head-... | true |
1e85866dc32067010373f9adb6beaa8ab715ce90 | C++ | kyo504/design-pattern | /20160328/20160328/3_casting.cpp | UHC | 1,141 | 3.625 | 4 | [] | no_license | // 3_ij.cpp
#include <iostream>
using namespace std;
// 1. C ij ̴̼. ( ְ ִ)
// 2. C++ 4 ij Ѵ.
// - static_cast: void* -> ٸ Ÿ Ǵ ִ ijø
// - reinterpret_cast: ؼ (÷ ٸ ֱ ؾ Ѵ.)
// - const_cast: ü , ֹ(volitile) ϴ 뵵θ
// - dynamic_cast: RTTI , ٿ ij 뵵
/*
volitile
ü ϱ ؼ
*/
int main()
{
const int c = 1... | true |