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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8add3014a00d917ced540869982bea0038c329aa | C++ | 404845560/Code | /HeapSort/HeapSort.cpp | GB18030 | 1,173 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
template<class T>
void AdjustDown(vector<T> &vec, int k, int len){
//kԪµ
vec[0] = vec[k]; //ݴ
int i;
for (i = 2*k; i <= len; i*=2)
{
if (i < len&&vec[i] < vec[i + 1]) i++; //ȡkeyϴӽڵ±
if (vec[0] >= vec[i]) break; //ɸѡ
else{
v... | true |
0b4ebe7da7d7bd99ab8fa5bc27d9b730d261f48a | C++ | Aria-K-Alethia/Sudoku | /SE-Single-Project[测试用]/Output.cpp | UTF-8 | 834 | 2.9375 | 3 | [] | no_license | #include "stdafx.h"
#include "iostream"
#include "Output.h"
using namespace std;
/*
@overview:this file implement the class Output in Output.h
*/
Output::Output()
{
}
void Output::error(int code)
{
/*
@overview:showing error info on screen corresponding to the code.
*/
if (code == 1) cout << "Error code 1:bad... | true |
b4a732125d4d4296b830fa5e976d2b6b7c1fd749 | C++ | SOFTK2765/PS | /BOJ/2596.cpp | UTF-8 | 1,423 | 2.578125 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
int main()
{
int n, tf=0;
scanf("%d", &n);
char a[61], t[61], p[11];
memset(a, 0, sizeof(a));
memset(p, 0, sizeof(p));
scanf("%s", a);
int l=strlen(a);
for(int i=0;i<l/6;i++)
{
strncpy(t, a+i*6, 6);
if(strcmp(t, "000000")==0) p[i]='A';
else if(strcmp(t, "001111")==... | true |
b7c4512cf8205c0db45fffd09e85f6331eb483f0 | C++ | rathoresrikant/HacktoberFestContribute | /rmvowel.cpp | UTF-8 | 407 | 3.25 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
bool is_vow(char c)
{
return (c == 'a') || (c == 'e') ||
(c == 'i') || (c == 'o') ||
(c == 'u');
}
void removeVowels(string str)
{
printf("%c", str[0]);
for (int i = 1; str[i]; i++)
if ((!is_vow(str[i - 1])) ||
(!is_vow(str[i])))
printf("%c",... | true |
54fb31f29f164ce5397bb36ea1f0b9838ee8734e | C++ | johan-bjareholt/cpp-playground | /DV1537/Inlämningar/Inlämning IA/CellularPhone.cpp | UTF-8 | 1,868 | 3.390625 | 3 | [] | no_license | #include <sstream>
#include "CellularPhone.h"
CellularPhone::CellularPhone(string model, int price, string color, int amount){
this->model = model;
this->color = color;
this->price = price;
this->stock = amount;
}
CellularPhone::CellularPhone(CellularPhone& origin){
this->model = origin.getModel();
this->color ... | true |
134a68b489dbd2d7d46cf5ea17da09fbc4628dfa | C++ | honda2017/LeetCode | /Reverse Linked List.cpp | UTF-8 | 1,027 | 3.34375 | 3 | [] | no_license | //
// main.cpp
// Reverse Linked List
//
// Created by 唧唧歪歪 on 15/5/17.
// Copyright (c) 2015年 唧唧歪歪. All rights reserved.
//
#include<iostream>
#include<vector>
using namespace std;
//结构体;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution
{
public:
... | true |
533a17490bdcb37316e09bc7b7f7ce6c9ee9885d | C++ | ljalmanzar/cs480Almanzar | /PA11/src/gameDriver.cpp | UTF-8 | 6,716 | 2.578125 | 3 | [] | no_license | #ifndef __GAMEDRIVER_CPP_
#define __GAMEDRIVER_CPP_
#include "gameDriver.h"
GameDriver::GameDriver(){
//constructor
}
GameDriver::~GameDriver(){
//deconstructor
//destroy everything
for( unsigned int i = 0; i < _mazes.size(); i++ ){
delete _mazes[i];
}
for( unsigned int i = 0; i < _balls.size(); i++ ){
del... | true |
254ee71694cbf0982b2085af5d4d362f11ddcba7 | C++ | Dgut/converter3d | /converter.cpp | UTF-8 | 4,634 | 2.71875 | 3 | [] | no_license | #include "converter.h"
#include "general.h"
#include "modifier.h"
#include <array>
#include <glm/gtc/constants.hpp>
namespace Converter3D
{
// tokenizer
char* gettoken(char** str, const char* delim)
{
char* token = *str + strspn(*str, delim);
*str = *str + strcspn(*str, delim);
if (**str)
*(*str)++ = 0;
... | true |
8dc9d2277c159e1ef34e60247d96064ed7ef6cbf | C++ | ryanbujnowicz/mem | /src/lib/mem/regionReporter.h | UTF-8 | 1,049 | 2.703125 | 3 | [] | no_license | #ifndef MEM_REGIONREPORTER_H
#define MEM_REGIONREPORTER_H
#include <sstream>
#include "mem/tracking.h"
namespace {
std::string makeMemoryLeakSection(const mem::NoTracking& tracker)
{
return "";
}
std::string makeMemoryLeakSection(const mem::CountTracking& tracker)
{
std::stringstream ss;
ss << "\tU... | true |
00da8d58d16501ee1fa647ee9ee1d4a89a93c3cf | C++ | ericPrince/Probotics | /libraries/PID/PID.h | UTF-8 | 633 | 2.671875 | 3 | [] | no_license | /*
--Probotics, Princeton University--
PID.h: used for standard PID control
the main method is compute() which should
be called every time loop() runs
made for arduino 1.5.1 on Feb 4, 2013
*/
#ifndef PID_h
#define PID_h
#include <Arduino.h>
const double PWM_MAX=255;
class PID{
public:
PID(double p,double ... | true |
f460e209e9c2c955ae316f427357755f1b893c4c | C++ | Aragorn9756/CodePortfolio | /CPP/HW2 Singly Linked Lists/HW2 Singly Linked Lists/SinglyLinkedListSource.cpp | UTF-8 | 21,570 | 3.515625 | 4 | [] | no_license | //Copyright 2017, Bradley Peterson, Weber State University, All rights reserved.
#include <sstream>
#include <map>
#include <chrono>
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::stringstream;
//********************************************************************... | true |
bfff899a126bfb82ffd6e1ddf8853af73d44995c | C++ | LathaDurai/Code | /programs/binary/num_words.cpp | UTF-8 | 1,416 | 3.296875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main() {
int n;
string res ;
cin>> n;
if(n < 0 || n>9999) {
cout<<"please enter number between 0-9999\n";
exit(1);
}
string singles[] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
... | true |
93fccf9b8d1144aa161c0d2c9e961ffc3c45c825 | C++ | govg/Machine-Learning | /Random Forests/src/tree.cpp | UTF-8 | 9,263 | 2.890625 | 3 | [] | no_license | /*
This contains the definitions of all the class variables and the functions for
the class of the Tree datatype.
*/
#include "tree.hpp"
#include "typedef.hpp"
#include "splitCriterion.hpp"
#include <queue>
#include <vector>
#include <iostream>
#include <cmath>
#define DATA_MIN 3
#define NUM_CHECKS 5
... | true |
84dbc7076a35ab8beafedc1bc60e74e56535b580 | C++ | AlexP97/Juego-EDA | /AIru_6.cc | UTF-8 | 5,852 | 2.53125 | 3 | [] | no_license | #include "Player.hh"
#include <limits>
/**
* Write the name of your player and save this file
* with the same name and .cc extension.
*/
#define PLAYER_NAME ru_6
struct PLAYER_NAME : public Player {
/**
* Factory: returns a new instance of this class.
* Do not modify this function.
*/
static Player... | true |
b431c043dbf50225fb9d421b2eb4e3657ba27280 | C++ | timhang/Summer2018 | /car.h | UTF-8 | 528 | 2.734375 | 3 | [] | no_license | #ifndef CAR_H
#define CAR_H
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cstdlib>
#include <set>
class car{
public:
car(std::string make,std::string model,unsigned int year, std::string color);
~car();
const std::string get_promo() const;
private:
void add_promo(std:... | true |
f22d4ec4da1c540693e3085eb768e61eb11496c7 | C++ | jtahstu/iCode | /workspace/nyoj/src/1127.cpp | GB18030 | 3,448 | 3.03125 | 3 | [] | no_license | /**
* Project Name: nyoj
* File Name: 1127.cpp
* Created on: 2015717 8:29:02 last modify by 2015/7/20 3:12
* Author: jtahstu
* QQ: 1373758426 E-mail:1373758426@qq.com
* Copyright (c) 2015, jtahstu , All Rights Reserved.
*/
//#include<iostream>
//#include<cstdio>
//#include<cmath>
//#include<cstdlib>
... | true |
61003bc507d1ffae6b57fc23dd2d582f823ba895 | C++ | luanics/cpp-illustrated | /luanics/logging/SimpleSource.hpp | UTF-8 | 1,181 | 2.796875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "luanics/logging/Filter.hpp"
#include "luanics/logging/Record.hpp"
#include "luanics/logging/Sink.hpp"
#include "luanics/logging/Source.hpp"
#include <iostream>
#include <memory>
namespace luanics::logging {
///////////////////////////////////////////////////////////////////////////////
//////... | true |
ebb1990288c7b70bce6957128a2151026957e8ac | C++ | captn3m0/algorithms | /sorting/merge.cpp | UTF-8 | 1,313 | 3.453125 | 3 | [] | no_license | #include <math.h>
#include <iostream>
#include "../common.h"
#include <limits.h>
#define MAX_LENGTH 12
using namespace std;
void merge(int* a,int start,int pivot,int end)
{
//create left and right arrays
int left[MAX_LENGTH], right[MAX_LENGTH],i,lp=0,rp=0;
//Copy the left and right halves of a in left/right
fo... | true |
a2bc382993bbb3d29baa2f7ea49b3b8625bcb0b0 | C++ | Infamous999/Labisss | /YapisLaba7.cpp | UTF-8 | 1,551 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
double value();
double value_2();
class equation {
public:
double a;
double b;
double c;
};
int main() {
cout << "This program solves an equation of the form: a*sin(x) + b*cos(x) = c" << endl;
equation task;
task.a = v... | true |
1ede44c54082e9fdf03dacbf3bc9140849580a95 | C++ | kumbal123/test | /god1.cpp | UTF-8 | 13,294 | 2.875 | 3 | [] | no_license | #ifndef __PROGTEST__
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cassert>
#include <cctype>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
using namespace std;
#endif /* __PROGTEST__ */
class CTransaction{
private:
int m_Amount;
char * m_OtherID;
char * m... | true |
d6e11a14b1065eb377fad2d05c483bb5d3e4249f | C++ | ss9036726/Programs | /selection.cpp | UTF-8 | 2,163 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
struct node{
int data;
node *singlelink;
};
node *head; //head pointer used to store address of first node
node *q;//back tacking pointer during creation of Single linked list
void SelectionSort(node *head); //passing head node
voi... | true |
6f8ce750493fb0bb2f12aad352f881ab666aabbe | C++ | NathanCoxson/ASCII-Scrabble-Game | /210CT Task/210CT Task/Square.cpp | UTF-8 | 1,925 | 3.203125 | 3 | [] | no_license | #include "Square.h"
Square::Square() { square_type = 0; tile.letter = '_'; tile.blank = true; }
Square::Square(int type) { square_type = type; tile.letter = '_'; tile.blank = true; }
Square::Square(char currentLetter) { tile.letter = currentLetter; square_type = 0; tile.blank = false; }
Square::Square(char currentLett... | true |
a399caba281473cd97fe4c2de5b94eb696cdf997 | C++ | PoplarZhaoYang/Algorithm_problem | /game_theory/poj2484.cpp | UTF-8 | 273 | 3 | 3 | [] | no_license | #include <iostream>
class solve
{
public:
int n;
public:
void run(void){
while (std::cin >> n) {
if (!n) return;
std::cout << (n <= 2 ? "Alice" : "Bob") << std::endl;
}
}
}ac;
int main()
{
ac.run();
return 0;
}
| true |
eb04dbccc0c9600bfb8473f709fdccce896ca212 | C++ | sauloantuness/maratona | /uri2/1050.cpp | UTF-8 | 573 | 3.15625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int d;
while(cin >> d){
switch(d){
case 61 : cout << "Brasilia" << endl; break;
case 71 : cout << "Salvador" << endl; break;
case 11 : cout << "Sao Paulo" << endl; break;
case 21 : cout << "Rio de Janeiro" << endl; break;
case 32 : ... | true |
aff3fc44e9f908d7a6ccce267ac2d84a1c175f9a | C++ | Asionsolver/C-Note | /FunctionOverloading.cc | UTF-8 | 1,846 | 4.0625 | 4 | [] | no_license | /*
Function Overloading in C++
-->Function overloading is a feature of object oriented programming where two or more functions can have the same name but
different parameters.
-->When a function name is overloaded with different jobs it is called Function Overloading.
-->In Function Overloading “Function” name sh... | true |
f2063e6758f61473e7bfb42c7dbadc6ea9f812bf | C++ | KingBing/arduino-dev | /libs/SerialFlow/SerialFlow.cpp | UTF-8 | 2,285 | 2.890625 | 3 | [] | no_license | /*
SerialFlow.cpp - Communication library with packages of values.
Created by Oleg Evsegneev, September 11, 2012.
Released into the public domain.
*/
#include "SerialFlow.h"
SerialFlow::SerialFlow(int tx, int rx): _serial(tx, rx) {
_escape = 0;
_collecting = 0;
}
void SerialFlow::begin(int baud_rate) {
... | true |
94d2b1c2c05942e60a29fd5d833ef9169f484edc | C++ | Matthew-Haddad/Comp252_Final_Project | /Order_System.h | UTF-8 | 3,769 | 2.671875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <chrono>
#include <ctime>
#include "ClassTypes.h"
int userChoice;
int tableCounter = 1;
/*PROTOTYPES*/
/******************************************************************************************************... | true |
ba040083058718a1f6a841312151784bf7212fdc | C++ | ncahill-wegfliegen/gemeinsam | /uom/puom_ratio.h | UTF-8 | 5,031 | 2.9375 | 3 | [] | no_license | #pragma once
#include "puom.h"
#include "prefix.h"
#include "../utility/object.h"
#include <string>
#include <sstream>
#include <type_traits>
namespace nhill
{
namespace uom
{
template<typename Uom_numerator, typename Uom_denominator>
class Prefixed_uom_ratio : public virtual nhill::Object
{
public:
static_assert(s... | true |
fc7d566a5f05f32cc2bd343241d29b6f0b595bb7 | C++ | kohn/kohn-zoj-sol | /zoj-1879.cpp | UTF-8 | 703 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <stdio.h>
using namespace std;
bool fun(int a[3001],int n)
{
bool flag[3002];
for(int i=0;i<n;i++)
flag[i]=false;
for(int i=1;i<n;i++)
... | true |
2bae90fc502a36b800081b59ac164378ca4c7adf | C++ | koalaink/hdoj | /hdoj/1716.cpp | UTF-8 | 1,094 | 2.515625 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<set>
using namespace std;
int card[6];
bool used[6],flag;
set<int>s;
void dfs(int num,int index){
if(index==4){
s.insert(num);
return ;
}
for(int i=1;i<=4;i++){
if(!used[i]){
used[i]=true;
dfs(num*10+card[i],inde... | true |
4420efe7922794a05da1f26750cbc4beb950f061 | C++ | avs13/alarma- | /sensor/sensor.ino | UTF-8 | 1,608 | 2.625 | 3 | [] | no_license | #include <SPI.h>
#include <RF24.h>
#include "ultrasonico.h"
#include <EEPROM.h>
#define echo 3
#define triger 2
#define CE_PIN 9
#define CSN_PIN 10
#define PIR 4
byte direccion[5] = {1,1,1,1,1};
RF24 radio(CE_PIN,CSN_PIN);
int datos[2];
float distancia = EEPROM.read(0);
boolean stateAlarm = 0;
int di... | true |
fcdaac04ed129a8bd7421ed564d3a8df383d514c | C++ | MohamedLEGH/SimuElections | /media.hh | UTF-8 | 757 | 2.96875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "electeur.hh"
#include "candidat.hh"
class Candidat;
class Media
{
public:
Media(std::string name, int influence)
:_nom(name),
_influence(influence)
{
}; //
~Media()
{
} // destructeur
std::string get_name() const
{
return _nom;
}
int get_influen... | true |
1ed60c73973bec50474c56c92f770cc11ce7a271 | C++ | strymj/sylib_ros | /include/sylib_ros/MoveBaseGoal.h | UTF-8 | 1,498 | 2.640625 | 3 | [] | no_license | /**
* @file MoveBaseGoal.h
* @brief sending ROS move_base library
* @author strymj
* @date 2017.05
*/
#ifndef MOVEBASEGOAL_H_
#define MOVEBASEGOAL_H_
#include <ros/ros.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <move_base_msgs/MoveBaseActionResult.h>
#include <geometry_msgs/Pose2D.h>
#include <tf/transfor... | true |
65c6a96d1ccb1d944a0ba7dda80d9431500d8b2e | C++ | PoundKey/Algorithms | /LintCode/388. Permutation Sequence.cpp | UTF-8 | 773 | 3.359375 | 3 | [] | no_license | class Solution {
public:
/**
* @param n: n
* @param k: the k th permutation
* @return: return the k-th permutation
*/
string getPermutation(int n, int k) {
vector<bool> visited(n + 1, false);
string sol;
Permutation(n, k, sol, visited);
return sol;
}
... | true |
4e4ab613e57ddfde31eb4036eb29090dbc34306a | C++ | vugartaghiyev/e-olymp-cplus | /8532.cpp | UTF-8 | 236 | 2.734375 | 3 | [] | no_license | #include<iostream>
#include<cmath>
using namespace std;
int main(){
long long n,m;
cin>>n>>m;
for(int i=n;i<=m;i++){
cout<<(long long)pow(i,2)<<" ";
}
cout<<endl;
for(;m>=n;m--){
cout<<(unsigned long long)pow(m,3)<<" ";
}
}
| true |
91cf507c92d47511ccff0c0c74db0e7fad098547 | C++ | JayTheCoder-page/PracticeProjects | /RaoListing9p3_Constructor/RaoListing9p3_Constructor.cpp | UTF-8 | 2,981 | 4.0625 | 4 | [] | no_license | /*
* File: main.cpp
* Author: Joshua
*
* Created on June 29, 2020, 1:04 PM
*/
#include <cstdlib>
#include <iostream>
using namespace std;
void Constructor(); //Using Constructors to Initialize Class Member Variables
class Human
{
private:
string name;
int age;
public:
Human() /... | true |
3003533f4fa31e8aea37dd29313bcc9219870d34 | C++ | axshivam/AlgoRithm | /code/Palindromic_String.cpp | UTF-8 | 677 | 2.859375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
string str;
getline(cin,str);
int n=str.size();
if(n%2==0)
{
int count=0;
if(n==2)
{
if(str[0]==str[1])
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
else
{
for(int i=0;i<=(n/2);i++)
{
if(str[i]==str[n-i-1])
{
count++;
}
... | true |
be7f87e04e73c47dc4f55873920be14ae8b2c93f | C++ | adiletabs/Algos | /DataStructures/Advanced/BST.cpp | UTF-8 | 4,121 | 3.40625 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
template<typename T>
class Node {
public:
Node* left;
Node* right;
T value;
int level;
int height;
int cnt;
int subtree_size;
Node (T x = 0, int _level = 0) {
value = x;
level = _level;
height = 1;
cnt = 0;
subtree_size = 1;
left = nullptr;
right = n... | true |
5b5fd649b9c467082f3608bc48182b7b8daf1e3b | C++ | jjzhang166/GameEngine-2 | /game/game/src/Renderer/PPE/GaussianSinglePassBlur.t.h | UTF-8 | 1,336 | 2.546875 | 3 | [] | no_license | #pragma once
#include "GaussianSinglePassBlur.h"
#include "Renderer/GlMacros.h"
template<BlurAxis A>
GaussianAxisBlur<A>::GaussianAxisBlur(unsigned int width, unsigned int height)
: shader(),
fbo(), depthStencilRbo(),
colorBuffer(width, height, true)
{
shader.bind();
shader.u_ScreenSampler.uncheckedSet(0);
shade... | true |
172409d16625fbb3c59210a6ffc95f4c85d743b1 | C++ | sgumhold/cgv | /cgv/media/illum/obj_material.hh | UTF-8 | 4,404 | 2.578125 | 3 | [] | permissive | #pragma once
#include <cgv/media/illum/phong_material.hh> //@<
#include "lib_begin.h" //@<
namespace cgv { //@<
namespace media { //@<
namespace illum { //@<
///@>extension of a phong material with support for texture mapped color channels
class CGV_API obj_material : public phong_material
{
protected... | true |
caa21d0add131db6c938a3c00e5973e306304972 | C++ | aneury1/AHTTPServer2 | /src/DocumentBuilder.h | UTF-8 | 395 | 2.765625 | 3 | [] | no_license | #pragma once
#include <string>
#include <sstream>
#include <vector>
#include <unordered_map>
struct DocumentParameter {
std::unordered_map<std::string, std::string> values;
std::string toString() {
std::stringstream stream;
for (auto iter : values) {
stream << iter.first;
if (iter.second.size() > 0)
... | true |
99e92270e75d0d7f6847a9f7ee3de06a5868ca4f | C++ | AishikBarua/3rd-year-2nd-semester | /Operating System Lab/online 7(disk algo-fcfs+sstf+cscan)/cscan.cpp | UTF-8 | 1,041 | 2.578125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int heads,totalCylinderMoves=0,headPos;
cout<<"Enter number of heads:"<<endl;
cin>>heads;
cout<<"Enter initial position of head:"<<endl;
cin>>headPos;
int cylinderReq[]= {98, 183, 37, 122, 14, 124, 65, 67};
int n=8;
sort(cylinderR... | true |
473fd36405f8e39146ecb457f4346cffddbaffff | C++ | AnibalSiguenza/effectiveModernCppNotes | /item27.cpp | UTF-8 | 1,654 | 3.671875 | 4 | [] | no_license | // this item talks about the solution for the problem presented in item26 which
// is the inability to averload a universal reference function
#include <bits/stdc++.h>
// one alternative is to use tag dispath /////////////////////////////////////
template <class T> void uniRefFuncImpl(T &&x, std::false_type) {
std::... | true |
9ac0a0010fef54f121e6ab42070eae6ba058bd2a | C++ | quocdoan419/Server | /testpoint/Mojing3DHelper.h | UTF-8 | 742 | 2.84375 | 3 | [] | no_license | #include <math.h>
#include "vec.h"
typedef android::vec3_t Point3f;
typedef android::vec2_t Point2f;
typedef android::vec3_t Vector3f;
class Plane
{
private:
float a;
float b;
float c;
float d;
float m_width;
float m_height;
Point3f m_topLeft;
Point3f m_topRight;
Point3f m_bottomLeft;
... | true |
2ea2dc075cd98c0e6c828e4be2ecc2f261fe6645 | C++ | jhomble/redis | /lib_acl_cpp/samples/db/mysql_query/main.cpp | GB18030 | 5,668 | 2.765625 | 3 | [] | no_license | // mysql.cpp : ̨Ӧóڵ㡣
//
#include "acl_cpp/lib_acl.hpp"
const char* CREATE_TBL =
"create table group_tbl\r\n"
"(\r\n"
"group_name varchar(128) not null,\r\n"
"uvip_tbl varchar(32) not null default 'uvip_tbl',\r\n"
"access_tbl varchar(32) not null default 'access_tbl',\r\n"
"access_week_tbl varchar(32) not null d... | true |
3d65e0cd2234e5daff257194c8fe1e5a12f83b15 | C++ | GUET-ACM-FRESHMEN-TRAINING/10.13-18-TASK | /李明智/05分数线划定.cpp | UTF-8 | 671 | 2.796875 | 3 | [] | no_license | #include <cstdio>
#include<algorithm>
using namespace std;
struct People{
int hs;
int cj;
}people[5000];
int cmp(const People &a,const People &b)
{
if(a.cj!=b.cj)
return a.cj>b.cj;
else
return a.hs<b.hs;
}
int main()
{
int n,m,i,a,lqx,sjrs=0;
scanf("%d %d",&n,&... | true |
d7da56f65b54becf87f0d1c953a3c41397899f99 | C++ | szkutek/uni | /sem2/cpp2017/prac10/units.h | UTF-8 | 2,999 | 3.46875 | 3 | [] | no_license |
#ifndef UNITS_INCLUDED
#define UNITS_INCLUDED 1
#include <iostream>
// I would have preferred to use 'Coulomb' instead of
// 'Ampere', but 'Coulomb' is not a basic SI-unit.
// Mass/Length/Time/Current.
// kg/m/sec/ampere.
template<int M, int L, int T = 0, int I = 0>
struct si {
double val;
explicit si(d... | true |
3f43da439b667400a1a90436fd91ad171e4b5106 | C++ | alexfp95/Advanced-Algorithms-and-Data-Structures | /Templates and Exceptions/real.cpp | UTF-8 | 1,303 | 3.53125 | 4 | [] | no_license | #include "real.h"
Real::Real (float x)
{
numero_ = x;
}
Real::~Real (void){}
float Real::get_numero (void) const
{
return numero_;
}
void Real::set_numero (float dato)
{
numero_ = dato;
}
Real operator+(const Real& n1, const Real& n2)
{
return Real (n1.numero_ + n2.numero_);
}
Real operator-(const Real& n... | true |
8557b7404e7cff6d3bb18234b70f1bffccabfb89 | C++ | CyberTaoFlow/telepath | /engine/Action.h | UTF-8 | 1,783 | 3.125 | 3 | [] | no_license | #define MAX_VALUE 512
using namespace std;
// Get a vector of numbers and put them in a string sperate by commas.
void unicodeParser(vector <unsigned int> & shortVec,string & str){
size_t sizeV = shortVec.size();
size_t length = 0;
unsigned int len;
size_t i;
if(sizeV > MAX_VALUE){
sizeV = MAX_VALUE;
}
c... | true |
1f8390b0c4f2909074e81cffe38290831402e6ac | C++ | haoofXu/Cpp_EasyX_exploreMaze | /exploreMaze/main/main/Maze.cpp | GB18030 | 12,556 | 2.625 | 3 | [] | no_license |
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <graphics.h>
#include <conio.h>
using namespace std;
int* readMaze(char maze[100][100]) {
ifstream in("e:\\maze.txt");
if (!in) {
cout << "ܴļ" << endl;
return 0;
}
int raw = 0;
int column = 0;
int flag = 0;
int lengt... | true |
fdce5b75121c5681bc54fff503e991709f2b5bf2 | C++ | brokenlanceorg/owlsong | /code/cc/Matc/Domain.hpp | UTF-8 | 2,053 | 2.75 | 3 | [] | no_license | //**************************************************************************
// File : Domain.hpp
// Purpose : Declares the DomaiN class
//**************************************************************************
#ifndef __DOMAIN_HPP
#define __DOMAIN_HPP
#include"Mathmatc.hpp"
//********************************... | true |
ffd198d651e53893577c2f2df68b5d55aadb67ef | C++ | Alex-zs/c-plus | /ClassExperiment/12/Array.h | UTF-8 | 1,833 | 3.390625 | 3 | [] | no_license | #ifndef Array_h
#define Array_h
#include<cassert>
template<class T>
class Array{
private:
T * list;
int size;
public:
Array(int sz=50);
Array(const Array<T> &a);
~Array();
Array<T>& operator = (const Array<T> &rhs);
T & operator [] (int i);
const T & operator [] (int i) const;
opera... | true |
391e626da7d7ae48b07355f38897fe896530a925 | C++ | Git-HF/Algorithm-Notebook | /LeetCode/Source/mergeKLists.h | UTF-8 | 1,468 | 3.59375 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* mergeKLists(vector<ListNode*>& lists) {
return process(lists, 0, lists.size()-1);
}
ListNode* process(vec... | true |
9c54c0bd49d835d7f1892e6e0c1e7d507df50fae | C++ | oddity1427/learning_cplusplus | /book/Chapter 10 - References/test10_func.cpp | UTF-8 | 4,434 | 3.53125 | 4 | [] | no_license | //Updates from last chapter:
//updated read_double_vector to work with references and output to more appropriate places
//Because of the way I wrote most of the sorting functions to all use iterators, I don't think It's going to be that useful to try and work references into those functions
#include "test10.hpp"
#inc... | true |
c3d3b5a1e0bcb9725195a3df5c433d6b039ba1d1 | C++ | ZetcH93/DV-ALG-labb2-Sorting | /labb2/Main.cpp | UTF-8 | 1,563 | 3.8125 | 4 | [] | no_license | #include <fstream>
#include <vector>
#include <string>
#include <iostream>
#include <chrono>
#include "SortingFunctions.hpp"
vector<long int> ReadValuesFromFile(const std::string& filepath)
{
std::ifstream file(filepath);
long int number;
std::vector<long int> numbers;
while (file >> number)
numbers.push_back(n... | true |
6c455a40dba75cd052dd1bf3e1814df4a3c52b86 | C++ | gilbertoamarcon/ply | /src/H5-utils.cpp | UTF-8 | 2,136 | 2.671875 | 3 | [] | no_license | #include "H5-utils.hpp"
// H5G_LINK 0 Object is a symbolic link.
// H5G_GROUP 1 Object is a group.
// H5G_DATASET 2 Object is a dataset.
// H5G_TYPE 3 Object is a named datatype.
herr_t H5utils::load_datasets(hid_t loc_id, const char *name, void *opdata){
std::pair<Node*,H5::H5File*> *pair=(std::p... | true |
06334e82348097ae0e8e98babaa977f868dd7bee | C++ | c0508383/Battle-Simulator | /wizard.h | UTF-8 | 613 | 3.03125 | 3 | [] | no_license | #ifndef WIZARD_H
#define WIZARD_H
#include "character.h"
#include <string>
#include <iostream>
using namespace std;
struct spell{
string name;
int mana_cost, damage;
};
class Wizard : public Character{
private:
int mana, numOfSpells;
spell spells[10];
public:
Wizard(s... | true |
987415c6deedb871d4d4a17e00f52d424ea05c6a | C++ | trnthsn/VongLapPractice | /bai22.cpp | UTF-8 | 388 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int main()
{
float n = 3;
vector <float> point;
while (true)
{
cin >> n;
if (n >= 0 && n <= 10)
point.push_back(n);
if (n < 0)
break;
}
float sum;
int m = point.size();
for (int i = 0; i < m; i++)
{
sum += point[i];
}... | true |
77227bb1e7a0ad4074359e306a4215b953538714 | C++ | pradyuman-verma/CodeForcesProblems | /C/C_A_B_Palindrome.cpp | UTF-8 | 3,332 | 2.546875 | 3 | [] | no_license | //pradyuman_verma
/* When you hit a roadblock, remember to rethink the solution ground up, not just try hacky fixes */
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define ps(x, y) fixed << setprecision(y) << x
#define w(x) ... | true |
1f86a81ed9858ba8cd72583a61bdf62d01356ff1 | C++ | chenyangchenyang/ptcx | /image.h | UTF-8 | 5,258 | 2.5625 | 3 | [
"BSD-2-Clause"
] | permissive |
/*
// Copyright (c) 2002-2014 Joe Bertolami. All Right Reserved.
//
// image.h
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, thi... | true |
0fbf40f618fc600444170977e4dd358133b6f1a1 | C++ | muin99/codeforces-c-plus-plus | /50A Domino piling.cpp | UTF-8 | 231 | 2.953125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int m, n;
cin >> m>>n;
if(m*n % 2 == 0){
cout << m*n/2;
}
else{
int value;
value = (m-1)*n/2 + (n-1)/2;
cout << value;
}
}
| true |
609e11274c8839991efc8bcd2c8ed293b8b72a88 | C++ | manthenasirisha/allpractice | /PSP2 Assignment 1/psp2AssignementMain/psp2AssignementMain/psp2AssignmentSource.cpp | UTF-8 | 2,911 | 3.46875 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include <string>
#include "psp2AssignmentHeader.h"
using namespace std;
struct TimeTableCell
{
string subject;
string lecturer;
string roomNumber;
// flag to represent if a cell is free
bool isFree = true;
};
TimeTableCell timeTable[5][9];
//-------------------------------... | true |
c7cf36a2a1a2cf0d7bd0391be75876a8c9a44394 | C++ | Wqxleo/C_plus | /作业1.C整数的封装.cpp | GB18030 | 1,566 | 3.546875 | 4 | [] | no_license | #include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
class Integer
{
public:
//Ƚϼʱ
Integer(int data)
{
m_data = data;
}
Integer(char*, int);
int getValue()
{
return m_data;
}
private:
char m_str[100];
int m_data,m_r... | true |
a69bf70f69b2532babb78c220c095a046ef00405 | C++ | hrishi3390/DesginPattersInCPP | /decorator/main.cpp | UTF-8 | 1,657 | 3.765625 | 4 | [] | no_license | //
// main.cpp
// decorator
//
// Created by Hrishikesh Chaudhari on 01/01/19.
// Copyright © 2019 Hrishikesh Chaudhari. All rights reserved.
//
/*
This is the pattern where you could augement the functionlity of a class. This pattern would require you to have access to source code and then we dont modify the ori... | true |
3bcacb9fc2911ceeb9449aa887123072a0d1724c | C++ | Darling1116/Darling_1116 | /lesson_8_16/Offer_6/test_1.h | GB18030 | 1,085 | 3.734375 | 4 | [] | no_license | #pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
//1.
//1
int FindGreatestSumOfSubArray_1(vector<int> array){
if (array.empty())
return 0;
vector<int> sum;
sum.resize(array.size()); //ʼʱҪvectorʼ
sum[0] = array[0];
int max_num = sum[0... | true |
e114e97f10c28a53c2c8e7064230c42741a25f93 | C++ | sarroutbi/pexpupm | /klondike/src/OptionResetGameText.cpp | UTF-8 | 598 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include "OptionResetGameText.h"
#include "LanguageMap.h"
#include "LanguageHandler.h"
#include "ActionReset.h"
OptionResetGameText::OptionResetGameText(const std::string& text,
const uint8_t& pos) : OptionText(text, pos)
{
;
}
OptionResetGameText::~Optio... | true |
e5a563fab930bf3c6439152651661baa67fd0146 | C++ | damengzai/damengzai | /cpp/2second/infloat/infloat.cpp | UTF-8 | 284 | 3.109375 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
vector<float> v;
for (int i = 0 ; i < 5 ; i++){
float f;
cout << "please inpute a num:" << endl;
cin >> f;
v.push_back(f);
}
for (int j = 0 ; j < 5 ; j++){
cout << v[j] << endl;
}
} | true |
07b4cdaa18ae60c7cd60a6c08f01e12a154baf86 | C++ | sanlf/Super-tic-tac-toe | /src/TicTacToe.cpp | UTF-8 | 17,434 | 2.703125 | 3 | [] | no_license | #include "../include/TicTacToe.h"
/**************************************************************************************************/
TicTacToe::TicTacToe(ALLEGRO_DISPLAY* display,
ALLEGRO_EVENT_QUEUE* eventQueue,
ALLEGRO_TIMER* timer,
GameFonts fonts,
... | true |
6b5f5cc15def81ff638cf38143105d280fd0aba6 | C++ | abnayak/brainz | /InterviewBit/BinarySearch/search2d.cpp | UTF-8 | 554 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int Solution::searchMatrix(vector<vector<int> > &A, int B) {
int rowLen = A.size();;
int columnlen = A[0].size();
for (int i = 0, j=0; i < rowLen && j < columnlen; ) {
if (A[i][j] == B)
return 1;
if(... | true |
4af8d1f6816a5c4c39b014ee2369dc0cee7ef451 | C++ | zarif98sjs/Competitive-Programming | /CSES/Graph Algorithms/Flight Discount.cpp | UTF-8 | 3,491 | 2.65625 | 3 | [] | no_license |
/** Which of the favors of your Lord will you deny ? **/
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()
#define READ freopen("alu.txt", "r", stdin)
#define WRITE ... | true |
eec6f1a50ae202387208b1d99f589c5ab4fcd012 | C++ | hntk03/atcoder | /ARC/007/A.cpp | UTF-8 | 407 | 2.625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef vector<string> VS;
//container util
#define SORT(c) sort((c).begin(),(c).end())
//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main(void){
char X; cin >> X;
string s; cin >> s;
REP(i,s... | true |
17b051dab913d2164e8812283b2ade8a3dbd6967 | C++ | dnjp/OpenCVTrafficSim | /src/TrafficLight.cpp | UTF-8 | 2,372 | 3.28125 | 3 | [] | no_license | #include "TrafficLight.h"
#include <iostream>
#include <random>
template <typename T> T MessageQueue<T>::receive()
{
std::unique_lock<std::mutex> uLock(_mutex);
_cond.wait(uLock, [this] { return !_queue.empty(); });
T msg = std::move(_queue.back());
_queue.pop_back();
return msg;
}
template <type... | true |
65be26d87f1c37e7043c2f6a0658509c480afbc0 | C++ | ydzh/algorithms | /src/heap_sort.cpp | UTF-8 | 1,208 | 3.828125 | 4 | [] | no_license | #include <iostream>
#include <vector>
int LeftChild(int i)
{
return i * 2 + 1;
}
void PercDown(std::vector<int> &arr, int root, int length)
{
int child;
int tmp = arr[root];
for (; LeftChild(root) < length; root = child)
{
child = LeftChild(root);
if (child + 1 < length && arr[chil... | true |
b5cb313a906f8425a76f494f15883b17db7c91eb | C++ | mikechen66/CPP-Programming | /CPP-Programming-Principles/chapter14-graphics-design/ch14_tools.cpp | UTF-8 | 4,034 | 3.296875 | 3 | [] | no_license | #include "./ch14_tools.h"
#include <iostream>
#include <cmath>
// Ex 1 - Smiley, Frowny
Smiley::Smiley (Point p, int r) :
Circle {p, r},
left {Point{p.x-r/3, p.y-r/3}, r / 4},
right {Point{p.x+r/3, p.y-r/3}, r / 4},
mouth {p, r*2/3, 200, 340} { }
void Smiley::draw_lines () const
{
Circle:... | true |
bdb70dbf0a0a7344b32907c70286e9d2e6f88545 | C++ | WesBach/PhysicsSoftBodies | /FirstOpenGL/MoveToDistanceTime.h | UTF-8 | 631 | 2.53125 | 3 | [] | no_license | #ifndef _MoveToDistanceTime_HG_
#define _MoveToDistanceTime_HG_
#include "iCommand.h"
#include <glm\vec3.hpp>
class cGameObject;
//Distance over time
class MoveToDistanceTime : public iCommand
{
public:
MoveToDistanceTime(glm::vec3 pointToMoveTo, cGameObject* theObjectToMove, float timeItShouldTake);
~MoveToDistanc... | true |
e904b1aea615d6717c3ed81b6485c512f1ab4ab8 | C++ | sibashish99/Algo-in-C-Cpp | /others/allPointsInaStraightLine.cpp | UTF-8 | 4,075 | 2.921875 | 3 | [] | no_license | #include<iostream>
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
//Note this solution does not work for repeated inputs... pls refer to GeeksForGeeks
int coordinate(vector<int> x_cord, vector<int> y_cord)
{
int l = x_cord.size();
unordered_map<double, unordered_map<double,int>> map;
... | true |
0321ef6ee517974c31e7c05c0cb4ed6a246e9a37 | C++ | markveligod/cpp_modules | /cpp_module_04/ex02/Squad.hpp | UTF-8 | 403 | 2.859375 | 3 | [] | no_license | #pragma once
/*
**==========================
** Includes
**==========================
*/
#include "ISquad.hpp"
class Squad: public ISquad
{
private:
int count;
ISpaceMarine **units;
public:
Squad();
Squad(Squad const &other);
virtual ~Squad();
Squad &operator=(Squad const &other);
int getCount() co... | true |
f5f50fb16fd27ce46d158cbbdaa565d6f319dea5 | C++ | fernandovilarino/robolab | /Hand/Hand_code_COMPLETE/Hand_code_COMPLETE.ino | UTF-8 | 17,840 | 2.625 | 3 | [] | no_license | #include <Servo.h>
Servo myservo1;
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;
const int FLEX1_PIN = A1; // Pin connected to voltage divider output A1
const int FLEX2_PIN = A2; //
const int FLEX3_PIN = A3; //
const int FLEX4_PIN = A4; //
const int FLEX5_PIN = A5; //
int modo; //MODE C... | true |
e2fe6ed59ffc9e58e47a1ef5336ccc8fcf7c100b | C++ | shubhampal39/Coding-blockk-CPP | /number theory/gcd.cpp | UTF-8 | 245 | 3.09375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
int main()
{
int a,b;
cin>>a>>b;
int n=gcd(a,b);
cout<<"gcd"<<n<<endl;
cout<<"lcm:"<<(a*b)/n<<endl;
return 0;
} | true |
18a39f125102dff29b7ad305bad314972bfb34a7 | C++ | genie97/ALGORITHM | /BOJ_ALGORITHM/15649_N과 M (1).cpp | UTF-8 | 447 | 2.796875 | 3 | [] | no_license | #include<cstdio>
#include<vector>
using namespace std;
int num[9] = {0,};
int N, M;
vector<int> vt;
void make_perm(int cnt) {
if (cnt == M) {
for (int i = 0; i < vt.size(); i++) {
printf("%d ", vt[i]);
}
printf("\n");
return;
}
for (int i = 1; i <= N; i++) {
if (num[i] == 1)continue;
vt.push_back(i);
... | true |
defa82e949b6318f018921308b036a4c2738c795 | C++ | Paradixes/Data_Structure_Based_on_Cpp | /Priority_Calculator/main.cpp | UTF-8 | 1,876 | 3.53125 | 4 | [] | no_license | #include "Calculator.h"
using namespace std;
bool IsExp(string& x);
bool isopt(char& x);
int main()
{
int alter = 1;
while (alter != 0)
{
system("cls");
string Exp;
cout << "Please input an expression you want to calculate:\n" << " ";
getline(cin, Exp);
if (!IsExp(Exp))
{
cerr << "Wrong Expressio... | true |
c2461447b90087d7825336352e419dcb9ee77b03 | C++ | dddddhow/ResolutionAnalysis | /src/inc/sub_tools.h | UTF-8 | 2,085 | 2.59375 | 3 | [] | no_license | #pragma once
/****************************************************************************
* Filename : sub_tools.h
*
* Author : Sheng Shen
* WPI,Tongji university
*
* Copyright : 2021-
*
* Date : 2021.09.01
*
* Description:
* 程序所涉及到的一系列子函数的头文件,主要包括:
*... | true |
90210c31cf3e94052e893cefe8fd870b30103baf | C++ | seflopod/PBJsimple | /include/be/bed/stmt.h | UTF-8 | 2,687 | 2.578125 | 3 | [] | no_license | ///////////////////////////////////////////////////////////////////////////////
/// \file be/bed/stmt.h
/// \author Benjamin Crist
///
/// \brief be::bed::Stmt class header.
#ifndef BE_BED_STMT_H_
#define BE_BED_STMT_H_
#include "be/_be.h"
#include <glm/glm.hpp>
#include <string>
#include <memory>
#include <unord... | true |
a4f9cd133f4c3a479b13e54de589a4718767d906 | C++ | mariyaveleva16/OOP | /HW1/3/main.cpp | UTF-8 | 588 | 3.234375 | 3 | [] | no_license | #include "Header.h"
int main()
{
int a;
std::cout << "Enter how many rectangles you want to have in the list: ";
std::cin >> a;
double b;
double* arr;
arr = new double[a + 1];
double max = -1;
int index = 0;
for (int i = 0; i < a; i++)
{
SVG p; SVG q;
p.read();
std::cout << "Rectangle " << i << " p";
... | true |
7797ef60fc4ca5c8fd4803a270d4799ec59a0b3e | C++ | TheMarlboroMan/cheap-shooter | /class/aplicacion/escudo/escudo.cpp | UTF-8 | 6,701 | 2.59375 | 3 | [] | no_license | #include "escudo.h"
const float Escudo::MS_DESPLIEGUE_ESCUDO=500.0f; //Tiempo que tarda en desplegarse plenamente.
const float Escudo::GASTO_CARGA_SEG=250.0f; //Carga gastada en un segundo.
const float Escudo::RECUPERACION_CARGA_SEG=150.0f; //Carga recuperada en un segundo.
Escudo::Escudo()
:
//recurso(NULL),
a... | true |
c5749fdb6d06e01deafe31ea075f99bf3784f447 | C++ | yhondri/EDA | /2_3/juez/2_cuatrimestre/juez39/juez39/BookShop.h | UTF-8 | 4,022 | 2.9375 | 3 | [] | no_license | //
// BookShop.h
// juez39
//
// Created by Yhondri on 24/05/2019.
// Copyright © 2019 yhondri. All rights reserved.
//
#ifndef BookShop_h
#define BookShop_h
#include <iostream>
#include <fstream>
#include <map>
#include <unordered_map>
#include <list>
#include <stdexcept>
#include <sstream> // std::stringst... | true |
b6e88caa7221eb7a64e1ac8963ffd48830e1aad4 | C++ | Anmol2307/Codechef | /SeptCha2013/LEEXAMS.cpp | UTF-8 | 1,455 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
inline void inp(int &n ) {//fast input function
n=0;
int ch=getchar(),sign=1;
while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getchar();}
while( ch >= '0' && ch <= '9' )
n=(n<<3)+(n<<1)+ ch-'0', ch=getchar();
n=n*sign;
}
double dp[51][1<<... | true |
b6e40700b27c46d03cb252f804c34fa67c56e6e4 | C++ | pratiksaha/practice | /array/checkRotationPalindrome.cpp | UTF-8 | 1,178 | 3.875 | 4 | [] | no_license | //to check if a string is a rotation of a palindrome
//TODO: do in O(n) time using manacher's algorithm
#include<iostream>
#include<string>
using namespace std;
bool checkPalindrome(string str) {
int l = 0;
int h = str.length() - 1;
while (l<h)
if (str[l++] != str[h--])
return false;
... | true |
6e4f683e62df840ed916338e37cb57e96c73d9e5 | C++ | jaemin2682/BAEKJOON_ONLINE_JUDGE | /17362.cpp | UTF-8 | 317 | 2.625 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main() {
int n, cnt=1, val=1;
bool mode = true;
cin >> n;
while(n != cnt) {
if(cnt%8==5) mode = false;
else if(cnt%8==1) mode = true;
if(mode) val++;
else val--;
cnt++;
}
cout << val;
return 0;
} | true |
ad7a72bbf9af47f98a1b6e319033600bfac05673 | C++ | AndreyStulov/VisualStudio_project | /Shapes/Source.cpp | UTF-8 | 2,515 | 3.4375 | 3 | [] | no_license | #include<iostream>
#include<math.h>
#include<time.h>
using namespace std;
class Shape
{
public:
virtual double Area() = 0;
};
class Rectangle : public Shape
{
public:
//Constructor
Rectangle()
{
this->Side_A = (rand() % 20)+1;
this->Side_B = (rand() % 20) + 1;
}
//Getters
int Get... | true |
d531252a34e2ce9dabf97f8bef6b9f8d16333c1e | C++ | geetanshatrey/Competitive-Coding | /Code Forces/TheatreSquare.cpp | UTF-8 | 371 | 2.953125 | 3 | [] | no_license | //Link to the problem: https://codeforces.com/problemset/problem/1/A
#include<iostream>
#include <cmath>
using namespace std;
int main(){
long long int a,b,c;
long long int z;
cin>>a>>b>>c;
long double x=(double)b/c;
long double y=(double)(a-c)/c;
if(y>0){
z=ceil(x)*(1+ceil(y));
}... | true |
8e71dfbb572046783e8ea1cc3b94e64007eb7ca0 | C++ | KolHaj/Expression-Evaluation-Application | /src/parse.cpp | UTF-8 | 418 | 2.78125 | 3 | [
"MIT"
] | permissive | /*
* File: parse.cpp
* Author: Kolger Hajati
* Date: May 7, 2019
* Purpose: Parse variable names from input.
*/
#include <cctype>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
#include "parse.h"
string parseName(stringstream& ss)
{
char alnum;
string name = "";
ss >> ws;
... | true |
cd716669ddde90343458be07e41dfc4028ca4f66 | C++ | Xavota/Compiladores | /Project/Compilador/Compilador/Syn_FunctionState.cpp | UTF-8 | 9,472 | 2.65625 | 3 | [] | no_license | #include "pch.h"
#include "Syn_FunctionState.h"
#include "Syn_Parameters.h"
#include "Syn_FunctionBlock.h"
namespace Compilador
{
Syn_FunctionState::Syn_FunctionState()
{
}
Syn_FunctionState::~Syn_FunctionState()
{
}
eRETURN_STATE Syn_FunctionState::Update(AnalizadorSintactico* syntactic)
{
m_hasReturn = fa... | true |
70c50fb50eb8b2cc8ef515a21e9b81ee1f76d75c | C++ | nuttybamboo/Lextory | /reg_lexer.cpp | UTF-8 | 7,141 | 2.796875 | 3 | [] | no_license | #include "reg_lexer.h"
string Lexer::getAction(){
string value = "";
for(;peek != '\0'; peek = inbuf.nextChar()){
value += peek;
}
return value;
}
string Lexer::getDifiName(){
string value = "";
for(;peek != '\0';peek = inbuf.nextChar()){
if((peek <= 'Z' && peek >= 'A') || (peek... | true |
46fd6668687bbe0254ae37e278c7e85146565c06 | C++ | cleancoindev/ness-engine | /examples/SpaceFighter/shot.h | UTF-8 | 828 | 2.9375 | 3 | [
"Zlib",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #pragma once
#include <NessEngine.h>
// define the laser shot object that players can shoot
class LaserShot
{
private:
Ness::NodePtr m_parent;
Ness::SpritePtr m_shot;
Ness::Point m_direction_vector;
float m_time_to_live;
public:
// create the new shot instance
LaserShot(Ness::NodePtr& parentNode, const Ness::Po... | true |
e8cbd34594d50c7ad3bb98a5aeb971c13a53ee03 | C++ | StavrosBizelis/NetworkDistributedDeferredShading | /Include/Common/RenderControl/RenderPassPipeline.h | UTF-8 | 1,357 | 3.03125 | 3 | [
"MIT"
] | permissive | #pragma once
/// Render pass pipeline - holds an internal vector of render passes - the lower the index in the vector -> the earlier the render pass is going to be done
#include <vector>
#include "Common/RenderControl/IRenderPass.h"
#include "Common/MaterialControl/IMaterialManager.h"
namespace RenderControl
{
/// ... | true |
e96cdb76afd1d60d712d0b1e4875311e01dacf9e | C++ | roytam1/palemoon27 | /gfx/skia/skia/src/gpu/effects/GrConvolutionEffect.h | UTF-8 | 3,507 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrConvolutionEffect_DEFINED
#define GrConvolutionEffect_DEFINED
#include "Gr1DKernelEffect.h"
#include "GrInvariantOutput.h"
/**
* A convolution effect. The kernel ... | true |
fcdd92a7276b99173342e32fdc42b0d600126cdc | C++ | gytim/morse | /MainWindow.h | UTF-8 | 1,019 | 2.609375 | 3 | [] | no_license | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QObject>
#include <QQmlApplicationEngine>
class MainWindow : public QObject
{
Q_OBJECT
public:
explicit MainWindow(QQmlApplicationEngine *engine);
public slots:
void translateText(QString text); //!< Принимаем текст и отправляем обратно
voi... | true |
0c0f578af462493fb9085fdc925a211451d81be6 | C++ | charmdong/Algorithm_solutions_2019 | /Baekjoon/BJ16236.cpp | UHC | 2,453 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#define MAX 20
using namespace std;
int n;
int sharkSize=2, eatNum;
int dy[4] = { -1,0,0,1};
int dx[4] = { 0,-1, 1,0 };
pair<int, int> shark;
int map[MAX][MAX];
bool visited[MAX][MAX];
int bfs(int y = shark.first, int x =shark.second);
bool isI... | true |
35f14bbc798b2989137b923b558cb8f727fe1037 | C++ | suraj8730/coding | /q1_lab4.cpp | UTF-8 | 488 | 3.859375 | 4 | [] | no_license | # include <iostream>
using namespace std;
int main(){
//declaring the variable
float LENGTH;
cout <<"enter your length"<<endl;
//taking input
cin >>LENGTH;
//declaring variables for output
double METER;
double KILOMETER;
//doing operation
METER= LENGTH*0.01;
KILOMETER= LENGTH*0.00001;
//printing answer
cou... | true |