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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3c39d13b289261512b15713fc29ce84e7906ab26 | C++ | Adrian925492/DataStructuresAndSearchAlgorithms | /Source/SortByChoose/SortByChoose.hpp | UTF-8 | 1,864 | 3.84375 | 4 | [] | no_license | #include <iostream>
/*
Sort by choose algorithm:
(min to max sort)
As in bouble algorithm, the algorithm divides array into two places - sorted and unsorted yet part.
Sorted part is on tle left side (in that case). The algorithm goes threw each element
of input array looking for minimum value and swapping it to be pla... | true |
8477c298f881853346e1373cbb9dc11c95f36ac6 | C++ | felipe0610/Proyecto02 | /main.cpp | UTF-8 | 2,878 | 2.984375 | 3 | [] | no_license | #include <cstdlib>
#include <iostream>
#include "Asiento.h"
#include "graderiaPreferencial.h"
#include "nodoAsiento.h"
using namespace std;
//Hileras de la gradería preferencial
//(PILAS)
//----------------------------------------------------------------
graderiaPreferencial *a = new graderiaPreferencial();
... | true |
ab086d1f9e4361399dfc88520dc34d3ac96f3f4d | C++ | blee1710/QwirklesqueGame | /LinkedList.cpp | UTF-8 | 2,851 | 3.578125 | 4 | [] | no_license |
#include "LinkedList.h"
LinkedList::LinkedList() :
head(nullptr),
tail(nullptr)
{
size = 0;
}
LinkedList::~LinkedList() {
// clear();
// delete head;
// delete tail;
}
void LinkedList::addFront(Tile* tile) {
Node* temp = new Node(tile, head, nullptr);
if (head == nullptr) {
head = temp;
tail = t... | true |
c5f0ca0fb4ad57c29d589c9f1d20ab36a38defa9 | C++ | jjzhang166/MessageWait | /include/AsyncWaitMsg.h | UTF-8 | 2,103 | 2.578125 | 3 | [] | no_license |
#ifndef AsyncWaitMsg_INCLUDED
#define AsyncWaitMsg_INCLUDED
#include <map>
#include <vector>
#include <list>
#include "Poco/Timer.h"
#include "boost/function.hpp"
#include "boost/make_shared.hpp"
typedef boost::function<void (int msg, int param1, int param2)> MsgCallback;
typedef boost::function<void (int msg)> Ms... | true |
0dc5a29c5b99ff4c204ab03382d5554440c5d0fa | C++ | DoniDub/HomeWork | /Vehicle(CrossRoad)/Vehicle/Bicycle.h | UTF-8 | 382 | 2.734375 | 3 | [] | no_license | #pragma once
#include "GroundVehicle.h"
class Bicycle :
public GroundVehicle
{
public:
void stop();
void start();
Bicycle(std::string color, std::string model, int max_speed, int number_of_seats, int engine_power, std::string typeOfSeat);
std::string getTypeOfSeat();
void setTypeOfSeat(std::string typeO... | true |
b558f4ee222bce497b59d1a08649471b38c817d9 | C++ | saigowri/OpenCV-with-CUDA | /displayImage.cpp | UTF-8 | 727 | 2.546875 | 3 | [] | no_license | #include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include "opencv2/core/utility.hpp"
#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
int main()
{
Mat src=imread("image.jpg",0); //load image from file
cuda::GpuMat d_src(src); // cpu -> gpu
cuda::GpuMat d... | true |
576593b7ffab3d7a0b3e218af447c323051fef64 | C++ | peitaosu/Logger | /Cpp/Logger/LogEvent.cpp | UTF-8 | 1,525 | 2.8125 | 3 | [
"Zlib",
"MIT"
] | permissive | //---------------------------------------------------//
// MIT License //
// Copyright @ 2018-2020 Tony Su All Rights Reserved //
// https://github.com/peitaosu/Logger //
//---------------------------------------------------//
#include "LogEvent.h"
LogEventExceptio... | true |
b7466876d179a1f96f493fcb937561cbdfefbc87 | C++ | jcayzac/random-stuff | /win-infographie/ray.cpp | UTF-8 | 717 | 2.59375 | 3 | [] | no_license | #include "ray.h"
#include "commode.h"
// Create a new Ray. When it's not iterated yet, it is endless.
CRay::CRay(const SMLVec3f& origin, const SMLVec3f& direction):
SMLRay(origin, direction,infinity) {
}
bool CRay::intersection(CRadPatch* patch) {
float nv_dot = patch->norm.Dot(direction);
// direction ... | true |
084d59ed631b7d02b782f2942206078482ea3593 | C++ | wlike/sfcpp | /src/geo/ConvexPolytope.cpp | UTF-8 | 3,189 | 2.578125 | 3 | [
"LicenseRef-scancode-generic-exception",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | /* Copyright 2017 The sfcpp Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | true |
7bfddac27fa62f64e8565661c0893a1106bed811 | C++ | Girl-Code-It/Beginner-CPP-Submissions | /Rishika/MILESTONE 12/PASSING FUNCTION 2D.cpp | UTF-8 | 963 | 3.453125 | 3 | [] | no_license | #include<iostream>
#include<stdlib.h>
using namespace std;
void inp(int*a, int*m, int*n)
{
cout<<endl;
cout<<"Enter the number of rows :- ";
cin>>*m;
cout<<"Enter the number of columns :- ";
cin>>*n;
cout<<"Enter elements in the matrix :- "<<endl;
for(int i=0;i<*m;i++)
{
for(int j=0;j<*n;j++)
{
... | true |
db1a78484d91632aa3a8b80931fefbedbc6e59d1 | C++ | docici/cpp-test | /src/cti/test_cti_list.h | UTF-8 | 1,574 | 3 | 3 | [] | no_license | /*!
* 数据结构与算法分析(C++描述)_第3版
* @author hongjun.liao <docici@126.com>, @date 2017//05/05/18
* 双链表
* */
//////////////////////////////////////////////////////////////////////////
#ifndef TEST_CRACKING_THE_CODING_INTERVIEW_LIST
#define TEST_CRACKING_THE_CODING_INTERVIEW_LIST
#include <cstdio>
#include <cstdlib>
templa... | true |
886635944c4fa827b80059700496df03af2db087 | C++ | dementrock/acm | /poj/Archives/new/7070645_RE.cpp | UTF-8 | 2,348 | 2.765625 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct sbt
{
int l,r,s,w,id;
} t[100001];
int data[100001],tot,root;
void rightrotate(int &k)
{
int p=t[k].l;
t[k].l=t[p].r;
t[p].r=k;
t[p].s=t[k].s;
t[k].s=t[t[k].l].s+t[t[k].r].s+1;
k=p;
}
void leftrotate(int &k)
{
int p=t[k].r;
t[k]... | true |
a3bf17749328760754e2c3001a4a802b83f70e5c | C++ | vizzuhq/vizzu-lib | /src/chart/options/autoparam.h | UTF-8 | 1,465 | 3.046875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | #ifndef AUTOPARAM_H
#define AUTOPARAM_H
#include <optional>
#include <stdexcept>
#include <string>
#include "base/conv/parse.h"
#include "base/conv/tostring.h"
namespace Vizzu::Base
{
template <typename Type> struct AutoParam
{
public:
AutoParam() : autoSet(true) {}
explicit AutoParam(const Type &value) : value(... | true |
c4f13f54b0c3854bf5cae8591f90f6c990402acc | C++ | VitalyGrachev/Nsu-computer-graphics | /Life/model/life_impacts.h | UTF-8 | 637 | 3.109375 | 3 | [] | no_license | #ifndef LIFE_IMPACTS_H
#define LIFE_IMPACTS_H
#include <vector>
#include <cstdint>
class LifeImpactField {
public:
using Row = std::vector<double>;
LifeImpactField(uint32_t cols, uint32_t rows);
Row & operator[](uint32_t row);
const Row & operator[](uint32_t row) const;
bool is_contained(int c... | true |
a8f099d765da5f7c4a35925eb0077b6ab6328a26 | C++ | Zhenghao-Liu/LeetCode_problem-and-solution | /0143.重排链表/solution2_deque.cpp | UTF-8 | 988 | 3.3125 | 3 | [] | no_license | //[deque介绍](https://www.cnblogs.com/linuxAndMcu/p/10260124.html)
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void reorderList(ListNode* head) {
if (head==NULL)
... | true |
aeae448643446b551009642e6cb973f0b65ffb9d | C++ | jerryhanhuan/test-code-backup | /WTL/DecryptionDLP/show/memorymap/stkmutex/stk/os/SysMemory.cpp | UTF-8 | 2,364 | 2.984375 | 3 | [] | no_license | #include "SysMemory.h"
namespace STK
{
CSysMemory::CSysMemory(size_t nSize, const wchar_t *pszName)
: m_pMemory (NULL)
, m_hMemory (NULL)
, m_eMemoryType (eMemoryInvalid)
{
Create(nSize, pszName);
}
CSysMemory::~CSysMemory()
{
Release();
}
bool CSysMemory::Create(size_t nSize, co... | true |
d7b5431e3c3c32687c75da7fc93aef8b7c49a8f6 | C++ | qhdwight/frc-go | /frc/phoenix/include/ctre/phoenix/motorcontrol/InvertType.h | UTF-8 | 1,523 | 2.734375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #pragma once
#include <string>
namespace ctre {
namespace phoenix {
namespace motorcontrol {
/**
* Choose the invert type of the motor controller.
* None is the equivalent of SetInverted(false), where positive request yields positive voltage on M+.
* InvertMotorOutput is the equivelant of SetInverted... | true |
fecf92279f6bbb476c6b5f885a9f3df8f17ca6f8 | C++ | AlekhinKirill/C-_labs | /queues_&_stacks/Queue.cpp | UTF-8 | 1,329 | 4.03125 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct Cell
{
int value;
Cell* next_ptr;
};
struct Queue
{
int length;
Cell* first;
Cell* last;
};
Queue create_empty()
{
Queue list;
list.length = 0;
list.first = nullptr;
list.last = nullptr;
return list;
}
Queue enqueue(Queue queu... | true |
d9e93b0e561c6bf026de4024c05fe451abd33ee2 | C++ | kernight/ayitoj | /old/Windows/control/control/src/log.cpp | GB18030 | 2,313 | 3.171875 | 3 | [
"MIT"
] | permissive | /* Author:steve-liu
*blog:http://blog.csdn.net/liuxucoder/
*git:http://git.ykgzs.com
*/
#include "../include/log.h"
/* ַʽʱϢ */
stringstream string_stream;
/* ־Ϣȶ */
priority_queue<Info_Log> Que_Log;
/* ʼ־Ϣ */
Info_Log::Info_Log(int pri, string datail_info)
{
m_priori = pri;
m_detail = datail_info;
time_t now =... | true |
4b32d25aeb29b2b24cef38905e49d60a2fe001de | C++ | Novacane01/Traphouse | /LinkedMap.h | UTF-8 | 2,686 | 2.765625 | 3 | [] | no_license | #pragma once
#include "SFML/Graphics.hpp"
#include "ctime"
#include "cstdlib"
#include <random>
#include <iostream>
#include "Player.h"
#include "Chest.h"
class Player;
class LinkedMap {
public:
struct hallway{
sf::RectangleShape floor;
sf::RectangleShape wallTop, wallRight, wallBottom, wallLeft;
... | true |
e5dba3495026a23023b62c5adf0094b0362c7089 | C++ | ayush2512/Interview-Questions | /revAltLL.cpp | UTF-8 | 818 | 3.4375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct node
{
struct node *next;
int data;
};
void push(struct node **head,int data)
{
struct node *temp = (struct node *)malloc(sizeof(struct node));
temp->data = data;
temp->next = *head;
*head = temp;
}
void printLL(struct node *head)
{
struct node *temp = head;
... | true |
176e0d6b83ec23e6bb220286c87942e680b58cbf | C++ | frikkfossdal/improved-garbanzo | /src/Node.cpp | UTF-8 | 1,887 | 2.59375 | 3 | [] | no_license | //
// Node.cpp
// phd_sketch2
//
// Created by Frikk Fossdal on 31.01.2018.
//
// Redo this and make it as a thread
#include "Node.hpp"
Node::Node(){
}
Node::Node(ofVec3f initPos){
setup();
pos = initPos;
timeIndex = 0;
}
void Node::show(){
ofNoFill();
ofSetColor(100);
//ofDrawBox(pos->x, ... | true |
bc734fd5f38607a1a87d1e8b11176181bac20168 | C++ | seanxwzhang/leetcode-1 | /122 Best Time to Buy and Sell Stock II/best_time_to_buy_sell_stock_2.cpp | UTF-8 | 441 | 3.203125 | 3 | [] | no_license | /*
* LeetCode Submissions by Xinyu Chen
* Best Time to Buy and Sell Stock II
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
* Runtime: 8 ms
*/
class Solution {
public:
int maxProfit(vector<int>& prices) {
int profit = 0;
for (int i = 1; i < prices.size(); i++) {
... | true |
ca0ecad98e35ae98f88689161a104a27d9fe34ff | C++ | axelcinco/Programacion2 | /trabajo27_cap9.cpp | UTF-8 | 298 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include<cstring>
#include<string_view>
using namespace std;
int main()
{
string_view sv{"pelota"};
sv.remove_suffix(3);
string str{sv};
auto szNullTerminated{str.c_str()};
cout<<"Tiene "<<strlen(szNullTerminated)<<" Letra(s)"<<endl;
return 0;
}
| true |
adf36d3cb0bd9a6244f79eb1d65803e4547b093a | C++ | hushaobao/vcf2csv | /src/meta/any.hpp | UTF-8 | 326 | 2.546875 | 3 | [] | no_license | #pragma once
// std
#include <initializer_list>
namespace vcf {
namespace meta {
template <typename T, typename ...Args>
constexpr bool any(T&& t, Args&&... args)
{
bool match{false};
(void)std::initializer_list<bool>{(match = match || t == args)...};
return match;
}
} // namepace meta
} // namespac... | true |
fd466cd4cd0c2ad6ae24e8f100c87b33423d7552 | C++ | Adnn/Graphics-archived | /src/libs/Math/Vector-impl.h | UTF-8 | 1,698 | 3.015625 | 3 | [] | no_license | /*
* Vector implementation
*/
template <class T_derived, int N_dimension, class T_number>
T_number & Vector<T_derived, N_dimension, T_number>::operator[](std::size_t aColumn)
{
return this->at(aColumn);
}
template <class T_derived, int N_dimension, class T_number>
T_number Vector<T_derived, N_dimension, T_numbe... | true |
07110815f114e09fdc176c3ce68685a609d69b45 | C++ | heyzqq/Cpp-Back-Syntax | /3Class/35 - 异常 .cpp | UTF-8 | 1,458 | 3.875 | 4 | [] | no_license | #include <iostream>
using namespace std;
/*
异常:
try catch throw
异常类型:
* 数字
* 字符串
* 对象
*/
// 传统方式
double div(double n1, double n2)
{
if (0 == n2)
{
return 1;
}
return n1 / n2;
}
// 异常: 数字
double div2(double n1, double n2)
{
if (0 == n2)
{
... | true |
7bfbbeab30b10d61681e3fc0bb9012bbf18ca506 | C++ | ailyanlu/acm-code | /2014-training/0512_map/B.cc | UTF-8 | 1,359 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <map>
#include <string>
#include <cstring>
using namespace std;
map<string, int> m;
map<string, int>::iterator iter, end;
map<char, char> t;
int main()
{
t['A'] = t['B'] = t['C'] = '2';
t['D'] = t['E'] = t['F'] = '3';
t['G'] = t['H'] = t['I'] = '4';
t['J'] ... | true |
d00cdf2508429a1320180fc26cd02f045bccabc5 | C++ | cuiwenzhe/BackSwipe | /BackSwipeApp/app/src/main/cpp/internal/base/quantizer.cc | UTF-8 | 1,474 | 2.640625 | 3 | [] | no_license | #include <cmath>
#include "quantizer.h"
#include <android/log.h>
Quantizer::Quantizer() : max_(1.f), nbits_(1) {};
Quantizer::Quantizer(float max, int nbits) : max_(max), nbits_(nbits) {};
void Quantizer::init(float max, int nbits) {
max_ = max;
nbits_ = nbits;
}
Quantizer::~Quantizer() {}
float Quantizer:... | true |
17983dd26222b26929f636a4effba73ebe5997de | C++ | pizisuan/Algorithm-Problem | /Uncommon_Words_from_Two_Sentences.cpp | UTF-8 | 1,747 | 3.765625 | 4 | [] | no_license | /*
* Problem Description
* We are given two sentences A and B. (A sentence is a string of space separated words. Each word consists only of lowercase letters.)
* A word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other sentence.
* Return a list of all uncommon words.... | true |
52c0701da327b6b72f2f94bcc2fdf13d7aa859b8 | C++ | artisth/YoloMouse | /source/YoloMouse/Share/Cursor/CursorInfo.cpp | UTF-8 | 965 | 2.640625 | 3 | [
"Unlicense"
] | permissive | #include <YoloMouse/Share/Cursor/CursorInfo.hpp>
namespace Yolomouse
{
// public
//-------------------------------------------------------------------------
CursorInfo::CursorInfo( CursorType type_, CursorId id_, CursorVariation variation_, CursorSize size_ ):
type (type_),
id (id... | true |
00200ee308ae867cf2ec3ca8880df4d8a0f885ff | C++ | ydl0715/yuan | /moshi/Factory.h | UTF-8 | 1,365 | 2.8125 | 3 | [] | no_license | //
// Factory.h
// moshi
//
// Created by Sudent on 14-9-25.
// Copyright (c) 2014年 Sudent. All rights reserved.
//
#ifndef __moshi__Factory__
#define __moshi__Factory__
#include <iostream>
//using namespace std;
//static const double PI=3.14;
//
//class Shape {
//public:
// virtual double Area()=0;
// virt... | true |
a0b60456c5998d550079b754111b8c28e35d8d0b | C++ | edjo93/p3lab3_EddasCarrasco | /Cola.cpp | UTF-8 | 499 | 2.671875 | 3 | [] | no_license | #ifndef COLA_CPP
#define COLA_CPP
#include<string>
using namespace std;
class Cola{
private:
int largo;
string peluda;
public: Cola(){
}
public: int getLargo() {
return largo;
}
public: void setLargo(int largo) {
this->largo = largo;
}
public: strin... | true |
886b0161119739618da98afc70d5f6ac88cda2da | C++ | vifactor/AnalyticalMisfitInterface | /tests/test_analytical_interface_cub_bx.cpp | UTF-8 | 1,924 | 2.640625 | 3 | [] | no_license | //============================================================================
// Name : test_analytical_interface_cub_bx.cpp
// Author : Viktor Kopp
// Version :
// Copyright : Your copyright notice
// Description : Tests for cubic interface class with bx component dislocations
//====================... | true |
3d0acb964e8772301471230ac1688b43fb04ce9d | C++ | tihonov-e/cpp_stepik | /Algorithms/Source/pairs_sort.cpp | WINDOWS-1251 | 1,870 | 3.078125 | 3 | [] | no_license | //1.12 STL
// algorithm.
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
/**
. ,
. utility.
, .
.
*/
int main()
{
int n = 0;
cin >> n;
vector <pair <int, int>> a(n);
for (int i = 0; i < n; i++) {... | true |
b60ff10ec3d5b0b109ca15075d2c84568d2a1ba5 | C++ | Zepyhrus/CPP-Primer | /src/chapter5/e5.1.cpp | UTF-8 | 545 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
/* Exercise of section 5.1, including:
* 5.1
* 5.2
* 5.3
*/
int main(int argc, char** argv) {
cout << "5.1 An empty sentence with single semicolon." << endl;
cout << "5.2 A few statements compounded by curly braces.\n"
<< "... | true |
33877959a3829776392d025de387ac44f7d52317 | C++ | ewalasagas/university_directory | /Student.h | UTF-8 | 720 | 2.5625 | 3 | [] | no_license | /*********************************************************************
** Program name: Lab4
** Author: Elaine Alasagas
** Date: 2/4/2019
** Description: CS162_400_WINTER2019 - Student.hpp class
*********************************************************************/
#ifndef STUDENT_H
#define STUDENT_H
#include <iostre... | true |
54d25882bb51e99e18ff1bc5406e9508425f9b1f | C++ | utec-ads-2019-2/spreadsheet-196-rvmosquera | /main.cpp | UTF-8 | 5,193 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
const int CANT_ROWS = 1000;
const int CANT_COL = 18279;
using namespace std;
struct node {
int col = 0;
int row = 0;
node *next = nullptr;
void killSelf() {
if (next) {
next->killSelf();
}
... | true |
adceabb2ff7a82af1b055a6b2536574546e87dff | C++ | martinv/pdekit | /src/common/ArrayShape.hpp | UTF-8 | 5,110 | 3.078125 | 3 | [] | no_license | #ifndef PDEKIT_Common_Array_Shape_hpp
#define PDEKIT_Common_Array_Shape_hpp
#include "common/PDEKit.hpp"
#include <ostream>
namespace pdekit
{
namespace common
{
template <Uint DIM, typename SizeType>
class ArrayShape;
template <Uint DIM, typename SizeType>
bool operator==(const ArrayShape<DIM, SizeType> &lhs, con... | true |
887145650b5f7fd67f4aa146e3a9ba4b6221c74f | C++ | B-Matt/algoritmi-labosi | /ConsoleApplication1/LV3.cpp | UTF-8 | 2,709 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | #include "pch.h"
//#include <stdio.h>
//#include <stdlib.h>
//#include <conio.h>
//
//// Povrh s povezanim popisom
//struct cvor
//{
// int x;
// struct cvor* next;
//};
//
//struct cvor* push(struct cvor* glava, int data)
//{
// struct cvor* p = (struct cvor*) malloc(sizeof(cvor));
// if (p == NULL)
// {
// printf("... | true |
01315b95f355e7272c4bbb99df492170cdb0655b | C++ | heroinetty/ACM | /C++/code/类运算符.cpp | GB18030 | 1,053 | 3.78125 | 4 | [] | no_license | #include <iostream>
#include <typeinfo>
using namespace std;
class op
{
int a = 0, b = 0;
public :
op(int x, int y) : a(x), b(y) {}
~op() {}
int Add()
{
return a + b;
}
int Sub()
{
return a - b;
}
};
class A
{
public :
int Add(int a, int... | true |
1b8e0ba133809d471ab75165071afff95ca8546d | C++ | zyhustgithub/leetcode | /hard/128.最长连续序列.cpp | UTF-8 | 2,026 | 3.015625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=128 lang=cpp
*
* [128] 最长连续序列
*/
// @lc code=start
// class Solution {
// public:
// int longestConsecutive(vector<int>& nums) {
// if (nums.empty()) {
// return 0;
// }
// for (int n : nums) {
// st[n] = n;
// cnt[n] = 1;
... | true |
5c6df4b874d03d0dd702b134ccc0a2d8874587f3 | C++ | github11/Renderman-Tests | /capi/anim/main.cpp | UTF-8 | 2,891 | 2.53125 | 3 | [] | no_license | #include <ri.h>
#include <cmath>
#include <cstdlib>
#include <iostream>
void doFrame(int fNum, char *fName);
int main(int argc, char *argv[])
{
if (argc<2) {
std::cerr << "No filename given.\n";
return 1;
}
int i;
RiBegin(RI_NULL);
for (i=1;i<=360; ++i) {
doFrame(i, argv[... | true |
af5a9e40e7d4f14dd294e67ad29a183f79bfffdc | C++ | yqbeyond/Algorithms | /uva/uva1225_fast.cpp | UTF-8 | 1,370 | 3.046875 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int len(int n)
{
int res = 0;
if (n == 0)
return 1;
while(n)
{
n /= 10;
res++;
}
return res;
}
void print(long long *times)
{
for (int i = 0 ; i < 9; i++)
printf("%lld ", times[i]);
printf("%lld\n", times[9]);
}
int main()
{... | true |
e6505bcac98dcef8163ecbf1880d14e7b2313594 | C++ | brinkqiang2cpp/cpp-validator | /include/dracosha/validator/validate.hpp | UTF-8 | 4,480 | 2.53125 | 3 | [
"BSL-1.0"
] | permissive | /**
@copyright Evgeny Sidorov 2020
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************/
/** @file validator/validate.hpp
*
* Defines validate() help... | true |
509d2fa6ad7a1be5aba58b1caddd4c16016667f2 | C++ | timothyschoen/CSD2 | /CSD2d/Opdr1-ADSR/Source/Generator.cpp | UTF-8 | 764 | 2.875 | 3 | [] | no_license | #include <unistd.h>
#include <iostream>
#include <cmath>
#include "Generator.h"
//Constructor
Generator::Generator() {
frequency = 0;
}
//Constructor
Generator::~Generator() {
}
//Function we can overwrite for the filter, will do nothing on an oscillator subclass
void Generator::setPitch(int pitch) {
frequency... | true |
959fc5bc00331ebd11afdbfd5c55d4836fba92e4 | C++ | hamsham/LightUtils | /include/lightsky/utils/NetServer.hpp | UTF-8 | 2,782 | 2.65625 | 3 | [
"BSD-2-Clause"
] | permissive |
#ifndef LS_UTILS_NETWORK_SERVER_HPP
#define LS_UTILS_NETWORK_SERVER_HPP
#include <cstdint>
#include <vector>
#include "lightsky/utils/NetNode.hpp"
#include "lightsky/utils/NetConnection.hpp"
namespace ls
{
namespace utils
{
/*-----------------------------------------------------------------------------
* UDP ... | true |
da921004d7fcebce82e72b117cc668d94404985c | C++ | alvinquach/cs5550 | /Labs/Lab01/Lab01.cpp | UTF-8 | 3,878 | 3.015625 | 3 | [] | no_license | // Computer Graphics
// change accordingly
#include <windows.h>
#include <math.h> // included for random number generation
#include <gl/Gl.h>
#include "glut.h"
#define PI 3.14159265
const int screenWidth = 500;
const int screenHeight = 500;
struct GLintPoint {
GLint x, y;
};
GLintPoint pts[4];
int NoOfPts = 0;
int... | true |
306ff923ab0b8b45c31bc98cc2b3e1150f46540e | C++ | talesm/glBoilerplate | /src/util/fastMath.hpp | UTF-8 | 897 | 3.328125 | 3 | [
"MIT"
] | permissive | #pragma once
/**
* @brief Get an always positive module
*
* The number returned is the number you have to subtract from the quotient to
* get the previous divisible quotient.
*
* @param q the quotient
* @param d the divisor
* @return int the module
*/
inline int
floorMod(int q, int d)
{
return q > 0 ? q % d... | true |
6d87f4c35577b1d66f92c096a8bba7d92310948b | C++ | zahidford/C-plus-plus-Procedural-Programming-Knowlege | /Pointer_to_functios/main.cpp | UTF-8 | 459 | 3.46875 | 3 | [] | no_license | #include <iostream>
using namespace std;
void double_value(int *int_ptr)
{
*int_ptr *=2;
}
int main()
{
int value {10};
int *int_ptr {nullptr};
cout << "value is " << value << endl;
double_value(&value);
cout << "value :" << value << endl;
cout << "............................" << end... | true |
e70b8b8ced6db83687c08a81b85a3ec4e44cf0e3 | C++ | CrazyIEEE/algorithm | /OnlineJudge/LeetCode/第1个进度/143.重排链表.cpp | UTF-8 | 2,068 | 3.703125 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=143 lang=cpp
*
* [143] 重排链表
*
* https://leetcode-cn.com/problems/reorder-list/description/
*
* algorithms
* Medium (55.03%)
* Likes: 271
* Dislikes: 0
* Total Accepted: 33.8K
* Total Submissions: 60K
* Testcase Example: '[1,2,3,4]'
*
* 给定一个单链表 L:L0→L1→…→Ln-1→Ln ,
* 将其重... | true |
3de77a932bf6534f29bd09fb2c6fcca0808c7516 | C++ | zachdavids/Wolfenstein3D | /Source/Private/Camera.cpp | UTF-8 | 869 | 2.828125 | 3 | [] | no_license | #include "Camera.h"
#include "WindowManager.h"
#include <GLM/gtc/matrix_transform.hpp>
Camera::Camera(glm::vec3 const& position, glm::vec3 const& rotation)
{
m_Position = position;
m_Rotation = rotation;
}
void Camera::Move(glm::vec3 const& movement)
{
Translate(movement);
m_bViewHasChanged = true;
}
void Camer... | true |
eba77525825858b481a33445cfacca081f259047 | C++ | Dongsu-h/BAEKJOON | /07. 함수/#15596.cpp | UTF-8 | 241 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
long long sum(std::vector<int> &a)
{
int count = a.size();
int sum_data = 0;
for (int i=0; i < count; i++)
sum_data += a.at(i);
return (long long)sum_data;
}
int main()
{
} | true |
0cae07a50ea6c3dd18596e61d7ba26888bb8b1b5 | C++ | arthurhauer/arno-fan-controller | /src/ArnoController.cpp | UTF-8 | 2,309 | 2.6875 | 3 | [] | no_license | #include "ArnoController.h"
ArnoController::ArnoController(byte pin, byte device) {
this->pin = pin;
this->device = device;
init();
} // ArnoController
int hex2int (char c) {
if (c >= '0' && c <= '9')
return c - '0' ;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
if (c >= '... | true |
f654efec6fe92a0d1c9940b7c4b8ad02e94e3963 | C++ | Ahn-Ssu/Class_DataStructure | /기말/L33_Graphs02.cpp | UTF-8 | 2,159 | 3.15625 | 3 | [] | no_license | /**
* < Spanning trees >
* Graph G의 spanning tree
* : G의 모든 vertex를 연결하는 Cycle이 없는 subgraph, Spanning tree는 n-1개의 edge를 갖는다.
* (모든 것을 연결'만' 수행)
*
* 1. 종류
* DFS spanning tree // serch 과정이랑 똑같음
* BFS spanning tree
* < Biconnected components >
* ... | true |
ceb67c579aa21d770a19b5ac30b729a9570d4217 | C++ | umer-amjad/Baby-Wolf | /Function.cpp | UTF-8 | 2,546 | 3.34375 | 3 | [
"MIT"
] | permissive | //
// Function.cpp
// BabyWolf
//
//
#include <algorithm>
#include "Function.hpp"
#include "Argument.hpp"
#include "Constant.hpp"
#include "Unary.hpp"
#include "Variadic.hpp"
Function::Function() : f(new Argument()) {}
Function::Function(double value) : f(new Constant(value)) {}
Function::Function(... | true |
4af7658b6db33b4c8b3d5a24bf19cf24c98473fe | C++ | bubbercn/LeetCode | /C++/Solved/234_PalindromeLinkedList.h | UTF-8 | 1,931 | 3.625 | 4 | [] | no_license | #pragma once
#include "Common.h"
// Definition for singly-linked list.
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution
{
public:
bool isPalindrome(ListNode *head)
{
if (!head || !head->next)
return true;
ListNode *f... | true |
423ad96a597fb48d04425a73db3e6395b1acb339 | C++ | ck-leo/c_plus_plus | /my_exp/main.cpp | UTF-8 | 343 | 2.984375 | 3 | [] | no_license | #include "MyExp.hpp"
#include <iostream>
using namespace std;
int main()
{
try
{
string a("MyExp2");
throw MyExp2(a);
}
catch (const MyExp2 & e)
{
cout << e.what() << endl;
}
catch (const exception& e)
{
cout << e.what() << endl;
... | true |
6a2efe3b7841b9a8a97db0daed3da6d76a2b2f99 | C++ | qinzhiqiang163/RayTraceGroundUp | /include/light/PointLight.h | UTF-8 | 2,521 | 2.90625 | 3 | [] | no_license | #ifndef POINTLIGHT_H
#define POINTLIGHT_H
#include "Light.h"
#include "Vector3D.h"
#include "RGBColor.h"
#include "World.h" // you will need this later on for shadows
#include "ShadeRec.h"
class PointLight : public Light
{
public:
PointLight(void);
PointLight(const PointLight& pl);
vir... | true |
e5dec873880f8e71ad0bca308f6484e30db93e43 | C++ | jiewaikexue/linux | /第三单元全部结束45个文件夹/3_test/314/314.cpp | UTF-8 | 312 | 3.03125 | 3 | [] | no_license | #include<iostream>
#include<vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
int main()
{
vector<int>vInt;
int i;
cout << "输入Q退出" << endl;
while (cin >> i)
{
if (i == 'q')
{
break;
}
vInt.push_back(i);
}
for (auto a : vInt)
cout << a;
return 0;
}
| true |
43b5bf7070304eb31fec3e4dbc50259beb192f8b | C++ | AnkangH/LeetCode | /二分查找/035. 搜索插入位置.cpp | UTF-8 | 1,263 | 3.515625 | 4 | [] | no_license | /*
给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。
你可以假设数组中无重复元素。
示例 1:
输入: [1,3,5,6], 5
输出: 2
示例 2:
输入: [1,3,5,6], 2
输出: 1
示例 3:
输入: [1,3,5,6], 7
输出: 4
示例 4:
输入: [1,3,5,6], 0
输出: 0
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/search-insert-position
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
class Solut... | true |
874933253a9a84fdea5f96427557b1d53079e622 | C++ | ExayDX/OpenGL4Viewer | /OpenGL4Viewer/OpenGL4Viewer/Viewer.h | UTF-8 | 1,240 | 2.609375 | 3 | [] | no_license | #ifndef VIEWER_H
#define VIEWER_H
#include <GLFW/glfw3.h>
#include "GLM/glm/glm.hpp"
#include "GLM/glm/gtc/matrix_transform.hpp"
// Forward declarations
class Camera;
class Scene;
class Viewer
{
public :
void error_callback_impl(int error, const char* description);
void key_callback_impl(GLFWwindow* window, in... | true |
612811b42a14016a1ba9ac8bb4ed858960b8e011 | C++ | rykermcintyre/DataStructuresFinalProject | /testsepchain.cpp | UTF-8 | 531 | 2.609375 | 3 | [] | no_license | #include "project.h"
int main() {
SepChain sc;
string keys[] = {"k", "kieran", "ryker", "kiernan", "r", "reichurr", "bob"};
string vals[] = {"kieran", "ryker", "kiernan", "reichurr", "rayyan", "q", "kie"};
for (int n = 0; n < 7; n++) {
sc.insert(keys[n], vals[n]);
}
for (int n = 0; n < 6; n++... | true |
d398887c4be4bd90f28fd411ee7fbed9989deb9c | C++ | Barrymantelo/Attack-of-the-Unidead | /level.cpp | UTF-8 | 513 | 2.671875 | 3 | [] | no_license | #include "level.h"
#include "globals.h"
#include <SOIL.h>
void Map::create(int width, int height) {
this->width = width;
this->height = height;
map = new int[width * height];
}
void Map::load(char* path) {
}
void Map::save(char* path) {
}
void Map::draw(int xPos, int yPos) {
for (int x = 0;... | true |
25eb5bb35dfcfaaba3893251a35022b56000d068 | C++ | RaniAgus/ayed-tp-2018-mundial | /AED-D20-PARTE2/ejercicio-2-3/codigo.cpp | UTF-8 | 7,427 | 2.875 | 3 | [] | no_license | #include "../utils/utils.hpp"
#include "listas.hpp"
#include "estructuras.hpp"
#include "arboles.hpp"
#define CANTEQUIPOS 32
#define CANTPARTIDOS 7
#define imprimirFecha(fecha) \
(fecha) % 100 << "/" << ((fecha) / 100) % 100 << "/" << (fecha) / 10000
Nodo<Jugador> *partidos[CANTEQUIPOS][CANTPARTIDOS] = {... | true |
1b89fa8648a6d5c15d88ecd5d8f9f5e7aad0ce16 | C++ | Dvmenasalvas/EDA | /Juez/1er cuatri/VA-04.cpp | ISO-8859-1 | 2,035 | 3.5 | 4 | [] | no_license | // Daniel Valverde Menasalvas
// Comentario general sobre la solucin,
// explicando cmo se resuelve el problema
#include <iostream>
#include <vector>
using namespace std;
// funcin que resuelve el problema
// comentario sobre el coste, O(f(N)), donde N es ...
void funcionariosVA(int k, int &valor, int &mejorValor, vec... | true |
572de3110e7fad33906133b17bb945bb4c453661 | C++ | RoutingKit/RoutingKit | /src/test_id_set_queue.cpp | UTF-8 | 1,306 | 3.015625 | 3 | [
"BSD-2-Clause"
] | permissive | #include <routingkit/id_set_queue.h>
#include "expect.h"
#include <iostream>
using namespace RoutingKit;
using namespace std;
int main(){
try{
IDSetMinQueue q(100);
EXPECT_CMP(q.id_count(), ==, 100);
EXPECT(q.empty());
q.push(3);
q.push(8);
q.push(77);
q.push(2);
q.push(15);
q.push(66);
EXPE... | true |
838b39c9cc07e698269514a2f81d38b0d215a98b | C++ | intolerants/str | /beagleSocket/setDate.cpp | UTF-8 | 1,434 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define YEAR_DEPRECATED 2015
void manual(void){
char date[30] /*= "1 May 2016 19:30:00"*/, cmd[40], c;
while((c = getchar()) != '\n' && c != EOF); // clear buffer
printf("Entre com a hora atual no formato (1 May 2016 19:30:00): \n");
... | true |
359bbc8db6bbaf08f3f73af54e09347f0cdf09ca | C++ | hjmediastudios/Top-Down-Game-Framework | /src/Input.cpp | UTF-8 | 1,195 | 3 | 3 | [] | no_license | #include "../include/main.hpp"
Input::Input()
{
//Create memory
memset(&keyboardState, 0, sizeof (ALLEGRO_KEYBOARD_STATE));
}
void Input::poll()
{
al_get_keyboard_state(&keyboardState);
}
float Input::get_lr()
{
float rValue = 0.0;
if (al_key_down(&keyboardState, ALLEGRO_KEY_LEFT) && !al_key_down... | true |
eb5e0f2dcf7db040543a946b24a33db3f9630acc | C++ | jacob-hegna/yasc | /src/ast/number.h | UTF-8 | 3,077 | 3.5 | 4 | [] | no_license | #ifndef __YASC_AST_NUMBER_H_
#define __YASC_AST_NUMBER_H_
#include <memory>
#include <numeric>
#include <complex>
#include <iostream>
namespace yasc {
template<typename T>
using fraction_t = std::pair<T, T>;
template<typename T>
std::ostream& operator<<(std::ostream& o, fraction_t<T> const& f) {
... | true |
158a290011e79baa7671132736ca51c651aa76b3 | C++ | rogrhrh/3DGameProgramming_2016 | /CodeCompleteExample/CodeCompleteExample_Step6_DrawAll/KCharacter.h | UTF-8 | 2,010 | 2.65625 | 3 | [] | no_license |
#pragma once
#include "KCharacterBase.h"
#include <memory>
#include "KVector.h"
class KCharacter;
typedef std::shared_ptr<KCharacter> KCharacterPtr;
typedef std::weak_ptr<KCharacter> KCharacterWeakPtr;
class KCharacter : public KCharacterBase
{
public:
KCharacter()
... | true |
1d44c18f6c69cd8b5f5ad0db2b52190c2f84e096 | C++ | townboy/acm-algorithm | /HDOJcode/1022 2012-02-27 21 49 22.cpp | UTF-8 | 1,570 | 2.515625 | 3 | [] | no_license | ******************************
Author : townboy
Submit time : 2012-02-27 21:49:22
Judge Status : Accepted
HDOJ Runid : 5426032
Problem id : 1022
Exe.time : 0MS
Exe.memory : 208K
https://github.com/townboy
******************************
#include<stdio.h>
int top,j,stack[10000],num,tai[... | true |
250324a55333d04030bde348c285333066e09464 | C++ | chrisliu/BidirectedGraphGPU | /tests/serialization/serialization_test.cpp | UTF-8 | 1,179 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include "../../src/BidirectedGraph.hpp"
using namespace std;
int main(int argc, char* argv[]) {
string filename = argv[argc - 1];
ifstream json_file(filename, ifstream::binary);
BidirectedGraph g;
bool ret = g.deserialize(json_file);
cou... | true |
a781f6349b55241bce558c2975ad5654935cd033 | C++ | AverJing/LeetCode | /LeetCode/PointToOffer/CH06/Ex38GetNumberCountOfK.cpp | UTF-8 | 1,353 | 3.578125 | 4 | [] | no_license | /*
*
*
*@author: Aver Jing
*@description:
*@date:
*
*
*/
#include <iostream>
#include <vector>
using std::vector;
class Solution {
public:
int GetNumberOfK(vector<int>& data, int k) {
if (data.empty()) return 0;
int first = GetFirstKey(data, k, 0, data.size() - 1);
int end = GetLastKey(data, k, 0, data.size(... | true |
23b74f270ba2203d9fcee78e71402ecc8ce68722 | C++ | federicopratto/Algoritmos-y-Programacion-2---TP-1 | /1- Programa/tablero.h | UTF-8 | 2,136 | 3.03125 | 3 | [
"MIT"
] | permissive |
#ifndef TABLERO_H_
#define TABLERO_H_
#include <iostream>
using std::cout;
using std::endl;
/*
* Esta función se encarga de inicializar con el valor '-'
* todas los casilleros del tablero
*/
void inicializarTablero(char tablero[10][10]);
/*
* Esta función revisa si hay espacio disponible para agregar
* fich... | true |
06809675f4eec158c69f12b14c17e176bb559a3f | C++ | piashishi/cleancode | /ut/libpool_ut.cc | UTF-8 | 2,440 | 2.984375 | 3 | [] | no_license | #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "UnitTest++.h"
#include "list.h"
#include "libpool.h"
#define TEST_POOL_TYPE_DATA (0)
#define TEST_POOL_TYPE_2ND (1)
#define TEST_POOL_TYPE_MAX (2)
TEST(libpool_ut_init)
{
size_t element_size = 4;
const int entry_count = 25;
pool_att... | true |
8fd13ae0102d9f684595990e34f4436cd9e5cf32 | C++ | alexandraback/datacollection | /solutions_5769900270288896_1/C++/aid/main.cpp | UTF-8 | 1,672 | 3.0625 | 3 | [] | no_license | #include <fstream>
using namespace std;
int solve0(int r, int c, int n) {
int ans = (r - 1) * c + (c - 1) * r, cnt = ((r - 2) * (c - 2) + 1) / 2;
if(n <= cnt)
return ans - 4 * n;
ans -= 4 * cnt;
n -= cnt;
cnt = (r * c + 1) / 2 - cnt;
if((r * c) & 1)
cnt -= 4;
else
c... | true |
e899c4ab0c0e1c361a887bc3bccd6a96bcad78ae | C++ | OverseerCouncil/leetcode | /1052.爱生气的书店老板/C++/75%T70%M.cpp | UTF-8 | 660 | 2.828125 | 3 | [] | no_license | int maxSatisfied(vector<int>& customers, vector<int>& grumpy, int X) {
int customers_num = customers.size();
int base_cnt = 0;
for (int i = 0; i < customers_num; i++) {
base_cnt += customers[i] * (1 - grumpy[i]);
}
int more_cnt = 0;
for (int i = 0; i < X; ... | true |
cc321f6e93af6874a667744f2cb089b884826f82 | C++ | joe-zxh/OJ | /程序员代码面试指南/第3章 二叉树问题/18.2 在二叉树中找到两个节点的最近公共祖先(进阶).cpp | UTF-8 | 895 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <map>
#include <set>
using namespace std;
int LCA(int head, int*lc, int *rc, int*father, int o1, int o2) {
set<int>f1;
f1.insert(o1);
while (father[o1] != -1) {
o1 = father[o1];
f1.insert(o1);
}
do {
if (f1.find(o2)!=f1.end()) {
return o2;
}
else ... | true |
0fd7855873809c27dcb682238d48d44e1c7d6797 | C++ | albertakopian/Algo | /SecondTerm/GraphTheory/Dijkstra.cpp | UTF-8 | 3,640 | 3.40625 | 3 | [] | no_license | /*
Требуется отыскать самый выгодный маршрут между городами.
Требуемое время работы O((N+M)logN), где N-количество городов,
M-известных дорог между ними.
Оптимизируйте ввод
Формат входных данных.
Первая строка содержит число N – количество городов.
Вторая строка содержит число M - количество дорог.
Каждая следующая ст... | true |
c10c211e0d13d28a4ccf2ddff12ca553ff538b4e | C++ | alladdinkumar/LeetCoding-Challenge-MAY- | /K Closest Points to Origin.cpp | UTF-8 | 1,133 | 3 | 3 | [] | no_license | class Solution {
public:
float euclidean(vector<int> x)
{
return sqrt(pow(x[0],2)+pow(x[1],2));
}
vector<vector<int>> kClosest(vector<vector<int>>& points, int K) {
int cnt=0;
map<float,vector<int>> m;
map<float,vector<int>>::iterator itr;
for(int i=0;i<points.siz... | true |
bef5999c5ed099b0e0be4ffed3d9a750b1a34e2f | C++ | gndu91/donneesLibres | /tableau-donnees.h | UTF-8 | 1,267 | 3.46875 | 3 | [] | no_license | #include <vector>
#include <string>
using namespace std;
/** Moyenne d'un tableau
* @param un tableau d'entiers
* @result la moyenne de ces entiers
**/
int moyenne(vector<int> t);
/** Total d'un tableau
* @param un tableau d'entiers
* @result la somme de ces entiers
**/
int total(vector<int> t);
/** Max d'un t... | true |
4ec3aea5e4afef1ec7d14a0dfb622f5cdbc22492 | C++ | muneebGH/complex-number-library-cpp | /cmplx.cpp | UTF-8 | 1,551 | 3.15625 | 3 | [] | no_license | #include"cmplx.h"
double cmplx::getRealPart() const
{
return realvalue;
}
void cmplx::setRealPart(double r)
{
realvalue = r;
}
double cmplx::getImgValue() const
{
return imgvalue;
}
void cmplx::setImgValue(double i)
{
imgvalue = i;
}
void cmplx::setcomplexno(double r, double i)
{
... | true |
4be2e463d4fb83710094aef47cf4e2b7768d2bb0 | C++ | crosslink/tranlator | /src/article.h | UTF-8 | 1,214 | 2.546875 | 3 | [] | no_license | /*
* article.h
*
* Created on: Apr 24, 2012
* Author: monfee
*/
#ifndef ARTICLE_H_
#define ARTICLE_H_
#include <string>
class article {
public:
enum {WRITE_TO_DATABASE = 1, WRITE_TO_DISK = 2};
/*, WRITE_TO_DISK_AND_DATABASE = 3*/
protected:
std::string file_path;
std::string name;
std::s... | true |
77a1f654519b21e68c1dafe448715763732007ef | C++ | Dio12334/proyecto-alpha | /saviour/UTEC/POO2/estructuras/unidad5_sem07/src/ejercicios.cpp | UTF-8 | 2,921 | 3.46875 | 3 | [] | no_license | //
// Author: marvin on 5/20/20.
//
#include "ejercicios.h"
#include "funciones.h"
#include "hash/hash_direct_address_table.h"
#include "hash/hash_chaining.h"
void ejercicio1() {
cout<<"hashing"<<endl;
client_hash_direct_address_table();
}
void ejercicio2() {
my_hash myHash(7);
myHash.insert(53);
... | true |
3e0282d8663db6e6ef2614d62bb45a23bb99d5ce | C++ | Grishameister/CoursachStatVerySimple | /include/SafeQueue.h | UTF-8 | 907 | 3.15625 | 3 | [] | no_license | #ifndef HIGHLOAD_SERVER_SAFEQUEUE_H
#define HIGHLOAD_SERVER_SAFEQUEUE_H
#include <queue>
#include <condition_variable>
template<typename T>
class SafeQueue {
private:
std::queue<T> q;
mutable std::mutex mu;
std::condition_variable cv;
public:
bool Push(T value) {
std::lock_guard<std::mutex> gu... | true |
89fabbdf19d0b11fa94c1e00273667d00e91dd11 | C++ | linguoliang/learning | /data_strcture_and_algorithms/algorithms/dynamic_programming/src/cutting_rod.cc | UTF-8 | 1,374 | 3.390625 | 3 | [] | no_license | #include "cutting_rod.h"
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include "util.h"
using std::cout;
using std::endl;
using std::max;
using std::string;
using std::vector;
int cut1(const vector<int>& prices, int index, int length);
int cut2(const vector<int>& prices, int length);... | true |
0d4905d96bda2eccfb35a5a2fddb8c9f8f059610 | C++ | hahanhuy/KTLT_2017 | /UserManager.cpp | UTF-8 | 5,133 | 2.8125 | 3 | [] | no_license | #include "Assignment.h"
//////////////////////////////////////////////////////////////////////////////////
// Phan quyen cho account, nho chu y CLOSE va OPEN, phai check ky xem CO TON TAI TEMP hay khong.
void delete_in_permissionaccount(string username) {
fstream outfile;
outfile.open("permissionaccount.txt", ... | true |
ec7b02c7cbb24115fb0f4a3072ff04bd3b91c423 | C++ | iamDip171/URI-Probelms | /1960.cpp | UTF-8 | 562 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std ;
int main ()
{
int n, temp, i, j ; cin >> n ;
int test[] = {500, 100, 50, 10, 5, 1} ;
for (i=0; n!=0; i++){
temp = n / test[i] ;
n = n % test[i] ;
for (j=1; j<=temp; j++){
if (i==0) cout << "D" ;
else if (i==1) ... | true |
6c09f4a90078df6e509ffd23cdd9f0065761c0f8 | C++ | liangjisheng/C-Cpp | /books/C++_Prime_Plus/Chapter15/error1.cpp | UTF-8 | 445 | 3.203125 | 3 | [
"MIT"
] | permissive | // error1.cpp -- using the abort() function
#include"iostream"
#include"cstdlib"
double hmean(double,double);
int main()
{
double x,y,z;
std::cout<<"Input two numbers:";
while(std::cin>>x>>y) {
z=hmean(x,y);
std::cout<<"z="<<z<<std::endl;
std::cout<<"\nInput two numbers:";
}
return 0;
}
double hmean(doubl... | true |
e9b0367a783e1216f589b3543ae66751d42fc242 | C++ | abhavgarg/DX11-Scene | /Source/Ball.cpp | UTF-8 | 2,608 | 2.953125 | 3 | [] | no_license | #include "pch.h"
#include "Ball.h"
//camera for our app simple directX application. While it performs some basic functionality its incomplete.
//
Ball::Ball()
{
//initalise values.
//Orientation and Position are how we control the camera.
m_orientation.x = 90.0f; //rotation around x - pitch
m_orientation.y = ... | true |
6f42524fa45cdffc058e39445c80c3ab2752bc25 | C++ | shihyu/MyTool | /Doxygen_Graphviz/DesignPatternExample/品味Java的21種設計模式/dp_cpp/factorymethod/example2/Creator.h | GB18030 | 665 | 2.546875 | 3 | [] | no_license | #pragma once
#include "Product.h"
namespace cn
{
namespace javass
{
namespace dp
{
namespace factorymethod
{
namespace example2
{
///
/// <summary> * </summary>
///
class Creator
{
///
/// <summary> * ProductĹ </summary>
/// * <retu... | true |
61beb0dc5eb1794c1f78fe8ffd66d1f1d774ece2 | C++ | Victor-Barcelo/Arduino-FSM-test-1 | /FSMExample.ino | UTF-8 | 2,627 | 2.78125 | 3 | [] | no_license | #include <Wire.h>
#include <Time.h>
#define SLAVE_ADDRESS 0x05
#define DEBUG true
const int PIN_TEMPSENSOR = 0;
const int PIN_PUSHBUTTON = 7;
// Debounce para el botón: (http://arduino.cc/en/Tutorial/Debounce)
int buttonState;
int lastButtonState = LOW;
long lastDebounceTime = 0;
long debounceDelay = 50;
//--------... | true |
91ddfa21e58b28f3ada92c93ceb514853dfd4d99 | C++ | JohnGlassmyer/cpp-sandbox | /x86storeload.cpp | UTF-8 | 1,055 | 3.125 | 3 | [] | no_license | #include <atomic>
#include <iostream>
#include <thread>
// based on the oft-referenced example from Intel's x86 guide.
// switch this to demonstrate the effect
constexpr bool shouldFence = false;
int x;
int y;
// not registers but w/e
int r1;
int r2;
std::atomic<bool> shouldProceed;
void storeAndLoad(int &storeTo,... | true |
34e7096bb50437e46d8c87f5a431943ce931151d | C++ | KeylaRocha/URI_problems | /Beginner/C++/2936.cpp | UTF-8 | 516 | 3.0625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int pesos[5] = {300, 1500, 600, 1000, 150}; //peso em gramas das porções de cada convidado
int porcao[5]; //Quantidade de porçoẽs que cada convidado comeu
int mandioca = 0; //Quantidade final de mandioca
cin >> porcao[0] >> porcao[1] >> porcao[2] >> po... | true |
b8caa1e79819db49c5effef38945a2083e445c1b | C++ | garrettkinman/ECSE-421-Labs | /Lab 4/a4_e1/a4_e1.ino | UTF-8 | 3,180 | 3.125 | 3 | [] | no_license | #include <Arduino_FreeRTOS.h>
#include "Arduino_SensorKit.h"
#include "loopTimer.h"
#include <semphr.h>
#define BUZZER 5
#define LED 6
// declare tasks
void buzzTask(void *pvParameters);
void ledTask(void *pvParameters);
void messageTask(void *pvParameters);
// declare global mutex for the serial port
SemaphoreHandl... | true |
3581ea2e4dc806f1135e84efbd021efe13017e07 | C++ | vigusmao/IntroC_2015_2 | /Escola/src/Funcionario.cpp | UTF-8 | 787 | 3.1875 | 3 | [] | no_license | #include "Funcionario.h"
#include <iostream>
#include <string>
using namespace std;
Funcionario::Funcionario(string _nome, int _idade):Pessoa::Pessoa(_nome, _idade)
{
//cout << "Construindo um Funcionário " << endl;
}
Funcionario::Funcionario(string _nome, int _idade, double _salario):Pessoa::Pessoa(_nome, _idade... | true |
565c224d19febf290abc60fdb7760a763d621a9c | C++ | archer18/homework | /HW2 Q1 near done.cpp | UTF-8 | 4,356 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
using namespace std;
main ()
{
int hour, min, duration;
double cost;
char day;
string Time, Day;
do
{
cout << "What time was the call placed?\n";
cin >> Time;
if ((Time.length () > 4) && (Time.length () ... | true |
6aaa8021953ac4501d7128df07f74857fc6f329f | C++ | Tryneus/Lethe | /LetheCommon/src/windows/WindowsAtomic.cpp | UTF-8 | 2,380 | 2.71875 | 3 | [] | no_license | #include "windows/WindowsAtomic.h"
#include "Windows.h"
#include <intrin.h>
using namespace lethe;
WindowsAtomic32::WindowsAtomic32(const uint32_t value) :
m_data(value)
{
// Do nothing
}
uint32_t WindowsAtomic32::set(uint32_t value)
{
return m_data = value;
}
uint32_t WindowsAtomic32::add(uint32_t value)
{
... | true |
76ff172ce7365704d8b9705759037b9937f273c0 | C++ | vejmarie/dbus-sensors | /src/NVMeBasicContext.cpp | UTF-8 | 11,898 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #include "NVMeBasicContext.hpp"
#include <endian.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <boost/asio/read.hpp>
#include <boost/asio/streambuf.hpp>
#include <boost/asio/write.hpp>
#include <cassert>
#include <cerrno>
#include <cinttypes>
#include <cstdio>
#include <cstring>
#include <system_error>
#inc... | true |