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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
70e1514603660fb16fba214e0d0f4918ac1b486e | C++ | nolan-downey/SchoolCodingWork | /fundcomp/lab3/polar.cpp | UTF-8 | 1,640 | 4.03125 | 4 | [] | no_license | //Nolan Downey
//Function to produce radius and angle to a given point, along with which quadrant the given point is located
#include<iostream>
#include<cmath>
using namespace std;
double get_radius(double,double);
double get_angle(double, double);
void quadrant_info(double, double);
int main() //main function
{
d... | true |
a8bc5d42671b015475fef65fa861a30d1b5f1243 | C++ | konflicts/Sandbox | /C++/MultiArrays/MultiArrays/main.cpp | UTF-8 | 2,270 | 3.015625 | 3 | [] | no_license | //
// main.cpp
// MultiArrays
//
// Created by Pedro Pena on 5/1/14.
// Copyright (c) 2014 Pedo Peña. All rights reserved.
//
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
const int vendor = 5;
const int month = 6;
int sales [ve... | true |
b4d6d4508ccf67f117af7b5823ee70a0824bf770 | C++ | A284Philipi/1541_Construindo-Casas_Cpp | /main.cpp | UTF-8 | 772 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
long long int comprimento_casa, altura_casa, porcentagem_contrucao, lado_lote, cont, area_casa, area_lote;
while (true){
cin >> comprimento_casa;
if (comprimento_casa == 0){
break;
}
... | true |
5e5898060c5536473f6455e89306706064cc0f4f | C++ | rosynirvana/ZeroJudge | /a263.cpp | UTF-8 | 1,170 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <ios>
#include <cstdlib>
inline bool isLeapYear(int);
inline int daysPassed(int, int ,int);
int month[] = {31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
std::ios_base::sync_with_stdio(false);
int y1, m1, d1;
while(std::cin >> y1 >> m1 >> d1){
int y2, m2, d2;
std::cin >> y2 >... | true |
4e35a8b0b115e98322246f81cfe1df69cbb86c6d | C++ | strisunshine/RemoteCodeManagement | /Message/Message.cpp | UTF-8 | 8,684 | 2.640625 | 3 | [] | no_license | /////////////////////////////////////////////////////////////////////
// Message.cpp - Support message construction and configuration //
// ver 1.0 //
// //
// Application: CSE687 2015 Project 3 - ... | true |
3fced59174541f383aa12852df9e52354ee57872 | C++ | icrelae/cpp_primer | /6-function/6.12-parameter_passing.cpp | UTF-8 | 281 | 3.078125 | 3 | [] | no_license | /* 2016.10.05 12:46
* P_190
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void Swap(int &a, int &b)
{
int tmp = a;
a = b;
b = tmp;
}
int main(int argc, char **argv)
{
int a = 10, b = 80;
Swap(a, b);
cout << a << ' ' << b;
return 0;
}
| true |
948cfea0a9f0bce4470b066d66b67099c86ec518 | C++ | lizzyly7/SmartDraw | /aBaseTool/src/utility/Ini.cpp | UTF-8 | 3,758 | 2.515625 | 3 | [] | no_license | #include <assert.h>
#include <utility\ini.h>
#include <fstream>
#include <windows.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
// parameter :
// description :
// remarks :
// returns :
CIni:... | true |
1db28d7771223249d247c6b093195fc9c34077b7 | C++ | ExcaliburEX/My-oj | /蓝桥_芯片测试_3.25.cpp | GB18030 | 659 | 3.046875 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
int count1[25];
int arr[25][25];
int main()
{
int n, i, j;
cin >> n;
for (i = 0; i<n; i++)
{
for (j = 0; j<n; j++)
{
cin >> arr[i][j];
}
}
for (j = 0; j<n; j++)
{
for (i = 0; i<n; i++)
{
if (j != i && arr[i][j] == 1)... | true |
fe8e00f542f29a6bd5e6f88544d2785231b17286 | C++ | jediserg/ws-server | /tests/fake_ws_server_impl.cpp | UTF-8 | 1,165 | 2.53125 | 3 | [] | no_license | //
// Created by serg on 7/6/16.
//
#include "fake_ws_server_impl.h"
FakeWsServerImpl::FakeWsServerImpl() {
}
void FakeWsServerImpl::_close(Connection c) {
auto info = _map.find(c);
if(info == _map.end())
return;
info->second = {.is_oppened = true, .in_msg_cnt = 0, .out_msg_cnt = 0};
_onClo... | true |
0938545493ab7d4da66fbf62cd40ddf07c7c1ba4 | C++ | sameerkhan97/data-structure-sheet | /searching sorting/ProductArrayPuzzle.cpp | UTF-8 | 1,064 | 3.765625 | 4 | [] | no_license | /*Given an array A[] of size N, construct a Product Array P (of same size N) such that P[i]
is equal to the product of all the elements of A except A[i].
Example 1:
Input: N = 5 A[] = {10, 3, 5, 6, 2}
Output: 180 600 360 300 900
Explanation:
For i=0, P[i] = 3*5*6*2 = 180.
For i=1, P[i] = 10*5*6*2 = 600.... | true |
e30a56b42a9ee24c29e82333fb791545d48287c6 | C++ | WilliamMajor/CmpE142-Assignment3 | /src/Swap.h | UTF-8 | 344 | 2.5625 | 3 | [] | no_license | #ifndef SWAP_H
#define SWAP_H
#include <iostream>
using namespace std;
class Swap
{
public:
Swap();
~Swap();
string getPID() const;
string getVM() const;
void setPID(string argPID);
void setVM(string argVM);
private:
string PID;
string... | true |
64648b0c33b6d21468dd59bdc44ac67cc49a3b38 | C++ | duffwang/hash-table-simple | /hashtable.cpp | UTF-8 | 2,212 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
class Node {
public:
string key, value;
Node* next;
Node(string a, string b) {
key = a;
value = b;
next = NULL;
}
};
class LinkedList {
public:
Node* start;
int insertData(string key, string value){
Node* node_last = start;
Node* node_t... | true |
d2d6982c137835cf14eb3f95e6eb75c1340b4b46 | C++ | gcc-o-o/cpp_code | /content_1/text/textin4.cpp | UTF-8 | 243 | 3.625 | 4 | [] | no_license | //textin4.cpp read char with cin.get()
#include<iostream>
int main(void)
{
using namespace std;
char ch;
int count=0;
while((ch=cin.get())!=EOF)
{
cout.put(ch);
count++;
}
cout<<endl<<count<<" characters read"<<endl;
return 0;
} | true |
82b1f5dce1431e252b9ba5faf66838c016081d25 | C++ | Joklost/sims | /include/sims/link.h | UTF-8 | 890 | 2.796875 | 3 | [
"MIT"
] | permissive | #ifndef MANETSIMS_LINK_H
#define MANETSIMS_LINK_H
#include <utility>
#include <ostream>
#include <functional>
#include "node.h"
namespace sims {
class Link {
public:
Link() = default;
Link(unsigned long long id, sims::Node &node1, sims::Node &node2);
const ::std::pair<sims::Node, si... | true |
df3a2cd485d0a26ccd14e908eb386f158bdac6af | C++ | Sylwestrone/Game-engine | /ComponentMovement.h | UTF-8 | 1,218 | 2.875 | 3 | [] | no_license | #ifndef MOVEMENT_COMPONENT_H
#define MOVEMENT_COMPONENT_H
#include <vector>
#include <list>
#include "Component.h"
#include "Map.h"
class ComponentMovement : public Component
{
public:
ComponentMovement(Map& gameMap);
ComponentMovement* clone() const override;
const std::vector<int>& getPath() const;
... | true |
273a29b9e811a5b35a00b41388357d9ed9392e17 | C++ | TimberToss/tp-lab-7 | /src/LivingObject.cpp | UTF-8 | 2,398 | 3.296875 | 3 | [] | no_license | #include "LivingObject.h"
#include "Ocean.h"
#include "Cell.h"
LivingObject::LivingObject(int x, int y, Ocean* ocean) : Object(x, y, ocean) {}
LivingObject::LivingObject(Coordinates coordinates, Ocean* ocean) : Object(coordinates, ocean) {}
void LivingObject::move(int x, int y) {
ocean->getCell(&location)->setO... | true |
07bedff0ccc66593c8bfa64d10c0d784f0b71ccb | C++ | danymtz/C-Course-for-begginers | /01.- Preliminares.cpp | ISO-8859-1 | 2,749 | 3.09375 | 3 | [] | no_license | /*Estructura general de un programa econmico en C.
main()
{
//Sentencia 1;
//Sentencia 2;
//Sentencia n;
}
////////////////////////////////////////////////////////////////////////////////
Estructura de control condicional if, else if, else en C
if (condicin)
{
Sentencia 1;
Sentencia 2... | true |
3c41f457a58158979ae3114ed473ade3170788e6 | C++ | kahyunKo/C-plus-plus_class | /ch03/default.cpp | UHC | 433 | 3.6875 | 4 | [] | no_license | // p140
#include <iostream>
using namespace std;
void display(char c = '*', int n = 10) {
for (int i = 0; i < n; i++) {
cout << c;
}
cout << endl;
}
int main() {
cout << "ƹ μ ʴ : \n";
display();
cout << "\nù ° μ Ǵ : \n";
display('#');
cout << "\n μ Ǵ : \n";
display('#', 5);
... | true |
685dbae86cde7d49f77cf78315aeff4fcc943054 | C++ | linmx0130/OJCode | /RQNOJ/40/main.cpp | UTF-8 | 493 | 2.6875 | 3 | [] | no_license | #include <string>
#include <iostream>
using namespace std;
string h[10000];
int t,mm;
int main(){
h[1]="http://www.acm.org/";
t=1;
mm=1;
string s;
while (cin >>s){
if (s=="VISIT"){
cin>>s;
cout << s <<endl;
h[++t]=s;
mm=t;
continue;
}
if (s=="BACK"){
if (t==1) cout <<"Ignored\n";
else co... | true |
ca36cb7725762de0df64463a76d457c78efe6850 | C++ | huimingli/leetcodedailyworks | /LeetcodeProject/isHappy.h | UTF-8 | 386 | 2.6875 | 3 | [] | no_license | #pragma once
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
#include<queue>
using namespace std;
bool isHappy(int n) {
string num = to_string(n);
int sum = 0;
for (char a : num) {
sum += pow((a - '0'), 2);
}
if (sum<6 && sum != 1) {
re... | true |
d5a7b595b8721aa42981b375e176cd69bd4f76ab | C++ | tisma/ctorious | /runner_agent.cpp | UTF-8 | 1,104 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | #include <atomic>
#include <chrono>
#include <thread>
#include <utility>
#include <fmt/printf.h>
#include <gsl/gsl_assert>
template <typename Agent> concept IsAgent = requires(Agent agent) {
{agent.doWork()};
};
template <typename Agent> requires IsAgent<Agent> class Runner {
public:
Runner(Agent &&agent) : m_ag... | true |
c9533817b63cd97f03c23e313bcca9365be0cca3 | C++ | swzhangmit/Coding-Practice | /Codeforces/1055/d/d.cc | UTF-8 | 2,931 | 2.875 | 3 | [] | no_license | #include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
void computeLPSArray(string pat, int M, int* lps);
int KMPSearch(string pat, string txt)
{
int M = pat.length();
int N = txt.length();
int lps[M];
computeLPSArray(pat, M, lps);
int i = 0; // index for txt... | true |
3b4e780f295651f3a1e6386ce4d9327dbfacd44d | C++ | igorbrasileiro/competitive | /aa-intermediary/19.1/list4/c.cpp | UTF-8 | 2,629 | 3.15625 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
// Multiples of 3
struct node {
int lazy;
vector<int> mult; // alterar pra vector
};
void print_arr(vector<node> &sgtree) {
for (int i = 0; i < sgtree.size(); i++) {
cout << '[';
for(auto &c: sgtree[i].mult) {
cout << c << ',';
}
cout << "] "... | true |
971053d1df09fbe02ae05445ca0fa76708b28ccc | C++ | ThaliaVillalobos/fileIO_B | /Villalobos_IOB.cpp | UTF-8 | 2,217 | 3.328125 | 3 | [] | no_license | //Name:Thalia Villalobos
//22 Oct 2015
//Write a program that will utilize a text input file (scores.txt) and compute the listed specifications. The text input file "scores.txt" is provided. Write a program to compute numeric grades for a course. The course records are a file that will serve as the input file. The inp... | true |
5fac3de27fd3d6ac8406aea1cab4e11f2dde80cf | C++ | ibMH/multi_robot_system | /formation/include/formation/formation_publisher.h | UTF-8 | 2,497 | 2.8125 | 3 | [] | no_license | #pragma once
#include<ros/ros.h>
#include<formation/formation.h>
class FormationPublisher{
public:
/**
* @brief Construct a new Formation Publisher object
*
*/
FormationPublisher();
/**
* @brief Construct a new Formation Publisher object for a giv... | true |
dd094bc80809d5e8a42a8c85c1f2426ee2d98738 | C++ | Nazrath10R/RUHI-MSA | /Archive/old_scripts/main_pedro_saved.cpp | UTF-8 | 94,458 | 3.25 | 3 | [] | no_license |
// main.cpp
// ptm
//
// Created by Nazrath Nawaz on 28/08/2019.
// Developed by Pedro Cardoso on 09/06/2020.
// Copyright © 2019 Nazrath Nawaz. All rights reserved.
//
//uiuiuiu
#include <iostream>
#include <fstream>
#include <vector>
#include "string"
#include <limits>
#include <algorithm>
#include <math.h>
#in... | true |
a860ce3f993ae5928cc31aaa3fe6b10682537a09 | C++ | Anton94/itc | /tests/condition_variable_tests.cpp | UTF-8 | 1,131 | 2.828125 | 3 | [
"MIT"
] | permissive | #include "condition_variable_tests.h"
#include "utils.hpp"
#include <itc/condition_variable.hpp>
#include <itc/thread.h>
#include <chrono>
namespace cv_tests
{
using namespace std::chrono_literals;
void run_tests(int iterations)
{
auto th1 = itc::make_thread();
auto th2 = itc::make_thread();
for(int i = 0; i < i... | true |
af5246fe1c376d464b6e9bfc441d5282caec92dc | C++ | KimDoKy/Cpp-ex-200 | /part3.중급/076.cpp | UTF-8 | 593 | 3.6875 | 4 | [] | no_license | // Call by Address 이해하기
// 주소를 명시적으로 전달받아 4바이트가 할당
#include <iostream>
using namespace std;
void Func1(bool *is_on)
{
cout << "Call by address: " << sizeof(is_on) << endl;
}
void Func2(bool &is_on)
{
cout << "Call by reference: " << sizeof(is_on) << endl;
}
int main()
{
bool is_tmp = true;
// 함수가 ... | true |
15889cd29432a078476b2f83b4b2d3a0c431d0a9 | C++ | Kanu-Priya-Sehrawat/InterviewPrep | /Maximum of all subarrays of size k.cpp | UTF-8 | 899 | 3.25 | 3 | [] | no_license | //Function to find maximum of each subarray of size k.
vector <int> max_of_subarrays(int *arr, int n, int k)
{
// your code here
vector<int> ans;
int i, j;
i = j = 0;
list<int> l;
while(j < n){
// Calculation
// All the smaller element in t... | true |
3b6c96df3f1126e860de0217bba73eb9f061509a | C++ | ryuxsherlockdeveloper/LPU-Workshop | /Day 1/recursion_2nd.cpp | UTF-8 | 2,341 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <climits>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <cstring>
#include <stack>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
string removeDuplicates(string str) {
... | true |
e28c9d29a4c981f3623fc696050dc7dc3cba2d25 | C++ | gezi322/WindowsPrinterDriver | /UI/Pdk/PdkApp.h | UTF-8 | 5,306 | 2.53125 | 3 | [] | no_license | #ifndef PDKAPP_H_ // (make sure this is only included once)
#define PDKAPP_H_
#ifndef __cplusplus
#error PdkApp.h included in a non-C++ source file!
#endif
// --------------------------------------------------------------------
// INCLUDES
// -----------------------------------------------------... | true |
a5cedf37d66e51ad13f97c79e98b9c29202e0c1c | C++ | tallavi11/csci13600-labs | /lab_01/smaller3.cpp | UTF-8 | 773 | 3.46875 | 3 | [] | no_license | /*
Author: Tal Lavi
Course: CSCI-133
Instructor: Mike Zamansky
Assignment: Lab1B
Write a program smaller3.cpp that asks the user to input three integer numbers and prints out the smaller of the three.
*/
#include <iostream>
using namespace std;
int main() {
int x = 0;
int y = 0;
int z = 0;
cout << "Enter the fir... | true |
22fd106197f77a62b564027635894a3ce8dec810 | C++ | siolag161/thread_pool | /thread_pool.hpp | UTF-8 | 1,158 | 2.953125 | 3 | [] | no_license |
#include <vector>
#include <queue>
#include <thread>
#include <mutex>
#include <condition_variable>
typedef std::function<void()> Task;
class ThreadWorker;
class ThreadPool {
public:
ThreadPool(unsigned max_workers=5, unsigned max_tasks = 20);
virtual ~ThreadPool();
template<class F, class... Args>
... | true |
a674e0d45064ff5ea5c1c2acd4b58c7b0fe42922 | C++ | SoC-OpenGL/soc-assignment-1-nnicobar | /Q1/MyShape.cpp | UTF-8 | 8,356 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include<math.h>
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
// Window dimensions
const GLuint WIDTH = 700, HEIGHT = 700;
// Shaders
const GLchar* vertexShaderSource = "#version 330 core\n"
"layout (location = 0) in vec3 position;\n"
"void main()\n"
"{\n"
"gl... | true |
0317c10165b375474c504a56cb565677b384b39e | C++ | wesmail/hydra | /old_hydra/hydra/branches/v3_04stable/base/geantutil/hgeantshower.h | UTF-8 | 1,653 | 2.5625 | 3 | [] | no_license | ///////////////////////////////////////////////////////////////////////////
// HGeantShower
//
// GEANT SHOWER event data
//
// last modified on 29/1/99 by R.Holzmann (GSI)
///////////////////////////////////////////////////////////////////////////
#ifndef HGEANTSHOWER_H
#define HGEANTSHOWER_H
#include "hlocatedda... | true |
0de0f0cddd59aade660a2e6de95d47383eb84a9e | C++ | wushangzhen/LeetCode-Practice | /137-clone-graph/8-20-2018-bfs.cc | UTF-8 | 1,392 | 3.1875 | 3 | [] | no_license | /**
* Definition for undirected graph.
* struct UndirectedGraphNode {
* int label;
* vector<UndirectedGraphNode *> neighbors;
* UndirectedGraphNode(int x) : label(x) {};
* };
*/
class Solution {
public:
/*
* @param node: A undirected graph node
* @return: A undirected graph node
... | true |
2ac3fd63d49b78cdd4ea02837fa76355371e8226 | C++ | zpiao1/CPP-Primer | /Exercise 13.22.cpp | UTF-8 | 474 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class HasPtr {
public:
HasPtr(const std::string &s = std::string()):
ps(new std::string(s)), i(0) {}
HasPtr(const HasPtr &hp):
ps(new std::string(*(hp.ps))), i(hp.i) {}
HasPtr &operator=(const HasPtr &hp) {
std::string *temp ... | true |
3bf53615dd5a56e0a6b165ed0ce10c8b64daa217 | C++ | baturevychvitalii/game_book | /src/game_book/items/food.h | UTF-8 | 599 | 2.953125 | 3 | [] | no_license | #ifndef __GAMEBOOK_ITEMS_FOOD__
#define __GAMEBOOK_ITEMS_FOOD__
#include "../item.h"
/**
is supposed to heal the creature, on which is being used
*/
class Food : public Item
{
int heal_value;
size_t Use(size_t charges = 1, Creature *potential_opponent = nullptr) override;
public:
/**
constructs item from... | true |
97581c36de91c45c622187d0f6192937248c770f | C++ | nik464/Coding-Ninjas-DSA-CPP | /Tree/StructurallyIdentical.cpp | UTF-8 | 530 | 3.46875 | 3 | [] | no_license |
bool areIdentical(TreeNode<int> *root1, TreeNode<int> * root2) {
if((root1==nullptr && root2 !=nullptr) || (root1 !=nullptr && root2==nullptr) )
{
return false;
}
if(root1->data != root2->data)
{
return false;
}
if(root1->children.size()!=root2->children.size())
{
... | true |
d87575a97f23fa9acac5fb700d676f4385bf0bcc | C++ | aseem01/Competitive_Programming | /codeforce/Codeforce_Rating_Round/round_413/B. T-shirt buying.cpp | UTF-8 | 4,464 | 2.515625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define uniq(x) x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr //Lower value search;
#define max3(a,b... | true |
ed2983c0abdbb7f1ddca1d8ad9d3ac185c22d958 | C++ | adamjer/Virtual-World | /SowThistle.cpp | UTF-8 | 2,126 | 2.703125 | 3 | [] | no_license | #include "SowThistle.h"
namespace organisms
{
SowThistle::SowThistle(worlds::VirtualWorld* world, SDL_Point& location)
{
this->initiative = 0;
this->strength = 0;
this->location = location;
this->world = world;
this->name = "SowThistle";
this->isAfterAction = false;
this->texture.loadFr... | true |
12036dc7d7b45d383a7c5604f7db106ae7183366 | C++ | Oktianto123/T-8 | /8-4-19.cpp | UTF-8 | 872 | 3.203125 | 3 | [] | no_license | #include <iostream>
using namespace std;
double input (string ohyeah){
double total;
cout<<"Input Nilai "<<ohyeah<<" : ";cin>>total;
return total;}
void grade (double total){
if(total>80)
{cout<<total<<endl;cout<<"A"<<endl;}
else if(total>60)
{cout<<total<<endl;cout<<"B"<<endl;}
else i... | true |
526bbb84bb7a294a5dcd812674e14825043739e3 | C++ | StevenD33/Plante_Connecte | /Capteurs/capteurs.ino | UTF-8 | 1,181 | 2.53125 | 3 | [] | no_license | #include "SparkFunBME280.h"
// La librairie accepte I2C ou SPI, on inclue donc les deux
#include "Wire.h"
#include "SPI.h"
#include <math.h>
// const int sensor=A0;
BME280 capteur;
void setup() {
Serial.begin(9600);
while (!Serial) {
// Attente de l'ouverture du port série pour Arduino MKR WiFi 1... | true |
e6afb0a22b5446c0cc6374b3ef8d7cb9d8c2ff31 | C++ | DaniBarac/Connect-four | /AI.cpp | UTF-8 | 2,411 | 3 | 3 | [] | no_license | #include "Board.h"
#include "AI.h"
//#include "hash_map.h"
#include <unordered_map>
#include <iostream>
using namespace ai;
int min(int a, int b) {
return a < b ? a : b;
}
int max(int a, int b) {
return a > b ? a : b;
}
// Player 1 minimizes, player 2 maximizes
int minimax(Board board, std::unordered_map<Board, i... | true |
16905dc772f6149c13f5dc07db2a3e03c1199340 | C++ | pkunjam/Data-Structures-and-Algorithms | /Sorting/Three way partitioning.cpp | UTF-8 | 2,108 | 3.390625 | 3 | [
"MIT"
] | permissive | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
vector<int> threeWayPartition(vector<int> A,
int lowVal, int highVal);
int main() {
int t;
cin>>t;
while(t--)
{
int N;
cin>>N;
vector<int> A(N);
int hash[1000001];
memset(hash,0,sizeof hash);
for(int i=0;i<... | true |
8c6cf4b82e21317df376157a3b6f4d1c54071a58 | C++ | dalalsunil1986/OnlineJudge-Solution | /UVa Online Judge/uva 10226.cpp | UTF-8 | 619 | 2.71875 | 3 | [] | no_license | #include<iostream>
#include<map>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
int tc;
//string s;
cin>>tc;
getchar();
getchar();
while(tc--)
{
map<string,int>dict;
string s;
int total = 0;
while(getline(cin,s))
{
... | true |
9f51f742dd86b4c78676d92162f92eedce2ec31f | C++ | cwlseu/Algorithm | /cpp/AcceleratCPP/Chapter4/CStackWithMin.cpp | UTF-8 | 2,637 | 3.96875 | 4 | [] | no_license | /**
* 讨论:如果思路正确,编写上述代码不是一件很难的事情。但如果能注意一些细节无疑能在面试中加分。
比如我在上面的代码中做了如下的工作:
· 用模板类实现。如果别人的元素类型只是int类型,模板将能给面试官带来好印象;
· 两个版本的top函数。在很多类中,都需要提供const和非const版本的成员访问函数;
· min函数中assert。把代码写的尽量安全是每个软件公司对程序员的要求;
· 添加一些注释。注释既能提高代码的可读性,又能增加代码量,何乐而不为?
总之,在面试时如果时间允许,尽量把代码写的漂亮一些。说不定代码中的几个小亮点
就能让自己轻松拿到心仪的Offer。
*/
#include <deque>
#i... | true |
aec518427be7acad4c994f1099af0c5a84bceda1 | C++ | shahed-shd/Online-Judge-Solutions | /UVa-Online-Judge/121 - Pipe Fitters.cpp | UTF-8 | 541 | 3.171875 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const double K = 2/sqrt(3.0);
int calc_skew(double a, double b)
{
int col = int(b);
int row = 1 + K*(a-1);
return row * col - ((b - int(b) < 0.5)? row/2 : 0);
}
int main()
{
double a, b;
while(scanf("%lf %lf", &a, &b) ... | true |
dc4b5335c2a8e5be2f5b7acfb30c286b418158fb | C++ | zehuichen123/DataStructure_homework | /homework9.cpp | UTF-8 | 5,670 | 4.09375 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Node{
public:
Node():left(NULL),right(NULL){} //初始化让左右两个节点为NULL
~Node(){}
Node* left; //指向左子节点
Node* right; //指向右子节点
int value; //保存该节点的值
};
class bTree{ ... | true |
a2abb508892da4206745351d3beffa01c43626de | C++ | AbelDeLuna/CSUSM | /CS311/HW7Part2/llist.h | UTF-8 | 2,100 | 4 | 4 | [] | no_license | #ifndef LLIST_H
#define LLIST_H
#include <vector>
typedef char el_t;
using namespace std;
// The single Linked List class
// Data members are marked "protected" instead of "private" for use in later classes.
class llist
{
protected:
// The basic building block of a Linked list is a node.
// A node has some pi... | true |
574427ae1a8b0db9feae87ae8e8634aacf113f7e | C++ | 1432junaid/quarentine | /online-classes/virtual_demo.cpp | UTF-8 | 532 | 3.34375 | 3 | [] | no_license | #include<iostream>
using namespace std;
class base{
public:
virtual void printer(){ //printer1
cout<<"Printer of base "<<endl;
}
void display(){
cout<<"Display of base"<<endl;
}
};
class derived:public base{
public:
void printer(){
cout<<"Printer of derived "<<endl;
}
virtual void display(){ //we... | true |
39e4e185b3b7e89d7a101bf291e7ee4c9a6ef73d | C++ | liruqi/topcoder | /POJ/2559/12349638_AC_141MS_1860K.cc | UTF-8 | 1,226 | 2.65625 | 3 | [] | no_license | //Problem: 2559 User: himdd
//Memory: 1344K Time: 141MS
//Language: C++ Result: Accepted
//Source Code
#include<iostream>
#include<stdio.h>
using namespace std;
const int A=100005;
struct{
long long h;
int id;
}st[A];
long long h[A];
int main()
{
//freopen("1.txt","r",stdin);
int n;
while(scanf... | true |
5b7cf3dc780fc6581a0cfabe6e864529a948e942 | C++ | programowanie-obiektowe-cpp-classes/kolokwium-1a-paulass97 | /include/zad3.hpp | UTF-8 | 448 | 2.59375 | 3 | [] | no_license | #include "zad1.hpp"
#include <cstdint>
#include <functional>
• przyjmuje jako drugi argument stałą referencję do obiektu typu, którym jest sparametryzowany (obiekt ten reprezentuje sos)
• zwraca obiekt typu std::size_t, będący wynikiem wywołania metody polej drugiego argumentu na pierwszym argumencie (załóż, że typ ... | true |
882145fa3379be2e7a1c9725af5d64c49c0b55e2 | C++ | iujaypuppy/LeetCode | /zyy/462.cpp | UTF-8 | 322 | 2.671875 | 3 | [] | no_license | class Solution {
public:
int minMoves2(vector<int>& nums) {
sort(nums.begin(), nums.end());
int mid(nums[nums.size() / 2]);
int moves(0);
for (vector<int>::iterator i(nums.begin()); i != nums.end(); i++) {
moves += abs(*i - mid);
}
return moves;
}
}... | true |
d4be922a2b2e9ca7aa6994b7e51c2ff7e7f1ca7e | C++ | rid-32/avr-timer1 | /lib/Led/Led.cpp | UTF-8 | 280 | 2.8125 | 3 | [] | no_license | #include "Led.hpp"
using namespace led;
Led::Led(volatile uint8_t *port, uint8_t pin) {
this->port = port;
this->pin = pin;
/* set DDRx register */
*(port - 1) |= 1 << pin;
/* set PORTx register */
*port &= ~(1 << pin);
}
void Led::toggle() { *port ^= 1 << pin; }
| true |
dd0dbec511cd8f08a6993a69dccee87dd4302afe | C++ | ghali/gcb | /GLOW/07/04-float-to-binary/04-float-to-binary.cpp | UTF-8 | 1,935 | 3.03125 | 3 | [] | no_license | /* The following code example is described in the book "Introduction
* to Geometric Computing" by Sherif Ghali, Springer-Verlag, 2008.
*
* Copyright (C) 2008 Sherif Ghali. This code may be freely copied,
* modified, or republished electronically or in print provided that
* this copyright notice appears in all... | true |
770d73cef50717da05ea11d8fe0dc2b5e3409751 | C++ | rakhils/SpecialTopic | /Engine/Code/Engine/Time/Clock.hpp | UTF-8 | 1,445 | 2.671875 | 3 | [] | no_license | #pragma once
#include <stdint.h>
#include <vector>
#include <vcruntime_string.h>
#include "Engine/Core/Time.hpp"
/*\class : Clock
* \group : <GroupName>
* \brief :
* \TODO: :
* \note :
* \author : Rakhil Soman
* \version: 1.0
* \date : 3/6/2018 4:15:45 PM
* \contact: srsrakhil... | true |
59bd3e11822480079439645c1f219f01c3a8b709 | C++ | quadhier/KidFTP | /ftpsession.h | UTF-8 | 371 | 2.546875 | 3 | [] | no_license | #ifndef FTPSESSION_H
#define FTPSESSION_H
#include "ftpuser.h"
#include <string>
class FTPSession
{
public:
FTPSession() { }
FTPSession(const FTPUser *user, std::string cwd, int cmd_sock, int data_sock) : user(user), cwd(cwd), cmd_sock(cmd_sock), data_sock(data_sock) { };
const FTPUser *user;
std::string cwd;
... | true |
237ebb6839013a93275dfe008946b33d847a555d | C++ | sgc109/acm-icpc-teamnote | /tree/lowest-common-ancestor.cpp | UTF-8 | 1,509 | 3.25 | 3 | [] | no_license | /*
주의 사항
1. 노드 번호는 0번 부터 시작
*/
class LCA {
vector <vector<int>> G, par;
vector<int> dep;
int root, size, depLog;
public:
LCA(int size, int root) {
this->root = root;
this->size = size;
depLog = 1;
int sz = 1;
while (sz < size - 1) depLog+... | true |
7e45cd1bb16a1bbe6cd9b7ed6cde2d8c54410a5a | C++ | polBachelin/BomberVerse | /src/gameEngine/objects/Moveable.cpp | UTF-8 | 1,939 | 2.875 | 3 | [] | no_license | /*
** EPITECH PROJECT, 2021
** Indie_Studio
** File description:
** Moveable
*/
#include "Moveable.hpp"
using namespace gameEngine::objects;
Moveable::Moveable(const std::string &id) : AGameObject(id)
{
}
Moveable::~Moveable()
{}
Vector3T<float> Moveable::getSpeed() const noexcept
{
return _speed;
}
void Move... | true |
d020f881f7129d965c2af225913910084d6ec251 | C++ | SanyaAttri/LeetCode | /01283. Find the Smallest Divisor Given a Threshold.cpp | UTF-8 | 2,018 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <numeric>
using namespace std;
/**
*
*
1283. Find the Smallest Divisor Given a Threshold
Given an array of integers nums an... | true |
8bbce2be389bd0f6bfa54b5b161d95ce9747fbdf | C++ | Tasselmi/algorithms_in_cpp | /chapter09/ArrayQueue.h | UTF-8 | 2,737 | 3.59375 | 4 | [] | no_license | //
// Created by Tasselmi liang on 2020/6/24.
//
#ifndef ALGORITHMS_IN_CPP_ARRAYQUEUE_H
#define ALGORITHMS_IN_CPP_ARRAYQUEUE_H
#include <sstream>
#include "../exception/myExceptions.h"
#include "Queue.h"
using namespace std;
template<typename T>
class ArrayQueue : public Queue<T>
{
private:
int theFront;
int... | true |
296cb65a28d076c8ec5766ffaa9b419adc79f3ae | C++ | raulsg3/TrueInferno | /galeon/Src/Graphics/Scene.h | UTF-8 | 7,997 | 3.015625 | 3 | [] | no_license | //---------------------------------------------------------------------------
// Scene.h
//---------------------------------------------------------------------------
/**
@file Scene.h
Contiene la declaraci�n de la clase contenedora de los elementos
de una escena.
@see Graphics::CScene
@author David Llansó
@date Ju... | true |
618e0638645b743db095e2a69530669ac0084b0d | C++ | rscalt/SUSU_CPP_LAB | /labs_C1_S1/listings/control/practice/T10-0.cpp | UTF-8 | 14,639 | 3.046875 | 3 | [] | no_license | /* Валяльная фабрика производит валенки.
Данные об объемах сбыта продукции и о ценах продаж за прошлый год помесячно
хранятся в файле в виде таблицы.
При подведении итогов года необходимо выяснить динамику сбыта, то есть найти и упорядочить по убыванию информацию о прибылях, приносимых производством.
Использовать фу... | true |
ec8b49399b446c6728185084a724a996e43d7e7a | C++ | Ta-ma/TP3---C | /Ejercicio 5/cliente.cpp | UTF-8 | 4,335 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <string>
#include <signal.h>
#include <semaphore.h>
#incl... | true |
72ceb559a319f1fb4534c773846fae2a99949b13 | C++ | artHub-j/JUTGE | /X59210/solution.cpp | UTF-8 | 552 | 2.828125 | 3 | [] | no_license | #include "llista.hpp"
#include <iostream>
using namespace std;
Llista::Llista(const vector<int> &v) : _long(v.size())
// Pre: True
// Post: El p.i. conté els elements de v amb el mateix ordre.
{
_prim = new node;
_prim->info = 0;
_prim->seg = NULL;
if (not v.empty())
{
node *pant = _prim;
... | true |
8f6aa023c8f3eeb574b33edc0cb954d4e74a458d | C++ | wzj1988tv/code-imitator | /data/dataset_2017/dataset_2017_8_formatted_macrosremoved/zhiheng3/5304486_5697460110360576_zhiheng3.cpp | UTF-8 | 2,146 | 2.5625 | 3 | [] | no_license | #include <cstring>
#include <iostream>
using namespace std;
int R[50];
int Q[50][50];
int n;
int d[201][201];
int match[201];
bool visited[201];
bool matching(int k) {
for (int i = 0; i < n; ++i) {
if (d[k][i] && !visited[i]) {
visited[i] = true;
if (match[i] == -1 || matching(match[i])) {
... | true |
171528a30c79393969613b76ffd710c59f7b1260 | C++ | Zoruk/labos-asd2 | /Labo 5/Code/ASD2_Labo5/wrongword.h | UTF-8 | 675 | 2.828125 | 3 | [] | no_license | #ifndef WRONGWORD_H
#define WRONGWORD_H
#include <string>
#include <array>
#include <list>
#include <iostream>
#include "worddictionary.h"
class WrongWord
{
friend std::ostream& operator<<(std::ostream& out, const WrongWord& wrongWord);
public:
typedef std::array<std::list<std::string>, 4> Possibilities;
... | true |
133de7e18e7e605f0ab85670e0d8b86841f0b55c | C++ | BiomedNMR/aura | /include/boost/aura/backend/cuda/call.hpp | UTF-8 | 1,096 | 2.5625 | 3 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #ifndef AURA_BACKEND_CUDA_CALL_HPP
#define AURA_BACKEND_CUDA_CALL_HPP
#include <stdio.h>
/// check if a call returned error and throw exception if it did
#define AURA_CUDA_SAFE_CALL(call) { \
CUresult err = call; \
if (err != CUDA_SUCCESS) { \
printf("CUDA error %d at %s:%d\n", err, __FILE__, __LINE__ ); \
... | true |
e17fee4c81f67a70cd4d7d0344f6af29cff94ee9 | C++ | kolibreath/HomeWorks | /CppClass/C++进阶二/CRect.cpp | UTF-8 | 747 | 3.125 | 3 | [] | no_license | #include "CRect.h"
Rect::Rect() {}
Rect::Rect(string stype) {
this->type = stype;
}
void Rect::setRect()
{
setGraph();
cout<<"please input the width"<<endl;
int w;
cin >> w;;
width = w;
cout << "please input the height" << endl;
int h;
cin >> h;
height = h;
}
void Rect::show()
{
... | true |
fe9a36c814c780170bfe32dafd39c05ffc73ba34 | C++ | CloudNartiveProjects/SEAL | /native/src/seal/randomgen.h | UTF-8 | 21,208 | 2.890625 | 3 | [
"MIT",
"CC0-1.0"
] | permissive | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#pragma once
#include "seal/dynarray.h"
#include "seal/memorymanager.h"
#include "seal/version.h"
#include "seal/util/common.h"
#include "seal/util/defines.h"
#include <algorithm>
#include <array>
#include <cstddef>
#inclu... | true |
3c4106df1dc4a3e2e3d0f6f8fb8e9ff58a340171 | C++ | bbkgl/bbkgl | /src/net/EventLoopThreadPool.cpp | UTF-8 | 1,168 | 2.984375 | 3 | [
"MIT"
] | permissive | //
// Created by bbkgl on 19-4-3.
//
#include "EventLoopThreadPool.h"
#include "EventLoop.h"
#include "EventLoopThread.h"
EventLoopThreadPool::EventLoopThreadPool(EventLoop *loop) :
base_loop_(loop),
started_(false),
num_threads_(0),
next_(0)
{}
EventLoopThreadPool::~EventLoopThreadPool()
{
// 这里... | true |
6841c6912421a94575e7fa1e96d24889e78d71d2 | C++ | grzesiakm/OOP1 | /Bubble/Calc_error.h | UTF-8 | 1,286 | 3.078125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <vector>
#include <string>
#include <exception>
//static int value of levels
int LicznikPoziomow::lvl = 0;
//this class shows the number of line and file name where the error occured, as well as reason to throw exception
class Calc_error : public std::runtime_error {
public:
... | true |
9320c85c948500b6a11508355414d60ee72383e8 | C++ | qualab/dot | /include/dot/box.h | UTF-8 | 12,983 | 3.234375 | 3 | [
"MIT"
] | permissive | // dot::box<slim> contains value of slim type
// which size allows ot store it in-place (by value)
// this is suitable for simple values and small structures
// data class box<slim>::cat is simply contain its value
#pragma once
#include <dot/object.h>
#include <utility>
#include <new>
namespace dot
{
// base cla... | true |
31338b1a7ed98729f4dbbd31adc3adc56d1a0f62 | C++ | mambolevis/tcpppl | /test/adl.cpp | UTF-8 | 2,019 | 2.953125 | 3 | [
"MIT"
] | permissive | // Created by Samvel Khalatyan on Jan 29, 2014
// Copyright (c) 2014 Samvel Khalatyan. All rights reserved
//
// Use of this source code is governed by a license that can be found in
// the LICENSE file.
#include <iostream>
using namespace std;
namespace base
{
struct Struct {};
void a(const Struct &)
{... | true |
77c06e6bd9e500bee18516e027802a9e4886b967 | C++ | rjindel/OnlineServices | /OnlineService/Utils.h | UTF-8 | 666 | 2.9375 | 3 | [] | no_license | //-------------------------------------------------------------------------
//
// File: Utils.h
//
// helper functions
//
//--------------------------------------------------------------------------
#pragma once
#include "stdafx.h"
namespace Utils
{
//Convert a single ascii character to a 4 bit hex value
//If the ch... | true |
c127fcf9d2b62d5043bdad98c6492cb9a8628733 | C++ | mhorowitzgelb/TinyRendererWindowsApp | /TinyRendererWindowsApp/gaurad_shader.h | UTF-8 | 755 | 2.515625 | 3 | [] | no_license | #pragma once
#include "SimpleGraphics.h"
#include "model.h"
/*
namespace simple_graphics {
class GauraudShader :
public IShader
{
public:
GauraudShader() = delete;
~GauraudShader() = default;
explicit GauraudShader(Model* model, TGAImage* texture, const Vec3f& light_direction... | true |
182c31cb4ab16e2f63d254943ecf0909ff305c6b | C++ | ivokaragyozov/Programming-Contests | /CodeForces/Round#253_DIV2/a.cpp | UTF-8 | 422 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
bool used_letters[26];
int size_s, ans;
string s;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
getline(cin, s);
size_s = s.size();
for(int i = 0; i < size_s; i++)
{
if(s[i] >= 'a' && s[i] <= 'z')
{
if(!used_letters[s[i] - '... | true |
c4630cd658732da62c75d274bca917a8bdc537a3 | C++ | ericgu/ESP8266Animation | /SingleColor.h | UTF-8 | 902 | 2.90625 | 3 | [] | no_license | class SingleColor: public Animation
{
private:
Adafruit_NeoPixel* _pStrip;
Mapper* _pMapper;
Pixel _pixel;
Chunk* _pChunk;
RGBColor _color;
public:
SingleColor(Adafruit_NeoPixel* pStrip, RGBColor color)
{
_pStrip = pStrip;
_color = color;
_pMapper = new Mapper(_... | true |
7aaf38cec30ab11428f7df9289a37daf15c09b6a | C++ | 18600130137/leetcode | /LeetCodeCPP/264. Ugly Number II/main.cpp | UTF-8 | 864 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | //
// main.cpp
// 264. Ugly Number II
//
// Created by admin on 2019/7/2.
// Copyright © 2019年 liu. All rights reserved.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int nthUglyNumber(int n) {
vector<int> helper{1};
int i2=0,i3=0,i5=0;
for(int ... | true |
3b8f5834cb9a65efd9d7bb489071de241e57f6e7 | C++ | natemc/qiss | /src/key.cpp | UTF-8 | 1,426 | 2.640625 | 3 | [
"MIT"
] | permissive | #include <key.h>
#include <exception.h>
#include <limits>
#include <numeric>
#include <ukv.h>
namespace {
template <class X> using OT = ObjectTraits<X>;
template <class X> L<X> iota(index_t n) {
L<X> r(n);
std::iota(r.begin(), r.end(), X(0));
return r;
}
}
L<J> Til::operator()(ind... | true |
4a07a1d77b55a634947f633164b0591a44d2f750 | C++ | Kewenjing1020/C-Primer | /chap3/chap3.cpp | UTF-8 | 2,536 | 3.390625 | 3 | [] | no_license | //writen by Ke Wenjing,19/11/2015
//C++ Primer, chap3
//including using, string, vector, iterator, bitset
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
using std::bitset;
using std::vector;
using std::string;
using std::cin;
using std::cout;
using std::endl;
int main(){
// string... | true |
7a1e8695c507312ec70a497f32549e65c29a5ace | C++ | grayengineering425/HomeAiAutomation | /VideoStream/VideoStream/Camera.cpp | UTF-8 | 1,868 | 2.703125 | 3 | [] | no_license | #include "Camera.h"
#include "Frame.h"
#include <filesystem>
ICamera::ICamera () = default;
ICamera::~ICamera() = default;
bool ICamera::isActive() const { return active; }
//-------------------------------------------------------------//
Camera::Camera(int cameraIndex, std::string name)
: ICamera ()
, windowN... | true |
43b952d5b9a982261e5f01ba8383a8b956d8ab6f | C++ | LuHeFr/cpp-course | /05_rational/rational.cpp | UTF-8 | 133 | 3.171875 | 3 | [] | no_license | unsigned int gcd(unsigned int x, unsigned int y) {
while (y != 0) {
auto tmp = y;
y = x % y;
x = tmp;
}
return x;
} | true |
519cc4b5418e49a52921543bb38b8e9b5ebcf73b | C++ | snow-cube/Luogu_OJ_code | /P1423.cpp | UTF-8 | 278 | 2.65625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
double goal, length = 2, step_len = 2;
int steps = 1;
cin >> goal;
while (length < goal) {
step_len *= 0.98;
length += step_len;
steps++;
}
cout << steps;
return 0;
} | true |
964377260a04b79e21b439bdf26e657cfa2acb1e | C++ | bit-zll/cpp | /20200731/test.cpp | GB18030 | 3,342 | 3.46875 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS 1
#include "Student.h"
#include <iostream>
#include <string.h>
using namespace std;
//class A1
//{
//public:
// void f1(){}
//private:
// int _a;
// char _b;
//};
//class A2
//{
//public:
// void f2(){}
//};
//class A3
//{};
//struct A
//{
// int a;
// char b;
// double c;
// char d;
//... | true |
84a5fa380147224637425dd051458f6bd3c52295 | C++ | ddarkclay/programming-cookbook | /C++ Programs/Class/18_areaofcircle.cpp | UTF-8 | 519 | 3.125 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
class aoc
{
private:
int r;
float pi,area;
public:
void check()
{
pi=3.14;
cout<<"Enter the radius of a circle : ";
cin>>r;
area... | true |
410d3ffb1c147b2cb541ccc346d5ec0dfdf26f27 | C++ | TzeHimSung/AcmDailyTraining | /Leetcode/1248.cpp | UTF-8 | 360 | 2.734375 | 3 | [] | no_license | class Solution {
public:
int numberOfSubarrays(vector<int> &nums, int k) {
vector<int> cnt(nums.size() + 1, 0);
int currSum = 0, ans = 0;
cnt[0] = 1;
for (auto x : nums) {
currSum += x & 1;
cnt[currSum]++;
if (currSum >= k) ans += cnt[currSum - k];... | true |
607b13547a01d88aca56040a3a94b160c7795237 | C++ | monsty/licenserecognizer | /Server/myclient.cpp | UTF-8 | 2,880 | 2.59375 | 3 | [] | no_license | #include "myclient.h"
MyClient::MyClient(QObject *parent) :
QObject(parent)
{
QThreadPool::globalInstance()->setMaxThreadCount(5);
isLoggedIn = false;
}
void MyClient::SetSocket(int Descriptor)
{
socket = new QTcpSocket(this);
connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
con... | true |
8d89e93f290528c2a1d59d2d24eb6f3b50c9d431 | C++ | khlebous/milling-machine-5C | /Engine/src/Graphics/Buffers/VertexBuffer.h | UTF-8 | 2,202 | 2.671875 | 3 | [] | no_license | #pragma once
#include "pch.h"
namespace fe
{
class VertexBuffer
{
private:
Microsoft::WRL::ComPtr<ID3D11Buffer> buffer;
UINT stride;
UINT vertexCount = 0;
public:
VertexBuffer() {}
ID3D11Buffer* Get()const
{
return buffer.Get();
}
ID3D11Buffer* const* GetAddressOf()const
{
return buffer.... | true |
aee3de71a738fd1965e6fdbffa1c85e727016dce | C++ | gzhang8/klg2oni | /src/Utils/Resolution_depre.h | UTF-8 | 1,684 | 2.515625 | 3 | [] | no_license | /*
* This file is part of ElasticFusion.
*
* Copyright (C) 2015 Imperial College London
*
* The use of the code within this file and all code within files that
* make up the software that is ElasticFusion is permitted for
* non-commercial purposes only. The full terms and conditions that
* apply to the cod... | true |
602c7a911a4bcd26139b4148ec7b2b97a2b0da0e | C++ | jackiechen0708/Algorithm | /sort/MergeSort.cpp | UTF-8 | 845 | 3.265625 | 3 | [] | no_license | //
// Created by JackieChen on 16/10/13.
//
#include "MergeSort.h"
#include <iostream>
void MergeSort::merge(int *a, int p, int q, int r) {
int left[q-p+1+1];
int right[r-q+1];
//Copy Thus O(n)
for(int i=0;i<q-p+1;i++){
left[i]=a[p+i];
}
for(int i=0;i<r-q;i++){
right[i]=a[q+1+i... | true |
9e1466eebbcd292563bf8bc3354871fc817e3b83 | C++ | artash/sandbox | /algo/quick_sort.cpp | UTF-8 | 1,770 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cassert>
template<typename T>
void printArray(const std::vector<T>& vec)
{
std::copy(vec.begin(), vec.end(), std::ostream_iterator<T>(std::cout, " "));
std::cout << std::endl;
}
template<typename T>
void swap(T& a, T& b)
{
T t... | true |
3e82d81ea54830cc460a673f1a3ea955dbd71a32 | C++ | JaiAravindh-git/HactoberFest21 | /LeetCode Problems/C++/Minimum Absolute Difference in BST.cpp | UTF-8 | 447 | 3.0625 | 3 | [
"Unlicense"
] | permissive | class Solution {
public:
void inorder(TreeNode* root,vector<int> &v)
{
if(root==NULL)
return;
inorder(root->left,v);
v.push_back(root->val);
inorder(root->right,v);
}
int getMinimumDifference(TreeNode* root) {
vector<int> v;
inorder(root,v);
... | true |
8ce19352ea77f7055bfe25856e468b5583ee16a9 | C++ | nnghsa/Reactor | /ThreadPoll.h | UTF-8 | 1,313 | 2.65625 | 3 | [] | no_license | #pragma once
#include"EventHandler.h"
#include<pthread.h>
#include<functional>
#include<memory>
#include<vector>
const int THREADPOOL_INVALID = -1;
const int THREADPOOL_LOCK_FAILURE = -2;
const int THREADPOOL_QUEUE_FULL = -3;
const int THREADPOOL_SHUTDOWN = -4;
const int THREADPOOL_THREAD_FAILURE = -5;
const int THRE... | true |
39b4c34c8b5af7238767f1f91852e3587ad0944d | C++ | jxie418/leetcodecpp | /palindromenumber.cpp | UTF-8 | 417 | 3.546875 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Solution {
public:
bool isPalindrom(int x) {
if (x < 0)
return false;
int k = x;
int v = 0;
while(k > 0) {
v = v * 10 + k % 10;
k /=10;
}
return x == v;
}
};
int main() {
Solution s;
cout << s.isPal... | true |
a184d5060b21b1bb6918669d0b1a0970f227a3f7 | C++ | mstmkn67/pem | /src/Frame.h | UTF-8 | 408 | 2.609375 | 3 | [] | no_license | #ifndef _FRAME_H_
#define _FRAME_H_
#include "Vector3d.h"
#include <cmath>
using namespace std;
class Frame{
public:
Frame();
Frame(const Vector3d& u1,const Vector3d& u2);
virtual ~Frame();
//
virtual void update();
virtual Vector3d operator()(int i)const;
Vector3d u1,u2,u3;
protected:
... | true |
cc56bee824cc69a6ea72786bec27d0b006536d49 | C++ | tobyrobb/Xbee-Parachute | /ParachuteRX.ino | UTF-8 | 2,191 | 2.8125 | 3 | [] | no_license | // T robb
// for the arduino nano
#include <Servo.h>
#define servoPin 9
#define speakerPin 4
#define ledHeartbeatPin 5
#define ledActivationPin 6
#define buttonPin 7
Servo myservo; // create servo object to control a servo
int openPos = 0; // variable to store the servo position
int closePos = 180; // va... | true |
73a2c04f5eba2f3b6801adfa888ff9f93149c8fa | C++ | laughtrey/cis202 | /Midterm/addresslisting.h | UTF-8 | 388 | 2.703125 | 3 | [] | no_license | #ifndef ADDRESSLISTING_H
#define ADDRESSLISTING_H
#include <iostream>
#include <string>
class AddressListing {
private:
std::string m_name, m_address;
public:
AddressListing(const std::string& name, const std::string& address);
void set_name(const std::string& name);
void set_address(const std::string& address);
std::... | true |
cff9e6c30da66e0ac8450ff712bebd74c21fa6a3 | C++ | marehr/cpp_template_external_linkage_test | /my_class.hpp | UTF-8 | 271 | 3.140625 | 3 | [] | no_license |
template <typename value_t>
class my_class
{
public:
my_class(value_t value) : _value{value}
{};
value_t value()
{
return _value;
}
private:
value_t _value;
};
extern template class my_class<char>;
extern template class my_class<int>;
| true |