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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9f64d26f628b7081702a761a0d52715a1928a855 | C++ | JJuOn/Algorithm-Study | /11000~11999/11724.cpp | UTF-8 | 1,118 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
using namespace std;
bool visitable(vector<bool> visited, int& startNode) {
int size = visited.size();
for (int i = 0; i < size; i++) {
if (!visited[i]) {
startNode = i;
return true;
}
}
return false;
}
void BF... | true |
145667122646fbc182ad66c7d0cf4292ee41b397 | C++ | zacharyvincze/sdl2-boilerplate | /src/sdl2-boilerplate/graphics.cpp | UTF-8 | 2,032 | 2.984375 | 3 | [] | no_license | #include "graphics.h"
Graphics::Graphics(std::string title, int window_width, int window_height) {
SDL_Init(SDL_INIT_EVERYTHING);
IMG_Init(IMG_INIT_PNG);
this->window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_width, window_height, SDL_WINDOW_FULLSCREEN_DESKTOP);
thi... | true |
6565e67a072d651e06feef2d8970e857a25e476a | C++ | zeroli/playground | /list/merge_sortedlist.cc | UTF-8 | 6,059 | 4.375 | 4 | [] | no_license | /*
Merge two sorted linked lists
Write a SortedMerge() function that takes two lists, each of which is sorted in increasing order, and merges the two together into one list which is in increasing order. SortedMerge() should return the new list. The new list should be made by splicing
together the nodes of the first two... | true |
311d77a43fb8b4fecba84b29492f7a959c454e50 | C++ | echener/Airship | /Code/RaspberryPi/hardware/motor/motor.cpp | UTF-8 | 2,048 | 2.859375 | 3 | [] | no_license | #include <stdlib.h>
#include <unistd.h>
#include <stdexcept>
#include "motor.h"
//TODO: reduce TIMEs to minimum and find optimal values for PWs (pulse width)
#define ZERO_PW 1100
#define MAX_PW (1900 - ZERO_PW)
#define ZERO_TIME (500 * 1000)
#define RELAIS_TIME (6 * 1000) //from datasheet
#define ARM_TIME ... | true |
286211938d723ab7b0717e8e576b3d10f89693f1 | C++ | zero0/zp4 | /ZeroPoint4/RenderingOpenGL/zpOpenGLBuffer.h | UTF-8 | 899 | 2.609375 | 3 | [] | no_license | #pragma once
#ifndef ZP_OPENGL_BUFFER_H
#define ZP_OPENGL_BUFFER_H
class zpBufferImpl
{
public:
zpBufferImpl();
~zpBufferImpl();
void create( zpBufferType type, zpBufferBindType bind, zp_uint count, zp_uint stride, void* data = 0 );
void destroy();
void map( void** data, zpMapType mapType = ZP_MAP_... | true |
b39cdde1ce91f3256237612ce2ad6f82b000a537 | C++ | camperjett/DSA_dups | /Datastructures/005 Trees/create_tree_iterative.cpp | UTF-8 | 5,160 | 3.578125 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
node* lchild = nullptr;
node* rchild = nullptr;
node(int data){
this->data = data;
}
};
node* input_tree(){
cout<<"Enter root data: "<<endl;
int temp;
cin>>temp;
node* root = new node(temp);
q... | true |
5b4b18f6dfa3fa6a7b8c492f93ee88f9614f0ffe | C++ | wideglide/CS3021 | /Class711.cpp | UTF-8 | 936 | 3.5625 | 4 | [] | no_license | //============================================================================
// Name : Classroom1.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#includ... | true |
75f4e2f90f623f2cdde943f4c2b2644fc863b77b | C++ | caffedrine/Arduino | /Projects/Tests/DRV8834_StepperMotorNonblockingLoop/DRV8834_StepperMotorNonblockingLoop.ino | UTF-8 | 1,113 | 2.984375 | 3 | [] | no_license | /* Simple Stepper Motor Control
* -- NON-BLOCKING LOOP --
*/
#include <Arduino.h>
#include "../libs/my_util.h"
#include "StepperPWM.h"
// All the wires needed for full functionality
#define DIR 8
#define STEP 9
#define ENBL 13
// microsteps pins
#define MS1 10
#define MS2 11
#define MS3 12
StepperPWM stepp... | true |
99cbff4ca211d668c55efbc90231beb50e369bba | C++ | arushnagpal/fictional-disco | /leetcode/701.cpp | UTF-8 | 873 | 3.40625 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* helperutil(TreeNode* root, int val){
if(root==NULL){
return ... | true |
f4ff8b87cf0b520e61ece39615b7d2916f470d66 | C++ | swizzley/skeksis | /type.hpp | UTF-8 | 5,711 | 3.078125 | 3 | [] | no_license | #pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <iostream>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
template <typename T>
void toJson(const T& v, rapidjson::Document& document, const char* key) {
document.AddMember(... | true |
bd1a8ff538f580b225db86a70a6cefcd397b2694 | C++ | Abdul-Hamid-k/CPP-Notes | /Polimorphism/BaseClassPointer/main.cpp | UTF-8 | 2,251 | 3.984375 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
class Account{
public:
// For dinamic binding we need to make the function virtual, if we dont make the function virtual it will do static binding.
// lets take a example Base and Derived are 2 class Derived inherit the Base, if I create a objec... | true |
01939431a9b3b7982a0787a49fa578f4c0f2ae88 | C++ | ebshimizu/Lumiverse-Patcher | /Source/components/ControlsPanel.cpp | UTF-8 | 11,407 | 2.75 | 3 | [] | no_license | #include "ControlsPanel.h"
#include "../Main.h"
LumiverseFloatPropertySlider::LumiverseFloatPropertySlider(string propertyName,
DeviceSet devices, LumiverseFloat* val)
: SliderPropertyComponent(propertyName, val->getMin(), val->getMax(), 0.001)
{
param = propertyName;
// We don't want to immediately capture th... | true |
c4f578f5ad0c8588eb7fee9009a77e90f904d520 | C++ | KevinPolez/Evolution | /include/Animation.h | UTF-8 | 752 | 2.5625 | 3 | [] | no_license | #ifndef ANIMATION_H
#define ANIMATION_H
#include "Object.h"
namespace evo
{
class Animation : public evo::Object
{
public:
Animation(int width, int height);
~Animation();
void setTextureSprite(SDL_Texture *texture);
void setAnimationFrameCount(int anima... | true |
3cdf94493b42f754c3001035219c7e149594fcff | C++ | uofuseismo/rtseis | /include/rtseis/utilities/interpolation/linear.hpp | UTF-8 | 6,786 | 3.265625 | 3 | [
"MIT"
] | permissive | #ifndef RTSEIS_UTILITIES_INTERPOLATION_LINEAR_HPP
#define RTSEIS_UTILITIES_INTERPOLATION_LINEAR_HPP 1
#include <memory>
namespace RTSeis::Utilities::Interpolation
{
/*!
* @class Linear linear.hpp "rtseis/utilities/interpolation/linear.hpp"
* @brief A class for performing linear interpolation.
* @author Ben Baker (U... | true |
8aef34e3b30f0d43c36b08e21c420dd5e9919036 | C++ | fuzh97/leetcode | /code/0139.单词拆分.cpp | UTF-8 | 1,306 | 3.234375 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=139 lang=cpp
*
* [139] 单词拆分
*/
// @lc code=start
class Solution {
public:
bool wordBreak(string s, vector<string>& wordDict) {
queue<int> q;
vector<bool> visited(s.size() + 1, false);
q.push(0);
visited[0] = true;
while (!q.em... | true |
32aeb9357e54ae396d3da8461df63b9b94b41b8f | C++ | mubai-victor/DataStructure | /Memory/AllocBuddy/Source/Function.cpp | UTF-8 | 2,652 | 2.734375 | 3 | [] | no_license | #include "stdafx.h"
#include "Function.h"
#include "Test.h"
using namespace std;
cAlloc::cAlloc()
{
root = NULL;
}
cAlloc::~cAlloc()
{
delete[] root;
root = NULL;
}
void cAlloc::Init()
{
for (int i = 0; i <= SIZE; i++) {
a[i].first = NULL;
a[i].nodesize = pow(2, i);
}
root = a[SIZE].first = new WORD_b[int(p... | true |
611888a93ac680ad2fe9b09ae56de508cd394ba6 | C++ | LauZyHou/Algorithm-To-Practice | /AcWing/LeetCode究极班/542.cpp | UTF-8 | 1,140 | 2.8125 | 3 | [
"MIT"
] | permissive | #define x first
#define y second
typedef pair<int, int> PII;
class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& matrix) {
if (matrix.empty() || matrix[0].empty()) return matrix;
int n = matrix.size(), m = matrix[0].size();
// 距离数组
vector<vector<int>> dis... | true |
58120f600db985ea70fb80a8e7775e368e392f6e | C++ | DKU-STUDY/Algorithm | /programmers/난이도별/level02.쿼드압축_후_개수_세기/6047198844.cpp | UTF-8 | 999 | 3.359375 | 3 | [] | no_license | #include <string>
#include <vector>
using namespace std;
int zero_one[2] = { 0,0 };
void divide_and_conquer(vector<vector<int>> &arr,int y, int x, int size) {
if (size == 1) {
zero_one[arr[y][x]]++;
return;
}
bool check = true;
for (int i = y; i < y + size; i++) {
if (!check)
... | true |
1233012e9895003523c839ff3d89f1f2d01866bf | C++ | Aleks-P-97/Rings-Of-Time-3D-animation | /external/include/tygra/FileHelper.hpp | UTF-8 | 754 | 2.9375 | 3 | [] | no_license | /**
* @file FileHelper.hpp
* @author Tyrone Davison
* @date September 2012
*/
#pragma once
#ifndef __TYGRA_FILEHELPER__
#define __TYGRA_FILEHELPER__
#include <string>
#include "Image.hpp"
namespace tygra
{
/**
* Construct a new string object with the contents of a text file.
... | true |
f72dae39a6ce7ffffa252f2a63b463f26e848e7c | C++ | ZeroZhong/dataStructure | /stack_learn/stack/stack_c++.h | UTF-8 | 319 | 2.609375 | 3 | [] | no_license | #include "../../vecter_learn/vector/vector_c++.h"
namespace shitong
{
template <typename T>
class Stack : Vector<T>
{
public:
void push(T const &e) { insert(this->size(), e); }
T pop() { return remove(this->size() - 1); }
T &top() { return (*this)[this->size() - 1]; }
};
}
| true |
a3f06fb52667a3ccd7af759fe1c5d1a437ccfc06 | C++ | ant512/WiredMunk | /client/trunk/src/wiredmunk/network/message.h | UTF-8 | 5,160 | 2.78125 | 3 | [] | no_license | #ifndef _MESSAGE_H_
#define _MESSAGE_H_
#define MESSAGE_HEADER "WDMK"
#define MESSAGE_HEADER_LENGTH 9
#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "socketeventhandler.h"
namespace WiredMunk {
/**
* Messages that are to be sent across the n... | true |
6f8b6fb1ff5ceeb139787e4c760232cc8c9cb80c | C++ | buaaswf/ssss | /Bmpread.cpp | GB18030 | 1,816 | 2.65625 | 3 | [] | no_license | #include <string.h>
#include <stdio.h>
/***һBMPͼƬõһά***/
typedef unsigned long DWORD;
typedef unsigned short WORD;
typedef unsigned int UINT;
/* bitmap file header */
typedef struct tagBITMAPFILEHEADER
{
char type[2];
DWORD fileSize;
WORD reserved1;
WORD reserve... | true |
de79cddd1dc68747f441fe18d2254253075e9cda | C++ | rt77789/misc | /eps/hkmeans.cxx | UTF-8 | 5,493 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <vector>
#include <set>
#include <cstdlib>
#include <fstream>
#include <sstream>
using namespace std;
const int INF = 100000000;
int label_num = 0;
vector<vector<double> > vin;
struct Node {
// 199998 -> root_label.
// [label|dims|c... | true |
7e0477f07726fab4c410373a1df901e4e24185e5 | C++ | andrewome/kattis-problems | /guess.cpp | UTF-8 | 478 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main() {
int guess = 500;
int min = 1;
int max = 1001;
string input;
cout << guess << endl;
while(cin >> input) {
if(input == "correct") {
return 0;
}
if(input == "lower") {
max = g... | true |
b52e6046fea9ae0e577efe095cc55f6dee4b04ea | C++ | showmic96/Online-Judge-Solution | /UVA/10312/12733852_AC_0ms_0kB.cpp | UTF-8 | 549 | 2.59375 | 3 | [] | no_license | // In the name of Allah the Lord of the Worlds.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
ll cat[30] , cat2[30];
cat[0] = 1;
cat[1] = 1;
cat2[0] = 1;
cat2[1] = 1;
cat2[2] = 1;
cat2[3] = 3;
for(ll i=1;i<30;i++){
cat[i] = cat[i-1]*2*(2... | true |
a418d8a2e359bf7e5f4b37c955537781bb8ad33d | C++ | Paulmburu/Primer_CPP | /M_t.cpp | UTF-8 | 485 | 3.171875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
constexpr size_t rowCnt = 3, colCnt = 4;
int ia[rowCnt][colCnt]; // 12 uninitialized elements
// for each row
for (size_t i = 0; i != rowCnt; ++i) {
// for each column within the row
for (size_t j = 0; j != colCnt; ++j) {
// assign the element's positional i... | true |
a1d6d9d773309ebabf099a78fba8e1c6be45a7f1 | C++ | MinhazAbtahi/UVA | /11547 - Automatic Answer.cpp | UTF-8 | 344 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int t, n, result;
cin>>t;
for(int i=0;i<t;i++) {
cin>>n;
n *= 567;
n /= 9;
n += 7492;
n *= 235;
n /= 47;
n -= 498;
n = abs(n);
result = (n/10)%10;
cout... | true |
b847a46f7ac2a63c4d94e7316f6a4b2a758184cf | C++ | 0xGoerliMainnet/Zorro-Kraken-Plugin | /json.cpp | UTF-8 | 2,060 | 2.546875 | 3 | [] | no_license | //#include <curl/curl.h>
#include <stdlib.h>
#include "json.h"
#include "log.h"
#include "buf.h"
#define BUFFER_SIZE 32768
#define JSON_TOKENS 256
static size_t fetch_data(void *buffer, size_t size, size_t nmemb, void *userp)
{
buf_t *buf = (buf_t *)userp;
size_t total = size * nmemb;
if (buf->limit - buf->len <... | true |
5f780233e0631bebbb8044414f469b4c031676f6 | C++ | uvbs/FullSource | /Source/Source/KG3DEngine/KG3DEngine/Helpers/KGHelperClasses.h | GB18030 | 7,380 | 3.0625 | 3 | [
"MIT"
] | permissive | ////////////////////////////////////////////////////////////////////////////////
//
// FileName : KGHelperClasses.h
// Version : 1.0
// Creator : Chen Tianhong
// Create Date : 2007-3-20 19:18:47
/* Comment : ࣬ԲκҪκļĶ
// ҲṩSceneEditorʹ
1.TTypeCopy
ԶĻתԶ̫С
Class A; Class B : public A;
A a;
B b;
TTy... | true |
f0854c8b174d68ebaac61fe919146fcec68db54f | C++ | laureviens/histoires-interactives | /Tests/strintervalle.cpp | ISO-8859-1 | 2,203 | 3.1875 | 3 | [] | no_license | //------------------------------------------------------------------------------------------------------------------------------------------------------
//0) Inclure les bonnes library et utiliser les raccourcis pour standard
#include <iostream> //Pour les entres/sorties
#include <string> //Pour utiliser les obje... | true |
070061aaa80213f7ff8fc6c6291b68ad2450c5ee | C++ | WhiZTiM/coliru | /Archive2/f4/1b07c1d0912db2/main.cpp | UTF-8 | 792 | 2.78125 | 3 | [] | no_license | #include <boost/archive/text_oarchive.hpp>
typedef uint32_t WORD;
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
namespace boost { namespace serialization {
t... | true |
34670197d3f42e84b58935f737d5b78bf2489310 | C++ | timtingwei/prac | /cplus/value_type/prac_2.28.cpp | GB18030 | 409 | 2.84375 | 3 | [] | no_license | #include <iostream>
int prac_228()
{
//int i, *const cp; //ָһʼɣֵͲٸı
//int i, *const cp = &i //ȷд
//int *p1, *const p2; //ָ뱻ʼ
//const int ic, &r = ic; //ʼ
//const int *const p3; //ʼ
const int *p; //pָһ
system("pause");
return 0;
} | true |
04ef09b729cd530bac1ef51df338e9f5d94f1337 | C++ | Rashi103/practice-cpp | /binary_search_tree/bst_simple.cc | UTF-8 | 4,233 | 3.5625 | 4 | [] | no_license | #include "bst_simple.h"
namespace jw {
BSTNode* GetNewNode(int value) {
BSTNode* node = new BSTNode;
node->data = value;
node->left = nullptr;
node->right = nullptr;
return node;
}
BSTNode* Insert(BSTNode* node, int value) {
if (node == nullptr) {
node = GetNewNode(value);
return node;
}
if... | true |
7192fa22c58475bce22cafa4d9bf21384b3de29f | C++ | asherpdang/JollyBanker | /Account.h | UTF-8 | 1,411 | 3.296875 | 3 | [] | no_license | #pragma once
#include "Transaction.h"
#include "Fund.h"
#include <iostream>
#include <string>
using namespace std;
#ifndef ASS3_ACCOUNT_H
#define ASS3_ACCOUNT_H
/*
* Creates account classes that store 10 funds
* handles subtracting/adding/transferring money
*/
class Account {
friend ostream& operator<<(ostream& out,... | true |
c3d1d2ad9177737bebf8cc0f32fdb47936a46cf5 | C++ | EsaZul/C-Cplusplus | /Software Implementation I/Go Fish!/card.cpp | UTF-8 | 3,391 | 3.546875 | 4 | [] | no_license | //card.cpp
#include "card.h"
using namespace std;
Card::Card(){ // default, ace of spades
mySuit = spades;
myRank = 1;
}
Card::Card(int rank, Suit s){
mySuit = s;
myRank = rank;
/* 1 = A;
* 11 = J;
* 12 = Q;
* 13 = K;
*/
}
... | true |
5862d22ad8d9f24d10c35f607940aa448e45a426 | C++ | FrozenSky7124/Project_MSVS | /C++/FrozenSky/SkyFileSync v1.0/FileTraveDel.cpp | GB18030 | 2,522 | 3.140625 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <io.h>
#include <direct.h>
using namespace std;
/*
[Function]
srcDir·µļļУdestDir·µļбȶԣɾsrcDir·destDir·ڵļļС
curPathԼ¼·
[Return Value]
0 : Success!
-1: Error in _findfirst()
-2: Error in _rmdir()
-3: Error in remove()
*/
int fileTraveDel(const char *sr... | true |
7e3b933f29a226e2ac782635afa71e6f2fb7269e | C++ | yaoReadingCode/VS2015project | /AssetManager2/AssetManager2/menuinterface.h | UTF-8 | 2,224 | 3.0625 | 3 | [] | no_license | #ifndef MENUITERFACE_H
#define MENUITERFACE_H
#include <iostream>
#include<memory>
#include"date.h"
#include"asset.h"
#include"custodian.h"
/**
* @brief The MenuInterface class encapsulates all interaction with the asset management system.
*/
class MenuInterface {
public:
MenuInterface(std::ostream &display, std::i... | true |
1b8583e2c9f8331a20f4ee55cf45968b4b643d58 | C++ | redfern314/poe-lab1 | /poe_lab1/poe_lab1.ino | UTF-8 | 3,419 | 3.046875 | 3 | [] | no_license | /*Setup functions for a semi-sphere room sweep which detects the ambient light of its suroundings
using a photoresistor. This interfaces with a Python 2 GUI and code which produces a graph in Python.
Derek Redfern & Halie Murray-Davis
*/
//Get libraries:
#include<Servo.h>;
#include <stream.h>;
//Define global vari... | true |
85d5543a5d4d03eb57a8d51a280de9ee9e83120f | C++ | colsramble/Aircon2015-Firmware | /firmware/firmware.ino | UTF-8 | 2,479 | 2.578125 | 3 | [] | no_license | #include <SPI.h>
#include <Ethernet.h>
#include "globals.h"
#include "rpcserver.h"
#include "hardware.h"
#include "interrupt.h"
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(1... | true |
b2eddc4ecd2c9b42afec12a914ae919881e54436 | C++ | PatrDen/compress | /src/huffman.cpp | UTF-8 | 6,365 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include "huffman.hpp"
void print( const huffman::tree_node::ptr node, int s = 0 )
{
for ( int i = 0; i < s; ++i ) cerr << " ";
cerr << "'";
for ( int i = 0; i < BUF_LEN; ++ i ) if ( node->chars[i] ) cerr << (char) i;
cerr << "' " << node->frequency << endl;
if ( node->left != NULL )
{
for ... | true |
ac0a734ad9096017048f4bdd39edbe8c3bd42949 | C++ | Yousifba/-Introduction-To-3D-Animations---Final-Project | /igl/opengl/Movable.cpp | UTF-8 | 1,432 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | #include "Movable.h"
#include <iostream>
Movable::Movable()
{
T = Eigen::Transform<float, 3, Eigen::Affine>::Identity();
}
Eigen::Matrix4f Movable::MakeTrans()
{
return T.matrix();
}
Eigen::Transform<float, 3, Eigen::Affine>& Movable::getTrans()
{
return T;
}
void Movable::Move(Eigen::Vector4f new_coords)
{
Eig... | true |
d5464b59f39ad9835165170e02ab3de8fc6f7ade | C++ | lenmahaffey/ADT_Matrix | /ADT_Matrix/src/Matrix.h | UTF-8 | 11,083 | 3.34375 | 3 | [] | no_license | #ifndef MATRIX_H
#define MATRIX_H
#include <string>
#include <iostream>
#include "Cell.h"
namespace ADT
{
template <class T>
class Matrix
{
public:
Matrix<T>();
Matrix<T>(int columns, int rows, T defaultValue);
Matrix<T>(const Matrix<T>& other);
void Display();
int GetColumnCount() const;
int GetRowCou... | true |
8df1fe547ae670b23dd097357bca877e867b0847 | C++ | sanjusss/leetcode-cpp | /0/400/470/472_20211228.cpp | UTF-8 | 2,184 | 3.078125 | 3 | [] | no_license | /*
* @Author: sanjusss
* @Date: 2021-12-28 20:47:58
* @LastEditors: sanjusss
* @LastEditTime: 2021-12-28 21:14:11
* @FilePath: \0\400\470\472_20211228.cpp
*/
#include "leetcode.h"
class Solution {
struct Node {
bool end = false;
Node* children[26] = { nullptr };
~Node() {
... | true |
68aa668997a6cbe0b094f96a83525273f0788eb5 | C++ | Czar4ik/Repoz4 | /ЛР_5/ConsoleApplication1/Button.h | UTF-8 | 495 | 2.75 | 3 | [] | no_license | #pragma once
#include "Element upravlenia.h"
#include "iostream"
using namespace std;
class Button :
public Element
{
public:
Button()
{}
Button(char* name, int plosh) :Element(name)
{
this->plosh = plosh;
};
char * getName()
{
return name;
};
int getPlosh()
{
//cout << this->cost;
return plosh... | true |
f33b42dfe8df1c1593eb805bc6f4f69f75c7c86c | C++ | Greencats0/university | /2/Fall/CPSC-131/Final Revew/Recursion/print_linked_list.cpp | UTF-8 | 392 | 3.15625 | 3 | [] | no_license | #include <iostream>
struct n {
int data = 10;
n* next = nullptr;
// n* right = nullptr;
};
void print(n* node){
while(node != nullptr){
std::cout << node->data << std::endl;
node = node->next;
}
}
void test(){
n* n1 = new n;
n* n2 = new n;
n1->next = n2;
print(n1);
delete n1;
delete n2;... | true |
54d7edd8e301e613394538501deb87a9c7e571bb | C++ | dhornyak/LEGO-Racers | /01_Middle/01_Middle/GeometryFactory.cpp | ISO-8859-2 | 17,705 | 2.875 | 3 | [] | no_license | #include "GeometryFactory.h"
#include "TrackSection.h"
#include <vector>
// Static cube parameters.
const int GeometryFactory::N = 32;
const float GeometryFactory::knobHeight = 1.8f;
const float GeometryFactory::knobRadius = 2.4f;
const float GeometryFactory::cubeWidthUnit = 8.0f;
const float GeometryFactory::cube... | true |
417df2a5ce5b1afca02057d4e929bb70b8d269c1 | C++ | xiaohaoxiang/algo | /质因子分解Pollard_Rho与Miller_Rabin.cpp | UTF-8 | 2,934 | 2.75 | 3 | [] | no_license | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef unsigned long long ull;
const int MAX_N = 1000;
const int S = 32; // Miller_Rabin中的判断次数
ull factor[MAX_N]; // 分解出的质因子(无序)
int fcnt; // 质因子数量, 需先归零
ull gcd(ull a, ull b); // 计算 gcd(a, b)
... | true |
96f3a578b875df63cf4bf40c59c0428a49f007e1 | C++ | younnggsuk/cpp | /ch4/PrivateConstructor.cpp | UTF-8 | 468 | 3.359375 | 3 | [] | no_license | #include <iostream>
using std::cout;
using std::cin;
using std::endl;
class AAA
{
private:
int num;
AAA(int n) : num(n) {}
public:
AAA() : num(0) {}
AAA& InitObject(int n)
{
AAA *ptr = new AAA(n);
return *ptr;
}
void ShowInfo() const { cout<<num<<endl; }
};
int main(void)
{
AAA obj1;
obj1.ShowInfo();
... | true |
f60607304747be6c131157e38d6f6bfd76188e70 | C++ | chiuwe/ME405_Lab2_Motor_Driver | /motor_controller.h | UTF-8 | 2,440 | 2.984375 | 3 | [] | no_license | //**************************************************************************************
/** \file motor_controller.h
* This file contains the header for a motor controller class which controls speed
* and direction of a motor using a voltage measured from the A/D as input. A
* potentiomiter is used for sp... | true |
52d7abdfbe3348de233ac542dc4d4d68f6b70709 | C++ | pratiksachaniya/Cpp | /STRUCT.CPP | UTF-8 | 642 | 3.453125 | 3 | [] | no_license | /* Struct In C++ */
#include<iostream.h>
#include<conio.h>
struct student
{
int roll;
char name[20];
int m1,m2,m3;
float result()
{
return (m1+m2+m3)/3;
}
};
void main()
{
clrscr();
struct student s1;
cout<<"Enter Student Roll Number:";
cin>>s1.roll;
cout<<"Enter Student Name... | true |
3f0371c309faf76c632547ef3461b0f7b0da16dd | C++ | KFlaga/AutoRobo_Cpp | /AutoRobo_Cpp/src/ARSystemTimer.h | UTF-8 | 2,318 | 2.90625 | 3 | [] | no_license | /*
* ARTime.h
*
* Created on: Mar 23, 2017
* Author: Kamil
*/
#ifndef ARSYSTEMTIMER_H_
#define ARSYSTEMTIMER_H_
#include "ARTimeSpan.h"
#include <functional>
namespace AutoRobo
{
typedef unsigned int TimerId;
// Represents global timer, which works for entire time and enables
// to register callback w... | true |
e95ca13dda0ee771556f06fb3ab799f72691e6fe | C++ | zhouzora/Learning-C-skills | /exercise0507.cpp | UTF-8 | 722 | 3.078125 | 3 | [] | no_license | #include<bits/stdc++.h>
#include<string.h>
#include<array>
using namespace std;
struct car
{
string supplier;
int year;
};
int main()
{
int cars_size=0;
cout<<"how many cars do you wish to catalog: ";
(cin>>cars_size).get();
car *cars=new car[cars_size];
for(int i=0;i<cars_... | true |
9b2e4469b1119c1c4f9690cc6d79027988553175 | C++ | kanchan1910/June-Leetcoding-Challenge-2021 | /Construct Binary Tree from Preorder and Inorder Traversal.cpp | UTF-8 | 1,248 | 3.3125 | 3 | [] | no_license |
class Solution {
public:
unordered_map<int, int>m;
TreeNode* fun(vector<int>& preorder, int& index, int l, int r)
{
// base case
if(l > r)
{
return NULL;
}
int val = preorder[index];
index++;
// forming the node
TreeN... | true |
491174ecfd7c02d57125da318e7a04678c2b0346 | C++ | ljshou/workspace | /algorithm/poj/1003.cc | UTF-8 | 239 | 2.75 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(void)
{
double len, val;
int i;
while(cin >> len && len)
{
val = 0.0;
for(i=1; val < len; ++i)
val += 1.0/(i+1.0);
cout << i-1 << " card(s)" << endl;
}
return 0;
}
| true |
83e070fd8e99597697f81dc22cd6558a2e2792f8 | C++ | mfkiwl/cuda-flow2d | /src/optical_flow/optical_flow_base_2d.cpp | UTF-8 | 2,117 | 2.59375 | 3 | [] | no_license | /**
* @file 2D Optical flow using NVIDIA CUDA
* @author Institute for Photon Science and Synchrotron Radiation, Karlsruhe Institute of Technology
*
* @date 2015-2018
* @version 0.5.0
*
*
* @section LICENSE
*
* This program is copyrighted by the author and Institute for Photon Science and Synchrotron Radiation,
*... | true |
004a5ad14ff521f05bf6ced91cd2e423ce3fa89a | C++ | KoreanGinseng/CreativeLabo3 | /その他/Sample0218/Observer05/Character.h | SHIFT_JIS | 1,814 | 3.265625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Texture.h"
#include "Subject.h"
/**
* LN^[NX
*/
class Character
{
private:
/** LN^[̎c@ */
int life;
/** LN^[̃RC */
int coin;
/** LN^[̃XRA */
int score;
/** LN^[͉摜 */
Texture texture;
/** c@ύXʒm */
Subject<int> lifeSubject;
/** RCύXʒm */
Subject<int> coinSubject;
/** XRAύXʒm */
... | true |
9be45e8fb89fed1ded73ec712fd33d18701430e1 | C++ | jentos00/VIM | /model/Model.cpp | UTF-8 | 1,769 | 3.234375 | 3 | [] | no_license |
#include "Model.h"
void Model::open(const std::string &filename) {
std::ifstream in(filename);
if (!in.is_open()) throw std::runtime_error("can't open file " + filename);
read(in);
m_filename = filename;
}
void Model::read(std::istream &in) {
m_lines.clear();
std::string line;
while (std... | true |
8eb145143390db08e3ebb1d5df234ccebe2f5409 | C++ | himanshu9345/cpp-practice | /2.variables.cpp | UTF-8 | 541 | 3.265625 | 3 | [] | no_license | //
// Created by himanshu on 10/29/19.
//
#include <iostream>
int main(){
std::cout<<"Hello World"<< std::endl;
//value will remain constant
const double PI=3.14;
//char 1byte in memory
char myGrade = 'A';
//boolean true or false
bool isEmpty = true;
//float accurate upto 6 decimal p... | true |
6645c94b596c44be01f3cf76bae2af32c7e54d03 | C++ | vandenoordj/Lab3 | /ListArray.cpp | UTF-8 | 5,031 | 3.15625 | 3 | [] | no_license | /*
* ListArray.cpp
*
* Created on: Feb 16, 2015
* Author: vandenoordj
*/
#include "ListArray.h"
template < typename DataType >
List<DataType>::List (int maxNumber ){
maxSize = maxNumber;
size = 0;
cursor = -1;
dataItems = new DataType[maxSize];
}
template < typename DataType >
List<DataType>::List ( c... | true |
c4ac51880e64996f2e5f0bf40e16e3439d788059 | C++ | MaeBung/Client | /Client_Source/CFPSTimer.cpp | UHC | 632 | 2.640625 | 3 | [] | no_license | #include "DXUT.h"
#include "CFPSTimer.h"
CFPSTimer::CFPSTimer()
{
}
CFPSTimer::~CFPSTimer()
{
}
void CFPSTimer::Update()
{
DWORD iCurTime = timeGetTime(); // ð
float fTimeDelta = (iCurTime - m_iLastTime)*0.001f; //timeDelta(1 帥 ð) 1ʴ ٲش.
m_fTimeElapsed += fTimeDelta;
m_iFrameCount++;
m_fFPS = (... | true |
13cfbf13c297440def9b13a0cffea5b3d473a023 | C++ | zimnicky/knu-iii-s-labs-oop | /tasks/1/main.cpp | UTF-8 | 251 | 2.515625 | 3 | [] | no_license | #include <fstream>
#include "task.h"
using namespace std;
int main()
{
ifstream in("input.txt");
ofstream out("output.txt");
Task task;
task.read(in);
in.close();
out << task.solve() << endl;
out.close();
return 0;
}
| true |
60c0374cb1d5f9d01b6e96f79d1870af67c58581 | C++ | m00p1ng/UVa-problem | /Volume105/10530 - Guessing Game.cpp | UTF-8 | 1,115 | 3.109375 | 3 | [] | no_license | #include <cstdio>
int main() {
bool board[10] = { false };
int number;
char cmd[20];
char ig[10];
bool result = true;
while(scanf("%d", &number)) {
if(number == 0) break;
scanf("%s %s", ig, cmd);
switch(cmd[0]) {
case 'l':
for(int ... | true |
6fe05ca1f46dacf04db3674eeb33b19845860715 | C++ | dineshmakkar079/My-DS-Algo-code | /interviewbit/Search_for_a_Range.cpp | UTF-8 | 1,260 | 3.28125 | 3 | [] | no_license | /*
Time : Sat Sep 02 2017 11:21:15 GMT+0530 (IST)
URL : https://www.interviewbit.com/problems/search-for-a-range/
Given a sorted array of integers, find the starting and ending position of a given target value.
Your
algorithm’s runtime complexity must be in the order of O(log n).
If the target is not found in
the a... | true |
d9f0ccd286e8f5125ee01f9abe8634213f5e5db6 | C++ | BryanRobertson/Alba | /Source/Engine/Core/Core_Console.hpp | UTF-8 | 7,450 | 2.765625 | 3 | [] | no_license | #pragma once
#include "Core.hpp"
#include "Core_StringView.hpp"
#include "Core_Function.hpp"
#include "Core_VectorMap.hpp"
#include "Core_StronglyTypedId.hpp"
#include "Core_ConsoleCommandInternal.hpp"
namespace Alba
{
namespace Core
{
//----------------------------------------------------------------------------... | true |
c10ede713930e4ee67d2181974de774f310e14de | C++ | xulidong/c_cpp | /cpp/design/AbstractFactory.cpp | UTF-8 | 1,544 | 3.34375 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Fruit {
public:
virtual ~Fruit() {}
virtual void sayName() = 0;
};
class LocalApple: public Fruit {
public:
virtual void sayName() {
cout << "LocalApple" << endl;
}
};
class LocalBanana: public Fruit {
public:
virtual void sayName() {
cout << "LocalB... | true |
83a8de00e4cbd17f5d4fb937279e163992c94b84 | C++ | DOGGY-SAINT/DesignPatternProject_TJ | /Composite/Composite.cpp | UTF-8 | 722 | 2.53125 | 3 | [] | no_license | #include"FileSystemManager.h"
int main()
{
FileSystemManager manager;
string commandLine;
string commands[6];
commands[0] = "mkdir luoyuxia";
commands[1] = "mkfile luoyuxia1997 20";
commands[2] = "mkdir user";
commands[3] = "mkdir temp";
commands[4] = "mkdir bin";
commands[5] = "cd user";
for (int i = 0; i ... | true |
34df3c06a78c660772e84e4c661b45889ae650ee | C++ | adarshnanwani/cpp-course | /Basic/custom-functions.cpp | UTF-8 | 579 | 4.34375 | 4 | [] | no_license | #include <iostream>
double pow(double, int); // declaration
int main()
{
int base;
int exponent;
std::cout << "Please enter the base number: ";
std::cin >> base;
std::cout << "Please enter the exponent: ";
std::cin >> exponent;
double result = pow(base, exponent);
std::cout << base <<... | true |
300a854cd1fc61a95a551261a9a1aba34ba85294 | C++ | ajason6208/RL_Scheduling- | /RL_Scheduling/FileProcess.cpp | UTF-8 | 562 | 2.6875 | 3 | [] | no_license | #include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <boost/filesystem.hpp>
#include "FileProcess.h"
using namespace boost::filesystem;
using namespace std;
vector<string> FileProcess::Get_All_Files(string folder_path) {
vector<string> all_files_name;
path p(folder_path);
for (a... | true |
fa242ef36c7555120f0dc46e9e8b63dd98876378 | C++ | AntonWilson123/OOP | /lab1/main.cpp | UTF-8 | 794 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include "Quadrate.h"
#include "Rectangle.h"
#include "Trapeze.h"
using namespace std;
int main(int argc, char** argv){
Figure *figure1 = new Quadrate();
figure1->Print();
std::cout << "Площадь квадрата:" << figure1->Square() << "\n";
delete figure1;
std::cout << "______________________... | true |
f744291af6fa84248aec95feb5ef25f1efc05f43 | C++ | rafipriatna/Belajar-Bahasa-Pemrograman | /C++/Latihan/gantiVocal.cpp | UTF-8 | 1,449 | 4.03125 | 4 | [
"MIT"
] | permissive | /*
* Soal : Buatlah contoh program mengenai penerapan Fungsi
* dan Procedure pada bahasa pemrograman C++.
*/
#include <iostream>
#include <string>
using namespace std;
// Fungsi & prosedur
void gantiVocal(string kata){
// Output
cout << "Bimsalabim => ";
// Mengganti vocal dari kata yang diinput ... | true |
0b6fc7a4b5e7d6123ea9e9e4fbfc7743c10e529a | C++ | flywind2/nextclade | /packages/nextclade/src/io/formatMutation.cpp | UTF-8 | 4,096 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "formatMutation.h"
#include <fmt/format.h>
#include <nextclade/nextclade.h>
#include <nextclade/private/nextclade_private.h>
#include <string>
#include "utils/contract.h"
namespace Nextclade {
std::string formatRange(const Range& range) {
precondition_less(range.begin, range.end);
if (range.begi... | true |
658e0cab472106f89c8a0f89eed19e829c8fe976 | C++ | SamJia/Oj | /SJTU_OJ/1349.cpp | UTF-8 | 568 | 2.84375 | 3 | [] | no_license | #include <iostream>
using namespace std;
#define SIZE 20
int row_number, colomn_number;
char map[SIZE][SIZE] = {};
int result[SIZE][SIZE] = {};
int main(){
cin >> row_number >> colomn_number;
for(int i = 0; i < row_number; ++i)
cin >> map[i];
result[row_number-1][colomn_number-1] = 1;
for(int i = row_number - 2... | true |
dfdfdbbcda0ce775b954fbfd91582316b0487e6a | C++ | goog/Algorithms | /clang/cxx/google.class/composer/test_composer.cxx | UTF-8 | 429 | 2.546875 | 3 | [] | no_license | /*
* test_composer.cxx
*
* Copyright 2013 googcheng <googcheng@gmail.com>
*
*
*
*/
#include <iostream>
#include "composer.h"
#include <string>
using namespace std;
int main ()
{
cout << "Testing the Composer class." << endl;
Composer composer;
composer.set_name("Ludwig van");
composer.set_yob(1770);
... | true |
234cc72f29856fb0ea2626cc925ab68f8abaf1d3 | C++ | andrey-islentyev/Neuro-Game | /SFMLServer/server.cpp | UTF-8 | 8,016 | 2.796875 | 3 | [] | no_license | #include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <queue>
#include <random>
#include <string>
#include <vector>
#define GAME_START_TIME 10.0
#define PLAYER_MAX 8
//10 milliseconds for handling messages from players
#define RECV_PHASE_TIMEOUT 10.0
//hard limit of messages per one game ... | true |
1df3d7de57c34a57764ca163328b408cbaeda13c | C++ | Dibbo-56/cpp-programming | /Teach_Yourself_C++/chapter 4/4.4_2.cpp | UTF-8 | 411 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
class info{
char name[20],tele[15];
public:
void set_nl(char nam[], char tel[]){
strcpy(name,nam);
strcpy(tele,tel);
}
void show(){
cout<< name << " " << tele << endl;
}
};
int main()
{
info *p;
p = new i... | true |
8fee36458a364745b4e9cccd7392542dcc1cd822 | C++ | hchencn/leetcode | /best_time_to_buy_and_sell_stock_3.cc | UTF-8 | 1,060 | 2.875 | 3 | [] | no_license | class Solution {
public:
int maxProfit(vector<int> &prices) {
int len = prices.size();
if(len <= 1)
return 0;
vector<int> maxl(len, 0);
vector<int> maxr(len, 0);
int min = INT_MAX, max = INT_MIN;
for(int i = 0; i < len; i++) {
if(min... | true |
01fd7484a1c48bbc1cabfa8806543657c1d6a005 | C++ | MohdImran001/dsa | /activity-selection.cpp | UTF-8 | 574 | 2.84375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
bool compare(pair<int, int> a, pair<int, int> b) {
return a.second < b.second;
}
int main() {
int t, n, s, e;
vector<pair<int, int>> arr;
cin >> t;
while(t--) {
cin >> n;
for(int i=0; i<n; ++i) {
cin >> s >> e;
arr.push_back(make_pair(s, e));
}
sort(... | true |
4c7d252b922a47b3b455aa203e03f270d09e0841 | C++ | GJ-Lin/SJTUOJ | /4219.cpp | UTF-8 | 942 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
using namespace std;
const int MAXNUM = 300005;
const int P = 1e9 + 7;
int T, n;
int arr[MAXNUM]{0};
void quicksort(int *arr, int low, int high)
{
if (low >= high) return;
int k = arr[low], tmp;
int lf = low, rh = high;
while (lf < rh)
{
while (arr[rh] <= k &... | true |
4a680a34564929313b9304aad55731fc7ad367bf | C++ | mihirbshah/algorithms | /src/diagonal_traverse_II.cpp | UTF-8 | 1,244 | 3.421875 | 3 | [] | no_license | // 1424. Diagonal Traverse II
#include <iostream>
#include <vector>
#include "util.h"
#include <algorithm>
using namespace std;
// Solution gets TLEed
// For O(m.n) solution, refer - https://leetcode.com/problems/diagonal-traverse-ii/discuss/597698/JavaC%2B%2B-HashMap-with-Picture-Clean-code-O(N)
class Solution
{
p... | true |
b347af58ddceefe61d4b7134357b62405a92ba53 | C++ | BioPP/bpp-phyl-example | /ExPhylo/ExPhylo.cpp | UTF-8 | 8,524 | 2.71875 | 3 | [] | no_license | /*
* File: ExPhylo.cpp
* Created by: Julien Dutheil
* Created on: Dec Wed 10 17:10 2008
* Last modified: Jan Wed 11 09:21 2012
*
* Introduction to the classes and tools for phylogenetics.
*
* HOW TO USE THAT FILE:
* - General comments are written using the * * syntax.
* - Code lines are switched off using '/... | true |
e63b2c29c521b9671a3e58b0aa7705ec0d5cf401 | C++ | quocnguyenx43/data-structure-algorithm | /data_structure_algorithms/graph/dfs_bfs/dfs.cpp | UTF-8 | 2,092 | 3.390625 | 3 | [] | no_license | #include "../_library_graph_.h"
// DFS
// Độ phức tạp:
// - Time: O(V * E) (Danh sách kề)
// - Time: O(V^2) (Ma trận trọng số)
void DFS_UseRecursion(Graph &g, Index vertex) {
// In ra đỉnh vertex và đánh dấu đã đi qua
g.vertices[vertex].visited = YES;
cout << g.vertices[vertex].lable << " ";
Index ne... | true |
daae1df6fbe986d784c6a0aeac55075a6de69052 | C++ | intoyuniot/RGBmatrixPanel | /examples/testcolors_16x32/testcolors_16x32.ino | UTF-8 | 1,116 | 2.578125 | 3 | [
"MIT"
] | permissive |
#include <RGBmatrixPanel.h>
#include <math.h>
#define CLK D6
#define OE D7
#define LAT A4
#define A A0
#define B A1
#define C A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);
void setup()
{
matrix.begin();
uint8_t r=0, g=0, b=0;
// 画上半部分
for (uint8_t x=0; x < 32; x++)
{
fo... | true |
e4097e25ed828d42fdc780229e88992d74590c93 | C++ | WolodjaZ/sdizo | /part_2/PriorityQueue.h | UTF-8 | 901 | 2.859375 | 3 | [] | no_license | //
// Created by vladimir on 11.04.19.
//
#ifndef PART_2_PRIORITYQUEUE_H
#define PART_2_PRIORITYQUEUE_H
#include "Edge.h"
#include <iostream>
// Działanie PriorityQueue opiera się na kopcu gdzie na szczczycie jest minimalna liczba
// kopiec działa na obiektach klasy Edge gdzie wartość bierze ze zmiennej weigth
clas... | true |
9b0f9dbba9dab541db8a37c7d32cd9ac7d554a5e | C++ | Manvikaul/coding-practice | /Palindrome number.cpp | UTF-8 | 314 | 2.796875 | 3 | [] | no_license | //leetcode
class Solution {
public:
bool isPalindrome(int x) {
string s=to_string(x);
for(int i=0;i<s.length()/2;i++)
{
if(s[i]!=s[s.length()-i-1])
{
return false;
}
}
return true;
}
};
| true |
eaf84a3d9232c6745e70fe7956fd72fc12c90e20 | C++ | machinamentum/htn | /src/Code_Structure.h | UTF-8 | 3,371 | 2.90625 | 3 | [] | no_license |
#ifndef CODE_STRUCTURE_H
#define CODE_STRUCTURE_H
#include <string>
#include <vector>
#include <cstdint>
struct Variable {
enum VType {
DQString,
VOID,
CHAR,
INT_8BIT,
INT_16BIT,
INT_32BIT,
INT_64BIT,
FLOAT_32BIT,
POINTER,
DEREFERENCED_POINTER,
UNK... | true |
e053243386e031b584c25286e535e256b4f1daf5 | C++ | cyberwizard1001/advanced_programming | /Cpp/cpp/30th August 2020/Q1.cpp | UTF-8 | 505 | 3.71875 | 4 | [] | no_license | #include<iostream>
using namespace std;
class volume{
int side;
int vol;
void calc_vol()
{
vol = side*side*side;
}
public:
volume()
{
side = 1;
vol = 1;
}
volume(int i)
{
side = i;
vol = 1;
}
int ret_vol()
{
calc_vol();
return vol;
}
};
int main() {
volume ... | true |
a89074a94d941974e28ce4a6854550d53c4e01c7 | C++ | ivanovdimitur00/programs | /Programs/zadachi praktikum 4/sum_proizvedenie_doNula.cpp | UTF-8 | 344 | 3.046875 | 3 | [] | no_license | #include <iostream>
int main()
{
int number;
int sum = 0;
int mult = 1;
do {
std::cin>>number;
if (number == 0) {
break;
}
sum += number;
mult *= number;
} while (number != 0);
std::cout<<"sum = "<<sum<<"\n";
std::cout<<"mult = "<<mult<<"\n";
system("p... | true |
e6e63fc101b2ee10e07fad548395629503d14dbf | C++ | wangdejun/C-introduction | /practice/2016-8-2(4)-files and structs.cpp | UTF-8 | 590 | 3.1875 | 3 | [] | no_license | struct statsT{
int low;
int high;
double average;
}
statsT CalculateStatistics(string filename){
statsT stats;
stats.low = 101;
stats.high = -1;
int total = 0;
int count = 0;
//open a file and makesure it worked
ifstream in;
in.open(filename.c_str());
if(in.fail())
Error("Could not read"+filename);
w... | true |
f5eb576160fa023d8f1e351e687d441db4afdc3f | C++ | WhiZTiM/coliru | /Archive2/97/0416bf9b5df1ec/main.cpp | UTF-8 | 542 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <boost/random.hpp>
int main()
{
boost::mt19937 e2;
boost::normal_distribution<> dist(70, 10);
std::map<int, int> hist;
for (int n = 0; n < 100000; ++n) {
++hist[round(dist(e2))];
}
for ( std::map<int, in... | true |
7d3a36440e62946aba66fbcf2c4cefa27799db6c | C++ | lyb1234567/C-plus-plus- | /C++ primer plus/第九章/9.4/9.4/ns_f.cpp | UTF-8 | 1,435 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include"ns.h"
namespace SALES
{
void setsales(Sales& s, const double ar[], int n = QUARTERS)
{
double sum = 0;
s.max = -99999999;
s.min = 99999999;
for (int i = 0; i < n + 1; ++i)
{
s.sales[i] = ar[i];
sum += s.sales[i];
... | true |
f90bbb6714e9bc9221861ccbc9d24e943b7acf19 | C++ | kulakowskin/SHUNT | /Sqrt.cpp | UTF-8 | 1,187 | 2.9375 | 3 | [] | no_license | #include <cstring>
#include <string>
#include <cmath>
#include <sstream>
#include <stdlib.h>
#include "Sqrt.h"
Sqrt::Sqrt(){
this->in = 0;
}
Sqrt::Sqrt(string expression){
this->expression = strstr((char*)expression.c_str(),expression.c_str());
parseNumbers();
}
float Sqrt::getIn(){
return this->in;
}
string Sqrt:... | true |
933241d58935aa381c893d696affe57cafe8f531 | C++ | CiQiong/PAT | /平衡二叉树AVL.cpp | GB18030 | 2,741 | 3.9375 | 4 | [] | no_license | #include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
//ƽ
struct node{
int v,height;//vΪȨֵheightΪǰ߶
node *lchild,*rchild;//Һӽڵַ
};
//һ½㣬vΪȨֵ
node* newNode(int v){
node* Node=new node;//һnodeͱĵַռ
Node->v=v;
Node->height=1;
Node->lchild=Node->rchild=NULL;
return Node;
}
//ȡrootΪĵǰheight
... | true |
8f0d362b711d1d278a49b945a26788e865ef2a2d | C++ | Vdupendant/incendie | /outils.cpp | UTF-8 | 2,009 | 2.96875 | 3 | [] | no_license | #include "outils.h"
using namespace outils;
// On initialise la taille du terrain
int C=0;
int L=0;
// On créer ensuite deux plans en miroir
int**PLAN;
int**MIROIR;
const int MAXI = 1000;
const float SEUIL = 0.6*MAXI;
// Les différentes valeurs possibles
enum Types { ARBRE, TERRE, EAU, FEU, CENDRE,... | true |
4552e210b85309bedcb5d3692ad5a79b127b2314 | C++ | arsh317/Data-stuctures-and-Algo | /Graphs/Shortest Distance in a Maze.cpp | UTF-8 | 2,960 | 3.4375 | 3 | [] | no_license | /*
Shortest Distance in a Maze
Given a matrix of integers A of size N x M describing a maze. The maze consists of empty locations and walls. 1 represents a wall in a matrix and 0 represents an empty location in a wall. There is a ball trapped in a maze. The ball can go through empty spaces by rolling up, down, left o... | true |
526b670545cbc5a109d7759bee2b8cb26fe7961a | C++ | inhyeokk/Algorithm | /src/programmers/PRO_L3_입국심사.cpp | UTF-8 | 1,254 | 3.625 | 4 | [] | no_license | /* 입국심사
* 이분탐색
* 2020.01.12
*/
#include <algorithm>
#include <vector>
using namespace std;
long long grantedPeople(vector<int> times, long long time) {
long long people = 0L;
for (auto t: times) {
people += time / t;
}
return people;
}
long long solution(int n, vector<int> times) {
s... | true |
db086d3171d6f6da7e06c2e4064c638235372ae6 | C++ | Nnmjywg/isPrime | /src/main.cpp | UTF-8 | 1,712 | 3.453125 | 3 | [] | no_license | //
// main.cpp
// isPrime
//
// Copyright © 2018 nnmjywg. All rights reserved.
//
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include "number.h"
int main(int argc, char * argv[]) {
char arg = '\0';
int workingNumber;
if(argc <= 1)
{
std::cout << ">>>>> Please provide a num... | true |
eb1b7c5c1a2836509d042a9fda2f3d386ff7ccd4 | C++ | irajankumar/ProjectEuler | /projecteuler3/main.cpp | UTF-8 | 591 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include<vector>
//This program finds out the largest prime factor of given input
using namespace std;
int main()
{
long int n,big;
cin>>n;
vector<long int>primes;
for(long int l=2; l<n; l++)
{ int ct=0;
for(int m=2;m<l;m++)
{
if(l%m==0)
... | true |
4899c3a1edc31ca2e7b22a3a1f2c9c0687b9a0eb | C++ | Beta-Alf/glexamples | /source/animationexample/RiggedDrawable.h | UTF-8 | 1,059 | 2.53125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vector>
#include <map>
#include <glm/glm.hpp>
#include <globjects/base/ref_ptr.h>
#include <gloperate/primitives/PolygonalDrawable.h>
namespace globjects
{
class Buffer;
}
class RiggedDrawable : public gloperate::PolygonalDrawable
{
public:
/**
* @brief
* Constructor
... | true |
10928812bcb2a50b7b416f319f795158a5919d15 | C++ | wshwbluebird/LC16 | /leet21-40/28.ImplementstrStr().cpp | UTF-8 | 952 | 2.953125 | 3 | [] | no_license | ////
//// Created by wshwbluebird on 16/8/9.
////
//#include <iostream>
//#include <vector>
//
//
//using namespace std;
//
//
//class Solution {
//public:
// int strStr(string haystack, string needle) {
//
// if(needle.size()==0) return 0;
// if(needle.length()>haystack.length()) return -1;
// ... | true |
4a580ba78d4a68f5336b26ca83caefb7f9a35279 | C++ | pvCuongvjppro/Demo1 | /HIT_B4.cpp | UTF-8 | 1,663 | 3.203125 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
void NhapChuoi(char s[]){
cout <<"Nhap Chuoi ";
gets(s);
cout <<" Da Nhap Vao: "<< s<<endl;
}
//void ChuanHoa( char s[]){
//Chuan hoa toan bo
// while (a[0]==' ') strcpy(&a[0], &a[1]);
// while(a[strlen(a)-1]==' '){
//
// a[strlen(a)-1] = '\0';
// }
// fo... | true |