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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1e46d26eb7e4cf83cb11d677e1f51f8e7cc61edc | C++ | Sntai20/CPSC-5910-Data-Structures | /Week1/Lab/Solution/date.h | UTF-8 | 436 | 2.984375 | 3 | [] | no_license | #ifndef DATE_H
#define DATE_H
#include <string>
class Date {
public:
Date(int month, int day, int year); // constructor
std::string GetMonthName() const;
int GetDay() const;
int GetYear() const;
int GetDayInYear() const; // between 1 and 365/366
std::string GetDisplayForm... | true |
57576b01f6801da887caf09681bc457c4359f222 | C++ | GENTLEMAN009/Codeforce-Problem-Solve | /691A.cpp | UTF-8 | 491 | 2.8125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int n, a[10000], i;
while(cin>>n)
{
int cnt = 0;
for(i=0; i<n; i++)
{
cin>>a[i];
if(a[i] == 0)
{
cnt++;
}
}
if(n == 1 && a[0] == 1)
{
cout<<"YES"<<endl;
}
else if(n == 1 && a[0] ... | true |
37efe76c6368a82b621a6f006b879f099dec6ab4 | C++ | diasYuri/Data_Structures-01 | /Matriz/main.cpp | UTF-8 | 1,635 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include "matrix2d.h"
#include "matrixtritop.h"
#include "matrixsimetrica.h"
#include "matrixantisimetrica.h"
#include "matrixtridiag.h"
using namespace std;
int main()
{
/*int n = 5;
MatrixTriDiag m(n);
for(int l=0; l<n; l++)
{
for(int j=0; j<n; j++)
... | true |
dcf5cd7bd777672e2631c038141e1c05f3c9c656 | C++ | BaldrLector/PAT | /Advanced/1057. Stack (30).cpp | UTF-8 | 2,791 | 3.484375 | 3 | [] | no_license | /*1057. Stack (30)
时间限制
150 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Pop (deleting the top element). Now... | true |
c04764ba045bc6fea8a618b220342c3812f81bec | C++ | RitchieLab/pMDR | /src/pMDR/pBioComboGenerator.cpp | UTF-8 | 1,758 | 2.6875 | 3 | [] | no_license | //pBioComboGenerator.cpp
#include "pBioComboGenerator.h"
namespace mdr{
///
/// For sending combo parameters. For the biofilter reading, only need
/// the current index to get the next set from.
/// @param node
/// @param srParameters
///
void pBioComboGenerator::SendParameters(int node, int srParameters){
unsi... | true |
02dc35f15709ffe2b96ddd44afc10de2499f9dc1 | C++ | sergarb1/Competitive-Programming-Solved-Problems | /ACM-UVA/10142/10142.cpp | UTF-8 | 2,102 | 2.546875 | 3 | [] | no_license | #include<iostream>
#include<sstream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
int votos[25];
int eliminado[25];
char nombre[25][90];
int papeletas[1500][25];
int i,j;
int ntest;
int ncand;
char temp;
char linea[2000];
cin >> ntest;
for(int x=0;x<ntest;x++)
{
cin >> ncand... | true |
70c61bc69da85bb2121e18ef50ae61f3ea1530b9 | C++ | MKGAURAB/30-Day-LeetCoding-Challenge | /day-7-count-elements.cpp | UTF-8 | 724 | 3.046875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Solution
{
int arr[1500];
public:
int countElements(vector<int> &inp)
{
memset(arr, 0, sizeof arr);
for (auto a : inp)
arr[a] = 1;
return count_if(begin(inp), end(inp), [&](int const &num) { return arr[num + 1]; });
... | true |
4dd0a15c5e3a34eb8a066226bddc1d31e7fccffa | C++ | zhaoxiaohui/LeetCode | /Find the Duplicate Number.cpp | UTF-8 | 1,175 | 3.265625 | 3 | [] | no_license | /**
* Description: https://leetcode.com/problems/find-the-duplicate-number/
* Author: zhaoxiaohui
* Site: zhaoxiaohui.sinaapp.com
* Date: 2015-12-23
*
* O(N): http://keithschwarz.com/interesting/code/?dir=find-duplicate (Excellent)
*/
class Solution {
public:
int findDuplicateB... | true |
cd47fda01aac37e59363295d265d7e0fe1071d1b | C++ | connormai/CanCom | /myhelper.h | GB18030 | 2,103 | 2.84375 | 3 | [] | no_license | #ifndef MYHELPER_H
#define MYHELPER_H
#include <QTime>
#include <QProcess>
#include <QDebug>
#include <QByteArray>
#include <QString>
class myHelper:public QObject
{
public:
static void Sleep(int sec)
{
QTime dieTime = QTime::currentTime().addMSecs(sec);
while( QTime::currentTime() < dieTime )
... | true |
37887cef8a02f2d9c707e49b1485ce42b37e0795 | C++ | vgelinski/EngineCalc | /src/math/function/polynomial/polynomial.cc | UTF-8 | 4,724 | 2.8125 | 3 | [] | no_license | #include "polynomial.h"
#include <numeric>
using namespace std;
using namespace engc::math;
size_t Polynomial::Hash::operator()(const unordered_map<string, uint_fast8_t>& key) const {
return std::accumulate(
key.begin(),
key.end(),
0,
[](size_t acc, const pair<stri... | true |
459d89a291b17a097f6244fbcdd4e23ac3da16fb | C++ | seleneal1996/AED | /ARBOL-B/arbolB.cpp | UTF-8 | 8,319 | 3.015625 | 3 | [] | no_license | //ARBOL B
/*REGLAS
*/
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include <string>
#include<fstream>
#include<windows.h>
#include <sstream>
using namespace std;
class Pagina
{
int *claves;
int t; //grdo minimo de la pagina
Pagina **C; //arreglo de punteros a... | true |
d7698e4e962798ff4c723f5aa1325f6f3fbb8e7b | C++ | rbp28668/SuperTX | /StringEntryForm.h | UTF-8 | 1,657 | 2.53125 | 3 | [] | no_license | // StringEntryForm.h: interface for the CStringEntryForm class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_STRINGENTRYFORM_H__C18284E1_7350_11D2_BB29_F5D419D58836__INCLUDED_)
#define AFX_STRINGENTRYFORM_H__C18284E1_7350_11D2_BB29_F5D419D58836__INCLUDED_
#if _MSC_... | true |
6a419cb66d0523c0754bfdc367c197581385c76b | C++ | bestknighter/IDJ-Tuto-Game | /src/Camera.cpp | UTF-8 | 1,525 | 2.953125 | 3 | [] | no_license | #include "Camera.hpp"
#include "Game.hpp"
#include "InputManager.hpp"
Vec2 Camera::pos { 0, 0 };
Vec2 Camera::speed { 0, 0 };
bool Camera::following = true;
GameObject* Camera::focus = nullptr;
void Camera::Follow( GameObject* newFocus ) {
focus = newFocus;
}
void Camera::Unfollow() {
focus = nullptr;
}
vo... | true |
af0676c281cdc369e09ad2a00fa1f56a5bdd4f7a | C++ | isakson98/CMPS2_final | /FinalCMPS2q5.cpp | UTF-8 | 778 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
template <typename T>
void removeDuplicate(vector <T> & v) {
vector<T> smaller;
for (int i = 0; i < v.size(); i++) {
int counter = 0;
for (int j = 1; j < v.size(); j++) {
if (v[i] == v[j]) {
counter++;
}
}
... | true |
16cc54e04f839a15d7c393ebe1c8e1372a5dcafa | C++ | GPUOpen-LibrariesAndSDKs/Cauldron | /libs/vectormath/vec2d.hpp | UTF-8 | 16,024 | 3.328125 | 3 | [
"MIT"
] | permissive |
// ================================================================================================
// -*- C++ -*-
// File: vectormath/vec2d.hpp
// Author: Guilherme R. Lampert
// Created on: 30/12/16
// Brief: 2D vector and point extensions to the original Vectormath library.
// ======================================... | true |
8159fc9c63112835480a16a7246e34cfd85b5870 | C++ | smithje/HalloweenBot | /HalloweenBot.ino | UTF-8 | 11,565 | 2.984375 | 3 | [
"MIT"
] | permissive | /*
HalloweenBot
AUTHOR: Jeremy Smith (jeremy@musicsmith.net)
https://github.com/smithje/HalloweenBot
This is a sketch for an Adafruit Trinket, used in a robot halloween costume.
There are several things which should be attached:
- 2 neopixel rings. The data input of one of them should connect to the GOGGLES_PIN
... | true |
a5af7176aff27aaa116319caa06c013194d12ca1 | C++ | Noymul-Islam/problems | /Problem A - f91.cpp | UTF-8 | 482 | 2.75 | 3 | [] | no_license | #include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int compute(int n)
{
int j;
if(n<=100)
j=compute(n+11);
else
return n;
}
int main()
{
int n,m,k;
while(scanf("%d",&n)==1)
{
if(n==0)
break;
if(n>100)
printf("f91(%d) = %d... | true |
4283cc44056b273fd7f4787e15ea5dc255f35dbc | C++ | huangjianjun/data_structure_vs2012 | /字符串移位.cpp | GB18030 | 999 | 3.328125 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include<stdlib.h>
char* shifting(char *a, int n)
{
int m = strlen(a);
int d = m - n;
char *b = (char *)malloc(m*sizeof(char)+1);//һλô洢'\0'
*(b+m) = '\0';//ַռһλΪ־'\0'
char *temp = (char *)malloc((n+1)*sizeof(char));
char *p = temp;
for(int j = d; j < m; j++)/... | true |
6d9e3058d133df2a18759e63140699c5627225d5 | C++ | gumeniukcom/just-cpp | /cpp/2/2.cpp | UTF-8 | 2,545 | 3.1875 | 3 | [] | no_license | #include <iostream>
using namespace std;
static int nod(int a, int b){
if (b == 0)
return a;
return nod(b,a%b);
}
static int nok(int a, int b){
return a*b/nod(a,b);
}
class rational{
private:
int q,r;
public:
void balans(){
int thisnod = nod(q,r);
if (thisnod>1){
q =... | true |
7c89ff1b2dec9cb39e77be6034a2d6d277ccc241 | C++ | Devansh0112/cplusplus-practice | /sparse_table_linked.cpp | UTF-8 | 1,365 | 3.828125 | 4 | [] | no_license | // linked list representation
#include <iostream>
using namespace std;
class Node
{
public:
int row;
int col;
int val;
Node *next;
};
class Sll
{
private:
Node *head;
public:
Sll()
{
head = NULL;
}
void insert(int row1, int column, int value)
{
Node *item = n... | true |
cef96d4dcc047b64738cd021904aa0a475cc0856 | C++ | maximdervis/CameraArranger | /dbcameraaddition.cpp | UTF-8 | 4,990 | 3.015625 | 3 | [] | no_license | #include "dbcameraaddition.h"
#include "ui_dbcameraaddition.h"
#include <QMessageBox>
#include <QtXml>
#include <QKeyEvent>
DBCameraAddition::DBCameraAddition(QWidget *parent) :
QDialog(parent),
ui(new Ui::DBCameraAddition)
{
ui->setupUi(this);
this->additionConfirmed = false;
}
DBCameraAddition::~D... | true |
911f9122df43cfba3c33d627cff40948277c8d62 | C++ | nathinal/SwiftMPI | /src/utils/random.h | UTF-8 | 1,206 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <random>
namespace swift_snails {
/*
inline std::default_random_engine& local_random_engine() {
struct engine_wrapper_t {
std::default_random_engine engine;
engine_wrapper_t() {
static std::atomic<unsigned long> x(0);
std::seed_seq sseq = {x++, x++, x++... | true |
009eb78a89d1e088e0600d2de481ab495747c3d0 | C++ | lmashraf/code-eval | /FibonacciSeries.cpp | UTF-8 | 388 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
unsigned int Fib(int n)
{
if (n == 0) return 0;
if (n == 1) return 1;
return Fib(n - 1) + Fib(n - 2);
}
int main(int argc, char *argv[])
{
ifstream stream(argv[1]);
string line;
while (getline(stream, line))
{
unsigned int n = ato... | true |
8acbfdeeb64ef5abd47f58c08739de950f4f18ca | C++ | allan-cedric/codeforces | /easy/yearofuniversityentrance.cpp | UTF-8 | 412 | 2.578125 | 3 | [
"MIT"
] | permissive | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int> years(n);
for (int i = 0; i < n; i++)
cin >> years[i];
cout << (*max_element(years.beg... | true |
8161c52049acf26d43d16d8f3b7720c9e5bcfc11 | C++ | jguyet/Bomberman | /client/includes/utils/Properties.hpp | UTF-8 | 682 | 2.765625 | 3 | [] | no_license | #ifndef PROPERTIES_HPP
# define PROPERTIES_HPP
# include "Bomberman.hpp"
class Properties
{
public:
Properties( std::string const &file_path );
Properties( Properties const & src );
virtual ~Properties( void );
Properties & operator=( Properties const & rhs );
friend std::ostream & operator<<(std... | true |
1a36b2f1fd46d0bc880be8dce2af81a76bc04fc5 | C++ | SaySOwha/Numerical-Computation-Assignment | /Programming/ProgrammingAssignment5/CompositeNumericalIntegration.cpp | UTF-8 | 3,054 | 3.578125 | 4 | [] | no_license | #include <cmath>
#include <cstdio>
#include <float.h>
#include <functional>
#include <iostream>
#include <vector>
using namespace std;
// 使用复化 Simpson 积分公式计算在区间 [a, b] 上函数 f 的积分,区间等距分为 n 份
double SimpsonsRule(function<double(double)> f, double a, double b, int n)
{
int m = n / 2;
double h = (b - ... | true |
c2b7efbeb27589360f0aad7ce0101550f00adb54 | C++ | wz125/course | /coursera/dsalgo-001/11-spell-checker.cpp | UTF-8 | 2,935 | 2.6875 | 3 | [] | no_license | /*=============================================================================
# FileName: spell.cpp
# Desc: poj 1035
# Author: zhuting
# Email: cnjs.zhuting@gmail.com
# HomePage: my.oschina.net/locusxt
# Version: 0.0.1
# CreatTime: 2013-12-04 15:44:51
# LastChange: 2013-12-04 19... | true |
1a5e57def509e2a09f0cd7a440cc9c4813dd974b | C++ | arnabs542/CP | /gray_to_decimal.cpp | UTF-8 | 286 | 2.671875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
//sample case gray - 15 (1111)
// decimal- 10 (1010)
int main()
{
int gray, decimal = 0;
cin >> gray;
while(gray)
{
decimal = decimal ^ gray;
gray = gray / 2;
}
cout << decimal << endl;
} | true |
af15ed7fcccbe171a26d5a456c96c8526b36336d | C++ | CobraDevTeam/gameDevClient | /sources/gui/label.cpp | UTF-8 | 725 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | #include "headers/gui/label.hpp"
#include "headers/utility.hpp"
#include <iostream>
namespace GUI {
Label::Label(const std::string& text, const Resources::FontHolder& fonts, sf::Vector2f position)
:mText(text, fonts.get(Resources::FontsID::Base), 16)
{
setPosition(position);
Utility::centerOrigin(mText);
... | true |
bf09efe2b2f5258e00c10153850f6eaf20200566 | C++ | StadnickiK/Tanks | /ColliderComponent.h | IBM852 | 2,270 | 2.859375 | 3 | [] | no_license | #pragma once
#include <string>
#include <SDL.h>
#include "TransformComponent.h"
#include "Collision.h"
#include "textureManager.h"
class ColliderComponent : public Component {
private:
std::map<std::string, SDL_Rect*> colliders;
public:
SDL_Rect collider;
const char* tag;
const char* ownerTag = NULL... | true |
27b199e23bc3faf769a385df74adb00f634a302f | C++ | niuxu18/logTracker-old | /second/download/httpd/gumtree/httpd_old_hunk_5183.cpp | UTF-8 | 495 | 3.203125 | 3 | [] | no_license | /* first try to attach to existing slotmem */
if (next) {
for (;;) {
if (strcmp(next->name, fname) == 0) {
/* we already have it */
*new = next;
return APR_SUCCESS;
}
if (!next->next) ... | true |
081015dd27c10a3b4688cf241cbb1fc2797abb34 | C++ | ivigns/CompilerCourse2019 | /irt/IrTreeNode.h | UTF-8 | 1,061 | 2.71875 | 3 | [] | no_license | #pragma once
#include <IrtVisitor.h>
#include <memory>
#include <vector>
namespace IrTree {
class IIrTreeNode {
public:
virtual ~IIrTreeNode() = default;
virtual void AcceptVisitor(IIrtVisitor* visitor) const = 0;
};
class IIrtExpression : public IIrTreeNode {
};
class IIrt... | true |
6e6e5b8dc92c8dd82fd4c467617b3b1d3397587f | C++ | mantofer02/CI-0122-2021-S1 | /SocketC/HTTP/server.cpp | UTF-8 | 1,321 | 2.984375 | 3 | [] | no_license | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
int main(void) {
FILE *html_data;
html_data = fopen("index.html", "r");
char response_data[1024];
fgets(response_data, 1024, html_data);
char http_header[204... | true |
b5d00543006d322656b061c9b6299afc911e3596 | C++ | dotnet/dotnet-api-docs | /snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp | UTF-8 | 2,495 | 3.453125 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive |
// System::Net::NetworkCredential::GetCredential
/*This program demontrates the 'GetCredential' of 'NetworkCredential' class.
It accepts an URL, username and password from console. Creates a 'NetworkCredential' Object*
using these parameters. A 'WebRequest' Object* is created to access the Uri S"http://www.microsoft.... | true |
db3e13c28f3dbce7eaa02f3347dd4acbe493442b | C++ | Mikeziegler123/Linked_List-Cpp | /MAIN.cpp | UTF-8 | 7,073 | 3.265625 | 3 | [] | no_license | // olaDLL BY Michael Ziegler, CSCI2170-002, Due: 04/10/18
// PROGRAM ID: SortedListTester.cpp / Illustration of using the SortedList
// AUTHOR: Michael Ziegler
// REMARKS: Simple-minded driver for exercising the SortedList methods.
// Original concept based on a variation of Carrano (5th Ed.), Chapter 3,
// pp. 13... | true |
b216355ef15c1f11984a3d0a4ab327b0c7878ebc | C++ | rapman1986/Programming_Principles_and_Practice_using_Cpp | /Chapter_09/Exercises/Book.h | UTF-8 | 1,034 | 3.359375 | 3 | [] | no_license | #pragma once
#include "std_lib_facilities.h"
namespace Book_Library
{
enum class Genre
{
fiction, nonfiction, periodical, biography, children
}; // Genre
class Book
{
public:
// Cinstructor
Book(string authot, string title, Genre genre, string isbn, string copyright);
// Get`s
string ISBN() const { r... | true |
3ae0cee1e8889b19143885451bcf764fa030fdb1 | C++ | gtier/VoxwellEngine | /VoxwellEngine/ShaderProgram.h | UTF-8 | 1,172 | 2.625 | 3 | [] | no_license | //
// Created by Griffin Dunaif on 3/10/21.
//
#ifndef FINAL_PROJECT_SHADERPROGRAM_H
#define FINAL_PROJECT_SHADERPROGRAM_H
#include "ves.h"
#include "Shader.h"
class ShaderProgram {
private:
const char * _vertex_contents;
const char * _fragment_contents;
unsigned int _id;
bool _built = false;
public... | true |
0aab8d58549372af73fa170c8b087850881859b1 | C++ | ftena/cplusplus-snippets | /src/delete_vectors_and_lists/main.cpp | UTF-8 | 824 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <list>
#include <vector>
#include <algorithm>
class foo_class
{
public:
foo_class(int i): i(i) {};
~foo_class() { std::cout << "deleting " << i << std::endl; }
private:
int i;
};
static bool delete_all ( foo_class * element ) { delete element; return true; }
int ... | true |
b918ba0ee6ef2edbdfcfc65bc4c4e72e31707385 | C++ | Luiz1996/Fundamentos_de_Algoritmos | /listas 1ª prova/lista 2/exe12_lista2.cpp | UTF-8 | 381 | 3.234375 | 3 | [] | no_license | #include <stdio.h>
int main(void){
float salario, novo_salario;
printf("Insira o salario do funcionario: ");
scanf("%f", &salario);
if(salario < 2000.00){
novo_salario = ((salario/100)*30)+salario;
printf("\nO salario passara de R$%.2f para o valor de R$%.2f .", salario, novo_salario);
}else {
printf(... | true |
f5b87f4db9ccb58ab3f88af1a533321f9fd6a6cc | C++ | MillerRidgeway/StreamDecoder | /main.cpp | UTF-8 | 2,123 | 2.921875 | 3 | [] | no_license | #include "pkt_decoder.h"
#include <stdio.h>
#include <vector>
static void pkt_printer(void *ctx, size_t len, const uint8_t *data) {
(void) ctx;
printf("pkt (%zd bytes) -", len);
for (size_t i = 0; i < len; i++) {
printf(" %02x", data[i]);
}
printf("\n");
}
int main() {
//Testing vector... | true |
3b5e0e42c9733aee1dbea050b9adac761fb6f35f | C++ | grammarhoard/2014-rosu-inference-cpp | /CFG/MAT/ContextFreeGrammar.h | UTF-8 | 3,999 | 3.046875 | 3 | [] | no_license | /*
* Objective Context Free Grammar (CFG)
* A CFG is a tuple <Sigma, V, P, I> where:
* Sigma - set of terminal symbols
* V - finite non-empty set of non-terminals
* I - non-empty subset of V, the set of initial symbols
* P - finite set of productions of the form V x (V U Sigma)* in Chomsky N... | true |
ed594ccc9638171907ecc2594ba2afd08ba25df0 | C++ | ysemenovkrop/cpp_course | /11/02_pointers_to_class.cp | UTF-8 | 801 | 3.796875 | 4 | [] | no_license | #include<iostream>
using namespace std;
class Base{
public:
void test_method(){cout << "Base!" << endl;}
};
class Derived: public Base{
public:
void test_method(){cout << "Derived!" << endl;}
};
int main(){
Base* pointer_base;
Derived* pointer_derived;
pointer_base = new Base();
... | true |
49930790022963df4440bf8bbd2f51396e3fa21a | C++ | kongyi123/Algorithms | /Visual Studio 2017/Projects/baekjun/baekjun/1912_nlogn.cpp | UHC | 1,027 | 3.171875 | 3 | [] | no_license | // nlogn
// ҿ . , . ߿ѱ̴.
// ߰, ,
// ִ뿬 κ̱ ߰ ϴ
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define MIN -2000000000
int data[110000];
int n;
int max(int a, int b) {
if (a > b) return a;
return b;
}
int fastMaxSum(int s, int e) {
if (s <= e) {
if (s == e) return data[s];
int mid = (s + e)... | true |
4c12e7b59f896c04585020b8712fcdcf60a6c32c | C++ | deskmel/online-judge-for-sjtu | /1211.cpp | UTF-8 | 602 | 3.09375 | 3 | [] | no_license | #include <iostream>
class binaryTree
{
private:
struct node
{
int val;
node *l;
node *r;
node():l(NULL),r(NULL){}
node(int item,node* left=NULL,node* right=NULL):val(item),l(left),r(right){}
};
binaryTree():root(NULL){}
void createTree(int N)
{
node **li=new node *[N];
for (int i=1;i<=N;i++)
li[i... | true |
73af5e437641c0b5a747d8f42f870df19baa5c1a | C++ | mihaiburlaciuc/AppMonteCarlo | /openmp_implementation/integral_openmp.cpp | UTF-8 | 1,677 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <omp.h>
#include <time.h>
#define NUM_THREADS 6
#define NUM_REPS 200000000
unsigned int count;
long double total, inBox;
int x_min, x_max, y_min, y_max;
//The function that the integral should be calculated for
... | true |
7f4a0d9e6ec3b050bd97932766020eb49d6f4762 | C++ | Prashant1099/Cpp-Program | /PRAC16.CPP | UTF-8 | 551 | 3.796875 | 4 | [] | no_license | /* A program which takes any year as i/p and prints input year is either Leap
year or not with switch case*/
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
void main()
{
int y;
clrscr();
cout<<"\n Enter any Year = ";
cin>>y;
switch(y%4)
{
case 0:
cout<<"\n "<<y<<" is Leap Ye... | true |
c1a4be1ff5a358e4c098bea870c8fae4d067bd63 | C++ | HandsomeBoy2/LanQiao | /算法训练/ALGO-79删除数组零元素.cpp | UTF-8 | 495 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int CompactIntegers(int *p, int n)
{
int cnt = n;
for (int i = 0; i < cnt; i++) {
if (*(p+i) == 0) {
for (int j = i; j < cnt; j++) {
*(p+j) = *(p+j+1);
}
i--;
cnt--;
}
}
return cnt;
}
int main()
{
int n;
cin >> n;
vector <int> a(n... | true |
9f4a97e16c3f33b6bdb30e8dcd6e3848452b98ba | C++ | mahesh15230/fpga-booleanring-bfs | /dense-frontier/driver/HardwareBFSManager.cpp | UTF-8 | 11,256 | 2.75 | 3 | [
"CC-BY-4.0"
] | permissive | #include "HardwareBFSManager.h"
#include <string.h>
#include <iostream>
using namespace std;
HardwareBFSManager::HardwareBFSManager(unsigned int * inputRegs,
unsigned int * outputRegs) {
m_graphMan = 0;
m_bfsDistance = 0;
m_distanceVector = 0;
m_inputVector = 0;
m_inputVectorWordCount = 0;
m_deallocateBitmap ... | true |
f5570d4efab64357b9ddb0af895edba685b8aded | C++ | PacktPublishing/IoT-Building-Arduino-based-Projects | /Module 2/Chapter02/Chapter2-Code/chapter2-2/B04844_02_02.ino | UTF-8 | 546 | 2.640625 | 3 | [
"MIT"
] | permissive | #include <SPI.h>
#include <WiFi.h>
char ssid[] = "Dialog 4G Open";
int status = WL_IDLE_STATUS;
void setup()
{
Serial.begin(9600);
while (!Serial)
{
;
}
if (WiFi.status() == WL_NO_SHIELD)
{
Serial.println("No WiFi shield found");
while(true);
}
while ( status != WL_CONNECTED)
... | true |
ab741cc704c7fd9a972466df764d219e6c4233fa | C++ | garciajciro/Student-Records-Library | /p03.cpp | UTF-8 | 3,977 | 3.21875 | 3 | [] | no_license | #include "p03.h"
#include <fstream>
using std::ifstream;
//*****************************************************************
// FUNDAMENTALS
//*****************************************************************
Node* loadList(string filename) {
int stand;
Node* head = nullptr;
Nod... | true |
80dd343fbae8c61f3b87eb6b785a0c06aba869c9 | C++ | HanSong3233/Baruch-Cplusplus-programming-for-FE-Certificate | /Level 9/Group A&B/EuropeanOption.hpp | UTF-8 | 2,835 | 3.3125 | 3 | [] | no_license | #ifndef EUROPEAN_OPTION_HPP
#define EUROPEAN_OPTION_HPP
#include <vector> // include vector, used as a container
#include "Option.hpp" // Header file for base class VanillaOption
#include <iostream> // C++ style I/O
using namespace std;
class EuropeanOption : public Option {
private:
//add new member d1 ... | true |
5aa0e1253caf4cc9a49cfc1847d6ca5f76024ee4 | C++ | 1003613248/VForce | /src/robot/Pose.hpp | UTF-8 | 861 | 2.921875 | 3 | [
"MIT"
] | permissive | //
// Created by yongqi on 17-12-4.
//
#ifndef VFORCE_POSE_HPP
#define VFORCE_POSE_HPP
#include <ostream>
#include "utils/MathUtils.hpp"
namespace VForce {
struct Pose {
float x_, y_, z_; // in meter
float roll_, pitch_, yaw_; // in radian
Pose() = default;
Pose(float x, float y, float z, float roll, floa... | true |
53036b5c43a23a920b00f2f36f7e4163188107b7 | C++ | lyubakrupina/Pacman | /Pacman/Bullet.cpp | WINDOWS-1251 | 1,942 | 3.015625 | 3 | [] | no_license | #include <SFML/Graphics.hpp>
#include <iostream>
#include "Bullet.h"
#include "Entity.h"
using namespace sf;
using namespace std;
Bullet::Bullet(Image &image, float X, float Y, int W, int H, std::string Name, int dir) :Entity(image, X, Y, W, H, Name)
{
x = X;
y = Y;
direction = dir;
speed = 0.8;
... | true |
ef661fe1db3f6719771950b7061ade3662dd450e | C++ | AtomicOrbital/SPOJ_PTIT | /TONGBINHPHUONG.cpp | UTF-8 | 531 | 2.5625 | 3 | [] | no_license | #include<iomanip>
#include<iostream>
#include<stdio.h>
using namespace std;
#define D 1000000000
int main()
{
unsigned long long x,z,a,b,c,d,A,B,C;
cin>>x;
z=2*x+1;
x=x*(x+1)/2;
if(x%3==0) x=x/3; else z=z/3;
a=x/D; b=x%D;
c=z/D; d=z%D;
A=a*c;
B=b*c+a*d;
C=b*d;
... | true |
2fdbc7d1e74c0d942d6f39f5ad4dcc2a1cacf6f9 | C++ | WeilerWebServices/textmagic | /textmagic-rest-cpp-v2/model/GetSurveyNodesResponse.cpp | UTF-8 | 3,278 | 2.5625 | 3 | [
"MIT"
] | permissive | /**
* TextMagic API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 2
*
*
* NOTE: This class is auto generated by the swagger code generator 2.4.8.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class man... | true |
35bca8a04aef4cc9dfcae64fd91609dfd2271a9e | C++ | jingdongHe/my-code | /c/算法/p78-uva11039.cpp | UTF-8 | 549 | 2.734375 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
typedef struct node {
int data;
int sig;
}node;
bool comp(node x,node y)
{
return x.data<y.data;
}
int main()
{
int n,i,s,k,t,j;
node A[500000];
scanf("%d",&t);
for(j=0;j<t;j++)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&... | true |
c0b1dbc2dbfc2bdf69e0e2add53cf0117a1d5be8 | C++ | NicoKNL/coding-problems | /problems/kattis/2048/sol.cpp | UTF-8 | 3,742 | 3.21875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
ostream &operator<<(ostream &os, const vector<vector<int>> &G)
{
for (int r = 0; r < 4; ++r)
{
for (int c = 0; c < 4; ++c)
{
if (c > 0)
os << " ";
os << G[r][c];
}
os << endl;
}
retur... | true |
0b46bf7790421eb0745f245480751062b6849227 | C++ | annisele/9-tiles-game | /Mwindow.cpp | UTF-8 | 5,746 | 2.671875 | 3 | [] | no_license | #include "Mwindow.h"
#include "Gwindow.h"
#include "board.h"
#include <QPushButton>
#include <QLabel>
#include <QString>
#include <QApplication>
#include<vector>
#include <QRadioButton>
#include <QMessageBox>
#include "puzzle_heur.h"
#include "puzzle_solver.h"
#include "puzzle_move.h"
/**
construtor for main window. ... | true |
8956876da6a4217c937ce90ec1af813661ca5f5c | C++ | permanentbelief/programmer_road | /ACwing/差数组.cpp | UTF-8 | 1,691 | 2.734375 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
#include <iostream>
using namespace std;
//
//const int N = 100004;
//int a[N];
//int b[N];
//
//int main()
//{
// int n = 0;
// int m = 0;
// cin >... | true |
52347400b0f067a38a5c8d626310a5eb66d4181b | C++ | kvassay/rt_dt | /Core/System/system.cpp | UTF-8 | 29,180 | 2.734375 | 3 | [] | no_license | #include "system.h"
#include <sstream>
#include <iostream>
#include "Core/ImportanceIndices/componentindex.h"
System::System(bool paEqualReliability)
{
equalReliability = paEqualReliability;
componentsCount = 0;
structuralFunction = NULL;
isInit = false;
}
System::~System()
{
clear();
}
void ... | true |
87bfa5980f0cca92f16882879e7516886cf8d763 | C++ | MagisterFleisher/pangolin6 | /include/AdjacencyMatrix.hpp | UTF-8 | 2,244 | 3.09375 | 3 | [] | no_license | // TODO: use PMR to speed up matrix creation
// TODO: use binary vs valued depending upon matrix size
// The adjencency list gives the position of each value in the incidence matrix.
// The incidence matrix is an n X n array.
#ifndef PANGOLIN_ADJACENCYMATRIX_HPP
#define PANGOLIN_ADJACENCYMATRIX_HPP
#pragma GCC opti... | true |
ccd3b802b1e9f533af57e57fdf865dfbd13317ea | C++ | r-zh/ReserveSystem | /ReservationRequest.h | UTF-8 | 1,088 | 2.984375 | 3 | [] | no_license | //
// COEN244, Winter 2020
// Assignment 2
//
// Created by Mohammed Altahat on 02/20/20.
//
// ReservationRequest.h
#pragma once
#include "Person.h"
enum Station {
Montreal = 0,
Dorval = 1,
Brockville = 2,
Kingston = 3,
Belleville = 4,
Toronto = 5,
NotSet = -1
};
class Reservation... | true |
4e0905427ceec6eff3a8f43354882fb02399465a | C++ | mcc12357/acm- | /ny 56.cpp | UTF-8 | 379 | 2.578125 | 3 | [] | no_license | #include<iostream>
using namespace std;
#include<stdio.h>
#include<math.h>
int f[10005];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
f[0] = 0;
f[1] = 0;
int i;
int n,m;
scanf("%d %d",&n,&m);
for(i=2;i<=n;i++)
{
f[i] = f[i-1];
int temp = i;
while(temp%m==0 && temp>=m)
{
f[i]++;
... | true |
fece614ae21bdc40da8cc8c9e775b82bf4a77b1f | C++ | geosabev/FMI-OOP-2019-2020 | /homeworks/hw03/3. School system/Teacher.h | UTF-8 | 467 | 3.03125 | 3 | [] | no_license | #pragma once
#include "Person.h"
class Course;
enum Title {
Part_Time, Assistant_Professor, Doctor, Associate_Professor, Professor
};
class Teacher : public Person {
public:
Teacher(string n, Title t);
void grade_student(Course* c, unsigned int fn, unsigned int value);
void join_course(Course* c) const;
void ... | true |
a230d432f30a6a568c493ae0fc6ee1bf37aa4bd6 | C++ | linmonsv/C_CPP | /Professional C++/t_23_7_future_exception.cpp | UTF-8 | 401 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <mutex>
#include <future>
using namespace std;
int calculate()
{
throw runtime_error("Exception thrown from a thread.");
return 123;
}
int main()
{
auto fut = async(launch::async, calculate);
try {
int res = fut.get();
cout << res << endl;
}
catch (const except... | true |
280b242c61f5ed7e9e04be33d2643ad3291b8fbe | C++ | ThePrimeagen/udp-fun | /src/network-udp.hpp | UTF-8 | 1,008 | 2.734375 | 3 | [] | no_license | #include <uv.h>
#include <iostream>
#include <chrono>
#include <thread>
namespace foo {
struct Work {
uv_work_t my_work;
};
void WorkAsync(uv_work_t* work) {
std::cout << "WorkAsync#sleep" << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
std::cout << "WorkAsync#sleep#complete" << s... | true |
5bbf117eaeaf9c09c59b91ee31eefc1f85f6ea76 | C++ | KevinsWang/Algorithm | /PAT/1030/1030.cpp | UTF-8 | 2,316 | 2.875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int inf = 0x3f3f3f3f;
int N,M,S,D;
int e[502][502], weight[502][502], dis[502];
int minCost = inf;
bool visit[502] = {false};
vector<int> pre[502], path, tempath;
void dfs(int d)
{
tempath.push_back(d);
if(d == S) //到达原点,计算... | true |
b1e3c1153bc74e60cc564cf7c76dd2f6e7b2c9f7 | C++ | yixincoding/leetcode | /Invert-Binary-Tree.cpp | UTF-8 | 1,009 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <cstring>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
TreeNode* invert(TreeNode* p)
{
if (p == NULL) return NULL;
if (p->left==NULL && ... | true |
62c507324ff47b13906964642410387ebe01b717 | C++ | zmahoor/TPR-1.0 | /pyrosim/synapse.cpp | UTF-8 | 679 | 2.71875 | 3 | [] | no_license | #ifndef _SYNAPSE_CPP
#define _SYNAPSE_CPP
#include "iostream"
#include "synapse.h"
SYNAPSE::SYNAPSE(void) {
std::cin >> sourceNeuronIndex;
std::cin >> targetNeuronIndex;
std::cin >> weight;
}
SYNAPSE::~SYNAPSE(void) {
}
int SYNAPSE::Get_Source_Neuron_Index(void) {
retu... | true |
f69d48af5956e872b4b91f66956efd46f2f4436f | C++ | gunrock/gunrock | /include/gunrock/graph/coo.hxx | UTF-8 | 4,409 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <cassert>
#include <tuple>
#include <iterator>
#include <gunrock/memory.hxx>
#include <gunrock/util/type_traits.hxx>
#include <gunrock/graph/vertex_pair.hxx>
#include <gunrock/algorithms/search/binary_search.hxx>
namespace gunrock {
namespace graph {
using namespace memory;
struct empty_coo_t... | true |
36fe2622c9df00971ad2c07e702eaf8b784b19ec | C++ | freecity/cpulsplus_primer | /chapter9/e9_42.cpp | UTF-8 | 504 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <stack>
#include <string>
using std::stack;
using std::string;
using std::cout;
using std::cin;
using std::endl;
int main ()
{
cout << "\nput some string:" << endl;
string input;
stack<string> str_stack;
while (cin >> input)
str_stack.push(input);
cout << "\n... | true |
4f4a32d3b2a3fe0d55edab1f53a6b0440c292c2c | C++ | Jack55913/ProgramacionChapingo | /pruebas/pruebas2.cpp | UTF-8 | 3,845 | 3.5 | 4 | [] | no_license |
/*
Algoritmo ProcesoMultiplicaMatrices
Escribir Sin Saltar "Ingrese el numero de filas de la matriz A :";
Leer filas_a;
Escribir Sin Saltar "Ingrese el numero de columnas de la matriz A:";
Leer columnas_a;
Escribir Sin Saltar "Ingrese el numero de filas de la matriz B :";
Leer filas_b;
... | true |
02523eb41e1300fcbf424f0072074649cad39fe4 | C++ | kenzan8000/data_structure_and_algorithm | /linked_list/doubly_circular_linked_list.cc | UTF-8 | 5,009 | 4.03125 | 4 | [] | no_license | // Linked List whose items can be navigated forward and backward.
// Also, Linked List whose last item contains link of the first element as next and the first element has a link to the last element as previous
#include <iostream>
#include <cstdlib>
#include <ctime>
class DoublyCircularNode {
public:
DoublyCirc... | true |
575ffef26d2a4eb9cba54bb964904a848e5f3162 | C++ | GiorgioDeMoraesRossa/tsp | /Aresta.h | UTF-8 | 464 | 2.84375 | 3 | [] | no_license | #include "Vertice.h"
#include <math.h>
#include <iostream>
using namespace std;
class Aresta
{
Vertice vertice1, vertice2;
double peso;
public:
Aresta(int v1, int v2, int x1, int y1, int x2, int y2);
Aresta(Vertice v1, Vertice v2);
void print();
int obterVertice1();
int obterVertice2();
Vertice obterP... | true |
6f8336f75e82dbd6a08ee4ca21b1a1f7097962c6 | C++ | MalinovayaZaya/Home_Work_2_semester | /Практика/3.cpp | UTF-8 | 2,304 | 3.828125 | 4 | [] | no_license | // Practice.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
//структура элементов списка
struct Node
{
int x;
Node* Next;
};
//циклический список
struct List
{
public:
Node* head; //указатель на первый элемент
//конс... | true |
fded32c700524d3a7cb101b88832cb4b482a4dc0 | C++ | MaybeAPotato/BasicEngine | /BasicEngine/EngineCore/LogManager.cpp | UTF-8 | 625 | 2.828125 | 3 | [] | no_license | #include "LogManager.h"
namespace Core {
//LogManager* LogManager::m_instance = nullptr;
//Loglevel LogManager::currentLevel = Loglevel::TOTAL;
LogManager::LogManager() : currentLevel(Loglevel::TOTAL)
{
}
LogManager::~LogManager()
{
}
void LogManager::SetLevel(Loglevel l)
{
LogManager::GetInstance().cur... | true |
7eea5995ae3866049a0ed38de5ff9c49b0ff3ecf | C++ | tmuttaqueen/MyCodes | /Online Judge Code/[Other] Online-Judge-Solutions-master_from github/Codingame/code-of-the-rings/main0.cpp | UTF-8 | 947 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
int val(char c){
if(c == ' ') return 0;
return c - 'A' + 1;
}
int moves(int s, int e){
int pos,neg;
if(s <= e){
pos = e - s;
neg = 27 - pos;
}else{
neg = s... | true |
49fabd9b79845987b6611c7b2af2d1aa426dbfa8 | C++ | dungeonfighter/git | /C++/homework/PSO/PSO.cpp | UTF-8 | 2,027 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include "PSO.h"
//P相關的功能
PSO::P::P(PSO &a){
pso=&a;
v.reserve(pso->D);
now.reserve(pso->D);
pbest.reserve(pso->D);
for(size_t i = 0; i < pso->D; i++)
{
double v1=double... | true |
98a5e3e75cf321d654fbb172a2b2e173133393d6 | C++ | philipplenk/adventofcode20 | /17/01.cpp | UTF-8 | 1,950 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | #include <advent.hpp>
#include <algorithm>
#include <array>
#include <iostream>
#include <string>
#include <vector>
#include <cstddef>
using namespace advent;
int main(int argc, char* argv[])
{
const auto directions = []()
{
std::array<vec3d,26> ret_val;
std::size_t count = 0;
for(int z=-1;z<2;++z)
f... | true |
6c8b3da678c60981be72eb81b211ea5b96edad7c | C++ | sc9ny/ECE3574 | /project1-sc9ny/track_test.cpp | UTF-8 | 9,341 | 3.03125 | 3 | [] | no_license | /** \file Unit tests for Track Module
*/
//#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "track.hpp"
#include <iostream>
#include <vector>
TEST_CASE( "Test Track module", "[track]" )
{
Track track;
TempoEvent tempo;
NoteEvent note(false, 0,0);
EndTrackEvent end;
MIDIEvent tempo_(tempo, 5... | true |
b9e122f72b1d8f57b6f271381bf82961ee731f76 | C++ | JLtea/Data_Structures | /mp_mazes/maze.h | UTF-8 | 618 | 3.1875 | 3 | [] | no_license | /* Your code here! */
#include <vector>
#include "cs225/HSLAPixel.h"
#include "cs225/PNG.h"
class SquareMaze {
public:
SquareMaze();
bool canTravel(int x, int y, int dir) const;
cs225::PNG* drawMaze() const;
cs225::PNG* drawMazeWithSolution();
void makeMaze(int width, int height);
void setW... | true |
334c52e528d7092e789e5cc4c1d25c5be71fd7a2 | C++ | LarsFL/Themaopdracht_Gaming | /MarsRunner/Code/Game engine/UI systems/Text.hpp | UTF-8 | 1,789 | 3.1875 | 3 | [] | no_license | #ifndef _TEXT_HPP
#define _TEXT_HPP
#include <SFML/Graphics.hpp>
#include <string>
#include <functional>
#include "UI_Element.hpp"
class Text : public UIElement {
protected:
sf::Font font;
sf::Text text;
std::string stringText;
sf::Vector2f position;
int textSize;
sf::Color color;
public:
Text(std::string fon... | true |
48bcc878f45e9f8aa1d95b9d60a20957f2ba4c9a | C++ | duanshuai123/MyApp_Framework | /libs/leetcode/LeetCode101/leetcode_101/chapter_14/236 二叉树的最近公共祖先.cpp | UTF-8 | 1,196 | 3.546875 | 4 | [
"Apache-2.0"
] | permissive |
// 236. Lowest Common Ancestor of a Binary Tree
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* helper(TreeNode* root, TreeNode* p,... | true |
95f9d353bf8a65f86091af0b810d3334ab30aa32 | C++ | mooredan/OpenROAD | /src/OpenDB/test/cpp/TestGeom.cpp | UTF-8 | 2,831 | 2.609375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #define BOOST_TEST_MODULE TestGeom
#include <boost/test/included/unit_test.hpp>
#include "db.h"
#include "helper.cpp"
#include <iostream>
using namespace odb;
BOOST_AUTO_TEST_SUITE( test_suite )
BOOST_AUTO_TEST_CASE( test_oct )
{
Oct* oct = new Oct;
oct->init(Point(0,0),Point(400,400),40);
BOOST_TEST((oct... | true |
33e1a9003341751f06cbde22ea59c5270b181ae6 | C++ | hyrise/hyrise | /src/lib/expression/unary_minus_expression.cpp | UTF-8 | 1,301 | 2.875 | 3 | [
"MIT"
] | permissive | #include "unary_minus_expression.hpp"
#include <sstream>
#include "utils/assert.hpp"
namespace hyrise {
UnaryMinusExpression::UnaryMinusExpression(const std::shared_ptr<AbstractExpression>& argument)
: AbstractExpression(ExpressionType::UnaryMinus, {argument}) {
Assert(argument->data_type() != DataType::Strin... | true |
0b62ee19fce930a4f35682105809bb5f57cee7a2 | C++ | Vulpelo/G1 | /G1/Sprite.cpp | UTF-8 | 2,182 | 2.953125 | 3 | [] | no_license | #include "Sprite.h"
namespace G1 {
Sprite::Sprite(const sf::Texture& texture, const Vector2& imageSize)
: texture(&texture), imageSize(imageSize)
{
sf::Vector2u vecU = texture.getSize();
this->texture = &texture;
this->imageSize = imageSize;
sfSprite.setTexture(*this->texture);
sfSprite.setTextureRect... | true |
8f53369f4d7f8bc27457aae36361f13d278ded04 | C++ | JDQberg/StudentRoster | /Student.h | UTF-8 | 1,209 | 3.234375 | 3 | [] | no_license | #pragma once
#include<string>
#include"Degree.h"
using std::string;
class Student
{
public:
Student();
Student(string studentID, string firstName, string lastName, string emailAddress, int age, int numDays[]);
~Student();
const static int daysInCourse = 3;
//an accessor(i.e., getter) for each... | true |
75f9778b5786bf634f4285dafbe66e56c18495fb | C++ | sngynhy/C | /Project/Project/day02_6.cpp | UHC | 790 | 3.21875 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h> // rand() Լ ǵǾ ִ ó
#include<time.h>
void main() {
// Լ rand()
// rand() % N : N
// 0, 1, 2, 3, ... , N-1
// ó ٲ ʴ´.
// ǻ õ尪(ȣ)
srand(time(NULL)); // srand() Լ ڷ ´. - time(NULL) ð ڷ
// srand() Լ rand() ʿ ۼǾ
//int dice = rand() % 6 + 1; // 1... | true |
698857cdd63fe6df0e12f01eae9bb5752320d326 | C++ | alirezaomidi/acm | /uva/10855-rotated-square/1.cpp | UTF-8 | 1,565 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef vector<string> vs;
vs rotate90(vs& square) {
int n = square.size();
vs res(n, string());
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
res[i] += square[n - 1 - j][i];
return res;
}
int f... | true |
906dbf2fc19cbbe0a083abf5c776bb9a0479d457 | C++ | astraloof/manx-mixer | /manx-mixer/routing.cpp | UTF-8 | 1,132 | 3.015625 | 3 | [
"MIT"
] | permissive | #include "routing.h"
#include <iostream>
#define ROTARY_BUFFER_SIZE 2048
RotaryBuffer::RotaryBuffer(int size)
{
buffer = new double[size];
this->size = size;
}
RotaryBuffer::~RotaryBuffer(void)
{
delete[] buffer;
}
void RotaryBuffer::Write(double value)
{
if (read_head == write_head && instantiated == this->si... | true |
fa040d5f88632d8b15eb2fce0daeaddc6c1fee75 | C++ | browngrg/caledonia | /misc/DOS2Seed.cpp | UTF-8 | 605 | 3.421875 | 3 | [] | no_license |
#include<iostream>
#include<sstream>
#include<string>
// Get X,Y output from the input file
void grabcol(int xcol, int ycol, std::istream& fin, std::ostream& fout)
{
xcol--;
ycol--;
std::string buff;
double vals[50];
while( !fin.eof() )
{
std::getline(fin,buff);
if( buff.size()==0 ) con... | true |
3a0767cb95266841ee1d537a8df29b0b6b5addcb | C++ | dingyp/3D-PointCloud-Detection | /Source/FilesLoadLib/obj.cpp | GB18030 | 25,592 | 2.71875 | 3 | [] | no_license | // obj.cpp: implementation of the CObj class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "obj.h"
#include <stdio.h>
#include <io.h>
#include <fstream>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////... | true |
b259ee837391a549950f8d3a8e8061b9a9c9f846 | C++ | usherfu/zoj | /zju.finished/1718.cpp | UTF-8 | 2,085 | 2.90625 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
#include<queue>
#include<cmath>
// 精度问题
using namespace std;
enum {
SIZ = 104,
};
struct Point {
double x,y,z,r;
};
struct Node {
int a;
int b;
double dis;
struct cmp{
bool operator()(const Node&a, const Node&b){
return a.dis > b.dis;
... | true |
fcb49a4528df1cb3e02ce3d388bb16e5267efaa0 | C++ | zhu-he/ACM-Source | /cf/632/C.cpp | UTF-8 | 326 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
std::string s[50000];
int main()
{
int n;
std::cin >> n;
for (int i = 0; i < n; ++i)
std::cin >> s[i];
std::sort(s, s + n, [](const std::string &a, const std::string &b)
{
return a + b < b + a;
});
for (int i = 0; i < n; ++i)
std::cout << s[i];
return... | true |
7716d2f9ff6a529b1fac3ca8573b0a2dd7c5c0c4 | C++ | PulsarFlux/SkySim | /SkySim/Texture.h | UTF-8 | 628 | 2.90625 | 3 | [] | no_license | #pragma once
#include "Sky.h"
class Texture
{
public:
Texture();
~Texture();
//Create blank texture, of the passed width and height, with streaming access
void Create(int, int, SDL_Renderer*, SDL_Window*);
//Destroys texture and resets relevant variables
void Free();
//Set the pixels of the texture to the RG... | true |
5ec99684738a5c6e13231ef38e447b8cf790ac67 | C++ | boulygin233/AISD | /Программирование/1 семестр/Задание 2/N.cpp | UTF-8 | 2,479 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
struct Node{
int Key;
Node* Next;
Node* Prev;
};
Node *Add(int Key, int &Count){
Node* pv = new Node;
pv->Key = Key;
pv->Next = 0;
pv->Prev = 0;
++Count;
return pv;
}
void Add(int Key, int &Count, Node **pf, Node **pe){
Node* p... | true |
da58a38105d4080f545545a969082265b41f5edc | C++ | lil7abt/study_notes | /Cpp_Primer_Plus/Chapter_10_Code/Basics/stock00.cpp | UTF-8 | 1,756 | 3.546875 | 4 | [] | no_license | //this file impmenting the stock class
#include <iostream>
#include "stock00.h"
stock::stock(const std::string &co, long n, double pr)
{
company=co;
if (n<0)
{
std::cerr<<"number of shares cannot be negative; "
<<company<<" shares set to 9.\n";
shares=0;
}
else... | true |
1283d087ea31e8d05f593c75852c8c8092713d59 | C++ | signmotion/arkanoid | /arkanoid/include/PIncarnate.h | WINDOWS-1251 | 3,477 | 2.71875 | 3 | [] | no_license | #pragma once
#include "GE.h"
namespace arkanoid {
class World;
/**
* , . ( ) Box2D.
*
* @see http://box2d.org
*/
class PIncarnate :
public GE
{
public:
typedef std::vector< typelib::coord2_t > polygon_t;
protected:
/**
* #! init() .
*/
PIncarnate(
std::shared_ptr< Wo... | true |
cfb1aac140b521b8fd3f0473e7fd69deae3ab88d | C++ | cpattillo/MachineLearning_ID3_KNN_NaiveBayes | /DataSet.cpp | UTF-8 | 7,113 | 2.78125 | 3 | [] | no_license |
/*
Caroline Pattillo
cbp53@georgetown.edu
Platform : Windows
Language / Environment : C++, Visual Studios
In accordance with the class policies and
Georgetown's Honor Code, I certify that, with
the exceptions of the class resources and those
items noted below, I have neither given nor received
any assistan... | true |
8187f4199f9b2dd46bfb3eddf4f8cd3f25aad818 | C++ | vishalmishraa/statistics_methods | /mean/meanDiscreat.cpp | UTF-8 | 704 | 3.359375 | 3 | [] | no_license | #include "iostream"
#include "vector"
#include "algorithm"
using namespace std;
int main(){
int n;
float SumOfF=0,SumOfFx = 0;
cout<<"Enter number of Observations : ";
cin>>n;
cout<<"\n";
int x[n+1],f[n+1],fx[n+1];
x[0]=0;f[0]=0;fx[0]=0;
cout<<"Enter value of X : ";
for (int i = 1... | true |