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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
88267a32303036020d92bad43621585734d039e0 | C++ | hrishikeshgoyal/leetcode_programs | /binaryTreePaths/binaryTreePaths.cpp | UTF-8 | 1,710 | 3.421875 | 3 | [] | no_license |
class Solution {
public:
vector<string> TreePaths;
void DFS(TreeNode* node, string answer)
{
answer += "->" + to_string(node->val);
if(node->left == NULL && node->right == NULL)
TreePaths.push_back(answer);
else
{
if(node->left != NULL)
... | true |
93fa4ef6acc116ab6a0a2c58a88964947a07b742 | C++ | rzwm/oglpg8 | /src/2.Subroutines/Subroutines.cpp | UTF-8 | 2,298 | 2.84375 | 3 | [] | no_license | ///////////////////////////////////////////////
// 简介:
// 根据 2.6 着色器子程序 一节,练习使用着色器
// 子程序。在顶点着色器中实现两个子程序-红色
// 和蓝色,在软件端选择要使用的子程序以改变三
// 角形的颜色。
//
///////////////////////////////////////////////
#include "GL/glew.h"
#include "GL/freeglut.h"
#include <iostream>
#include "LoadShaders.h"
GLuint VAO;
GLuint VBO;
GLuin... | true |
5be046b5b00683b50d5856ac79715e8e6da6c50c | C++ | Hyiker/CampusNavigation | /src/model/physical/building.cc | UTF-8 | 1,232 | 2.796875 | 3 | [] | no_license | #include "model/physical/building.h"
#include "error/errors.hpp"
#include "model/physical/path.h"
using namespace std;
Building::Building(string name) : PhysicalModel{name} {
}
void Building::init(Id id, vector<string>& params) {
this->set_id(id);
// TODO
if (params.size() < 8) {
// TODO: throw erro... | true |
21694bde713800d5e2f178e24d2b96e1a1bbbc59 | C++ | Lutzion/ESP8266_Artnet_DMX_DC | /lib/MultiResetDetector/src/MultiResetDetector.h | UTF-8 | 1,933 | 2.609375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #ifndef MultiResetDetector_H__
#define MultiResetDetector_H__
#include <Arduino.h>
#include <user_interface.h>
#include <EEPROM.h>
struct _rtcData
{
uint16_t data ;
uint16_t crc ;
} ;
class MultiResetDetector {
uint32_t timeoutMs;
bool waitingForMultiReset;
bool isLastResetReasonValuable;
EEPROMClass e... | true |
a4b3ba8b491126c7685402988c9eb9432e6ff8d4 | C++ | jihoonog/sudoku-solver | /SudokuGrid.cc | UTF-8 | 3,013 | 3.34375 | 3 | [] | no_license | /*
Author: Jihoon Og
Date: 3/15/18
This class implements a Sudoku puzzle grid
All valid coordinates are 1-9 (row and column)
*/
#include <algorithm>
#include <cctype>
#include "SudokuGrid.h"
SudokuGrid::SudokuGrid(){
for(int i = 0; i < SIZE; ++i){
for(int j = 0; j < SIZE; ++j){
grid[i][j] = EMPT... | true |
dd6251aeac981d1cfc30a5fb79795abf50c991ea | C++ | nikv98/p101 | /c++/array/arr.cpp | UTF-8 | 1,073 | 3.890625 | 4 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
using namespace std;
int size = 7;
int arr[7];
/*
Lets return the value at the specified index
*/
int get(int index){
if(index >= 0 && index < size){
return arr[index];
}else{
return NULL;
}
}
/*
Lets set the ... | true |
868f972f0188d858f9791f33cad505978324d3ef | C++ | Quinton19/Homework_6 | /Arm.cpp | UTF-8 | 399 | 2.9375 | 3 | [] | no_license | #include "Arm.h"
Arm::Arm(string n, int pn, double w, double c, string d, double pc) : Robot_Part(n, pn, w, c, d, Component_type::Arm)
{
power_consumed = pc;
}
double Arm::get_power_consumed()
{
return power_consumed;
}
string Arm::to_string()
{
string result;
result = Robot_Part::to_string() + "Power consumed: ... | true |
db2974a18a998b58eda2e8db25ae31b28a0f51ec | C++ | WhiZTiM/coliru | /Archive2/b1/d3c84f84b1f269/main.cpp | UTF-8 | 621 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <typeinfo>
class ClassA
{
public:
ClassA();
int a;
void doSomethingA();
};
class ClassB
{
public:
ClassB(A * A_instance_ptr)
{
A_ptr = A_instance_ptr;
}
void doSomethingB()
{
b = A_... | true |
fc448361cd6b403f42acc027cfece743f9190de4 | C++ | ulkumeteriz/Ray-Tracer-for-CPU | /image/jpeg.cpp | UTF-8 | 3,350 | 3.109375 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <stdexcept>
#include <jpeglib.h>
#include "../jpeg.h"
void read_jpeg_header(const char *filename, int& width, int& height)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
FILE *infile;
/* create jpeg decompress object */
cinfo.err = jpeg_std_error... | true |
fdc3a3fc98512ef567c4e1054bc889f1c16fe19c | C++ | carriez0705/leetcode | /017-LetterCombinationsofaPhoneNumber.cpp | UTF-8 | 772 | 2.96875 | 3 | [] | no_license | class Solution {
vector<string> vec;
vector<string> re;
public:
void dfs(int n, string &digits, string &result){
if(n==digits.size()){
re.push_back(result);
return;
}
int c = digits[n]-'0';
for(int i = 0; i<vec[c].size();i++){
... | true |
068aeafaefcbb98e8f2eebf59071adb931237556 | C++ | mborzyszkowski/LinearEquationSystems | /matrix.h | UTF-8 | 1,331 | 2.65625 | 3 | [
"MIT"
] | permissive | #ifndef MATRIX_H
#define MATRIX_H
#include "objectManager.h"
class Matrix : public ObjectManager {
int sizeCols;
int sizeRows;
public:
/*NxN*/
Matrix(int size, bool marked = true);
/*MxN*/
Matrix(int rows, int cols, bool marked = true);
virtual ~Matrix();
int getSizeCols() const;
int getSizeRows() const;
v... | true |
d43341a7cbd69e5f1971a85bf51ca2ebf99057e1 | C++ | seanahmad/Joshi_Cpp_all-the-examples-and-code | /Chap_1___A_simple_Monte_Carlo_model/Ex_1/SimpleMCMain1.cpp | UTF-8 | 2,830 | 3.421875 | 3 | [] | no_license | // SimpleMCMain1.cpp
//
// Basic procedural implementation of a pricer for a vanilla call and put options.
// enum class Contract is an additional parameter to SimpleMonteCarlo1 to discriminate between calls and puts.
//require ../Code/Random1.cpp
#include "Random1.h"
#include <iostream>
#include <cmath>
enum class ... | true |
06d248b0cdf536a84e443a326fec476b132f90a6 | C++ | TaliShiva/Samples | /basic_element/test/DiskPortTest/DiskPortTests.cpp | UTF-8 | 5,962 | 2.6875 | 3 | [] | no_license |
#include <thread>
#include <fstream>
#include <gtest/gtest.h>
#include <boost/align/aligned_allocator.hpp>
#include "../../include/disk_performer/DiskPort.hpp"
/**
* @brief Read data from file
* @param file_path
* @param start_pos
* @param read_size
* @throw std::runtime_error when file less than expected
* ... | true |
19d1d10b0e8fa861bbc7a10e0c0e1085871afce1 | C++ | dittoo8/algorithm_cpp | /BOJ/11657.cpp | UTF-8 | 1,062 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#define INF 987654321
#define MAX 502
using namespace std;
struct edge {
int u,v,c;
};
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n,m;
cin >> n >> m;
long long dist[MAX];
fill(&dist[0], &dist[n]+1,INF);
dist[1]= 0;
vec... | true |
01a339ea9a1eb083092bc690dac3dda0919e79d1 | C++ | TejasPatil80178/InterviewBit | /Binary Search/RotatedSortedArraySearch.cpp | UTF-8 | 609 | 3.125 | 3 | [] | no_license | int bSearch(vector<int> a,int b,int s,int e)
{
while(s<=e)
{
//cout<<s<<" "<<e<<endl;
int mid = (s+e)/2;
if(a[mid]==b)
{
return mid;
}
else if(a[mid] > b)
{
e = mid-1;
}
else{
s = mid+1;
}
}
... | true |
04ac432a4fc63c6c9726d61f7ec0e82c44d9b55c | C++ | michalkuraz/infiltr-paper | /data/pasade-test/logo.cpp | UTF-8 | 8,158 | 2.6875 | 3 | [] | no_license | //
// File: logo.c
//
// Description: Class for logging output
//
// Author: Matej Leps
//
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include "logo.h"
const long KeywordLength=64 ;
struct logo_keyword
{
logo_keyword ( void ) ;
~logo_keyword ( void ) ;
char *word ;
lo... | true |
f3e2a8a2f9582f0317a90e66e3d47eb6006d8e93 | C++ | salakichi/Billiards | /Billiards/Scene.cpp | SHIFT_JIS | 4,047 | 2.796875 | 3 | [] | no_license | #include "stdafx.h"
#include "Scene.h"
Scene::Scene(ResourceManager &r, glm::uvec2 &size) : resource(r), windowSize(size)
{
// ̃V[
nextScene = NONE;
}
Scene::~Scene()
{
}
void Scene::Next(GAME_STATUS next)
{
nextScene = next;
}
void Scene::DrawSmallCircle(float radius, int x, int y)
{
glEnable(GL_POINT_SMOOTH);... | true |
0b74cd57687c45690cdbd5203de144b7a2b196e8 | C++ | BUIDUCTAI2105/hackerrank_algorithms | /Baitap-thaykhang/138.cpp | WINDOWS-1258 | 1,206 | 3.046875 | 3 | [] | no_license | // Tm vi tr cua gi tri chan dau tin trong mang 1 chieu cc so nguyn. Neu mang khng c gi tri chan th se tri ve -1
//B1: viet ham nhap va xuat mang 1 chieu a[i]
// nhap vao n neu n <= 0 hoac n > MAX ( MAX 100 ) thi bi loi va nhap lai
//
//B2: viet ham timvitrichandau
// duyet cc phn tu tu dau mang toi cuoi mang, ne... | true |
3a9d9ca022ebe9661a8b6e219df2e3fac1ded802 | C++ | stressedtyagi/ds-lab-sem1-nitw | /LAB - 6/14_JUNE_207919_P1.cpp | UTF-8 | 4,840 | 4.03125 | 4 | [] | no_license | /*
Design a program to implement the following sorting algorithms on integer data.
Bubble Sort [Optional]
Selection Sort [Optional]
Insertion Sort
Merge Sort
Quick Sort
The program should have a menu with options to
generate an array of random numbers,
call the various sorting algorithms on the array, and
print the ... | true |
8dc00310ac3a0f618077e4d886883b99bc974193 | C++ | JungAh12/BOJ | /1629.cpp | UTF-8 | 911 | 3.671875 | 4 | [] | no_license | /*
처음에 행렬제곱이랑 똑같다고 생각해서
matrix multiply → scalar multiply로 바꿨는데
바로 return할 수 있는 조건들을 따지다 보니 굳이 matrix 경우처럼 식이 길어질 필요가 없었음.
- 곱하고자 하는 수가 홀수이면 A가 한번 더 곱해진다는 것을 주의해서 풀어야했음.
*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
using namespace std;
long long int recul(long long int A, long long int B... | true |
8128bc21de0d4e752f3d7b295d87ecd79b4a8c7f | C++ | iamvickynguyen/Kattis-Solutions | /permutedarithmeticsequence.cpp | UTF-8 | 650 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
bool is_arit(vector<ll> &v, int m) {
ll diff = v[1] - v[0];
for (int i = 2; i < m; i++) {
if (v[i] - v[i - 1] != diff) {
return false;
}
}
return true;
}
int main() {
int n, m;
ll x;
cin >> n;
whil... | true |
6b537d106ea3c83516f084d950eec807c7846e7f | C++ | aaronschraner/CST211 | /assignment5/Exception.h | UTF-8 | 1,282 | 3.328125 | 3 | [] | no_license | /**********************************************************************
* Author: Aaron Schraner
* Date created: September 30, 2015
* Last modified: October 11, 2015 (added comments)
* Filename: Exception.cpp
* Purpose: Generic exception class with error message
* Constructors:
* Exception(): default constructo... | true |
0c6891f4cd7c46aee3d055b74ffd1bfff985b3f3 | C++ | zhengyujie306/mySmartPtr | /include/mySharedPtr.h | UTF-8 | 1,084 | 3.703125 | 4 | [] | no_license | #ifndef MYSHAREDPTR_H
#define MYSHAREDPTR_H
#include <iostream>
using std::cout;
using std::endl;
template <typename T>
class mySharedPtr
{
public:
//constructor
mySharedPtr():ptr(new T()), count(new int(1)) {}
explicit mySharedPtr(T *src) : ptr(src), count(new int(1)) {}
explicit mySharedPtr(T value) : ptr(new T(... | true |
ddec57a3f21a31aa4b77b4a4613e57d45583de7a | C++ | mehulthakral/logic_detector | /backend/CDataset/countPrimes/countPrimes_8.cpp | UTF-8 | 472 | 2.765625 | 3 | [] | no_license | class Solution {
public:int countPrimes(int n) {
if(n<=1) return 0;
vector<bool> isPrime(n,true);
// we will mark 0 and 1 as false manually
isPrime[0]=isPrime[1]=false;
for(int i=2;i*i<n;++i) {
if(isPrime[i]) {
for(int j=i*i;j<... | true |
a2ff26950caf75ef8a9ffbf44a2ba76b91f1aef7 | C++ | rajeev921/Algorithms | /LeetCode/All_Problem/Graphs/200.cpp | UTF-8 | 2,811 | 3.046875 | 3 | [] | no_license | class Solution {
public:
private:
vector<pair<int, int>> dir {{0, 1}, {0, -1}, {-1, 0}, {1, 0} };
public:
// Faster BFS
int Bfs(int row, int col, vector<vector<char>>& grid, vector<vector<bool>>& visited) {
queue<pair<int,int>> q;
q.push(make_pair(row, col));
visited[row][col] = true;
... | true |
120bee78d61ba2901974842e864657ebe6b1f0f7 | C++ | scratchboom/CoolGrids | /MPI-wrapped.cpp | UTF-8 | 2,626 | 2.96875 | 3 | [] | no_license | #include "GridsCommon.hpp"
using namespace std;
template<typename T>
class MpiGrid3D: Grid3D<T> {
private:
Grid3D<T> fullGridBounds;
Grid3D<T> subGridBounds;
int partsX, partsY, partsZ;
public:
MpiGrid3D() {
Grid3D<T>();
partsX = partsY = partsZ = 1;
}
void setParts(int partsX, int partsY, int partsZ) ... | true |
ebee58c7355bc4b9394fab9e1d554b3b961793f5 | C++ | alortimor/c-_tests | /tcp_server/client/AsyncTCPClient.h | UTF-8 | 6,484 | 3 | 3 | [] | no_license | #ifndef ASYNCTCPCLIENT_H
#define ASYNCTCPCLIENT_H
#include <boost/asio.hpp>
#include <thread>
#include <mutex>
#include <memory>
#include <iostream>
using namespace boost;
// Function pointer type that points to the callback
// function which is called when a request is complete.
typedef void(*Callback) (int request... | true |
a55a594c84de3b98743c3eaba4cada05345f7422 | C++ | busebd12/InterviewPreparation | /LeetCode/C++/General/Medium/TheMazeII/solution.cpp | UTF-8 | 3,628 | 3.46875 | 3 | [
"MIT"
] | permissive | #include <array>
#include <deque>
#include <limits>
#include <utility>
#include <vector>
using namespace std;
/*
Solution: breadth-first search.
Time complexity: O(rows * columns)
Space complexity: O(rows * columns)
*/
class Solution
{
private:
array<pair<int, int>, 4> directions={{{0, -1}, {-1, 0}, {0, ... | true |
e38d0f015695aba92dddd4e6df0cfb4730ba34c1 | C++ | m-d-asenov/SoftUni-Programming-Basics-with-Java-and-CPP | /exam_2020_march/CatWalking.cpp | UTF-8 | 488 | 3.21875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int minPerWalk;
cin >> minPerWalk;
int walks;
cin >> walks;
int calories;
cin >> calories;
int burntCal = minPerWalk * walks * 5;
if(burntCal >= calories * 0.5)
cout << "Yes, the walk for your cat is enough. Burned calories per ... | true |
a32f5a75ce7cc0f7279df11f805f38844e968ee6 | C++ | vv1133/mintdb | /src/extend/hash/main.cpp | UTF-8 | 11,298 | 2.625 | 3 | [] | no_license | #include <map>
#include <iostream>
#include <vector>
#include <string.h>
#include <stdio.h>
using namespace std;
#define get16bits(d) (*((const unsigned short *) (d)))
unsigned int ossHash ( const char *data, int len )
{
unsigned int hash = len, tmp ;
int rem ;
if ( len <= 0 || data == 0 ) return 0 ;
rem... | true |
8bb1bee257d9fcd47e1547c6e7d0acf4211b552e | C++ | VenyaSob/Multiplayer | /Network/UdpSocket/UdpSocket.cpp | UTF-8 | 3,410 | 2.65625 | 3 | [] | no_license |
//////////////////////////////////////////
// Headers //
//////////////////////////////////////////
//
#include "UdpSocket.h" //
//
//////////////////////////////////////////
namespace net
{
///////////////////////////////////////////////////////////////////////////////////////////... | true |
4cf206b25ccecfce51f058f252ddbca92b6934fc | C++ | Akeloya/Interpretator | /interpretator/Stack.h | UTF-8 | 383 | 3.171875 | 3 | [
"MIT"
] | permissive | #pragma once
namespace Interpreter {
namespace Collections {
template<typename T>
class Stack
{
private:
struct stackItem {
public:
stackItem* next;
T Value;
};
stackItem* _stack;
int _depth;
public:
Stack();
void Push(T);
T Pop();
T Peek();
T Take... | true |
de86d460aeac079f95780ce970828868b9e77320 | C++ | xdinos/Cocoa | /CocoaEngine/include/cocoa/components/components.h | UTF-8 | 3,107 | 2.890625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "externalLibs.h"
#include "cocoa/physics2d/Physics2D.h"
#include "cocoa/renderer/TextureHandle.h"
#include "cocoa/renderer/Texture.h"
#include "cocoa/util/Log.h"
namespace Cocoa
{
struct Sprite
{
TextureHandle m_Texture = TextureHandle::null;
int m_Width = 32;
int m_Height = 32;
glm::v... | true |
8fac544fdae62ed2240227ae5d94fd75fd3304c1 | C++ | nuriu/ogy-oyunlar | /breakout-ish/src/Scenes/MenuScene.cpp | UTF-8 | 2,750 | 2.53125 | 3 | [] | no_license | #include <Scenes/MenuScene.hpp>
MenuScene::MenuScene(const CoreComponents& components)
: m_Components(components)
, m_Title(std::make_unique<sf::Text>())
, m_Start(std::make_unique<sf::Text>())
, m_Exit(std::make_unique<sf::Text>())
, m_MenuSelectedIndex(0)
{
}
void MenuScene::initialize()
{
m... | true |
649d10093b5db3eae0c4d97ed12a9c2a8f93ab22 | C++ | AutumnKite/Codes | /互测2022/day6/C/std.cpp | UTF-8 | 3,702 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
template<typename Val>
class fast_copy_array {
public:
typedef std::size_t size_type;
protected:
size_type n;
struct node {
node *ls, *rs;
Val v;
node() : ls(), rs(), v() {}
};
node *rt;
void modify(node *&u, size_type l, size_type r, size_type x, const Val &v) {
... | true |
a7416e009415eb7ec05bb174dbecadde5eb5b6e5 | C++ | mardanovaAA/Laborat_2sem | /Sort/Sort_algorithms.cpp | UTF-8 | 7,527 | 3.546875 | 4 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <chrono>
#include <fstream>
void print_arr(int* arr, int len){
for (int i = 0; i < len; i++){
std::cout << arr[i] << " ";
}
std::cout << std::endl;
}
void bubble_sort(int* arr, int len, bool mod = true){
//mod = true - from small to big;
//mo... | true |
8a436e86beac64ec6da7c3d93da1a83c6d8f1fed | C++ | DaanNiphuis/Jigsaw3D | /source/Jigsaw3D/Matrix44.h | UTF-8 | 7,789 | 2.765625 | 3 | [] | no_license | #ifndef MATRIX44_H
#define MATRIX44_H
#include "Debug.h"
#include "Vector3.h"
#include "Vector4.h"
#include <string>
class Matrix44
{
public:
union
{
float m[4][4];
float _m[16];
};
inline Matrix44()
{
}
inline Matrix44(
float p_m00, float p_m01, float p_m02, float p_m03,
f... | true |
c62c3ac1a323e029a7bab1d3a16614dcddc4f740 | C++ | petrecristi/SonerieSMART | /ConectareMQTT.cpp | UTF-8 | 1,666 | 2.609375 | 3 | [] | no_license | #include "ConectareMQTT.h"
WiFiClient wifiClient;
PubSubClient client(wifiClient);
//constructor
ConectareMQTTClass::ConectareMQTTClass() {
}
void ConectareMQTTClass::Publica(const char *text) {
client.publish(MQTT_SERIAL_PUBLISH_CH, text);
}
void ConectareMQTTClass::setup_wifi() {
//Serial.begin(115200);
de... | true |
51f63f8b123262929f93dec492ac9fb2f7af23f8 | C++ | Aranaevens/tetra-solver | /tile.hxx | UTF-8 | 1,431 | 3.421875 | 3 | [] | no_license | template<class T>
Tile<T>::Tile()
{}
template<class T>
Tile<T>::Tile(T s, T e, T n, T w)
{
south_ = s;
east_ = e;
north_ = n;
west_ = w;
}
template<class T>
Tile<T>::~Tile()
{}
template<class T>
void Tile<T>::set_north(T n)
{
north_ = n;
}
template<class T>
void Tile<T>::set_east(T e)
{
east_ = e;... | true |
3e49b0b7fc757184bbf31b3fb474278cddfe6f91 | C++ | TorqueRolled/itsthisonebeth | /Space.hpp | UTF-8 | 691 | 2.625 | 3 | [] | no_license | /************************************************************************
* Author: Jacob Theander
* Date: 3/18/2019
* Description: hpp file for space class. Contains setters and getters
* for space objects.
***********************************************************************/
#ifndef SPACE_HP... | true |
ce1bb5ff82a32e5744e3af3a967b5854139d90ce | C++ | BryceKopan/2RPG | /src/gameLogic/gameObject/attack/Projectile.h | UTF-8 | 544 | 2.515625 | 3 | [] | no_license | #ifndef PROJECTILE_H
#define PROJECTILE_H
#include "Attack.h"
#include "../../../util/Vector2.h"
class Projectile : public Attack
{
public:
Projectile(Point location, Sprite sprite,
bool playerFriendly, int lifetime, int damage,
Vector2 velocity, double speed);
... | true |
20ae3614e367cfa64c375ef5eb683e57b4e9cfca | C++ | auroraleso/Cpp-course | /examples_theory/teacher/7_vector_inheritance/vfunct/testShapeFun.cc | UTF-8 | 1,926 | 3.84375 | 4 | [] | no_license | #include "Triangle.h"
#include "Square.h"
#include "Rectangle.h"
#include <iostream>
#include <vector>
using namespace std;
// function taking a Shape argument by reference:
// its actual type (triangle, square...) is preserved
void printRef( int i, const Shape& s ) {
cout << "shape " << i
<< " has perimeter... | true |
93056325daa0042a22e919bdc2165087d25ec45d | C++ | iwiwi/programming-contests | /sgu/38/C.cpp | UTF-8 | 1,401 | 2.515625 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
#include <utility>
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long ll;
int N;
vector<pair<int, pair<int,... | true |
1ade708f2663592473a86b19a001cccc1dc76581 | C++ | shunya-s15/Atcoder | /ABC181/d.cpp | UTF-8 | 1,654 | 2.828125 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
string s;
cin >> s;
bool ans=false;
int key=104;
int key2=16;
if(s.length()==1&&s.at(0)=='8'){
cout << "Yes" << endl;
return 0;
}
else if(s.length()==2){
whil... | true |
3bbee1e3cd32e0965b2e6befb1ed1e6007756796 | C++ | FlyingRhenquest/fr_demo | /ephemeris_cache.h | UTF-8 | 5,694 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | /**
* This object caches ephemeris lines and can be called upon to
* retrieve them for a given time. This object will delete
* ephemeris lines put into it when it is deleted, so there's
* no need to track that yourself.
*
* Copyright 2011 Bruce Ide
* Licensed under the Apache License, Version 2.0 (the "License"... | true |
6028fbd2ea5f43cb180b571ebca1c494630f637b | C++ | Bruteforceman/cp-submissions | /codeforces/1073/G.cpp | UTF-8 | 5,799 | 2.921875 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
#define next adfdf
// Begins Suffix Arrays implementation
// O(n log n) - Manber and Myers algorithm
// Refer to "Suffix arrays: A new method for on-line txting searches",
// by Udi Manber and Gene Myers
//Usage:
// Fill txt with the characters of the txting.
// Call Suff... | true |
a3b441fd5dbb8ecdf6eda61b9724ff25ec7105d2 | C++ | xuau34/competitive-programming | /PCCA2017s/Day11/A.cpp | UTF-8 | 1,247 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int z[300005], N, M;
// z[i] : 從s[i]開始的與從s[0]開始的匹配長度
inline void z_alg(char *s,int len,int *z){
int l=0,r=0;
z[0]=len;
for(int i=1;i<len;++i){
z[i]=i>r?0:(i-l+z[i-l]<z[l]?z[i-l]:r-i+1);
while(i+z[i]<len&&s[i+z[i]]==s[z[i]])++z[i];
if(i+z[i]-1>r)r=i+z[i]-1,... | true |
6577a39bc1193a9acee7762767e07cf6e14e5d9e | C++ | hideonatc/uva | /20161004/11344.cpp | UTF-8 | 2,790 | 2.84375 | 3 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
bool by2(string n){
if((int(n[n.length()-1])-int('0'))%2==0)
return 1;
return false;
}
bool by3(string n){
int t=0;
for(int i=0;i<n.length();i++){
t+=int(n[i])-int('0');
}
if(t%3==0)
return 1;
return 0;
}
bool by4(string n){
int last=0;
last+=int(n[... | true |
0a7bfedb2b5fd9409aaa1fb4d7c9c73496be8803 | C++ | kyeongsoosoo/AlgoStudy | /DFS&BFS/1707myself.cpp | UTF-8 | 1,257 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <vector>
using namespace std;
int K,V,E;
const int MAX = 20000+1;
vector<int> graph[MAX];
int p_color[MAX];
void color_dfs(int start, int color){
p_color[start] = color;
for(int i=0; i<graph[start].size(); i++){
if(!p_color[graph[start][i]])
... | true |
14077df2ba72ead899e77a3adc7dc3f905490b61 | C++ | lineCode/MACE-1 | /include/MACE/Utility/DynamicLibrary.h | UTF-8 | 1,675 | 2.578125 | 3 | [
"MIT"
] | permissive | /*
The MIT License (MIT)
Copyright (c) 2016 Liav Turkia
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | true |
25538ccba7ad184361290dd3865a0d060ee48547 | C++ | SaberDa/LeetCode | /C++/325-maximumSizeSubarraySumEqualsK.cpp | UTF-8 | 727 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
int main() {
vector<int> nums;
nums.push_back(1);
nums.push_back(0);
nums.push_back(-1);
int k = -1 ;
if (nums.empty()) {
return 0;
}
unordered_map<int, int> m;
int a... | true |
55aed689cfc3e98bd2d393aa14ecdfa3c33ad26e | C++ | fz-marchen/learn_data_structures | /2/learn_data_structures/4 队列/顺序存储/判断队列已满已空.cpp | UTF-8 | 767 | 3.078125 | 3 | [] | no_license | #define MaxSize 10
#define ElemType int
// 判断队列已满/已空
// 1 牺牲一个存储单元,用来判断队列是否满了
typedef struct1 {
ElemType data[MaxSize];
int front, rear;
} SqQueue1;
void InitQueue(SqQueue1& Q) {
Q.front = Q.rear = 0;
}
// 2 添加一个size,用来记录长度
// 初始化是赋值0,插入成功++,删除成功--
// 空: size=0 满: size=MaxSize
typedef struct2 {
Ele... | true |
6d0a790e3f4185d103e4a48542e00a37b98c9c56 | C++ | kstuedem/MuckyFoot-UrbanChaos | /fallen/DDEngine/Source/shape.cpp | UTF-8 | 35,904 | 2.515625 | 3 | [
"MIT"
] | permissive | #include <MFStdLib.h>
#include <DDLib.h>
#include <math.h>
#include "aeng.h"
#include "..\headers\balloon.h"
#include "poly.h"
#include "shape.h"
#include "night.h"
#include "matrix.h"
#include "..\editor\headers\prim.h"
#include "mesh.h"
#include "game.h"
// How much to shift the W value up by to prevent Z-fighting... | true |
09ad8812339a0f60220f6fea46876c7f5e8928a1 | C++ | JEERU/ADS | /Trees/TREAP/Treap_C/main.cpp | UTF-8 | 1,495 | 3.765625 | 4 | [] | no_license | #include "Treap.h"
ctree nullnode, root;
/*
* Main Contains Menu
*/
int main()
{
srand ((unsigned int)time (NULL));
int num;
char choice;
bool flag = false;
initialize();
while (1)
{
printf("\n---------------------");
printf("\n Operations on Treap");
printf("\n---------------------\n");
printf("\n... | true |
f0813ea23cfe2e0366e8f4f9201935a0de2deede | C++ | pyrovski/scalasca | /cube-3.0/src/GUI-qt/display/FontWidget.cpp | UTF-8 | 3,055 | 2.65625 | 3 | [] | no_license | /****************************************************************************
** SCALASCA http://www.scalasca.org/ **
*****************************************************************************
** Copyright (c) 1998-2013 **
** Fors... | true |
23ecea7ac8c5fdd018c51efb46196258424c78f0 | C++ | SillyPasty/ybserver | /dao/connection_pool.h | UTF-8 | 1,267 | 2.59375 | 3 | [] | no_license | #ifndef CONNECTION_POOL_H
#define CONNECTION_POOL_H
#include <stdio.h>
#include <list>
#include <mysql/mysql.h>
#include <error.h>
#include <string.h>
#include <iostream>
#include <string>
#include "../locker/locker.h"
#include "../log/logger.h"
using namespace std;
class connection_pool
{
public:
MYSQL *get_con... | true |
47bd8d4d9c2e298cdd9e9839dfb839997f5fc3b3 | C++ | neesarg-yb/N-gene | /Engine/Code/Engine/Renderer/SpriteAnimation.hpp | UTF-8 | 1,434 | 2.71875 | 3 | [] | no_license | #pragma once
#include "Engine/Renderer/SpriteSheet.hpp"
enum SpriteAnimMode
{
SPRITE_ANIM_MODE_PLAY_TO_END, // Play from time=0 to durationSeconds, then finish
SPRITE_ANIM_MODE_LOOPING, // Play from time=0 to end then repeat (never finish)
NUM_SPRITE_ANIM_MODES
};
class SpriteAnimation
{
public:
// Data
const S... | true |
e065b84eb912b7fa601b7a8ac37edda13ae76b27 | C++ | zhiyb/Y1Labs | /P5 Digital Objects/14_9/main.cpp | UTF-8 | 566 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include "balrog.h"
#include "cyberdemon.h"
#include "elf.h"
#include "human.h"
#ifdef __linux__
#include <unistd.h>
#define msleep(ms) usleep(ms * 1000)
#else
#include <windows.h>
#define msleep(ms) Sleep(ms)
#endif
using namespace std;
int main()
{
Balrog barlog;
Cyberdemon cyberdemon;
Elf e... | true |
0d5b39e1d0be09a5fb0bd4849c2ee46dbc94f326 | C++ | zymov/leetcode | /cpp/172_Factorial_Trailing_Zeroes.cpp | UTF-8 | 711 | 3.796875 | 4 | [] | no_license | /*
Given an integer n, return the number of trailing zeroes in n!.
Example 1:
Input: 3
Output: 0
Explanation: 3! = 6, no trailing zero.
Example 2:
Input: 5
Output: 1
Explanation: 5! = 120, one trailing zero.
Note: Your solution should be in logarithmic time complexity.
*/
#include <iostream>
#include <cmath>
using ... | true |
330d20768c82c00379e1450ade8d42531d225002 | C++ | ldematte/beppe | /src/Camera.h | UTF-8 | 1,639 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | /*******************************************************************\
* Bezier Patch Editor --- Camera *
* *
* Una semplice interfaccia per gestire una telecamera. *
* La telecamera puo' muoversi avanti ed... | true |
e063cab171fb54c8e67c01c981bafbbc5277909f | C++ | donaldvenus/Revolution | /empire.cpp | UTF-8 | 437 | 3.21875 | 3 | [] | no_license | #include "empire.h"
/* Create the empire. */
Empire::Empire() {
}
/* Adjust troop deployment and return true if valid move. */
bool Empire::adjustTroopValues(City& src, City& dest, int num) {
if (num > src.getNumEmpire()) {
printf("Invalid number of troops, attempted to move %d but only %d exist.\n", num, src.getN... | true |
3e54a7dade6ee951f8fb5624eb2da49b97d251e3 | C++ | gyanesh94/Coding | /practice/question5.cpp | UTF-8 | 2,228 | 4.28125 | 4 | [] | no_license | /* Created Linked list is 1->2->3->4->5->6->7->8->9 */
#include <iostream>
using namespace std;
typedef struct node {
int data;
struct node *next;
} node;
void addNode(node **head, int data) {
node *newNode = new node;
node *temp = *head;
newNode->data = data;
newNode->next = NULL;
if (t... | true |
638c7040eecaf61141dad944918d3eab0203f954 | C++ | yeomko22/TIL | /algorithm/codility/prime/perimeter.cpp | UTF-8 | 391 | 2.890625 | 3 | [] | no_license | #include <math.h>
#include <iostream>
using namespace std;
int solution(int N) {
int sqrtNum = sqrt(N);
if (sqrtNum * sqrtNum ==N) {
return 4 * sqrtNum;
}
int answer = 0;
while (1) {
if (N % sqrtNum != 0) {
sqrtNum--;
continue;
}
answer = 2 *... | true |
6d2345a49707c9e28654186f604d041e1ef19097 | C++ | tectronics/Synthesizer | /my/my/Operation.cpp | UTF-8 | 3,172 | 3.140625 | 3 | [] | no_license | #include "StdAfx.h"
#include "Operation.h"
Operation::Operation()
{
op = NONE;
p = SINGLE;
}
Operation::Operation(OP op)
{
this->op = op;
p = SINGLE;
switch (op)
{
case PLUS:
case MINUS:
case R_MINUS:
p = PLUS_MUNUS;
break;
case MUL:
case DIV:
case R_DIV:
p =MUL_DIV;
brea... | true |
93e33465726d4b37883317dfc822180b337f622c | C++ | lukeflima/Page-replacement-algorithm-fault-counter- | /faultCounter.cpp | UTF-8 | 3,264 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <sstream>
std::stringstream output;
int main(int argc, char const *argv[])
{
///Ler entrada
std::fstream f("input", std::ifstream::in);
size_t memSize;
f >> memSize;
std::vector<int> mem(memSize,0);
int ... | true |
69785ecd84289c41e38e4660ea962796754d00d4 | C++ | Supersil/FamilyTreeRemade | /family.h | UTF-8 | 712 | 2.6875 | 3 | [] | no_license | #ifndef FAMILY_H
#define FAMILY_H
#include <QObject>
#include <QMap>
#include <QList>
#include "person.h"
#include "treeleaf.h"
class Family : public QObject
{
Q_OBJECT
public:
Family(QObject *parent = nullptr);
void addPerson(Person * nPers) { personList.append(nPers);}
void addLeaf(Person * pers, TreeLeaf * l... | true |
f9dd503c2483920c59f788bfeb2067cb7930e1df | C++ | kkdas088/sorting_network | /src/algo_sorting.cpp | UTF-8 | 8,349 | 2.703125 | 3 | [] | no_license | #include "algo_unpacked.h"
/*
* algo_unpacked interface exposes fully unpacked input and output link data.
* This version assumes use of 10G 8b10b links, and thus providing 192bits/BX/link.
*
* !!! N.B.: Do NOT use the first bytes of link_in/link_out (i.e. link_in/link_out[].range(7,0)
* as this portion i... | true |
a2e89a6a8bd5e512303875cbcd57c8554e5ed431 | C++ | smj2mm/OS | /homework2/homework2_4.cpp | UTF-8 | 2,210 | 3.28125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <iostream>
using namespace std;
/* GLOBALS */
struct threadStuff {
int index;
};
pthread_barrier_t barrier;
int numCompetitors;
int* numbers;
threadStuff* threadStructs;
void* getMax(void *arg1) {
threadStuff* info = (threa... | true |
34ddf06f87ab606b5a73e25ad77e7f5e0a5a6558 | C++ | zhanggyang/-offer | /连续最大子数组和/main.cpp | UTF-8 | 521 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int FindGreatestSumOfSubArray(vector<int> array) {
vector<int> Dp(array.size(),0);
Dp[0] = array[0];
int Max = array[0];
for(int i=1;i<array.size();i++){
if(Dp[i-1]<=... | true |
f7418ec1b9aaa91de6db5541736cbe01ecfbddb9 | C++ | cognimancer/infinidungeon | /infinidungeon/InstanceClass.h | UTF-8 | 1,451 | 3 | 3 | [] | no_license | /*--------------------------------------------------------------------------------------------------
Created by Alberto Bobadilla (labigm@rit.edu) in 2013
--------------------------------------------------------------------------------------------------*/
#ifndef _INSTANCECLASS_H
#define _INSTANCECLASS_H
#include "Mod... | true |
7ba1030692b5c1fa57378af3a79866ce3738f843 | C++ | zie87/sdl2_cxx | /src/test/video/rect_test.cxx | UTF-8 | 3,291 | 2.953125 | 3 | [] | no_license | /**
* @file rect_test.cxx
* @Author: zie87
* @Date: 2017-10-19 04:50:55
* @Last Modified by: zie87
* @Last Modified time: 2017-10-19 05:04:38
*
* @brief Brief description of file.
*
* Detailed description of file.
**/
#include <sdl2_cxx/video/rect.hxx>
#include <catch.hpp>
TEST_CASE("check rectangle... | true |
56a8e1755b9b24a830b2de0121638cba3625ea3d | C++ | JLPlummer79/CISC205 | /Project_3/src/menu.cpp | UTF-8 | 4,493 | 3.53125 | 4 | [] | no_license | /*
*
* Jesse Plummer
*
* Chapter 11, Programming Challenge #3
*
* March 19th, 2021
*
*/
#include "menu.h"
#include "error.h"
#include "options.h"
#include "display.h"
#include <string>
#include <iostream>
//*******************************************************
// name: menu
// called by: main
// passed:
... | true |
a6964b9a61732389d59bab48ce94fbd7c7e16a3e | C++ | jccarvalhosa/maratona | /uri/balls.cpp | UTF-8 | 362 | 3.046875 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
using namespace std;
int valid(int n, int v) {
for(int i=1;i<=v;i++) {
int d=0;
for(int ii=i;ii>0;ii--) for(int j=0;j<ii;j++) {
d += ii;
if(d==n) return 1;
}
}
return 0;
}
int main() {
int n, v;
while(cin>>n>>v && n) {
if(valid(n, v)) cout<<"possivel\n";
e... | true |
7ca9a236663e5fdafe3ff0891336f83110c834d9 | C++ | L-Naej/Grassman | /src/antitrivector.cpp | UTF-8 | 1,107 | 2.8125 | 3 | [] | no_license | #include "antitrivector.hpp"
namespace gca
{
GCA_antitrivector::GCA_antitrivector()
: Base()
{
setBases();
}
GCA_antitrivector::GCA_antitrivector(const GCA_antitrivector& other)
: Base(other)
{
setBases();
}
GCA_antitrivector::GCA_antitrivector(double x, double y, double z, double w)
: Base()
{
*this <<... | true |
68115db23c0188f42b1c3c888390ef91fd623ce8 | C++ | mosmeh/islands | /islands/include/Model.h | UTF-8 | 1,615 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"BSD-3-Clause",
"Zlib",
"Unlicense"
] | permissive | #pragma once
#include "Resource.h"
#include "Component.h"
#include "Texture.h"
#include "Mesh.h"
#include "Geometry.h"
namespace islands {
class Model : public SharedResource<Model> {
public:
Model(const std::string& filename);
Model(const Model&) = delete;
Model& operator=(const Model&) = delete;
Model(Model&&... | true |
0cde89ed1a398fba22e5e5615529db82601c3cc7 | C++ | pombredanne/Clonewise | /src/Launcher/main.cpp | UTF-8 | 2,057 | 2.625 | 3 | [] | no_license | #include <cstdlib>
#include <cstdio>
#include <cstring>
struct Command {
const char *name;
int (*main)(int argc, char *argv[]);
};
int Clonewise_build_database(int argc, char *argv[]);
int Clonewise_train(int argc, char *argv[]);
int Clonewise_train2(int argc, char *argv[]);
int Clonewise_query(int argc, char *arg... | true |
0fc9a96ee5759e7010477fbf34b4fe365b028927 | C++ | DinuCr/CS | /Info/Anton and Danik/main.cpp | UTF-8 | 336 | 2.828125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int a,b,i;
int main()
{
int n;
cin>>n;
for(i=1; i<=n; ++i)
{
char c;
cin>>c;
if(c=='A')
++a;
else
++b;
}
if(a>b)
cout<<"Anton";
if(a<b)
cout<<"Danik";
if(b==a)
cout<<... | true |
6aaf17921546f59e7729d9f6195f2e12bbc59f1f | C++ | koravel/textEditor-Cpp | /SaveFileDialog.cpp | UTF-8 | 1,140 | 2.546875 | 3 | [] | no_license | #include "SaveFileDialog.h"
SaveFileDialog::SaveFileDialog()
{
}
BOOL SaveFileDialog::SaveFile(HWND hwnd, HWND hEdit)
{
return Dialog(hwnd ,hEdit);
}
BOOL SaveFileDialog::ActionType(OPENFILENAME ofn, HWND hEdit, LPCTSTR szFileName)
{
if (GetSaveFileName(&ofn))
{
if (Action(hEdit, szFileName)) return true;
ret... | true |
7be1ec9d288ee20634be5b9b4a57a0de259a44df | C++ | Foidolite/Ray-Tracing-Demo | /rayTracer/rayTrace/matrix.h | UTF-8 | 12,304 | 3.4375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <stdexcept>
#include <vector>
#include <cmath>
template <typename component>
class Matrix {
public:
//constructors
Matrix() {}
Matrix(std::initializer_list < Vector<component>> cols) : columns(cols) { nRows = this->columns[0].getDimension(); nCols = cols.size(); verifyDims(); }
Mat... | true |
5a010bfadf6aadaf7992973a144f1932bdebc620 | C++ | artongdou/CarND-Path-Planning-Project | /src/costs.cpp | UTF-8 | 3,516 | 3.1875 | 3 | [
"MIT"
] | permissive | #include "costs.h"
#include <iostream>
using std::cout;
using std::endl;
using std::vector;
// Cost functions weights configuration
#define SPEED_WEIGHT 15
#define DIST_WEIGHT 40
#define LANE_CHANGE_WEIGHT 4
#define UNSAFE_DIST (10)
/**
* Function calculate costs based on given trajectory at {t=0, t=1}
* @param ... | true |
f55c21292eadd85895b3286914fd4c93bcb097cf | C++ | predatorsfr/OOP-tek-2 | /CCP_plazza_2018/loop.cpp | UTF-8 | 1,166 | 2.6875 | 3 | [] | no_license | /*
** EPITECH PROJECT, 2019
** plazza
** File description:
** loop file
*/
#include "my.hpp"
void loop4(ini::Info *info, const int chiefs)
{
int buf;
buf = info->g_to_m() / chiefs;
if (info->g_to_m() % chiefs != 0) {
buf = buf + 1;
}
info->s_kitchen(buf);
}
void loop3(ini::Info *info, st... | true |
54a55ac372c6abc90cd23adcdd332e019191829f | C++ | dscrawford/homework | /Junior/Fall_2018/CS4348/Project2/semFunctions.cc | UTF-8 | 471 | 2.90625 | 3 | [] | no_license | #include "project2_dsc160130.h"
void wait(sem_t &semaphore) {
if (sem_wait(&semaphore) == -1) {
printf("ERROR: waiting for semaphore");
exit(1);
}
}
void send(sem_t &semaphore) {
if (sem_post(&semaphore) == -1) {
printf("ERROR: sending semaphore");
exit(1);
}
}
void init_semaphore(sem_t& semap... | true |
cbd1015552589e64ccc6955bfcd227790b7a1360 | C++ | DaeYeon24/Portfolio | /etc/Telephone/TelephoneNumber.h | UHC | 1,129 | 2.65625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
using namespace std;
#define GROUPNUM 1
#define GROUPNUMNEXT 2
// 010 SKT 011, 017 KT 016, 018 LG 019
// 02
// 031 //õ 032 // 033
//泲 041 // 042 // 043
//λ 051 // 052 //뱸 053 // 054 //泲 055
// 061 // 062 // 063 // 064
enum TRUENUM // ι° ڸ Ǻ
{
PHONE = 49,
SEOUL,
RE... | true |
d5951f0de1bdb7cd13e7c17c4914e3103a92f7a2 | C++ | anirul/DataStructures | /ListTest.cpp | UTF-8 | 519 | 2.71875 | 3 | [
"MIT"
] | permissive | #include <cassert>
#include <iostream>
#include <gtest/gtest.h>
#include "List.h"
TEST(ListTest, SimpleTest)
{
List<float> myList;
for (int i = 0; i < 100; ++i)
myList.push_back((float)i);
float i = 0.0f;
EXPECT_EQ(100, myList.size());
for (float f : myList)
{
EXPECT_FLOAT_EQ(i, f);
i += 1.0f;
}
EXPECT_F... | true |
86ea740f7f5a5007047026204c3c0084cff6490b | C++ | Harrypotterrrr/Algorithm-ACM | /String/LC 0071 - getline.cpp | UTF-8 | 629 | 3.125 | 3 | [] | no_license | /*
71. Simplify Path
*/
class Solution {
public:
string simplifyPath(string path) {
vector<string>V;
stringstream ss(path);
string cur;
while(getline(ss, cur, '/')){
if(cur == "." || cur == "")
continue;
if(cur == ".."){
if(!V.... | true |
1444b3fa7a8696a27be8cacb32902b33dcda3439 | C++ | Malcom-Nubbins/DX11-Engine | /DirectX 11 Engine/Core/Scene/Scene Elements/Element Components/Transform.h | UTF-8 | 741 | 2.625 | 3 | [] | no_license | #pragma once
#include "../../../Globals/stdafx.h"
#include "../../../Globals/Structs.h"
class Transform
{
private:
XMFLOAT4X4 m_World;
XMFLOAT3 m_Position;
XMFLOAT3 m_Rotation;
XMFLOAT3 m_Scale;
XMFLOAT3 m_PrevPosition;
Transform* m_Parent;
public:
Transform();
~Transform();
void SetPosition(XMFLOAT3 pos)... | true |
e7490cfa054ede0ff9696ecf2f930b05ff25dde7 | C++ | tavallat/ECE244Lab2 | /main.cpp | UTF-8 | 8,145 | 3.0625 | 3 | [] | no_license |
// main.cpp
// lab3
// Created by Tina Tavallaeian on 2017-10-15.
// Copyright © 2017 Tina Tavallaeian. All rights reserved.
#include <iostream>
#include "Node.h"
#include "Resistor.h"
#include "RParser.h"
#include <cstdlib>
#include <sstream>
#include <string>
#include <iomanip>
using namespace std;
int main... | true |
7e2a9c5908899ce46fbc12556157880c189b3cdf | C++ | NaimaHasan/Data-Structure | /13.Graph/BFSDFS/party.cpp | UTF-8 | 1,096 | 2.6875 | 3 | [] | no_license | #include<bits/stdc++.h>
#define WHITE 0
#define GREY 1
#define BLACK 2
using namespace std;
queue<int>q;
void bfs(int s, int color[],vector<int> adj[],int depth[])
{
int i,x;
while(!q.empty()) q.pop();
q.push(s);
color[s]=GREY;
while(!q.empty())
{
int u=q.front();
q.pop();
... | true |
481438a0cd040e40c0161567182809eb262c020b | C++ | PixelCatalyst/CodingStandard | /vector/Vector.cpp | UTF-8 | 378 | 3.25 | 3 | [] | no_license | #include "Vector.hpp"
#include <cmath>
Vector::Vector(double x, double y) :
x(x),
y(y)
{
}
std::string Vector::toString()
{
return "(" + std::to_string(x) + ", " + std::to_string(y) + ")";
}
double Vector::getLength() const
{
return sqrt(x * x + y * y);
}
double Vector::getX() const
{
r... | true |
28118f8f390a78dc67c6c4018eadcf5a38ed6b98 | C++ | BackupTheBerlios/mgmodeler-svn | /plugins/IO/vrmlimport.cc | UTF-8 | 1,334 | 2.65625 | 3 | [] | no_license | #include "plugin.h"
#include <vector>
#include "math/vector3.h"
#include <cstdlib>
#include <cstdio>
#define PLUGIN_NAME "VRML Import Plugin"
#define PLUGIN_MENU "Vrml Import"
#define PLUGIN_ICON "vrml.png"
namespace {
std::vector<Vec3f> *points;
std::vector<std::vector<int> > *faces;
};
extern "C" int yy... | true |
ea2c2598ecb5cf540a5b74610a89fd506b2eb610 | C++ | jcfalcone/FalconeEngine | /FalconeEngine/Physics/spherecollider.cpp | UTF-8 | 9,469 | 2.578125 | 3 | [] | no_license | #include "spherecollider.h"
#define _USE_MATH_DEFINES
#include "boxcollider.h"
#include "polycollider.h"
#include "rigidbody.h"
#include <algorithm>
#include <float.h>
#include <math.h>
namespace FalconeEngine
{
namespace Physics
{
SphereCollider::SphereCollider() : Collider()
{
... | true |
d1f1899a2ad5c310253776e53f72908af3269ce1 | C++ | Gaston-Paz/GENERALA | /main.cpp | UTF-8 | 22,247 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
#include "funcionesNuestras.h"
#include "rlutil.h"
int modoDeDos (char jugador1[], char jugador2[], int &rondasGanador, int &puntajeGanador, char nombreGanador [], char nombreEmpate[],int &rondasPerdedor, int &puntajePerdedor, char nombrePe... | true |
6928331c9fedc11c61a18b896243f34e196372c4 | C++ | admirf/StreamCapture | /StreamCapture/main.cpp | UTF-8 | 2,458 | 2.59375 | 3 | [] | no_license | #include <IPv4Layer.h>
#include <Packet.h>
#include <PcapLiveDeviceList.h>
#include <SSLLayer.h>
#include <PlatformSpecificUtils.h>
#include <iostream>
#include "NetflixHandler.h"
using namespace std;
string getProtocolTypeAsString(pcpp::ProtocolType);
static void onPacketArrives(pcpp::RawPacket*, pcpp::PcapLiveDevic... | true |
f972a3bf031f2864aae0daf4f46408e82b660192 | C++ | lesharris/chipbit | /src/loaders/ShaderLoader.cpp | UTF-8 | 1,243 | 2.75 | 3 | [] | no_license | #include "ShaderLoader.h"
#include <string>
#include <fstream>
#include <sstream>
#include "../core/Log.h"
std::shared_ptr<Chipbit::Shader> Chipbit::ShaderLoader::load(const std::string& vertexPath, const std::string& fragmentPath) {
auto shader = std::make_shared<Shader>();
std::string vertexCode;
std::strin... | true |
9704b9b429e4ecd4eb0ae6b2009302c078b38dd7 | C++ | UniqueCoff/Homework1 | /3 week/Tabylirovanie 2n.cpp | UTF-8 | 585 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
int main()
{
int a, b;
std::cout << "Enter Interval" << std::endl;
std::cin >> a;
std::cin >> b;
float X;
std::cout << "Solve function. \nEnter X: ";
std::cin >> X;
std::cout << "\tx\t\ty" << std::endl;
float x = a;... | true |
7c4415114d2ccc2890aa6610772a2e66273740f4 | C++ | jpbream/3D-Engine | /3DEngine/Mat.h | UTF-8 | 1,049 | 3.03125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "Vec2.h"
#include "Vec3.h"
#include "Vec4.h"
class Mat {
private:
int rows;
int cols;
double* data;
public:
Mat(int r, int c);
Mat(Mat&&);
Mat& operator=(Mat&&);
~Mat();
int NumRows() const {
return rows;
}
int NumCols() const {
return cols;
}
double oper... | true |
2e6e2c8947ab81d81db639323dab67f287c71568 | C++ | zhzc1202/CppLearning | /Cpp/Day1/无所谓叫什么名字的main.cpp | UTF-8 | 1,031 | 2.59375 | 3 | [] | no_license | //
// main.cpp
// Day1
//
// Created by Jason's Macbook on 8/21/19.
// Copyright © 2019 Jason's Macbook. All rights reserved.
//
#include <iostream>
//不是每个程序都必须写
//C语言所有的函数要求先声明再使用
int main() //入口函数,一个程序只能有一个
{
printf("hello world!!!\n"); //打印函数
return 0;
}
void func()
{
}
void foo()
{
}
//三角号代... | true |
bd7971bd20bf010cc5429d7b4e8417aff6bc0670 | C++ | rnburn/portfolio | /nearby.cpp | UTF-8 | 21,249 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cassert>
#include <memory>
#include <cmath>
#include <set>
#include <algorithm>
#include <limits>
typedef uint32_t id_type;
typedef id_type index_type;
typedef std::vector<index_type> IndexMap;
typedef std::vector<id_type> OrderedQuestionList;
typedef std::vector<Ordered... | true |
425cc326984b37d6aa882e7227ad9ed080b6c530 | C++ | akrabulislam/UVA | /10006.cpp | UTF-8 | 1,023 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool mark[70000];
#define lli long long int
inline lli bigmod(lli a,lli b,lli m) {if(b==0)return 1%m;lli x=bigmod(a,b/2,m);x=(x*x)%m;if(b%2==1){x=(x*a)%m;}return x;}
void sieve(int n){
memset(mark,true,sizeof(mark));
mark[1]=mark[0]=fals... | true |
6a3572fe0570f0824cefe34e9fbfecdd2b805d44 | C++ | alexandraback/datacollection | /solutions_5630113748090880_1/C++/HowardChung/B.cpp | UTF-8 | 656 | 2.515625 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
int main()
{
freopen("B-large.in","r",stdin);
freopen("aout.txt","w",stdout);
int T;
scanf("%d",&T);
for(int cases = 1; cases <= T; cases++)
{
int cnt[2510];
memset(cnt,0,sizeof(cnt));
int n;
scanf("%d",&... | true |