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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fbd8c5b350f9003e0cdf365d7af31cc0b974a85f | C++ | 648664838/simpleproject | /mysqldbserver/mysqldbserver/clog.h | UTF-8 | 850 | 2.53125 | 3 | [] | no_license | #pragma once
#include<stdarg.h>
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#include <cstring>
using namespace std;
#define MAX_LOG_BUFF_LENGTH 86400
namespace af
{
void InitLogCategory();
void ShutDownCategory();
void LogInfo(const char* vLogName, const char* vFmt, ...);
void LogError(const char* vLo... | true |
4bdd8986944d758b70412581ae1ee46b088ea5bc | C++ | AJIOB/GraphProcessing | /Holt Model/Graph.h | UTF-8 | 2,753 | 3.328125 | 3 | [] | no_license | #pragma once
#include <map>
#include <set>
#include "Namespace.h"
#include "Node.h"
NAMESPACE_BEGIN
template <typename T>
class Graph
{
std::set<Node<T>*> nodes;
Node<T>* findOrCreateNode(const T& nodeID);
public:
/**
* Build the non-oriented graph with edges.
* Key in multimap - starting node.
* Value... | true |
94f5874108beba09aa4ec6a338d291bbae2a14a5 | C++ | bg1bgst333/Sample | /com/OleInitialize/OleInitialize/src/OleInitialize/OleInitialize/OleInitialize.cpp | SHIFT_JIS | 1,358 | 2.921875 | 3 | [
"MIT"
] | permissive | // wb_t@C̃CN[h
#include <windows.h> // WWindowsAPI
#include <tchar.h> // TCHAR^
// _tWinMain̒`
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd){
// ϐ̐錾
HRESULT hr; // COM̏̌ʂi[hr.
TCHAR tszText[256] = {0}; // \eLXgtszText(256){0}ŏ.
// OLȄ
hr = OleInitialize(NU... | true |
52d4156be7cae4564b22e415353ac621db0ab13c | C++ | msamual/CPP_Piscine | /module00/ex01/includes/Contact.hpp | UTF-8 | 1,357 | 2.953125 | 3 | [] | no_license |
#ifndef CONTACT_H
# define CONTACT_H
# include <iostream>
# include <string.h>
# include <iomanip>
class Contact
{
public:
Contact();
~Contact();
std::string getFirstName();
std::string getLastName();
std::string getNickName();
std::string getLogin();
... | true |
e13ef07a6bf874c71a7f0313b7b69678d47fd8f3 | C++ | AliOsm/CompetitiveProgramming | /CodeForces/961D. Pair Of Lines.cpp | UTF-8 | 1,240 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 1;
int n, a[N], b[N];
bool vis[N];
bool solve(int i1, int i2) {
memset(vis, false, sizeof vis);
long long s1, s2;
int v1 = -1, v2 = -1;
s1 = b[i2] - b[i1];
s2 = a[i2] - a[i1];
vis[i1] = vis[i2] = true;
int cnt = 2;
for(int i = 0; i < ... | true |
8001fe384ceaba69dab9a1be549ea6b3ddd691c4 | C++ | Girl-Code-It/Beginner-CPP-Submissions | /Megha/Milestone-19(sorting)/insertion sort/Insertion sort.cp | UTF-8 | 505 | 3.53125 | 4 | [] | no_license | //insertion sort
#include <iostream>
using namespace std;
void insertionSort(int arr[],int n){
for(int i=1;i<n;i++){
int value=arr[i];
int hole = i;
while(hole>0 && arr[hole-1]>value){
arr[hole]=arr[hole-1];
hole=hole-1;
}
arr[hole]=value;
}
}
int main(... | true |
b3712b26b3699d57e2ba4cc3d1e6d2cccfd7a704 | C++ | shvedovskiy/huffman | /main.cpp | UTF-8 | 3,494 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <map>
class Node {
public:
int _number;
char _symbol;
Node *_left, *_right;
Node() { }
Node(Node* l, Node* r) : _left(l), _right(r) { // from sons
_number = l->_number + r->_number;
... | true |
9034c35108c466062b92cf895f1864df6e3775a8 | C++ | adrianrodriguesm/Ray-Tracer | /src/Math/BoundingBox.cpp | UTF-8 | 3,674 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | #include "pch.h"
#include "BoundingBox.h"
#include "Core/Constant.h"
namespace rayTracer
{
//-------------------------------------------------------------------- - default constructor
AABB::AABB()
{
Min = Vec3(-1.0f, -1.0f, -1.0f);
Max = Vec3(1.0f, 1.0f, 1.0f);
}
// ------------------------------------------... | true |
dacc39c0fdc8428a0e932ae117a296d2c899811c | C++ | Mishiev711/Code-Samples | /Collision/CollisionLibrary/CollisionLib.cpp | UTF-8 | 29,590 | 2.921875 | 3 | [] | no_license | #include "../../PreCompiled.h"
#include "CollisionLib.h"
#include <math.h>
/************************************************
* Filename: CollisionLib.cpp
* Date: 06/08/2015
* Mod. Date: 07/10/2015
* Mod. Initials: MM
* Author: Mitchel Mishiev
* Purpose: To hold all collisions functions
*... | true |
6650c67c8bb91b534e67900704cbc63587674d33 | C++ | wsavoie/SmarticleSim | /matlabScripts/newSimScripts/codegen/lib/generatePackingFromSimDatPLANE/projPointOnPlane.cpp | UTF-8 | 6,171 | 2.53125 | 3 | [] | no_license | //
// Academic License - for use in teaching, academic research, and meeting
// course requirements at degree granting institutions only. Not for
// government, commercial, or other organizational use.
// File: projPointOnPlane.cpp
//
// MATLAB Coder version : 4.0
// C/C++ source code generated on : 20-Dec... | true |
b001be4158095780186cdb37c5ef69a6a2a4fe90 | C++ | senseiakhanye/cppmyunisa | /activity11/activity11a.cpp | UTF-8 | 288 | 3.375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int num;
cout << "Enter a number between 10 and 20 : ";
cin >> num;
while (num < 10 || num > 20)
{
cout << "Enter a number between 10 and 20 : ";
cin >> num;
}
return 0;
} | true |
3174fbc770a471be6f874ca5f5602d34748245ca | C++ | olihewi/ASGEground | /src/game/GameObjects/Core/TextObject.cpp | UTF-8 | 1,139 | 2.984375 | 3 | [] | no_license | //
// Created by hewis on 19/03/2021.
//
#include "TextObject.h"
TextObject::TextObject(
ASGE::Renderer* renderer, std::string contents, ASGE::Point2D position,
int font_index, ASGE::Colour colour, float scale, short z_order)
{
text.setString(contents);
text.setFont(renderer->getFont(font_index));
text.setPo... | true |
eda23241ff4de14fecf137659de6723d0274cb1e | C++ | wangsiping97/My-LeetCode-Solutions | /78.cpp | UTF-8 | 701 | 3.109375 | 3 | [] | no_license | // Given a set of distinct integers, nums, return all possible subsets (the power set).
// Note: The solution set must not contain duplicate subsets.
#include <vector>
using namespace std;
class Solution {
public:
vector< vector<int> > ans;
vector<int> tempans;
void dfs(int index, vector<int>& nums) {
... | true |
84fc55aff6555db6456663e28ccc3a31ceccaee3 | C++ | Ansou1/CPP | /Pisicne/Day_10/ex02/AssaultTerminator.cpp | UTF-8 | 1,030 | 2.609375 | 3 | [] | no_license | //
// AssaultTerminator.cpp for assault terminator in /home/daguen_s/rendu/piscine_cpp_d10/ex02
//
// Made by daguen_s
// Login <daguen_s@epitech.net>
//
// Started on Fri Jan 17 12:03:59 2014 daguen_s
// Last update Fri Jan 17 16:09:16 2014 daguen_s
//
#include "AssaultTerminator.hh"
AssaultTerminator::AssaultTer... | true |
b14613dd92578aadece7bba7bc583093156e5b7d | C++ | H-Shen/Collection_of_my_coding_practice | /Kattis/raggedright.cpp | UTF-8 | 586 | 2.890625 | 3 | [] | no_license | // https://open.kattis.com/problems/raggedright
//
#include <bits/extc++.h>
using namespace std;
int main() {
vector<string> A;
string s;
int maxLength = -1;
while (getline(cin, s)) {
A.emplace_back(s);
maxLength = max(maxLength, static_cast<int>(s.size()));
}
int raggedness =... | true |
63f70eaec88b3a65a1351051361c64e64ddfa4f6 | C++ | JIANSHULI/HERA_MapMaking_VisibilitySimulation | /src/_Bulm/include/wignerSymbols/wignerSymbols-fortran.h | UTF-8 | 2,437 | 2.6875 | 3 | [] | no_license | /*******************************************************-/
* This source code is subject to the terms of the GNU -/
* Lesser Public License. If a copy of the LGPL was not -/
* distributed with this file, you can obtain one at -/
* https://www.gnu.org/licenses/lgpl.html. -/
************************... | true |
0e8267a6506c222797edc33aac6ce4e7a0eaca34 | C++ | khayamgondal/827 | /patterns/singleton/gof/symbolTable.cpp | UTF-8 | 353 | 2.75 | 3 | [] | no_license | #include "symbolTable.h"
SymbolTable* SymbolTable::getInstance() {
if ( !instance ) instance = new SymbolTable;
return instance;
}
int SymbolTable::getValue(const std::string& name) const {
std::map<std::string, int>::const_iterator it = table.find(name);
if ( it == table.end() ) throw name+std::string(" not ... | true |
8d4fd3f3b22b09dd0773c9c170cced4d12f041f9 | C++ | alexcam96/progetto_Oggetti | /CuboRubik/CuboRubik/opengl-rubix-cube/src/game/MeshEntity.h | UTF-8 | 985 | 2.6875 | 3 | [] | no_license | #ifndef MESHENTITY_H_
#define MESHENTITY_H_
#include "Entity.h"
namespace game {
class MeshEntity : public Entity {
Mesh *mesh_;
Material *mtl_;
public:
MeshEntity(Mesh *m = NULL) : Entity() { mesh_ = m, mtl_ = NULL; };
~MeshEntity() {};
Mesh* mesh() { return mesh_; }
void set_mesh(Mesh *m) ... | true |
bcf354917a67466b717282fa70977e415ca1eeab | C++ | anujpathania/HotSniper | /common/misc/stable_iterator.h | UTF-8 | 683 | 3.1875 | 3 | [
"MIT"
] | permissive | #ifndef STABLE_ITERATOR_H
#define STABLE_ITERATOR_H
#include <vector>
template
<class T> class StableIterator
{
public:
StableIterator(const StableIterator<T> &s)
: _vec(s._vec), _offset(s._offset) {}
StableIterator(std::vector<T> &vec, unsigned int offset)
: _vec(vec), _offset... | true |
55ac83f5b5ba9c937b775340c8760288113bfca4 | C++ | CyanoFresh/KPI-Labs | /OOP/s3/5_1/main.cpp | UTF-8 | 532 | 2.875 | 3 | [] | no_license | #include "Adam.h"
#include "Eva.h"
#include "Array.h"
using namespace std;
int main() {
Adam adam(180, "light", 7);
Rib specialRib = adam[2];
Eva eva(160, "dark", specialRib);
Eva eva2(150, "light", Rib(23));
// adam.show();
// eva.show();
Array arr(specialRib);
arr.add(eva);
ar... | true |
067f397087e2dfbb7f5b668abf91066765a6db20 | C++ | cracer/offer | /牛客网刷题/翻转单词顺序列.cpp | UTF-8 | 383 | 3.0625 | 3 | [] | no_license | #include <string>
using namespace std;
class Solution
{
public:
string ReverseSentence(string str)
{
int len = str.size();
if (len < 2) return str;
string res = "", tmp = "";
for(int i=0;i<len;i++)
{
if (str[i] == ' ')
{
res = " " + tmp + res;
tmp = "";
}
else
{
tmp += str[i];
... | true |
4b89be45ea9adacb1cc32935ae80c9b106f21896 | C++ | kohyatoh/contests | /pku/3193/3193.cpp | UTF-8 | 941 | 2.765625 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
#define rep(i, n) for(int i=0; i<(int)(n); i++)
struct node {
char ch;
std::vector<node*> v;
node(char ch) : ch(ch) {}
~node() { rep(i, v.size()) delete v[i]; }
node *get(char ch) {
rep(i, v.size()) if(v[i]->ch==ch) return v[i];
return (node*)0;
... | true |
6e3422289481b0d82d00fd7316da93fd696d48f2 | C++ | yangyueren/CppConcurrencyInAction | /quicksort_using_chunk.h | UTF-8 | 3,422 | 3.109375 | 3 | [
"MIT"
] | permissive | //
// Created by yryang on 2021/10/21.
//
#ifndef CPPTEST_QUICKSORT_USING_CHUNK_H
#define CPPTEST_QUICKSORT_USING_CHUNK_H
#include <algorithm>
#include <atomic>
#include <future>
#include <iostream>
#include <list>
#include <thread>
#include <vector>
#include <string>
#include "threadsafe_stack.h"
#include "thread... | true |
53c436d9931d26625f606a367e49d22f62bed7f8 | C++ | LuciusKyle/LeetCode | /0228_Summary_Ranges/0228.cc | UTF-8 | 1,191 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive |
#include <limits.h>
#include <string>
#include <vector>
using std::string;
using std::vector;
class Solution {
public:
vector<string> summaryRanges(const vector<int>& nums) {
vector<string> rtn;
if (nums.empty()) return rtn;
rtn.push_back(std::to_string(nums.front()));
int64_t pre_num = nums.front... | true |
500bc8da9c6e74614cbfa90dd831f49d68989685 | C++ | zhan92/osal_stm_w | /McuMonitor/comm/commtxthread.cpp | UTF-8 | 712 | 2.546875 | 3 | [] | no_license | #include "commtxthread.h"
#include "bdcomm.h"
CommTxThread::CommTxThread()
{
m_bThreadRun = FALSE;
}
CommTxThread::~CommTxThread()
{
stop();
terminate();
wait();
}
void CommTxThread::setThreadRunFlag(void)
{
m_bThreadRun = TRUE;
}
BOOL CommTxThread::getIsThreadRun(void)
{
return m_bThreadRu... | true |
4020f9766643b7ad548fe49a42ec8e148bdd2dcc | C++ | adrs0049/FastVector | /linearAlgebra/VectorReduction.h | UTF-8 | 9,477 | 3.203125 | 3 | [
"MIT"
] | permissive | ////////////////////////////////////////////////////////////////////////////////
// //
// File Name: CSVector.h //
// ... | true |
4d82b4c5a104512f74722be83df288b7c7ec4b0d | C++ | DemonQAQ/C_Study | /文件操作.cpp | GB18030 | 981 | 3.1875 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<fcntl.h>//ļͷļ
int main()
{
char str[128] = {0};
int i = 0;
for (i = 0; str[i] != '!'; i++)//ַ!(Ӣ)
{
str[i] = getchar();
if (str[i] == '!')
break;
}
str[i] = getchar();//뻻зˢ!
i = 0;//iֵ
while (str[i]!='\0')//תСд
{
if (str[i] >= 'a' && str[i] <= 'z')
{
... | true |
218fc51e1f1949ddda7a88f0d2a08f84a71c2998 | C++ | Jballard419/lab11 | /main.cpp | UTF-8 | 698 | 2.90625 | 3 | [] | no_license | #include "Kruskal.cpp"
#include <fstream>
int main(int argc, char const *argv[]) {
/* code */
if (argc != 2)
{
std::cout << "file didn't load use like this " << '\n';
std::cout << "./Skew_Heap data.txt" << '\n';
}
std::ifstream in(argv[1]);
int value;
in>>value; // cause I don't need the first va... | true |
088d895df8c7cc02526411acdce04758dc948892 | C++ | ZhuBicen/ling-repeater | /UnitTest/PlayerStub.cpp | UTF-8 | 1,639 | 2.6875 | 3 | [] | no_license | #include <cassert>
#include <iostream>
#include "Player_impl.h"
Player_impl::Player_impl()
{
}
Player_impl::~Player_impl()
{
}
void Player_impl::Init(HWND hwnd, HINSTANCE hInst)
{
}
bool Player_impl::OpenFile(const std::wstring& file_name)
{
return true;
}
bool Player_impl::CloseFile()
{
... | true |
0bb48d37b6cb9eb25038cc56a6fbf58ccb182f32 | C++ | ViMaSter/arduinowrapper | /ArduinoMock.h | UTF-8 | 1,287 | 3.0625 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
#include <chrono>
class _Serial
{
public:
// ready check for the serial port
operator bool() const
{
return true; // always ready when mocking
};
void begin(int port)
{
return; // intentionally void
}
void println(std... | true |
a462615b5da086473580f3ffa3c5df9ab397b5e6 | C++ | ClementPhan/ENPCInfo | /Info/TP8/utils.h | UTF-8 | 989 | 2.859375 | 3 | [] | no_license | #ifndef UTILS_H
#define UTILS_H
#include <Imagine/Graphics.h>
using namespace Imagine;
//======================================
// Structure point
struct point
{
int x;
int y;
point operator+(const point &p) const{
point q;
q.x=x+p.x;
q.y=y+p.y;
return q;
}... | true |
fc2cfabe3b93efc8d9f1374daed7532bd9457517 | C++ | emmacneil/checkers | /include/board_scene.hpp | UTF-8 | 503 | 2.78125 | 3 | [] | no_license | /* board_scene.hpp
*
* This scene carries an instance of the game state, and is in charge of rendering the game state,
* getting user input, and updating the game state based on that input.
*/
#ifndef BOARD_SCENE_HPP
#define BOARD_SCENE_HPP
#include "scene.hpp"
#include "board_state.hpp"
class board_scene : publ... | true |
8ac8e3079efa9e35bb49d5a5a7668b1624c97407 | C++ | vikrantgupta95/Alcohol-Detector- | /alcohol.ino | UTF-8 | 1,177 | 2.625 | 3 | [] | no_license | // include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("No drunk drive");... | true |
4f4f8d02916a93587bf0c2568f713e5626dc7e3a | C++ | YuukiReiya/My-DirectX-Template | /Direct3D11/Direct3D11/Source/Mesh/Mesh.cpp | SHIFT_JIS | 2,853 | 2.609375 | 3 | [] | no_license | #include "Mesh.h"
#include "../Direct3D11/Direct3D11.h"
#include "../Camera/Camera.h"
#include "../MyGame.h"
#include "../MemoryLeaks.h"
Mesh::Mesh()
{
m_szShaderDataUsage = ShaderManager::c_MeshDefault;
}
Mesh::~Mesh()
{
}
HRESULT Mesh::Initialize()
{
return E_NOTIMPL;
}
HRESULT Mesh::Render()
{
HRESULT hr;
... | true |
cff44effec27a631b693a78e1c81fe4c3ec4d007 | C++ | seannash/logprocessor | /src/monitor_stringlogger.h | UTF-8 | 422 | 2.515625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <mutex>
#include <sstream>
#include <string_view>
#include <monitor_logger.h>
namespace monitor {
// Logs the records to a string. Useful for testing.
class StringLogger: public Logger {
public:
StringLogger();
void log(unsigned long tp, std::string_view msg) override;
std::string... | true |
060c8cad6acc3c9b4542275482a862af3c56b4a6 | C++ | nokia/CPU-Pooler | /test/thread_busyloop.cpp | UTF-8 | 3,687 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | #include <unistd.h>
#include <thread>
#include <string.h>
#include <iostream>
#include <vector>
#include <sstream>
std::string process_name;
void printAffinity()
{
cpu_set_t mask;
CPU_ZERO(&mask);
int ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &mask);
if (ret != 0) {
... | true |
f6c83f30e4f85d79965af53b1ce25029e200a292 | C++ | nihalchari/cpp-quickies | /src/threads/pthreads.cpp | UTF-8 | 1,013 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <pthread.h>
#include <sys/types.h>
#include <unistd.h>
using namespace std;
void* threadProc(void* param)
{
for (int count = 0; count < 1000; ++count)
{
// These are thread IDs assigned by pthread library
// This will be different compared to OS thread ID
/... | true |
723fe5e5ec6cd0f12fd085ff90a909f944e59569 | C++ | hchs910739/zerojudge_c | /d057.cpp | UTF-8 | 478 | 3.078125 | 3 | [] | no_license | #include<iostream>
using namespace std;
main(){
int x,y,z;
while(cin>>x>>y>>z)
{
if((x*x+y*y==z*z)||(x*x+z*z==y*y)||(y*y+z*z==x*x))
{
cout<<"right triangle"<<endl;
}
else if((x*x+y*y>z*z)||(x*x+z*z>y*y)||(y*y+z*z>x*x)||(y*y+x*x>z*z)||(z*z+x*x>y*y)||(z*z+y*y>x*x))
... | true |
041ab8e7cb4f82c6d198de2be3496fd1d0942969 | C++ | lehuubao1810/fstream2 | /bai1.cpp | UTF-8 | 7,856 | 3.484375 | 3 | [] | no_license | #include <iostream>
using namespace std;
// CÂY AVL
struct Node{
int key;
int bal; // 0: can bang // -1: lech trai // 1:lech phai
Node *left;
Node *right;
Node *parent;
};
struct Tree{
Node *root;
int NumberNode;
int NumeberLeaf;
int Hight;
};
Node* createNode(int k);
void InitTree(Tree ... | true |
14be39631a0271626d4a392f9e322daf1064eec6 | C++ | vsamy/labyfou | /include/State.h | UTF-8 | 1,858 | 3 | 3 | [
"CC0-1.0"
] | permissive | #pragma once
#include <memory>
#include <map>
#include <vector>
#include <functional>
#include "SFML/System/NonCopyable.hpp"
#include "SFML/Window/Event.hpp"
#include "utils.h"
#include "Player.h"
class StateStack;
class State
{
public:
typedef std::unique_ptr<State> uPtr;
struct Context
{
... | true |
21d30952c88867d959727aa4b4bb17a96032b9b9 | C++ | Moreno-Yassine/Analyseur-LTN | /LTN/src/symboles/Programme.cpp | UTF-8 | 1,006 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #include "../../include/symboles/Programme.h"
Programme::Programme() : Symbole(I_P, "I_P")
{
}
Programme::~Programme()
{
}
bool Programme::setParam(Symbole* symbole, int placeSymbole)
{
if(placeSymbole==1)
ptLd = (Ld*)symbole;
else if(placeSymbole==2)
ptLi = (Li*)symbole;
else
return false;
return true;
... | true |
f046ebb5cd748c309bdc20f4fef9907a12bf82dd | C++ | aryan09/DSA | /Strings/strngPalindrome.cpp | UTF-8 | 605 | 2.84375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
char ch[100],flag;
int strt=0,end=0,size,i;
flag=cin.get();
for(i=0;flag!='\n';i++)
{
ch[i]=flag;
flag=cin.get();
}
i=0;
end=size-1;
while(i<=size)
{
if(ch[strt]==ch[end])
... | true |
65203a1ecbc16df022cef0d3df87abece32e9377 | C++ | hobby16/code | /ThermK à supprimer/ThermK.ino | UTF-8 | 6,438 | 2.796875 | 3 | [] | no_license | /*
HMC : routines pour Thermocouple K, testé et validées
Mesure avec compensation soudure froide:
1) mesurer R ctn (cold junction)
2) R ctn -> Température, routine R2DegC()
3) T ctn -> mV coldjunction =V0, routine DegC2mV_PQ
4) mesurer mV thermocouple = V1
5) mV compensé V = V0+V1
6 V -> température pour thermocoupl... | true |
65c54fbc27383a6f738020ad664a709a9b3d3c92 | C++ | hayate242/lecture2019_applied_system_analysis | /kadaiB/systemA/MM3.cpp | UTF-8 | 4,579 | 2.796875 | 3 | [] | no_license | #include "MM3.hpp"
#include <algorithm>
#include <random>
#define SERVICE_NUM 3
std::tuple<double, double> MM3::simulation(double lambda, double mu, double startTime, double endTime)
{
// 初期化
vector<double> service; // 窓口
queue<double> systems[SERVICE_NUM]; //待ち行列
Random random; // ランダムク... | true |
173acefc633845618520aa6f596a6f63a159f798 | C++ | iguessthislldo/georgios_computer | /vm/src/main.cpp | UTF-8 | 950 | 2.921875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string>
#include "System.hpp"
void print_help() {
fprintf(stderr, "usage: georgios [-v|-h] FILEPATH MEMORY_SIZE\n");
}
int main(int argc, char * argv[]) {
if (argc == 1 || argc >= 5) {
print_help();
return 100;
}
bool verbose = false;... | true |
2a1471535afce42115c092e23c4dc5d87c8e3053 | C++ | stanleeyY/CS3391-Assignments | /192.cpp | UTF-8 | 577 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int check();
int main()
{
int T;
cin >> T;
int ctr = 0;
while (ctr<T)
{
if (check() == 0)
cout << "NO" << endl;
else
cout << "YES" << endl;
if (ctr != T - 1)
cout << endl;
ctr++;
}
return 0;
}
int check()
{... | true |
d95489a44e30e724d57148f5b8d9903aa6ce034b | C++ | wraithtc/timertask | /helloworld.cpp | UTF-8 | 684 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include "timertask.h"
using namespace std;
map<int, string> g_testMap;
void wifi_handler(int isIn)
{
if (isIn)
cout << "wifi down" << endl;
else
{
cout << "wifi up" << endl;
}
}
int main()
{
timertask t;
TASK_DURATION_INFO di = {TASK_D... | true |
5e3691fcbf16cbb76cee4ddb974bb0fee67afce9 | C++ | 19127618student/oop | /w5/19127618_NguyenThanhTung/Project4/Header.h | UTF-8 | 3,525 | 2.6875 | 3 | [] | no_license | #ifndef _HEADER_H_
#define _HEADER_H_
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class interface
{
public:
virtual void getName() {};
virtual double getSize() = 0 {};
virtual int SoLuong() = 0 {};
};
class TapTin :
public interface
{
protected:
string Ten;
double KichThuoc;
pub... | true |
56f5d8fbb78bbd59c0675fc174ae521909e8b043 | C++ | arnaudgelas/Examples | /c++/Broken/Iterator/Iterators.cpp | UTF-8 | 1,100 | 3.328125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
void Input();
void Output();
void AllMapElements();
int main(int argc, char *argv[])
{
//Input();
//Output();
AllMapElements();
return 0;
}
void Input()
{
std::vector<double> a;
a.push_back(1.2);
a.push_back(1.3);
a.push_back(1.4);
a.push_back(... | true |
62e628fbe26aa1368733c39426cbd2c43b9a4dc8 | C++ | Noor1504/Stack-Application | /stackXML.cpp | UTF-8 | 14,059 | 3.25 | 3 | [] | no_license | #include "stackXML.h"
tT Node<T>::Node() {}
tT Node<T>::Node(const T val)
{
this->data=val;
}
tT Stack<T>::Stack()
{
top=nullptr;
}
tT bool Stack<T>::IsEmpty()
{
if(!top)
return true;
return false;
}
tT bool Stack<T>::pop(T &val)
{
if(!IsEmpty())
{
val=top->data;
No... | true |
60c97ae2c7b44124c5465576fcd1e32db44ddf95 | C++ | YujinHa/Baekjoon | /5032.cpp | UTF-8 | 265 | 3.015625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int e, f, c, bottle, result = 0;
cin >> e >> f >> c;
bottle = e + f;
while ((bottle / c) != 0)
{
result += bottle / c;
bottle = (bottle / c) + (bottle % c);
}
cout << result << endl;
return 0;
}
| true |
d847c67196c81a2b78a7cadf44f722148994b194 | C++ | meihao1203/learning | /03202018/priority_queue.cpp | UTF-8 | 566 | 3.3125 | 3 | [] | no_license | ///
/// @file priority_queue.cpp
/// @author meihao1203(meihao19931203@outlook.com)
/// @date 2018-03-20 15:06:09
///
#include<iostream>
#include<queue>
using namespace std;
int main()
{
int arr[] = {0, 1, 3, 2, 5, 6, 9, 8, 7, 4};
priority_queue<int> ob1; // 优先队列,默认从大到小
for(int i=0;i!=sizeof(arr)/size... | true |
6b8c392f51baa199c1f72c575deac3d3a9ae163e | C++ | QuantumBird/ACM_Team | /gjz/Codeforces/Problem/1204A.cpp | UTF-8 | 291 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main(){
string s;
cin>>s;
int cnt = 0;
for(int i = 0; i < s.length(); i ++)
if(s[i] == '1')
cnt ++;
int ans = (s.length() - 1) / 2 + (cnt > 1? 1: 0);
cout<<ans<<endl;
return 0;
}
| true |
b9e2039ffc0eba0a95252483486175ff9611da3d | C++ | Alex-Sol/LeetCode-Notes | /Ceetcode/二叉树/MirrorBTree.cpp | UTF-8 | 949 | 3.84375 | 4 | [] | no_license |
/* 使用栈完成中序遍历 */
void MirroInBFS(TreeNode* root)
{
if(root==nullptr)
return;
stack<TreeNode *> nstack;
TreeNode *node = root;
while(node!=nullptr ||!nstack.empty())
{
while(node!=nullptr)
{
nstack.push(node);
node=node->left;
}
if(!nstack.empty())
{
node = nstack.top();
if(node->left!=... | true |
ff09e41b258d114b0678033638586b7c1d968a8a | C++ | uthnp/HW04_uthnp | /include/uthnpStarbucks.h | UTF-8 | 1,592 | 3.265625 | 3 | [] | no_license | /*
* @Author Nicholas Uth
* October 29, 2012 -- CSE 274
*
* @Sources: Child class to Starbucks class by Bo Brinkman.
*
* Class is intended to work as a KD tree. It handles the coordinates and description of a starbucks and the paths to it's subtrees.
*
*/
#pragma once
#include <string>
#include "Starbucks.h"
usin... | true |
0074d7f12c459fa704d893a307e935a8d6a9f2d7 | C++ | shenzhu/Quokka | /util/StringView.cc | UTF-8 | 2,149 | 3.265625 | 3 | [] | no_license | #include <algorithm>
#include <cassert>
#include <cstring>
#include "StringView.h"
namespace Quokka {
StringView::StringView() :
data_(nullptr),
len_(0) {
}
StringView::StringView(const char* p) :
data_(p),
len_(strlen(p)) {
}
StringView::StringView(const std::string& str) :
data_(str.data()),
len_(str.size(... | true |
fbdcab9f37f9ed8748fb32a7db3486e03c6fce88 | C++ | wbach/GameEngine | /Resources/Models/Mesh.cpp | UTF-8 | 5,558 | 2.625 | 3 | [] | no_license | #include "Mesh.h"
#include "../../Utils/GLM/GLMUtils.h"
#include "../../Utils/OpenGL/OpenGLUtils.h"
CMesh::CMesh()
{
}
CMesh::CMesh(
std::vector<float>& positions,
std::vector<float>& text_coords,
std::vector<float>& normals,
std::vector<float>& tangents,
std::vector<unsigned short>& indices,
SMaterial & mater... | true |
4b6c87534cd4ae20534ccc0f6968422c022acafd | C++ | Cholla-CAAR/cholla | /src/ppmp.cpp | UTF-8 | 16,995 | 2.578125 | 3 | [
"MIT"
] | permissive | /*! \file ppmp.cpp
* \brief Definitions of the PPM reconstruction functions, written following Fryxell et al., 2000 */
#ifndef CUDA
#ifdef PPMP
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include"ppmp.h"
#include"global.h"
#define STEEPENING
#define FLATTENING
/*! \fn void ppmp(Real stencil[], Real bou... | true |
4034a66835ec66390d4d5f74bdf442758870e2d7 | C++ | saga92/leetcode | /letter_combinations_of_phone_number.cpp | UTF-8 | 1,119 | 3.4375 | 3 | [] | no_license | #include<string>
#include<vector>
#include<unordered_map>
using namespace std;
class Solution {
public:
vector<string> letterCombinations(string digits) {
vector<string> res;
unordered_map<int,string> map={{2,"abc"},{3,"def"},{4,"ghi"},{5,"jkl"},{6,"mno"},{7,"pqrs"},{8,"tuv"},{9,"wxyz"}};
le... | true |
48a2dd3bee68f33508697341fc83318704f4093c | C++ | TabithaRoemish/CSS343_Assignment4.cpp | /store.cpp | UTF-8 | 4,524 | 3.046875 | 3 | [] | no_license | // File Name: store.cpp
// Programmer: Tabitha Roemish & Prathyusha Pillari
// Date: March 2, 2018
// File contains: store class definitions
// The Store class also contains a HashTable for all the Store’s Customers.
// Manager for all of the Store’s database which includes all
// the Movies sorted by t... | true |
37e727546d9c80d3e82218108ebbbca30cd9bc9b | C++ | rathyon/pbr | /src/Lights/Light.cpp | UTF-8 | 837 | 2.59375 | 3 | [] | no_license | #include <Light.h>
using namespace pbr;
Light::Light() : SceneObject(), _on(true), _intensity(1.0f), _emission(1.0f) { }
Light::Light(const Color& emission, float intensity)
: SceneObject(), _emission(emission), _intensity(intensity) { }
Light::Light(const Vec3& position, const Color& emission, float intensity... | true |
deb00e47e9009426951148834c9289cdddc5881c | C++ | delefme/jutge-informatica | /08. Consolidation I/P11916-Approximation_of_e.cc | UTF-8 | 681 | 3.328125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int factorial(double n) {
int i = 0;
int j = 1;
while (i < n) {
i = i+1;
j = j*i;
}
return j;
}
int main() {
cout.setf(ios::fixed);
cout.precision(10);
double n;
while (cin >> n) {
double suma = 0.000000000;
... | true |
6f47c885c751488fc3772659fd96c91f0be5d47d | C++ | rithikb2/PolyRoute | /routes_analysis.cpp | UTF-8 | 1,626 | 3.015625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
int main() {
ifstream in("/home/adammn2/final_project/routes.dat.txt");
string line;
int count = 0;
while(getline(in, line) && count < 4) {
stringstream linestream(line);
string airline, air... | true |
8c685171367580df95196eee2d8416337ff0f7bf | C++ | jetp250/JRSC-Compiler | /src/parsing/Parser.cpp | UTF-8 | 42,543 | 2.828125 | 3 | [] | no_license | #include "Parser.hpp"
#include "misc/Logging.hpp"
#include <algorithm>
using namespace Lexer; // Brings in LexResult, TokenType, TokenData
using namespace Parser;
static bool strequals(const char* a, const char* b) noexcept {
while(*a && *b) {
if (*a != *b) return false;
a++;
b++;
}... | true |
2d3097d6e93f53014f7d61c201ab71e2490e6ceb | C++ | MFarradji/inf3105 | /labs/lab10/lab10a.cpp | UTF-8 | 404 | 3.1875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<string> tab;
tab.push_back("un"); // tab.ajouter("un");
tab.push_back("deux");
tab.push_back("trois");
tab.push_back("quatre");
tab.push_back("cinq");
vector<string> tab2 = tab;
for (vector<string>::ite... | true |
bfada6ac28009bb9291d23a2648f699f1d51c652 | C++ | soneoed/cycloid | /main.cpp | UTF-8 | 1,846 | 2.90625 | 3 | [] | no_license | /*
*/
#include "main.h"
#include "locomotion/cmotion.h"
#include "control/controlthread.h"
// Thread scheduling variables (semaphores, mutexes, etc)
sem_t NewSensorDataSemaphore;
sem_t ControlReadySemaphore;
void createThreadScheduling();
void createControlThread(CMotion* motion);
int main()
{
createThreadSched... | true |
b04f6d73854723dc598aef77561cf9b320ac9dde | C++ | RashikAnsar/everyday_coding | /problems/arrays/sunny_buildings.cpp | UTF-8 | 673 | 3.28125 | 3 | [] | no_license | /**
* The heights of certain Buildings which lie adjacent to each other are given.
*Light starts falling from left side of the buildings. If there is a building
*of certain Height, all the buildings to the right side of it having lesser
*heights cannot see the sun . The task is to find the total number of such
*bu... | true |
b54c720d107046131df74ab4ab41a8d172a1900f | C++ | panu2306/Data-Structure-Programs | /stack_array_implementation.cpp | UTF-8 | 1,190 | 3.828125 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define MAX_SIZE 100
void push(int ele);
int pop();
int size();
bool isEmpty();
int returnTop();
int arr[MAX_SIZE];
int top = -1;
int main(){
int op = -1;
int ele;
cout << "choose the operation - 1. Push 2.Pop 3.Return Top 4. Return if stack empty 5. size of stack "... | true |
c604bc8e3536b0450bc7fd3e1fc2cd6dbda3aebe | C++ | dshin21/RPNCalculator | /subtraction_operation.hpp | UTF-8 | 469 | 3.078125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "abstract_operation.hpp"
class subtraction_operation : public abstract_operation {
public:
static const char operation_CODE = '-';
subtraction_operation() : abstract_operation(operation_CODE) {};
~subtraction_operation();
int perform(int, int) override;
};
... | true |
27cb378001b4252ebee124981797bedb61100aa3 | C++ | liuning587/D6k2.0master | /d6k/trunk/src/mail/queue_impl.h | GB18030 | 2,356 | 2.765625 | 3 | [] | no_license | /*! @file queue_impl.h
<PRE>
********************************************************************************
ģ :
ļ : queue_impl.h
ļʵֹ : ̶еĴ
: LiJin
汾 : V1.00
--------------------------------------------------------------------------------
ע : Ϊǵƽ̨ļδȷԣʲpimplģʽ
-----------------... | true |
e0c3de83122490fe070080d24fdb73da8a44c91f | C++ | meskandari/Power-Grid | /Cpp files/Picture.cpp | UTF-8 | 2,142 | 3.03125 | 3 | [] | no_license | #include <string>
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
#include "Picture.h"
#include <iostream>
// Default constructor. Doesn't build the picture yet.
Picture::Picture(): Graphic() {
file = "";
bitmap = nullptr;
resize = 1;
}
// Sets the picture name and file name.
Pictur... | true |
9becc919a6217b96aaa635fa2454847251398f05 | C++ | stefanalex99/algorithm-design | /CPP/data-structures/Circular_Queue.cpp | UTF-8 | 3,692 | 4.21875 | 4 | [
"MIT"
] | permissive | /** Circular Queue */
#define DEFAULT_SIZE 100
#include <iostream>
#include <climits>
template <typename T>
class Queue {
private:
T *container;
int numElems;
int size;
int head, tail;
public:
/** Constructor */
Queue() {
container = new T[DEFAULT_SIZE];
numElems = 0;
... | true |
154085666915166418517b74db95f055045e2b4d | C++ | antoinechalifour/Cpp_TP4 | /CTableGType.h | UTF-8 | 1,416 | 3.28125 | 3 | [] | no_license | #ifndef _CTableGTypeT_H
#define _CTableGTypeT_H
template<class T, int N=10>
class CTableGType{
private:
T tab[N];
int lastIndex;
public:
CTableGType();
CTableGType(const CTableGType<T, N>&);
~CTableGType();
CTableGType& operator=(const CTableGType<T, N>&);
T operator[](int i) const;
T& operator[](int i);
int ... | true |
ed1c2873fdb6812df3e8c2a35db1720b08a586e3 | C++ | leonardovallem/grafos-implementation | /dp/main.cpp | UTF-8 | 614 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include "Matrix.h"
int main() {
Matrix grafo;
grafo.add("1");
grafo.add("2");
grafo.add("3");
grafo.add("4");
grafo.addRelation("1", "2", 2);
grafo.addRelation("3", "1", 5);
grafo.addRelation("3", "4", 3);
grafo.addRelation("4", "3", 9);
grafo.addRelation("... | true |
fd6814752bae9105a8e2f1f42b23ded99d944ffd | C++ | amj311/cs142-lab8-shopping-cart | /ItemToPurchase.h | UTF-8 | 702 | 3.078125 | 3 | [] | no_license | #ifndef ITEMTOPURCHASE_H
#define ITEMTOPURCHASE_H
#include <string>
using namespace std;
class ItemToPurchase {
public:
//Default constructor
ItemToPurchase(string itemName = "none", string itemDescription = "none", double itemPrice = 0.0, int itemQuantity = 0);
void SetName(string nameToSet);
str... | true |
c384d3f4401444ad5f8a10aef04534c1bb4b6b21 | C++ | rohitbhatghare/c-c- | /Sept-08-20/assignment23.cpp | UTF-8 | 993 | 3.359375 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
int main(int x,int y)
{
int x,y;
cout<<"\n Enter Value of "<<endl;
cout<<"x="<<endl;
cin>>x;
cout<<endl;
cout<<"\n Enter Value of "<<endl;
cout<< "y="<<endl;
cin>>y;
if((x>0)&&(y>0))
{
cout<<"T... | true |
0c9cb323a386f9efe7c5a51c90bf26951ee4a77e | C++ | phoenix76/teach_projects | /Prata_S/Prata_S/pr56.cpp | UTF-8 | 808 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <array>
int main()
{
const char *months[] =
{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
int price[3][13] = { 0 };
int all = 0;
int year = 2012;
for(int i = 0; i < 3; i++)
{
... | true |
04c371c1456a1f17b3a352ec35ae01ee89c19f97 | C++ | vinothcse123/Miscellaneous | /PHN-CodeUpload/user_defined_key_for_map.cpp | UTF-8 | 548 | 3.1875 | 3 | [] | no_license | #include<iostream>
#include <algorithm>
#include <map>
template<typename T1,typename T2>
class KeyPair
{
public:
T1 key1;
T2 key2;
KeyPair(T1 a,T2 b): key1(a),key2(b) {}
bool operator<(const KeyPair<T1,T2> &obj)const
{
if(key1 < obj.key1)
{
return tru... | true |
27f246e64e5072b2a011e97500c0b210b501f2a6 | C++ | zlumer/eos-london-poker | /contracts/notechain/notechain.cpp | UTF-8 | 22,097 | 2.59375 | 3 | [] | no_license | #include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
#include <eosiolib/asset.hpp>
#include <eosiolib/currency.hpp>
#include <eosiolib/singleton.hpp>
#include <eosiolib/time.hpp>
#include <eosiolib/system.h>
#include <eosio.token/eosio.token.hpp>
using namespace eosio;
struct playerpair
{
uint64_t alice;
uin... | true |
6f1270f670d995a514630d412ce4be48f34067ae | C++ | RanaRanvijaySingh/my_doc_exp | /ranvijay/c++/assign.cpp | UTF-8 | 8,756 | 3.046875 | 3 | [] | no_license | #include <stdio.h>
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
int check_file_type(string name);
void identify_class(string file);
void find_methods(string file, int type);
void correct_indentation(string filename,int type);
int main()
{
int type=0;
string filename;
cout<<"Enter the... | true |
9f2c1c3ce4113369eb0367d9d8769b8af562cfe1 | C++ | fish-ball/acm.zju.edu.cn | /17XX/zoj.1766.src.1.cpp | GB18030 | 1,176 | 2.921875 | 3 | [] | no_license | // 1788059 2009-03-13 22:51:21 Accepted 1766 C++ 0 184 ͵
// ַע⣺Words consist of the characters {a-z,A-Z,0-9}. Words are separated by whitespace, end-of-line, and punctuation.
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
map<string, int> MP;
in... | true |
51eeb02aa661c62844d3efffca55b8285ceadd71 | C++ | jobhope/TechnicalNote | /code/FactoryMethod.cpp | UTF-8 | 2,059 | 3.515625 | 4 | [
"MIT"
] | permissive | #include<iostream>
#include<memory>
#include<string>
class Drink
{
public:
virtual ~Drink() = default;
virtual std::string getName() const = 0;
};
class Coffee : public Drink
{
std::string getName() const override
{
return "커피";
}
};
class Coke : public Drink
{
std::string getName() co... | true |
bfbfa05f26ab60b8967eba2c3b2123a72cd0ef6e | C++ | Alpha0531/Peliculas | /Serie.cpp | UTF-8 | 653 | 3.046875 | 3 | [] | no_license | #include "Serie.h"
//Constructores
Serie::Serie(){
int id = 0;
string Nombre = "";
int numCap=0;
}
Serie::Serie(int id,string Nombre, string genero, int numCap){
this->id = id;
this->Nombre=Nombre;
this->numCap=numCap;
}
//Getter
int Serie::getIdS(){
return id;
}
string Serie::getNomb... | true |
01912fe295b9b2300103f4a6a26d043fcec2e7cb | C++ | p15-git-acc/code | /semaphores/sem_make.cpp | UTF-8 | 514 | 2.90625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <semaphore.h>
int main(int argc, char **argv)
{
if(argc!=3)
{
printf("Usage:- sem_make <sem_name> <no_resources>\n");
exit(1);
}
sem_t *this_sem=sem_open(argv[1],O_CREAT,S_IRUSR|S_IWUSR,atoi(argv[2]));
... | true |
fb3bb7c4f8579c309aef593d2062d1e49e7b4ecc | C++ | njumathdy/code-practice | /Leetcode/746_Min Cost Climbing Stairs/c++/solution.cpp | UTF-8 | 1,074 | 3.5 | 4 | [] | no_license | /*******************
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).
Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1.
*********... | true |
23f76a7ac5003dbb962f648ca9915e2864c2c06d | C++ | BinyuHuang-nju/leetcode-implement | /all123/all123/main.cpp | UTF-8 | 3,246 | 3.109375 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include <vector>
class Solution1 //190/120
{
public:
int maxProfit(vector<int>& prices) {
if (prices.size() < 2)
return 0;
int i = 0, j;
vector<int> choose;
while (i < prices.size() - 1) {
j = i;
while (j... | true |
5c180b198219e3b46fda8f5c5bb76c55085c791e | C++ | Suryavf/CameraCalibration | /Patron/structures.cpp | UTF-8 | 1,269 | 3.078125 | 3 | [] | no_license | #include "structures.h"
/*
* Class Vect
* =================================================
*/
void Vect::module(float &m){
m = x*x + y*y;
}
T Vect::module(){
return x*x + y*y;
}
void Vect::norm(T &m){
m = std::sqrt(x*x + y*y);
}
T Vect::norm(){
return std::sqrt(x*x + y*y);
}
void Vect::dot(... | true |
b8ddf7b8aae2287ba4f339c57bfddf21f0e43510 | C++ | hldnwrght/Calculator_1_Using_Design_Patterns | /Evaluate_Postfix.cpp | UTF-8 | 355 | 2.640625 | 3 | [] | no_license | //This holds the code for evaluate postix
#include <iostream>
#include "Evaluate_Postfix.h"
//Function that iterates over the given array until empty and executes the command
bool Evaluate_Postfix::evaluate_postfix(Array_Iterator<Expr_Command*> & iter) {
for (; !iter.is_done(); iter.advance()) {
(*iter)-... | true |
fabd685d14c4c3c4dd218308c84a858c146385aa | C++ | Rabbidon/project-euler | /euler013/largeSum.cpp | UTF-8 | 977 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
//We are given a sum of 100 50-digit numbers and are asked to calculate the first 10 digits.
//This solution represents each number as digit arrays and adds each place in the number separately
//It first adds on the 10 entries of least value, and then works its... | true |
5eb062acf0c607de280d3d1af2731f76d7106350 | C++ | Adriments/Relearning-CppBasics | /Relearning CppBasics/Episode2.cpp | UTF-8 | 167 | 2.515625 | 3 | [] | no_license | /* #include <iostream>
using namespace std;
int main() { //Every Cpp program needs a main function. Compiler looks for it.
cout << "Hello World!";
return 0;
} */ | true |
bba071f02c6f04df51afeab0fa594b0b18e44cd2 | C++ | preetisoni123/Tree | /bottomView.cpp | UTF-8 | 2,265 | 3.828125 | 4 | [] | no_license | /* We need to do level order traversal starting root.
Then keep putting node values in the vector based on
its horizontal distance from root.
20
/ \
8 22
/ \ \
5 3 25
/ \
... | true |
4c838f5d65b39421f56e79b9b235f6491b63d732 | C++ | levicode/mystl | /SqStack.h | GB18030 | 632 | 3.65625 | 4 | [] | no_license | #pragma once
typedef int ElemType; //˳ջԪ
class SqStack
{
public:
SqStack(int size); //캯
~SqStack(); //
int Length(); //ȡ˳ջij
bool Empty(); //ж˳ջǷΪ
bool Push(ElemType element); //ջѹһԪelement
bool Pop(ElemType &element); //ջȡһԪطظelement
bool GetTop(ElemType &element); //ȡջԪطظelement
void Clear(); //ջ
bo... | true |
2918494336831d0c6085816c6ca3ec154310d50d | C++ | maxschau/IINI4003-CPP-for-programmerere | /Oving3/Circle.h | UTF-8 | 389 | 2.90625 | 3 | [] | no_license | //
// Created by Max Torre Schau on 26/08/2020.
//
#ifndef OVING3_CIRCLE_H
#define OVING3_CIRCLE_H
const double pi = 3.141592;
class Circle {
public:
Circle(double radius_); //Changed from lower-case to Upper-case C
double get_area() const;
double get_circumference() const;
private: //... | true |
cb1fc7ce76f0fd130b72b4e9f761d48c9e5055ef | C++ | isaigm/leetcode | /missing-number/Accepted/3-3-2021, 3_37_44 PM/Solution.cpp | UTF-8 | 306 | 3.15625 | 3 | [] | no_license | // https://leetcode.com/problems/missing-number
class Solution {
public:
int missingNumber(vector<int>& nums) {
int n = nums.size();
int s1 = n * (n + 1) / 2;
int s2 = 0;
for(const auto &j: nums)
{
s2 += j;
}
return s1 - s2;
}
}; | true |
1779a282914d5a616fe964612faa5f53a04d0bfb | C++ | JaeJang/COMP_3512_Lab5 | /RPNCalculator/RPNCalculator/RPNCalculator.cpp | UTF-8 | 1,369 | 3.640625 | 4 | [] | no_license | #include "RPNCalculator.hpp"
#include <iostream>
#include <string>
#include <sstream>
//Decide operation type
//PRE : parameter should be one of +,-,* and /
//RETURN: matched class
Operation * RPNCalculator::operation_type(char operation)
{
if (operation == AdditionOperation::OPERATION_CODE)
return new AdditionOp... | true |
473665f70d80adc72e2ec01673dfe69e33b4d78e | C++ | tiggersworth/huffman_coding | /encode.hpp | UTF-8 | 1,284 | 2.859375 | 3 | [] | no_license | /***
* File: encode.hpp
* Author: Tammy Chang
*/
#ifndef ENCODE_HPP
#define ENCODE_HPP
#include "a6.hpp"
#include <string>
// IMPLEMENT FUNCTION ENCODE BELOW
// THIS FUNCTION IS USED BY EXTRA CHALLENGE PROGRAM a6e
// ONLY IF YOU GET 100 FOR a6 YOU WILL BE TESTED ON a6e
struct value_count{
char value;
std::... | true |
db0f0b8558fe4cf7d995d100d7b2bac4574059a4 | C++ | aernesto/moodbox_aka_risovaska | /velasquez/mousedrawingelement.h | UTF-8 | 1,511 | 2.75 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | #ifndef MOUSEDRAWINGELEMENT_H
#define MOUSEDRAWINGELEMENT_H
#include "drawingelement.h"
namespace Velasquez
{
// Basic mouse drawing element class
class MouseDrawingElement : public DrawingElement
{
public:
enum Settings {PenColor, PenTransparency, PenWidth};
public:
MouseDrawingElement(QGraphicsIt... | true |
187dc8541423f2f1e2a24676f17362bafb850307 | C++ | myuaggie/myuaggie1 | /practice5.8(有注释.cpp | UTF-8 | 1,550 | 3.09375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <map>
using namespace std;
int main() {
string fileName;
fstream f;
cout << "Input file name?"; //open file
cin >> fileName;
f.open(fileName);
while (!f.is_open()) {
cout << "Unable to open that file.Try again." << endl;
... | true |
2c9dfa30928fb3b58533fd7036f1983fde73b06a | C++ | TrungKenbi/BaiTap-CSLT | /34.cpp | UTF-8 | 319 | 3 | 3 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
int i, n;
float S;
do
{
cout<<"\nNhap n(n >= 1): ";
cin>>n;
if(n < 1)
{
cout<<"\nn phai >= 1. Xin nhap lai !";
}
}while(n < 1);
i = 1;
S = 0;
while(i <= n)
{
S = sqrt(i + S);
i++;
}
cout<<"\nTong S = %f"<<S;
return 0;
}
| true |
6857cd5b05953581232b02dbcacbc359362b7855 | C++ | ggyool/study-alone | /ps/boj_cpp/1212.cpp | UTF-8 | 626 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
string s;
const string arr[8] = {
"000",
"001",
"010",
"011",
"100",
"101",
"110",
"111"
};
int main(void){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> s;
int slen = s.size();
int i=0;
if(s[0] ... | true |