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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
606682dd474e2486ddae44750277596e1474b238 | C++ | cho-jae-seong/Algorithm | /Tallest_tower.cpp | UTF-8 | 846 | 2.71875 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
struct Brick {
int s, h, w;
Brick(int a, int b, int c) {
s = a;
h = b;
w = c;
}
bool operator<(const Brick& b)const {
return s > b.s;
}
};
int main(void) {
int n, a, b, c, max_h... | true |
90e602a00d4bc0825fbb63aba15a80c43311a789 | C++ | SMara99/Labor2 | /complex.cpp | UTF-8 | 2,904 | 3.53125 | 4 | [] | no_license | #include "complex.h"
#include <math.h>
complex::complex() {
//constructor fara parametri
a = 0;
b = 0;
}
complex::complex(double a_value, double b_value) {
//constructor cu parametri
a = a_value;
b = b_value;
}
complex::~complex(){
//destructor
}
double complex::get_a() const {
// return... | true |
3efe100ea7b006d6fdc24736636bf565c8fa3028 | C++ | ulinka/tbcnn-attention | /github_cpp/21/83.cpp | UTF-8 | 3,168 | 3.609375 | 4 | [] | no_license |
#include <iostream>
using namespace std;
void SelectionSort(int arr[], int size);
int SelectionSortPartB(int arr[], int arrSize, int sortSectionSize);
double median(int arr[], int size);
void printArray(int arr[], int size);
int main(int argc, const char * argv[]) {
int selectionSortArrPartA[10] = {... | true |
d090a0f74327bf3687ec0734784af5fb81859bb0 | C++ | ABX9801/Data-Structures | /linked-list/linkedlist1.cpp | UTF-8 | 1,010 | 3.765625 | 4 | [] | no_license | #include<iostream>
using namespace std;
// In this code we will observe linked list as a queue implementation
struct node
{
int data;
node* next;
};
node* head = NULL;
void append(int value){
if(head==NULL){
node* temp = (node*)malloc(sizeof(node));
head = temp;
temp->data = val... | true |
fadbeea1c12c51f26ec2805f9224ef9be6ca68cf | C++ | Binarianz/Dataons | /ISI/D03-C++-Web1909B- J. Chevalier/SubmittedDocs/Joseph_LibraryExercise/Book.cpp | UTF-8 | 1,077 | 3.34375 | 3 | [] | no_license | #include "Book.h"
using namespace std;
Book::Book()
{
}
Book::Book(string title,string author, int pageCount):LibraryItem(title)
{
this->author = author;
this->pageCount = pageCount;
this->timesRead = 0;
this->dateLastRead = nullptr;
}
Book::~Book()
{
if (this->dateLastRead != nullptr)
delete dateLastRead;
}
... | true |
b5ea31fa8594fb60d09529a91050887029b93b47 | C++ | liuy307/Coding-Interviews | /01Operator.cpp | UTF-8 | 1,157 | 3.34375 | 3 | [] | no_license | #include<cstring>
#include<cstdio>
#include <assert.h>
#include <iostream>
class CMyString
{
public:
CMyString(char* pData = nullptr);
CMyString(const CMyString& str);
~CMyString(void);
CMyString& operator = (const CMyString& str);
private:
char* m_pData;
};
CMyString::CMyString(char* pData) {
std::cout << "... | true |
355bbc2b6c9807143b65db084f9f6e83bf2a4008 | C++ | Libaier/ABC | /算法/剑指offer/18.cpp | UTF-8 | 988 | 3.78125 | 4 | [
"MIT"
] | permissive | /*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
class Solution {
public:
bool IsSubtree(TreeNode* pRoot1, TreeNode* pRoot2)
{
if (pRoot2==NULL)
{
return true;
}
if (pRoot1==NULL)
{
... | true |
bc281dd435b9ea6fcab12ecd292a8241bc804440 | C++ | Anne-ClaireFouchier/ImageProcessingComputerVision | /AVSA/Histogram_based_object_tracking/src/Tracker.cpp | UTF-8 | 2,883 | 2.671875 | 3 | [] | no_license | #include "Tracker.hpp"
#include "ShowManyImages.hpp"
using namespace cv;
using namespace std;
// initializing the tracker parameters
Tracker::Tracker (Model* model, unsigned int nrCandidates, unsigned int stride)
{
this->model = model;
this->nrCandidates = nrCandidates;
this->stride = stride;
}
Trac... | true |
55ceb0d78b4d7153becd9eb6e5a26b6d3ff4cde5 | C++ | PalashHawee/Data-Structures-and-Algorithms-My-Preparation-for-Software-Engineering | /String/Comparing_Strings.cpp | UTF-8 | 384 | 3.78125 | 4 | [] | no_license | //Comparing two strings
#include<stdio.h>
int main()
{
char A[]="Painter";
char B[]="Painting";
int i,j;
for(i=0,j=0;A[i]!='\0'&&B[j]!='\0';i++,j++)
{
if(A[i]!=B[j])
{
break;
}
if(A[i]==B[j])
{
printf("Two strings are equal");
}
else if(A[i]<B[j])
{
printf("A is smalle... | true |
ef5b31c95790f2d080d2e69e5790af9b44c03ee4 | C++ | yjhui0331/DesignPattern | /Adapter/main.cpp | UTF-8 | 1,491 | 2.875 | 3 | [] | no_license | // Adapter.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include "Adapter.h"
#include <iostream>
/*
意图:
将一个类的接口转换成客户希望的另外一个接口。Adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。
角色:
Target 目标使用的接口
Adaptee 第三方类接口
Adapter 适配器本身 通过继承Target,父接口,在接口中适配调用Adaptee特殊功能接口(对象组合方式实现)
适应性:
你想使用一个已经存在的类,而它的接口不符合你的需求。
你想创建一个可以复用的类,该类可以与... | true |
600aaaa99a71a06628e8a44f517adfa4f09971a5 | C++ | ankitvashisht12/Competitve-programming | /SPOJ/AddingReversedNumbers.cpp | UTF-8 | 549 | 2.765625 | 3 | [] | no_license | /*
* Author : Ankit Vashisht
* Problem :https://www.spoj.com/problems/ADDREV/
*/
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int n;
cin>>n;
while(n--){
int res,resres =0,r=0;
string a,b;
cin>>a>>b;
reverse(a.begin(), a.end... | true |
cb7ca17eaf9ba12ca5e0eaac80a7565e5e658fcb | C++ | Helvinion/libTuyaux | /include/Buffers/Buffer.hpp | UTF-8 | 435 | 2.78125 | 3 | [] | no_license | #ifndef INCLUDE_BUFFERS_BUFFER_HPP
# define INCLUDE_BUFFERS_BUFFER_HPP
class Buffer
{
public:
virtual ~Buffer() {};
virtual unsigned char& operator[](unsigned int index) = 0;
virtual const unsigned char& operator[](unsigned int index) const = 0;
virtual unsigned int size() const = 0;
virtual Buffer* split(un... | true |
7e2384dd564ea8c0136e0f218114e1d0a96b21d7 | C++ | BlackKvader/my_database | /main.cpp | UTF-8 | 846 | 2.546875 | 3 | [] | no_license | /*
databaza
forma:
subor sa vola hocijako.dat
C: category
T: title
K: keywords
Q: otazka
A: answer / data
*/
#include <sstream>
#include <string>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include "classes.hpp"
#define ss_clr() {ss.str(""); ss.clear();}
#define my... | true |
e51711af4287c1f7b86bcce1f4fb19e6c754e35a | C++ | ihewro/iNet | /utils/UdpConnection.cpp | UTF-8 | 3,014 | 2.609375 | 3 | [] | no_license | /**
文件注释样例,参考: http://www.edparrish.net/common/cppdoc.html
socket 连接流程实现
@project netTester
@author Tao Zhang, Tao, Tao
@since 2020/4/26
@version 0.1.3 2020/4/30
*/
#include "UdpConnection.h"
#include "seeker/loggerApi.h"
using seeker::SocketUtil;
UdpConnection::UdpConnection() {}
UdpConnection& UdpCon... | true |
13dddcb9bd5553fc044645947a95fb79a739dbf7 | C++ | JHYOOOOON/Collection | /baekjoon/10826.cpp | UTF-8 | 787 | 3.203125 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
using namespace std;
string d[10001];
string sum(string a, string b) {
string ans = "";
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
while (a.length() < b.length()) a += '0';
while (b.length() < a.length()) b += '0';
int n, carry = 0;
... | true |
b9956577dde3fe8489c28b8accbba6ed149ed020 | C++ | pikacsc/CodingTestPrac | /BAEKJOON_1904_01Tile/1904_01Tile_main.cpp | UHC | 1,604 | 3.515625 | 4 | [] | no_license | /*
https://www.acmicpc.net/problem/1904
01Ÿ
̿ 2 ֱ , ƹ Ÿϵ ̴ּ. Ÿϵ 0 Ǵ 1 ִ Ÿϵ̴.
ְ θ ϱ 0 Ÿϵ ٿ ̷ 00 Ÿϵ .
ᱹ 1 ϳ ̷ Ÿ Ǵ 0Ÿ 00Ÿϵ鸸 Ǿ.
Ƿ ̴ ŸϷ ̻ ũⰡ N 2 Ǿ. , N=1 1 ְ,
N=2 00, 11 ִ. (01, 10 Ǿ.) N=4 0011, 0000, 1001, 1100, 1111 5 2 ִ.
츮 ǥ N ־ ̰ ִ ̴. Ÿϵ .
Է
ù ° ٿ ... | true |
4a9609c5020e62f037b24ba8a279cef7a442083c | C++ | magnusl/ssh | /src/sftp_transfer_observer.h | UTF-8 | 661 | 2.625 | 3 | [] | no_license | #ifndef _SFTP_TRANSFER_OBSERVER_H_
#define _SFTP_TRANSFER_OBSERVER_H_
#include "sftp_transfer_info.h"
namespace sftp
{
/* Class: sftp_transfer_observer
* Description: Used to notify a observer about the transfers.
*/
class sftp_transfer_observer
{
public:
/... | true |
cb5783e4d4984e0d7b70ebffcfc24c4a01e43fca | C++ | Daratrixx/cpp-gl4-engine | /src/Entity.h | UTF-8 | 937 | 2.8125 | 3 | [] | no_license | #pragma once
#ifndef ENTITY_H
#define ENTITY_H
#ifndef TYPES_H
#include "Types.h"
#endif
#ifndef GAMEOBJECT_H
#include "GameObject.h"
#endif
class Entity : public GameObject {
public:
Entity();
Entity(Entity* e);
virtual ~Entity();
virtual bool writeInFile(std::ofstream & fout);
virtual bool rea... | true |
a4c33742ab4b2bd070eb42fceee92d52976ab484 | C++ | hezyin/pvz | /mainwindow.cpp | UTF-8 | 2,425 | 2.5625 | 3 | [] | no_license | #include <QtGui>
#include "mainwindow.h"
#include "plant.h"
#include "sunflower.h"
#include "backgroundmusic.h"
#include "sunlight.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
createActions();
createMenus();
QPushButton *quit = new QPushButton(tr("Quit"));
connect(quit, SIGNAL... | true |
fbed0964742c9c9c420965cf148e3ba79b4fa521 | C++ | Laurie-S/ITC313-TP2 | /commande.cpp | UTF-8 | 2,072 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include "produit.h"
#include "commande.h"
#include "client.h"
commande::commande(client client1, vector<produit> produits) : client1_(client1), produit_(produits){
statusCommande_=false;
}
void commande::addProduit(produit prod1){
produit_.push_b... | true |
fa942472174f43cdd95ea3d57049f24f97b8c805 | C++ | TGiumenta/SuperPaulBox | /source/UnitTest.Library.Desktop/VectorTests.cpp | UTF-8 | 12,449 | 2.8125 | 3 | [] | no_license | #include "pch.h"
#include <crtdbg.h>
#include <CppUnitTest.h>
#include "foo.h"
#include <exception>
#include "Vector.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace FieaGameEngine;
using namespace UnitTests;
namespace Microsoft::VisualStudio::CppUnitTestFramework
{
template<>
inlin... | true |
b213e054a9c9da12576cbf28c61146a4d8460b6f | C++ | kamilsan/algorithms-and-data-structures | /data-structures/linked-list/test.cpp | UTF-8 | 1,434 | 3.65625 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include "linkedList.hpp"
int main()
{
LinkedList<int> list;
list.add_front(12);
list.add_front(42);
list.add_front(53);
list.for_each([](const int& n) { std::cout << n << " ";});
std::cout << std::endl;
std::cout << "Front: " << list.get_front() << std::endl;
std::cout << "Size:... | true |
bf5c32531c773d3f74239ce275494bd9fe90cbb5 | C++ | arosh/NJPC2017 | /InputForm/solution/main.cc | UTF-8 | 186 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
int L; string S;
cin >> L >> S;
cout << S.substr(0, min<int>(L, S.size())) << endl;
}
| true |
b0a63e9ac95bb88a0ea0b1d88890e7ed5f1f566a | C++ | daman94/Coding-Problems | /Stacks/2-Linked List Implementation.cpp | UTF-8 | 1,393 | 3.640625 | 4 | [] | no_license | //
// main.cpp
// Array
//
// Created by Daman Saroa on 09/06/15.
// Copyright (c) 2015 Daman Saroa. All rights reserved.
//
#include <iostream>
#include <stdlib.h>
#include <limits.h>
using namespace std;
struct stack {
int data;
struct stack* next;
};
struct stack* Create()
{
return NULL;
}
void P... | true |
58b184479249088d17dc59a588b8b294bb18c36c | C++ | eif-courses/tiesinePaieskapi20s | /main.cpp | UTF-8 | 4,994 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include "Studentas.h"
using namespace std;
int TiesinePaieska(const vector<int> &sarasas, int raktinisZodis);
vector<int> TiesinePaieskaSurandintiVisusAtitikmenis(const vector<int> &sarasas, int raktinisZodis);
int DvejetainePaieska(vector<int> &sarasas, i... | true |
66914b63f3aa124cb350bccdd922497f35dc76d6 | C++ | needhourger/university | /数据结构/conversion.cpp | UTF-8 | 1,020 | 3.546875 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
void dec2bin(int n){
short a[32]={0};
unsigned short i=0;
if (n<0) {
printf("-");
n=-n;
}
while (n>0) {
a[i++]=n%2;
n/=2;
}
while(i>0) printf("%d",a[--i]);
printf("\n");
}
void dec2oct(int n){
short a[12]={0};
unsigned short i=0;
if (n<0) ... | true |
a3474bdb657b1a9365a93b477d0d5c31cd8581ba | C++ | iamSamuelFu/ucsbhaha | /moreLinkedListFuncs.cpp | UTF-8 | 5,161 | 3.484375 | 3 | [] | no_license | #include <cassert>
#include "linkedList.h"
#include "linkedListFuncs.h"
Node * pointerToMax(LinkedList *list) {
assert(list!=NULL);
assert(list->head != NULL);
Node *p=list->head; //declare a new pointer p to iterate the list
int maxValue=p->data; //declare max value to the first data
Node *max=list->head;... | true |
f5d65a4d613fb4a55fe7f8582eec160f5f4f77c7 | C++ | Aber4Nod/Templates | /basics_01/maxcommon.hpp | UTF-8 | 280 | 2.71875 | 3 | [] | no_license | //
// Created by n.mikhnenko on 04/01/2019.
//
#ifndef TEMPLATES_MAXCOMMON_HPP
#define TEMPLATES_MAXCOMMON_HPP
#include "type_traits"
template<typename T1, typename T2>
std::common_type_t<T1, T2> max(T1 a, T2 b)
{
return b < a ? a : b;
};
#endif //TEMPLATES_MAXCOMMON_HPP
| true |
f3b4cbb680a3b872fa262a4a8e78a53b14f6d07c | C++ | Polytechnic-Institute-of-Leiria/cg2020 | /Fire3D.cpp | UTF-8 | 2,576 | 2.546875 | 3 | [] | no_license | #include "Fire3D.h"
#define IMAGE_ROWS 4
#define IMAGE_COLS 8
//static const int IMAGE_COLS = 8;
static float vertices[4][3] = {
{ -.3f, 0.5f, 0.0f },
{ -.3f, 0.0f, 0.0f },
{ .3f, 0.5f, 0.0f },
{ .3f, 0.0f, 0.0f },
};
Fire3D::Fire3D()
{
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glGenBuffers(2, vbo);... | true |
9dc22042572f6aff87cca9a0b31ca0941877d01c | C++ | 49paunilay/Interfacing-with-arduino | /EEPROM.ino | UTF-8 | 750 | 2.953125 | 3 | [] | no_license | #include <EEPROM.h>
int value;
int address=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
String str="";
str=Serial.readString();
if(str.startsWith("read"))
{
address=str.substring(str.in... | true |
d3a4a37b216c4a27f561d6afffdc07e7ed29d1c8 | C++ | icode123/leetcode | /ZigZag Conversion.cpp | UTF-8 | 696 | 2.8125 | 3 | [] | no_license | class Solution {
public:
string convert(string s, int nRows) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(nRows<2) return s;
int n=s.size();
int l=2*nRows-2;
string res;
res.clear();
for(int i=0;i<n;i+=l)
... | true |
1f04ac05b538f3bcacb09857bdca56cc2914eb98 | C++ | TCtobychen/IntrotoAlgorithm | /C++Implementation/LuoguP1141.cpp | UTF-8 | 1,396 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#define For(x,y) for(int i =x;i<y;i++)
using namespace std;
int N;
bool vis[1010][1010];
int a[1010][1010];
int poi[1010][1010];
int ans[100010];
queue<pair<int, int > > q;
void dojob(pair<int, int > pt, int n)
{
int x=pt.first, y =pt.second... | true |
d69dc2446a1ed33d74040fb2dc381a55231bbb54 | C++ | blockspacer/realtime_server_pub | /src/lib/variable/key_value_cache_storage.cc | UTF-8 | 817 | 2.71875 | 3 | [] | no_license | #include "key_value_cache_storage.h"
void KeyValueCacheStorage::set(const std::string& key, const std::string& value)
{
string_cache[key] = value;
}
KeyValueCacheStorage::Option KeyValueCacheStorage::get(const std::string& key)
{
std::map<std::string, std::string>::iterator it = string_cache.find(key);
... | true |
c82b7018661f0e5e55d276db4d739f6a7f5c4608 | C++ | crafterrr/cpp_multithreading | /InputParallelizer.cpp | UTF-8 | 1,765 | 2.59375 | 3 | [] | no_license | #include <vector>
#include <stdint.h>
#include <string>
#include <sstream>
#include <thread>
#include <mutex>
#include <fstream>
#include <vector>
#include <stack>
#include <condition_variable>
#include "InputParallelizer.h"
// #include "exceptions.h"
using namespace std;
InputParallelizer::InputParallelizer(str... | true |
7dd603fae12471bd7753dd7d47709336903f6d5c | C++ | asassoye/ESI-DEV3-Labos | /td08/resources/data_fraction.h | UTF-8 | 2,184 | 3.5 | 4 | [
"MIT"
] | permissive | /*!
* \file data_fraction.h
*
* \brief Fonctions pour la génération de données de création de
* fractions.
*/
#ifndef DATA_FRACTION_H
#define DATA_FRACTION_H
#include <vector>
#include <utility>
#include <tuple>
namespace nvs {
/*!
* \brief Énumération fortement typée pour choisir le type de
* c... | true |
cffab1f85ed2677fa3bee570e754c511698cdbd0 | C++ | yutao-arch/2019-HIT-data-structure-lab | /数据结构实验4和实验5/1180300829-余涛-实验5/sort/sort/sort.cpp | UTF-8 | 7,708 | 3.40625 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#define max 101
struct records
{
int key;
};
records a[max];
void createtest(records a[])
{
int i, j, temp,k;
for (i = 1; i < 101; i++)
{
a[i].key = i;
//printf("%d %d ", k, test[k]);
}
for (k = 1; k < 10000; k++)
{
i = rand() % max;
j = rand() % max;
if (i !... | true |
4bff4f7cacaee3c591b3c50a78132e05de65ee71 | C++ | Rav263/Contests_4_2019 | /contest_7/dim.cpp | UTF-8 | 920 | 3.0625 | 3 | [] | no_license | #include <complex>
#include <vector>
#include <array>
namespace Equations
{
template <class T>
std::pair<bool, std::vector<std::complex<T>>> quadratic(const std::array<std::complex<T>, 3> &v)
{
std::pair<bool, std::vector<std::complex<T>>> res;
if (v[1] == std::complex<T>() && v[2] == std::... | true |
107f757eb647a069abbc060e8d95eccadb307fef | C++ | per1234/ArduinoUnifiedLog | /LogModule.h | UTF-8 | 317 | 2.59375 | 3 | [] | no_license | #ifndef LogModule_h
#define LogModule_h
#include <Arduino.h>
class LogModule {
private:
int outputMinimumLogLevel = 0;
public:
int getMinimumLogLevel() { return outputMinimumLogLevel; }
void setMinimumLogLevel(int min) { outputMinimumLogLevel = min; }
virtual void write_message(String message);
};
#endif
| true |
f230ac31d42ecaafe9a3221fcff995aa0f994ab1 | C++ | CAHeap/CAHeap | /src/CPU/tests/testparam.cpp | UTF-8 | 1,706 | 2.671875 | 3 | [] | no_license | /*
* test how d affect the performance
*/
#include <stdio.h>
#include <stdlib.h>
#include "../AHeap/AHeap.h"
#include "../common/IO.h"
#include "../common/metric.h"
#include "../tasks/AHeap_CountingTasks.h"
#define MAX_FLOW_NUM 16000
/*
* 1. range d1 from 1 to largest size
* d2 is fixed to 4
* 2. range d2 f... | true |
bf019a10e31b55de53bb79255171d84bcb9429ae | C++ | yuna-s/yunatcoder | /AOJ/introduction1/cardGame.cpp | UTF-8 | 511 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <locale>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
int n, p1 = 0, p2 = 0;
cin >> n;
rep(i, n)
{
string taro, hanako;
cin >> taro >> hanako;
if (taro == hanako)
{
... | true |
2b3d2f133787499e4517814870e0cb9de16906a6 | C++ | braunm/CppADutils | /inst/include/cppad_atomic/dlogitbeta_log_at.h | UTF-8 | 2,031 | 2.53125 | 3 | [] | no_license | #ifndef __DLOGITBETA_LOG_AT
#define __DLOGITBETA_LOG_AT
#include <cppad_atomic/mb_atomic.h>
// NOTE: This is a NORMALIZED incomplete beta function.
// Equivalent to the cdf of a beta(z;a,b) distribution
using Eigen::MatrixBase;
using R::digamma;
using R::trigamma;
class dlogitbeta_log_cl {
public:
t... | true |
8b760648db52e54bf2f4eca87064177d5060a48c | C++ | ablondal/comp-prog | /Real_Contests/CCPC2020/Dodec.cpp | UTF-8 | 1,266 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a<b)?a:b)
// DONE
map <string,int> ntone = {
{"C",0},
{"C#",1},
{"D",2},
{"D#",3},
{"E",4},
{"F",5},
{"F#",6},
{"G",7},
{"G#",8},
{"A",9},
{"A#",1... | true |
0738e6b22ae6e654891ce7583e5bb15a06a86703 | C++ | SarahWuTX/DataStructureCourseDesign | /P10/P10_1652677_吴桐欣.h | UTF-8 | 11,323 | 3.53125 | 4 | [] | no_license | //
// P10_1652677_吴桐欣.h
//
#ifndef P10_1652677_____h
#define P10_1652677_____h
#include <iostream>
#include <vector>
#include <time.h>
using namespace std;
void SWAP(int& a, int& b);//交换函数
void BubbleSort(vector<int> list);//冒泡排序函数
void SelectSort(vector<int> list);//选择排序函数
void InsertSort(vector<int> list);//直接插入排... | true |
4be73e51be5520f92cecfd1de481b91507252a67 | C++ | dev-zero/quantum3body | /time_evolutions.hh | UTF-8 | 3,735 | 2.984375 | 3 | [] | no_license | /* vim: set sw=4 sts=4 ft=cpp et foldmethod=syntax : */
/*
* Copyright (c) 2011 Tiziano Müller <tm@dev-zero.ch>
* Christian Reinhardt
*
*
*/
#ifndef TIME_EVOLUTIONS_HH
#define TIME_EVOLUTIONS_HH
#include "two_dim_spo.hh"
#include <limits>
/**
* This is the "default" time evolution which is... | true |
f31fa66e66a04ff31b1002b69d450fcffd62c1c8 | C++ | harini9804/operating_systems | /processclass.h | UTF-8 | 898 | 2.59375 | 3 | [] | no_license | #include<stdio.h>
#include<iostream>
#include<vector>
class process{
public:
int pid;
int at;
int bt;
int ct,tat,wt;
void input(int id);
void output();
bool operator < (const process& obj) const {
if(at == obj.at){
return pid < obj.pid;
}else
return at < obj... | true |
c5950ee7f1573cc82e0f2a67124a4343c6740af6 | C++ | mecha-rm/GDW_Y2-PJT-repos | /GDW_Y2 - CNZ/src/cherry/objects/Primitive.cpp | UTF-8 | 3,360 | 3 | 3 | [] | no_license | #include "Primitive.h"
#include "..\lights\LightManager.h"
// constructor
cherry::Primitive::Primitive() : cherry::Object()
{
}
// copy constructor.
// cherry::Primitive::Primitive(const cherry::Primitive& prim) : Object(prim)
// {
// baseColor = prim.GetColor();
// }
// destructor
cherry::Primiti... | true |
5c3f1777ed4feaa60a152787a0ce0d849b302abb | C++ | DejavuLeo/PyCAD | /CAD/LineArcDrawing.h | UTF-8 | 1,594 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | // LineArcDrawing.h
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#pragma once
#include "Drawing.h"
enum EnumDrawingMode{
LineDrawingMode,
ArcDrawingMode,
ILineDrawingMode,
CircleDrawingMode,
};
enum EnumCircleDrawingMode{
... | true |
4b7eeee395b01b1d9091656c52a6d0f599c826c1 | C++ | Daga2001/Warshall-s_Algorithm | /main.cpp | UTF-8 | 2,235 | 3.390625 | 3 | [] | no_license | /*
File: main.cpp
Author: anonymous.
creation date: 2021-04-15
last update date: 2021-04-15
Versión: 1.0
Licencia: GNU-GPL
*/
#include <iostream>
#include "Warshall.h"
#define KnowMatrix(x) warshall.knowMatrix(x);warshall.optimizeAdjacencyMatrix();cout << "This is the original matrix, called " #x << endl;... | true |
fb7ea691bdc727a1abe89da512da506d59009fad | C++ | mwstrfld/WheelOfJeopardy | /PointManager.h | UTF-8 | 2,056 | 2.96875 | 3 | [] | no_license | #pragma once
#include <QtGlobal>
#include <WheelOfJeopardyTypes.h>
// Note: This is a singleton class to only have one instance
// of the PointManager object within the application
class PointManager
{
public:
// Function call to get the instance
static PointManager* instance();
// Add points fu... | true |
aed24de3e3da7baafdb0b8a8538ac41ca1994375 | C++ | dennis5blue/WMSN | /Reasearch/OldVersion/ScheduleFactory.cpp | UTF-8 | 4,864 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <vector>
#include "ScheduleFactory.h"
using namespace std;
ScheduleFactory::ScheduleFactory(int numCameras, vector< pair<double,double> > positions, vector< vector<int> > overhearTopology):
m_numCameras(numCameras),
m_positions(positions),
m_overhearTopology(overhearTo... | true |
04f31ae494d9d54f36338afbdf8e7cd2757ffbbb | C++ | ups100/AAL2 | /src/CrisisAlgorithmCaseGenerator.cpp | UTF-8 | 2,325 | 2.90625 | 3 | [] | no_license | /**
* @file CrisisAlgorithmCaseGenerator.cpp
*
* @brief Implementation of the Class CrisisAlgorithmNamespace::CrisisAlgorithmCaseGenerator
*
* @details Implementation of project "AAL-9-LS KRYZYS"
*
* @date 28-10-2012 18:49:19
*
* @author Krzysztof Opasiak
*/
#include "CrisisAlgorithmCaseGenerator.h"
#include... | true |
b35709c3273a1b5a1581fa27c4df06fb708dee2b | C++ | Ruhtra47/Treino-OBI | /Prova Nível 1 Fase 2 Turno B/recorde.cpp | UTF-8 | 290 | 2.828125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int r, m, l;
cin >> r >> m >> l;
if (r < m) {
cout << "RM" << endl;
} else {
cout << "*" << endl;
}
if (r < l) {
cout << "RO" << endl;
} else {
cout << "*" << endl;
}
} | true |
1ddab7fc286625a18f18a4652f9b849f24b8c7ea | C++ | baidu/openrasp | /agent/php7/third_party/yaml-cpp/include/yaml-cpp/conversion.h | UTF-8 | 2,246 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #ifndef CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define CONVERSION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#include "yaml-cpp/null.h... | true |
5092fad9ee3caeeb5e8b61de60d96f28310a4243 | C++ | 741zxc606/LeetCodePractices | /Algorithm/cpp/91.DecodeWays.cpp | UTF-8 | 1,592 | 3.796875 | 4 | [
"MIT"
] | permissive | /*
* 91.Decode Ways
* A message containing letters from A-Z is being encoded to numbers using the following mapping:
* 'A' -> 1
* 'B' -> 2
* ...
* 'Z' -. 26
* Gicen an encoded message containing digits,determine the total number of ways to decode it.
* For example,
* Given encoded message "12",it could... | true |
c45c4dee0ec1a7899343fd29e902a67162b6232d | C++ | milasudril/coin | /dombuilder.hpp | UTF-8 | 1,575 | 2.75 | 3 | [
"BSD-2-Clause-Views",
"BSD-2-Clause"
] | permissive | //@ {
//@ "targets":[{"name":"dombuilder.hpp","type":"include"}]
//@ }
#ifndef COIN_DOMBUILDER_HPP
#define COIN_DOMBUILDER_HPP
#include "input.hpp"
#include "element.hpp"
namespace CoIN
{
class DOMBuilder
{
public:
DOMBuilder(Element& element_out):m_elem_current("root"),r_element_out(element_out)
{}
... | true |
498c961c1fa00b70db322bfb3f4a151cc872400a | C++ | dongheekim23/Algorithm-Problems | /LetterCombinationsOfAPhoneNumber.cpp | UTF-8 | 1,855 | 3.90625 | 4 | [] | no_license | // Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.
void GetStrings(const std::string& digits, std::vector<std::vector<char>>& stringSet)
{
for (int i = 0; i < digits.size(); ++i)
{
if (digits[i] == '2')
stringSet.emplace_back(s... | true |
314774e0c2a711bef9cc847c2ecf8bfce3041090 | C++ | drken1215/algorithm | /String/knuth_morris_pratt.cpp | EUC-JP | 2,196 | 3.125 | 3 | [
"CC0-1.0"
] | permissive | //
// Knuth-Morris-Pratt
// fail[i] := pat[0:i) suffix pat prefix ɤפ뤫 (Ĺ i ̤)
// O(N) ǹۤǤ
// Ѥưʲ줿
// pat[0:i) κǾ ("abcabcab" "abc" η֤ڤ뤳ȤǤǤΤ 3)
// ʸ S ˤ S[i:] prefix pat Ȱפ褦 i ٤Ƶ
//
// verified:
// ABC 150 F - Xor Shift
// https://atcoder.jp/contests/abc150/tasks/abc150_f
//
// ARC 060 F - ... | true |
ef161e51aa384c06853cb792718ee0eaef38dd50 | C++ | ScottFitzgerald83/cosc_1337 | /Course Materials/Examples/04 function/function as assignment.cpp | UTF-8 | 567 | 3.5625 | 4 | [] | no_license | /*
Name
Date
Project
*****************
Description
Examples for assignment of a function
*/
#include <iostream> // for cin, cout, endl
using namespace std;
int calc(int );
int main()
{
int number = 5;
cout << "The value of number before calling the function " << number << ... | true |
95d340ebfb313548fa38beb1adf62f03527ba554 | C++ | zhuzhonghua/pixeldungeon_cpp | /engine/button.cpp | UTF-8 | 1,211 | 2.71875 | 3 | [] | no_license | #include "button.h"
#include "game.h"
float Button::longClick = 1.0f;
Button::TouchArea1::TouchArea1(Button* btn) :TouchArea(0, 0, 0, 0)
{
_btn = btn;
}
void Button::TouchArea1::onTouchDown(TouchScreen::Touch* touch)
{
_btn->_pressed = true;
_btn->_pressTime = 0;
_btn->_processed = false;
_btn->o... | true |
f917f6cc20fd9c2c3da80abb4bad1d1016308b07 | C++ | nanlimarketing/Iris_gal_maker | /Button.hpp | UTF-8 | 1,743 | 2.640625 | 3 | [] | no_license | //按钮类
//用于选择和跳转
//First Draft: 2012.4.26
#ifndef SYS
#define SYS
#include "System.hpp"
#endif
#ifndef TEXT
#define TEXT
#include "Text.hpp"
#endif
#ifndef ANIMEM
#define ANIMEM
#include "AnimeManager.hpp"
#endif
class Button
{
public:
Button(); //构造函数
bool OnButton(const float x, const... | true |
db47fd4c288d5a12bbceecdc94e0c9d21f7c1076 | C++ | easmith14/cse687-group1 | /source/TestObjects/testDLL/testDLL/equipment.cpp | UTF-8 | 2,284 | 2.890625 | 3 | [
"MIT"
] | permissive | #include "pch.h"
#include "equipment.h"
#include "../../../TestHarness/TestResult.h"
#include "../../../TestHarness/TestResponse.h"
#include <string>
using std::string;
static string _EquipmentName;
static int _durability;
static int _property;
static int _saved_property;
void create_equipment(const string a, const... | true |
2ea13e229a08c131786cc6913b0ad329be9515a1 | C++ | mmardanova/C-lab-1 | /src/main1.cpp | UTF-8 | 694 | 2.890625 | 3 | [] | no_license | #include "task1.h"
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
char gender = 0; float weight = 0, height = 0;
printf("Enter your gender:", gender);
scanf("%c", &gender);
if (gender != 'm' && gender != 'w')
{
printf("Gender is entered incorrectly\n");
return 1;
}
printf("Enter your wei... | true |
02b379e49e90a2ffb7a2ccf6f8ed6a893cdb3a93 | C++ | vik228/SpojCodes | /ABCDEF.cpp | UTF-8 | 890 | 2.6875 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int *usr_val,*lhs,*rhs,t,sum=0,it1=0,it2=0,ans=0;
cin>>t;
usr_val=new int[t];
lhs=new int[t*t*t+1];
rhs=new int[t*t*t+1];
for(int i=0;i<t;i++)
{
cin>>usr_val[i];
}
for(int i=0;i<t;i++)
{
for(int j=0;j<t;j++)
{
for(int k=0;k<t;k+... | true |
7164541100fc159f9333f5585b7b5fef74eb2725 | C++ | Francisco-Ibarra07/sparky | /src/modules/controls/include/controls/Motor.hpp | UTF-8 | 7,075 | 3.296875 | 3 | [
"MIT"
] | permissive | #ifndef MOTOR_H
#define MOTOR_H
#include <ros/ros.h>
#include "wiringSerial.h"
#include <string>
#include <unistd.h>
#include <stdexcept>
#include <stdbool.h>
typedef enum{
FRONT_L_MOTOR= 1,
FRONT_R_MOTOR= 2,
REAR_L_MOTOR= 3,
REAR_R_MOTOR= 4,
} MOTOR;
typedef enum {
directionNotInitialized,
... | true |
6d12f2d5e0f09f39f261095cf0a72dcd5cbcddd9 | C++ | YuraTim/Ravage | /RavageRebuild/src/OpenGL/RavTextureOpenGL.cpp | UTF-8 | 1,781 | 2.609375 | 3 | [] | no_license | #include "OpenGL\RavTextureOpenGL.h"
namespace Ravage
{
TextureOpenGL::TextureOpenGL()
{
glGenTextures(1, &mTextureId);
}
TextureOpenGL::~TextureOpenGL()
{
glDeleteTextures(1, &mTextureId);
}
void TextureOpenGL::setFilterMode(FilterMode mode)
{
GLenum target = getTarget();
if (target == 0)
return... | true |
9a9a2ec8489503ca6a8f38272bb0314dc55e52b2 | C++ | cypypccpy/SRSLAM | /include/srslam/datastruct/mappoint.h | UTF-8 | 1,377 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <memory>
#include <mutex>
#include <list>
#include <Eigen/Core>
#include <Eigen/Geometry>
class frame;
class feature;
/**
* 路标点类
* 特征点在三角化之后形成路标点
*/
class mappoint {
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
unsigned long id_ = 0; // ID
bool is_outlier_ = false;
Eigen::V... | true |
1a89665c08dcfb038b201db8b0171daeb84287ca | C++ | ChaseDuncan/linkstate_distvec | /distvec.cpp | UTF-8 | 8,661 | 3.03125 | 3 | [] | no_license | #include "distvec.h"
using namespace std;
void Distvec::make_graph_and_list_edges(string topofile)
{
ifstream infile(topofile);
string line;
int ints[3];
while(getline(infile, line))
{
istringstream iss(line);
int number;
int idx=0;
while(iss >> number)
{
ints[idx] = number;
idx++;
}
pai... | true |
ac288486fc32eeb9b7b431da723b19c10adbee7c | C++ | jackflower/SCInfor | /SCInfor/source/Equipment/EquipmentData/EquipmentGunData.cpp | WINDOWS-1250 | 1,274 | 2.890625 | 3 | [] | no_license | // _____________________________________________
// | EquipmentGunData.cpp - class implementation |
// | Jack Flower - May 2016 |
// |_____________________________________________|
//
#include "EquipmentGunData.h"
#include "../Weapon/Gun/Gun.h"
#include "../../Logic/PhysicalManager.h"
namespace ... | true |
8904ae7b5ca7e0a9d2722b68df63ec2169e94981 | C++ | coconetlero/algoritmos_clase | /queue_dynamic/main.cxx | UTF-8 | 781 | 3.5625 | 4 | [] | no_license | #include <stdio.h>
#include <assert.h>
#include <queue.h>
int main(int argc, char **argv)
{
printf("Create the queue \n");
Queue queue;
queue.head = NULL;
queue.tail = NULL;
printf("Add element = 3 \n");
enqueue(&queue, 3);
printf("Add element = 5 \n");
enqueue(&queue... | true |
a77c5aaabff97d4ad5b3656d39d6fc9536adae4f | C++ | fusaimoe/embedded-systems | /consegna-3/smart_car/ServoImpl.cpp | UTF-8 | 309 | 2.828125 | 3 | [] | no_license | #include "ServoImpl.h"
#include "Arduino.h"
ServoImpl::ServoImpl(int pin){
myservo.attach(pin);
}
void ServoImpl::setValue(int value){
Serial.println(value);
value = map(value, 0, 180, 750, 2250); // Only needed if using ServoTimer2 instead of servo
Serial.println(value);
myservo.write(value);
}
| true |
597f4ac011ce5061f17f93fdd9c11750f7d84906 | C++ | vladfux4/test | /scheduler_worker.cc | UTF-8 | 4,317 | 2.75 | 3 | [] | no_license | #include "scheduler_worker.h"
#include <sstream>
#include <fstream>
SchedulerWorker::SchedulerWorker(boost::ptr_vector<GeneratorWorker>& generators,
boost::ptr_vector<ComputeWorker>& computers,
const size_t block_count)
: kRequiredBlockCount(block_c... | true |
6f4232fb8567c88b0356a5a270c8677d356fb4a4 | C++ | abhishek1026/COP3530_Project_1 | /PSLL.h | UTF-8 | 15,703 | 3.4375 | 3 | [] | no_license | //
// Created by Abhishek on 9/11/2017.
//
#ifndef COP3530_PROJECT_1_PSLL_H
#define COP3530_PROJECT_1_PSLL_H
#include <iostream>
#include <stdexcept>
#include "List.h"
using namespace std;
namespace cop3530{
template <class T>
class PSLL: public List<T>{
private:
struct Node {
T data... | true |
8348060565dd2ace18985dac050ed23bdc08d241 | C++ | bcooperstl/advent-of-code-2015 | /include/solutions/aoc_day_22.h | UTF-8 | 2,473 | 2.71875 | 3 | [
"MIT"
] | permissive | #ifndef __AOC_DAY_22__
#define __AOC_DAY_22__
#include <string>
#include "aoc_day.h"
#define MAX_TURNS 128
#define MAX_SPELLS 5
#define SPELL_MAGIC_MISSLE 0
#define SPELL_DRAIN 1
#define SPELL_SHEILD 2
#define SPELL_POISON 3
#define SPELL_RECHAHRGE 4
#define SPELL_NONE_OR_BOSS 99
#define PLAYER_START_MANA 500
#de... | true |
5d57e1540353639e361b7bda97d52692480ca604 | C++ | hphp/Algorithm | /Contest/ACM/2010_bak/MULTIPLE_2010/zstu/merge/cube/cube.cpp | UTF-8 | 1,487 | 2.640625 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
const int MaxN = 505;
bool vis[15][5], success;
int n, top, deg[15], hash[MaxN];
struct E {
int s, e;
}edge[MaxN][5];
void Input ()
{
int i, j;
char str[5][10];
scanf ("%d", &n);
getchar ();
E tmp;
for (i = 0; i < n; i++) {
for (j = 0; j < 3; j++) {
... | true |
979f3574059adde8f39cd1f34d31b3172889b646 | C++ | notantony/cpp-course | /hw3/vector.cpp | UTF-8 | 4,827 | 2.859375 | 3 | [] | no_license | #include "vector.h"
#include <exception>
#include <algorithm>
vector::vector(): isEmpty(true) {}
vector::vector(size_t size) : vector(size, 0) {}
vector::vector(size_t size, uint32_t one) {
switch (size) {
case 0:
isEmpty = true;
break;
case 1:
isEmpty = false;
isSmall = tru... | true |
d54ff83d32b8b49907c62e7cf3ccd98d5b38b656 | C++ | aditya81070/Data-Structures-and-Algoritham | /Codechef-solutions/LUCKFOUR.cpp | UTF-8 | 485 | 2.5625 | 3 | [] | no_license | #include<stdio.h>
#include<cmath>
int main() {
int t;
scanf("%d", &t);
long int n;
while(t--) {
scanf("%ld", &n);
long int count = 0, digits;
int last, first;
while(n > 0) {
last = n % 10;
n = n/10;
digits = int(log10(n));
first = n / pow(10, digits);
n = n - first... | true |
f5e00755ad14984ee3794f7c7a2f24bd6d555c92 | C++ | SoWeBegin/Dark-Knight-Chess-Engine | /Dark Knight v.1/move_generator.cpp | UTF-8 | 17,152 | 2.8125 | 3 | [] | no_license | #include "move_generator.h"
#include "bitboard.h"
void MovesList::gen_blackpawnmoves(const Board& position, bool quiet) noexcept {
constexpr int forward{ -10 };
constexpr int diag_right{ -11 };
constexpr int diag_left{ -9 };
constexpr int color{ Enums::B_PAWN };
constexpr int initial_rank{ Enums::RANK7 };
for (... | true |
24d085f416e309d3cba9a7a4bc40e2dbd90fcf2f | C++ | cxxtrace/cxxtrace | /test/pthread_thread_local_var.h | UTF-8 | 3,389 | 2.859375 | 3 | [] | no_license | #ifndef CXXTRACE_TEST_PTHREAD_THREAD_LOCAL_VAR_H
#define CXXTRACE_TEST_PTHREAD_THREAD_LOCAL_VAR_H
#if CXXTRACE_ENABLE_CONCURRENCY_STRESS
#include "concurrency_stress.h"
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cxxtrace/detail/debug_source_location.h>
#include <cxxtrace/detail/... | true |
f202245b2549fcf5ab8977f79c3d34e606e950a7 | C++ | kajtuszd/PAiMSI | /lab4/src/Board.cpp | UTF-8 | 10,432 | 2.890625 | 3 | [] | no_license | #include "Board.h"
Spot Board::getBox(int y, int x)
{
if(x>boardLength-1 || y>boardLength-1 || x<0 || y<0)
{
std::cout << "Bad index" << std::endl;
}
return *boxes[y][x];
}
bool Board::cleanEndField(Spot &end)
{
if(!this->getBox(end.x,end.y).isEmpty())
{
this->boxes[end.x][end.y]->figure = NULL;
ret... | true |
4883e9a29e273e190e75f7db038ccdd22bb2bc70 | C++ | mellery451/simple_code | /linked_list.cpp | UTF-8 | 2,438 | 3.828125 | 4 | [] | no_license | #include <cstdio>
#include <iostream>
#include <string>
#include <stdint.h>
#include <memory>
#include <cstdint>
/// @brief simple LL class to implement the
/// "classic" reverse a linked list interview
/// question
///
/// @tparam _T type held at each node, must be
/// copy constructable and have a public destructor
... | true |
993114b3e07f42dbc4f97ba2586e6189816439cb | C++ | robotcator/acm-icpc | /sgu/p141.cpp | UTF-8 | 1,999 | 2.859375 | 3 | [] | no_license | // SGU 141 -- Jumping Joe
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const long long INF = 1000000000000000000LL;
long long gcd(long long a, long long b) {
return b == 0? a: gcd(b, a % b);
}
void solve(long long a, long long b, long long c, long long &x, lo... | true |
dd59cecc47b2f47903aa4cd192b363bbd3c16741 | C++ | k124k3n/competitive-programming-answer | /hackerrank/30 Days of Code/3. Intro to Conditional Statements.cpp | UTF-8 | 306 | 2.890625 | 3 | [
"MIT"
] | permissive | #include <iostream>
int n;
int main(){
std::cin>>n;
if(n % 2 != 0){
std::cout<<"Weird"<<std::endl;
}else{
if(n >= 2 && n <= 5){
std::cout<<"Not Weird"<<std::endl;
}else if(n >= 6 && n <= 20){
std::cout<<"Weird"<<std::endl;
}else{
std::cout<<"Not Weird"<<std::endl;
}
}
return 0;
} | true |
093396fb1a44c51febe5b2fc94cdfb3a163a0f69 | C++ | tanvirulz/cascade | /scrap/test_string.cpp | UTF-8 | 352 | 3.109375 | 3 | [] | no_license | // strings and c-strings
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
typedef struct TestType {
int i;
} TestType;
int main ()
{
string str ("Please");
TestType tt;
tt.i=50;
cout<<str<<"\n";
str[2]='1';
cout<<str<<"\n";
cout<<str.length()<<"\n";
cout<<"tt has value:... | true |
817d158d8c0016021c5e36919aac550c6bdd3498 | C++ | PrajwalaDeode/CPP | /templare.cpp | UTF-8 | 357 | 3.375 | 3 | [] | no_license |
#include<iostream>
using namespace std;
template<class T>
class addition
{
T a;
public:
addition(T num)
{
a=num;
cout<<"Value of a "<<a<<endl;
}
add(T num)
{
return a+num;
}
};
int main()
{
addition<int> a1(90);
cout<<"Addition is: "<<... | true |
0502fc7ea57e064724f5e302f01a2862ce6f9871 | C++ | SteinsGate9/LinuxImageServer | /src/common/common.cpp | UTF-8 | 2,694 | 2.59375 | 3 | [] | no_license | /********************************************
* Content:
* Author: by shichenh.
* Date: on 2020-05-18.
********************************************/
#include "common.h"
/********************************************
* sighandlers
********************************************/
void addsig(int sig, void(handler)(int... | true |
9429642cc67b35310beb60ecf851ed455d33e3d0 | C++ | XFMemoirs/study | /线性表/双向缓冲链表.h | UTF-8 | 5,815 | 3.234375 | 3 | [] | no_license | #ifndef _LINK_LIST_H_
#define _LINK_LIST_H_
#include <stdint.h>
#define INIT_CACHE_LEN 16 // 初始化默认缓存长度
#define DILATATION_LEN 8 // 扩容长度
// 双向缓冲链表
template <typename T>
class Linklist
{
public:
// 节点
typedef struct ListNode
{
ListNode* mPre;
ListNode* mNext;
T mData;
}Ln;
public:
Linklist(int32_t cache_len... | true |
449c4b2613960aa0c9fb9e58bb2b0e79e4d603f0 | C++ | RustKnight/RoguePatterns | /RoguePatterns/Demo.h | UTF-8 | 5,417 | 2.53125 | 3 | [] | no_license | #pragma once
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
#include "Board.h"
#include "Creature.h"
#include "InputHandler.h"
#include "Strategy.h"
#include "Ai.h"
#include "InteractionHandler.h"
#include "Obstacle.h"
#include "map.h"
#include "turnTaker.h"
#include <vector>
#include <typeinfo>
// ad... | true |
799810ece5abd5f2d148617dead9b2d4e56ddca2 | C++ | trymnilsen/BotVille | /BotVille/BotVille/SpriteBuffer.cpp | UTF-8 | 974 | 2.96875 | 3 | [] | no_license | #include "SpriteBuffer.h"
SpriteBuffer::SpriteBuffer(SDL_Window *window)
{
renderer=std::shared_ptr<SDL_Renderer>(SDL_CreateRenderer(window,-1,SDL_RENDERER_ACCELERATED));
SDL_Surface *textureSurface = SDL_LoadBMP("unit.bmp");
unitTexture=std::shared_ptr<SDL_Texture>(
SDL_CreateTextureFromSurface(
rende... | true |
8cf45e325ca829493c0d31cf77703861b5ed76ef | C++ | nanguoshun/StatNLP-Framework | /src/common/types/token_array.h | UTF-8 | 556 | 2.53125 | 3 | [] | no_license | //
// Created by ngs on 06/10/2018.
//
#ifndef STATNLP_TOKEN_ARRAY_H
#define STATNLP_TOKEN_ARRAY_H
#include "linear_chain.h"
class TokenArray: public LinearChain{
public:
inline TokenArray(Token **pptr_tokens, int size){
pptr_tokens_ = pptr_tokens;
length_ = size;
}
inline ~TokenArray(){... | true |
8b575da9fbd8dcdabbfab1baf17643e14fd61243 | C++ | turi-code/GraphLab-Create-SDK | /graphlab/cppipc/client/issue.hpp | UTF-8 | 2,877 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Copyright (C) 2016 Turi
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD license. See the LICENSE file for details.
*/
#ifndef CPPIPC_CLIENT_ISSUE_HPP
#define CPPIPC_CLIENT_ISSUE_HPP
#include <tuple>
#include <boost/function.hpp>
#include <boost/type_tra... | true |
2f6d9cc7c67644431fd76b1ea18df39841b57af1 | C++ | nsehrt/GameOfLifeSFML | /src/gametime.h | UTF-8 | 1,089 | 3.15625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <SFML/System/Clock.hpp>
class GameTime
{
public:
explicit GameTime() = default;
//resets all internal clocks
void reset()
{
mInternalDeltaClock.restart();
mInternalTotalClock.restart();
}
//updates the delta time
void update()
{
mInt... | true |
abf0ea371c5aaacf2fa7bbce409e7ca4d005a12b | C++ | plushmonkey/Terracotta | /terracotta/GameWindow.h | UTF-8 | 1,615 | 2.578125 | 3 | [
"MIT"
] | permissive | #ifndef TERRACOTTA_GAME_WINDOW_H_
#define TERRACOTTA_GAME_WINDOW_H_
#include <GLFW/glfw3.h>
#include <vector>
#include <functional>
namespace terra {
using MouseSetCallback = std::function<void(double, double)>;
using MouseChangeCallback = std::function<void(double, double)>;
using MouseButtonCallback = std::functio... | true |
c92de7d6ace1a8051131029347d8ffc614559d4a | C++ | ascheel319/CSCI-340-Data-Structures | /hw2/assignment2.cc | UTF-8 | 5,107 | 3.484375 | 3 | [] | no_license | /****************************************
Name: Andrew Scheel
Z-ID: Z1790270
Section: section 3
Assignment: Assignment 1
Due Date: Feburary 5 2018
Purpose: In this assignment, you will use routines
from STL <algorithm> to implement these
algorithms.
****************************************/
#include <iostream>
#i... | true |
b86fdbce1cbbde0463b7b9f758abc44a1785894a | C++ | Myung-Hyun/Data-Structure-Practice | /Chapter5/Sorted List/SortedType.h | UHC | 11,868 | 3.71875 | 4 | [] | no_license | // Header file for Unsorted List ADT.
#include <iostream>
template <class ItemType>
struct NodeType;
using namespace std;
// Assumption: ItemType is a type for which the operators "<"
// and "==" are defined-either an appropriate built-in type or
// a class that overloads these operators.
template <class ... | true |
fa419f47c8b718eab69814cc505fce60b8e2bdea | C++ | bsheline/android_ete_pytroch_lib | /recognizer_impl.cc | UTF-8 | 2,150 | 2.515625 | 3 | [] | no_license | // Copyright 2020 Mobvoi Inc. All Rights Reserved.
// Author: lyguo@mobvoi.com (Liyong Guo)
#include "recognizer_impl.h"
#include <fstream>
#include <iostream>
RecognizerImpl::RecognizerImpl(const std::string& dict_file,
const std::string& model_file) {
LoadDict(dict_file);
model_ =... | true |
75508302903a020fd4bc2a927a5f64b49f935363 | C++ | LoysoPandohva/Chess | /Chess/Server.cpp | UTF-8 | 7,256 | 2.734375 | 3 | [] | no_license | #include "Server.h"
Server::Server() : port(27015), lose_connection(false) {}
Server::~Server() {
closeServer();
}
void Server::startServer() {
if (WSAStartup(MAKEWORD(2, 2), &wData) == 0) {
std::cout << "WSA Startup succes" << std::endl;
}
SOCKADDR_IN addr;
int addrl = sizeof(addr);
addr.sin_addr.S_un.S_add... | true |
3cd368af229355b7f805f68c02db8050ed77305e | C++ | wjshku/COMP2113 | /Module10/module10/assign1.cpp | UTF-8 | 780 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int num_seats, num_votes, num_lists;
int quota, idx_list, vote, seat;
cout << "Total number of seats: ";
cin >> num_seats;
cout << "Total number of votes: ";
cin >> num_votes;
cout << "Total number of lists: ";
cin >> num_l... | true |
f238c9f369a9fb748de9982137e03e61eb821a22 | C++ | Peymansoft/ICP3038 | /Lectures/Chapter 02 -- Introduction to C++/example3.cpp | UTF-8 | 211 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
int main()
{
float f1, f2;
std::cout << "Enter 2 floating point numbers :";
std::cin >> f1 >> f2;
std::cout << "sum = " << f1 + f2 << std::endl;
return 0;
}
| true |
110d2919b34a9125f26751d0a79486ad8bc6559b | C++ | richerarc/Projet-SIM | /The_Journalist/The_Journalist/sources/Classes projet/GestionnaireMenu.h | UTF-8 | 478 | 3.109375 | 3 | [] | no_license | #pragma once
#include "Menu.h"
class GestionnaireMenu : public Singleton<GestionnaireMenu>{
private:
std::list<Menu*> Menus;
public:
GestionnaireMenu(){
}
void retirerMenu(Menu* Menu){
this->Menus.remove(Menu);
}
void ajouterMenu(Menu* Menu){
this->Menus.push_back(Menu);
}
void vider(){
if (this->M... | true |
32796a68f6673a544330c2739d8b83d025f43403 | C++ | JackLas/Game-of-Life | /Source/Game.cpp | UTF-8 | 1,895 | 2.84375 | 3 | [] | no_license | #include "Game.hpp"
Game::Game(Settings settings): myWindow(sf::VideoMode(settings.winWidth, settings.winHeight), "Game of Life", sf::Style::Close),
gameField(settings)
{
mySettings = settings;
font.loadFromFile("font.ttf");
myWindow.setFramerateLimit(mySettings.FPS);
isPaused = true;
generationDelay = ... | true |