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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c45fcb98d6fbe830fdd789d7674cd153e9a36e00 | C++ | LinuxKernelDevelopment/cppprimer | /ch16/16.1/find.h | UTF-8 | 373 | 2.765625 | 3 | [] | no_license | #ifndef FIND_H
#define FIND_H
#include <set>
template <class T, typename U>
std::set<unsigned int> find(T vec, U key)
{
std::set<unsigned int> iset;
/*for (unsigned int i = 0; i <= vec.size(); i++) {
if (vec[i] == key)
iset.insert(i);
}*/
unsigned int i = 0;
for (auto tmp : vec) {
i++;
if (tmp == key... | true |
dc6a2ff3cb5fea47a4829e8f9e5c98a62578b3fb | C++ | tbfe-de/mc-cppmodern | /Exercises/06_Wednesday2_2/Airport.cpp | UTF-8 | 506 | 2.671875 | 3 | [] | no_license | #include "Airport.h"
#include "Connection.h"
using namespace std;
void Airport::addConnection(ConnectionRef c, size_t n) {
removeConnection(c);
connections.emplace_back(n, c);
}
void Airport::removeConnection(ConnectionRef c) {
connections.remove_if(
[c](const tuple<size_t, ConnectionRef> &_1) {
... | true |
4002c34998276974ab1be3cbf1b9f09786cddabf | C++ | niangu/Qt-C- | /设计模式/Memento_Pattern/memo.h | UTF-8 | 578 | 3.171875 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
class Memo;
//发起人类
class Originator{
public:
string state;
Memo* CreateMemo();
void SetMemo(Memo* memo);
void Show()
{
cout<<"状态:"<<state<<endl;
}
};
//备忘录类
class Memo
{
public:
string state;
Memo(string strState)
{
... | true |
7629fcbb1b0f0a0d82d67da9bb72d545ccb3cd0a | C++ | laurashcherbak/cpp_oop | /Lab_6_7/Lab/Predicate.h | UTF-8 | 2,960 | 3.640625 | 4 | [] | no_license | //Predicate.h
#pragma once
#include <iostream>
using namespace std;
// інтерфейс, що описує функтори - унарні предикати
template<class T>
class Predicate
{
public:
virtual bool operator () (T x) = 0;
};
// реалізуємо інтерфейс функтором - перевірка, чи значення дорівнює нулю
template<class T>
class Zero : public Pr... | true |
84085cfe284081fc141a9101c052673e8d4a3886 | C++ | mayank-75/Algorithms | /DSA/csacademy.cpp | UTF-8 | 3,654 | 3.265625 | 3 | [] | no_license | # include<bits/stdc++.h>
using namespace std ;
void generatePermutations(vector<vector<int>> &res, vector<int> comb, int index, vector<int> &v)
{
if(index >= v.size())
{
res.push_back(comb) ; return ;
}
for(int i=0;i<v.size();i++)
{
auto it = find(comb.begin(),comb.end(),i) ;
... | true |
b86c0131b13cb9585cf7c29ec6ed20b2f7b7948d | C++ | kejn/job-shop-HGA | /jobshop_HGA/src/html/PageHTML.cpp | UTF-8 | 1,509 | 2.828125 | 3 | [] | no_license | /*
* GanttHTML.cpp
*
* Created on: 20 kwi 2016
* Author: Kamil
*/
#include "../../inc/html/PageHTML.h"
#include "../../inc/html/TextContentHTML.h"
#include <sstream>
using namespace std;
void PageHTML::add(const PageHTML::Section& section,
ContentHTML * const & childElement) {
if (section == Section::... | true |
701f576b4329c9047b1af96b4122d4a4bf60943f | C++ | Aleda/libsummer | /algorithm/basic-algorithm/sort/heapsort.cpp | UTF-8 | 1,443 | 3.515625 | 4 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
using namespace std;
void print(int *a, int n)
{
for (int i = 1; i <= n; i++)
{
printf("%d ", a[i]);
}
cout << endl;
}
void heapify(int *a, int x, int n)
{
int l = x << 1;
int r = x << 1 | 1;
int largest;... | true |
1dbfec57135ce372f12a1fc051d736689c528cfc | C++ | fpischedda/ld33 | /main.cpp | UTF-8 | 649 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | #include <SFML/Graphics.hpp>
#include "director.hpp"
#include "test_scene.hpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML works!");
Director director;
TestScene scene;
director.set_scene(&scene);
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) ... | true |
cbb16f706c0a3fd578f7126717bd27b93dc6c835 | C++ | jafo2128/dht22 | /dht22.ino | UTF-8 | 2,563 | 2.734375 | 3 | [] | no_license | #include <SoftwareSerial.h>
#include <DHT22.h>
#define tx_PIN 2
#define DHT22_PIN 4
SoftwareSerial LCD = SoftwareSerial(0, tx_PIN);
DHT22 sensor(DHT22_PIN);
// since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=10; // conservative, 2 actually works
int flag = 0;... | true |
3aedd5b90f7d52bab63875c3a14fe4d2be02a143 | C++ | kamyu104/LeetCode-Solutions | /C++/maxPathSum.cpp | UTF-8 | 808 | 3.234375 | 3 | [
"MIT"
] | permissive | // Time Complexity: O(n)
// Space Complexity: O(logn)
/**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int maxPathSum(TreeNode *root) {
... | true |
9002476679b4945d16857d1579c7a851034d5301 | C++ | zetwhite/boj | /others/boj16917.cpp | UTF-8 | 324 | 2.9375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int A, B, C, X, Y;
cin >> A >> B >> C >> X >> Y;
if(A >= C*2)
A = C*2;
if(B >= C*2)
B = C*2;
if(A + B <= C*2){
cout << A*X + B*Y;
}
else{
int mix = min(X, Y);
cout << C*mix*2 + A*(X - mix) + B*(Y - mix);
}
return 0... | true |
4c6cbe770ba8853a8f24c14903847e8515ec1b8b | C++ | muffinista/palm-pitch | /Src/AI.cpp | UTF-8 | 32,042 | 2.984375 | 3 | [
"MIT"
] | permissive | #include "ComputerPlayer.h"
#include "GameManager.h"
extern GameManager *gManager;
ComputerPlayer::ComputerPlayer() : Player() {
TOLERANCE = 80;
VALUE_TOLERANCE = 80;
PARTNER_WIN_TOLERANCE = 85;
LOW_TRUMP_HOLD_VAL = (Int16)Card::five;
}
ComputerPlayer::ComputerPlayer(char c, CString name): Player(c,... | true |
03f300a3acf80e0b2af98bedf7106f2d323dcd03 | C++ | nurakib/Problems-and-Solutions | /Book-1/uva_11059_Maximum Product.cpp | UTF-8 | 732 | 3 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
long long maxProd(long long arr[], int n){
long long sum = 1, max_val = 0;
//checking all possible cases
for(int i = 0; i < n; i++){
for(int j = i; j < n; j++){
sum = sum * arr[j];
if(sum > max_val) max_val = sum;
}
... | true |
b8c841fecd375a07389989052ed3615bafe345c2 | C++ | zbream/school-work | /EECS4530/Project2/Project2/Program.cpp | UTF-8 | 8,581 | 2.59375 | 3 | [] | no_license | // Zack Ream
// EECS 4530 - Fall 2016
#include <iostream>
#include <string>
#include <GL/glew.h>
#include <GL/freeglut.h>
#include "vgl.h"
#include "vmath.h"
#include "LoadShaders.h"
float *readOBJFile(std::string filename, int &nbrTriangles, float * &normalArray);
#define BUFFER_OFFSET(x) ((const void*... | true |
82118b06bb9d831a0e4b2eb29e0bc7f6a082b595 | C++ | jzx0614/Course | /2ndhw/c09102014/exam2.cpp | BIG5 | 785 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
int f(int sum,char t[]) //1. B
{ int s=0;
for(int i=0;i<strlen(t);i++)
{
if(t[i]=='+'||t[i]=='-')
{
if(t[i+1]=='(') //3.A
{
s=atoi(t+i+2)+f(s,t+i+2);
if(t[i]=='+')
sum=sum+s;
else
sum=sum-s;
while(t[i]!=')')i++;
}... | true |
5c9706b45f2d4650b41375988b305e21d292f7b8 | C++ | murtada58/RobotCarApp | /RobotCarApp/RobotCarApp.ino | UTF-8 | 19,870 | 2.921875 | 3 | [
"MIT"
] | permissive | #include <SoftwareSerial.h>
#include <Servo.h> // include the servo libary this gives us access to functions and classes from the library
// TX and RX pin numbers
const uint8_t BLU_RX_ARD_TX = 1;
const uint8_t BLU_TX_ARD_RX = 0;
SoftwareSerial bluetooth(BLU_TX_ARD_RX, BLU_RX_ARD_TX);
Servo servosweep; // create a Se... | true |
fe21401c989e20116c6f22aa103d29a9ab7ece88 | C++ | eligantRU/TAaFL | /LW/nfa2dfa/main.cpp | UTF-8 | 6,736 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <cassert>
#include <string>
#include <vector>
#include <set>
#include "../Common/GraphizUtils.hpp"
using namespace::std;
template <class T>
void UnionSet(set<T> & targ, const set<T> & add)
{
targ.insert(add.cbegin(), add.cend());
}
struct NFA
{
vector<set<string>> states;
vector<stri... | true |
87be99f51160c5fde716cd48e2e9dc274fe46624 | C++ | DzikuVx/e45-ttl-100-base-station | /e45-ttl-100_range_test_sender.ino | UTF-8 | 1,491 | 2.828125 | 3 | [] | no_license | #define LED_PIN 13
#define UART_SPEED 57600
/*
* This code is for stationary device
*/
uint8_t counter = 0;
void setup() {
delay(2000);
pinMode(LED_PIN, OUTPUT);
Serial.begin(UART_SPEED);
}
enum dataStates {
IDLE,
HEADER_RECEIVED,
DATA_RECEIVED,
CRC
};
uint8_t protocolState = IDLE;
uint8_t dat... | true |
25128ec805891764755856ed849ea83cd2aee53f | C++ | gmtranthanhtu/competitive-programming | /UVa-AC/uva 10069 Distinct Subsequences.cpp | UTF-8 | 3,815 | 2.609375 | 3 | [] | no_license | /*
Name: UVa 10069 Distinct Subsequences
Copyright:
Author: 3T
Date: 02/06/10 16:58
Description: DP
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#define Max1 10005
#define Max2 105
#define INP "10069.INP"
int N,i,sX,sZ,j,r,len1,len2,MaxLen;
int M[Max2]... | true |
3ac0ea3f4c36f8fa6c8c321d276bc32e21185d39 | C++ | bolart161/polytech-c | /boltunov.artem/B1/taskNum2.cpp | UTF-8 | 677 | 3.203125 | 3 | [] | no_license | #include <fstream>
#include <vector>
#include <memory>
#include <iostream>
int taskNum2(const char *fileName)
{
std::ifstream inputStream(fileName);
if (!inputStream) {
std::cerr << "This file doesn't exist;";
return 1;
}
inputStream.seekg(0, inputStream.end);
const size_t length = inputStream.tell... | true |
916065f934b833703366ad9ea61706e86bf20fe2 | C++ | Anubis-13/EmulationStation | /es-core/src/guis/GuiTextEditPopupKeyboard.cpp | WINDOWS-1252 | 12,298 | 2.515625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | #include "guis/GuiTextEditPopupKeyboard.h"
#include "components/MenuComponent.h"
#include "Log.h"
#include "utils/StringUtil.h"
std::vector<std::vector<UNICODE_CHARTYPE>> kbFrench {
{ UNICODE_CHARS("&"), UNICODE_CHARS(""), UNICODE_CHARS("\""), UNICODE_CHARS("'"), UNICODE_CHARS("("), UNICODE_CHARS("#"), UNICODE_CHARS(... | true |
417e682776fc3a0520001f62ad6e7ffda4dfd091 | C++ | denis-gubar/Leetcode | /Depth-first Search/0934. Shortest Bridge.cpp | UTF-8 | 1,355 | 2.53125 | 3 | [] | no_license | class Solution {
public:
int shortestBridge(vector<vector<int>>& A) {
vector<int> dx{ 0, 1, 0, -1 };
vector<int> dy{ 1, 0, -1, 0 };
vector<vector<int>> M(A);
int X = A.size(), Y = A[0].size();
bool isCompleted = false;
for (int i = 0; i < X && !isCompleted; ++i)
for (int j = 0; j < Y; ++j)
if (M[i][... | true |
2faed5bec99e85cd9ab548afb064872fa5359531 | C++ | dean-mrack/TrapForMonsters | /TrapForMonsters.ino | UTF-8 | 2,239 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | // -------------------------------------------------
// Trap for Monsters
// Ulrix Creation © 2016
// Version: 1.4.12
// 2016-10-13
// -------------------------------------------------
#define Trig 8
#define Echo 7
unsigned int impulseTime=0;
unsigned int distance_sm1=0;
unsigned int distance_sm2=0;
unsigned int d... | true |
7971089e2a4f9cc0fe6958b5f89abba849726ebe | C++ | russellkir/project_euler | /src/id_12.cpp | UTF-8 | 937 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
inline long nth_triangle(int n){
return (n*n + n) / 2;
}
int is_fact(int n, int f) {
return n % f == 0;
}
int num_divisors(int n){
int divisors = 1;
int count = 0;
while(n % 2 == 0) {
++count;
... | true |
93cdbd6d2649e28e053dad04798a86e6b9833f64 | C++ | thegamer1907/Code_Analysis | /DP/364.cpp | UTF-8 | 495 | 2.6875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
main()
{
int n,m;
cin>>n;
int *a=(int*)malloc(n*sizeof(int));
for(int i=0;i<n;i++)
cin>>a[i];
cin>>m;
int *b=(int*)malloc(m*sizeof(int));
for(int i=0;i<m;i++)
cin>>b[i];
sort(a,a+n);
sort(b,b+m);
int i=0,j=0,ans=0;
while(i<n && ... | true |
adf97948860463b00d2758a9e8eaa8a21fb26213 | C++ | rahulinsane11/leetcode | /1.two_sum2.cpp | UTF-8 | 627 | 3.203125 | 3 | [] | no_license | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) { // T.C.=O(n) , S.C.=O(n)
vector<int> result;
unordered_map<int,int> hash_table;
for(int i=0; i<nums.size(); i++)
{
int x= target- nums.at(i);
if(hash_table.find(x) != hash_tab... | true |
bec7ff0a7ad7122eac354976da460cff66a2f26b | C++ | Teckwar160/EGE | /include/std/Windows/Others/WindowsTerminal.hpp | UTF-8 | 4,366 | 3.15625 | 3 | [] | no_license | #ifndef WINDOWSTERMINAL_HPP
#define WINDOWSTERMINAL_HPP
#include <core/Entity.hpp>
#include <core/Manager.hpp>
#include <core/Alias.hpp>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <string>
namespace EGE::STD::TERMINAL::WINDOWS{
class Terminal : public EGE::CORE::Entity... | true |
ed93e6cf48011971fdb93a0f9b6962740affd308 | C++ | szigetigabor/Arduino | /GardenWatering/MCPManagement.h | UTF-8 | 1,326 | 2.59375 | 3 | [] | no_license |
#ifndef _McpManagement_h
#define _McpManagement_h
#include "Adafruit_MCP23017.h"
#define NR_OF_PORTS 8
/*
* MCP23017 management class
* MCP ports are mapped the following rules:
* 0-7. ports: input
* 8-15. ports: output
*
* When i. input port is triggered (move to LOW) it triggers the i. output (i... | true |
d75bc4ec10e07c022d344c01883ba098e31fc44d | C++ | philbarbier/arduino-projects | /flimrail_switch_control/flimrail_switch_control.ino | UTF-8 | 2,953 | 2.984375 | 3 | [] | no_license | /*
* Flimrail switch control software
*
* v 0.1 - (c)2016 Phil Barbier / Flimflam
*
*/
#include <Switch.h>
const int numSwitches = 2;
// switches that work as pairs (ie: crossovers)
const int switchPairs[1][2] = {
{0,1}
};
/*
* Have custom header for switch object .h and .cpp, has functions to makeTurn/Str... | true |
16ee72da4adbe52b5fed2f7d8baa16e38e081bec | C++ | tejas01101001/Competitive-coding | /Graphs/Eulerian/hierholzers-algorithm.cpp | UTF-8 | 1,455 | 3.015625 | 3 | [] | no_license | //Eulerian cycle
const int N = 2e5 + 5;
list<int>adj[N];
int deg[N];
bool vis[N];
int cnt = 0;
stack<int>head,tail;
void dfs(int s)
{
vis[s] = true;
cnt++;
for (auto u : adj[s])
{
if (vis[u])
continue;
dfs(u);
}
}
int main()
{
int n, m, x, y;
cin >> n >> m;
... | true |
73bd50a8fa70e5a58d9712cfd922153d432dfd66 | C++ | andrewmashhadi/Advanced_Programming | /HW2/Charts.h | UTF-8 | 3,490 | 3.71875 | 4 | [] | no_license | /*
Andrew Mashhadi
ID: 905092387
PIC 10C
Programming Homework #2
Honor Pledge:
I pledge that I have neither given nor received
unauthorized assistance on this assignment.
*/
#ifndef CHARTS_H
#define CHARTS_H
#include <iostream>
#include <vector>
class Chart
{
public:
class Iterator ... | true |
a00bad2f2a2d9b4cba02b7e3ac252fb35be4053e | C++ | nickLehr/CardinalNick_CSC17a_43950 | /Projects/Project 2/CSC17A_Project2/Deck.h | UTF-8 | 538 | 2.828125 | 3 | [] | no_license | /*
* File: Deck.h
* Author: Owner
*
* Created on May 27, 2015, 10:35 AM
*/
#ifndef DECK_H
#define DECK_H
#include "Card.h"
#include <string>
class Deck{
private:
Card *gameDeck;
void createDeck(std::string);
void addWilds();
int size;
public:
Deck();
//Co... | true |
3bd85f46e1d5927db394ec117290b79000310fc3 | C++ | ILyoan/MySnippets | /problem-solving/acmicpc.net/2294.cpp | UTF-8 | 771 | 2.546875 | 3 | [] | no_license | // baekjoon online judge 2294 (www.acmicpc.net/problem/2294)
// Category: DP
// Difficulty: Easy
#include <stdio.h>
const int MAX_N = 100;
const int MAX_K = 10000;
int N, K;
int coin[MAX_N + 1];
int mem[MAX_K + 1];
int main() {
scanf("%d%d", &N, &K);
for (int i = 0; i <= K; ++i) {
mem[i] = -1;
... | true |
2fa444d8ff7cc9a4d9343c01aaf88e3109497106 | C++ | billpwchan/COMP-2011-Programs | /Program-14/Temperature/temperature_test.cpp | UTF-8 | 583 | 3.65625 | 4 | [] | no_license | #include "temperature.h" /* File: temperature_test.cpp */
int main()
{
char scale;
double degree;
temperature x; // Use default constructor
x.print( ); cout << endl; // Check the default values
cout << "Enter temperature (e.g., 98.6 F): ";
while (cin >> degree >> scale)
{
... | true |
b720091d470e95ff6c082266ec575daf5cec0ff6 | C++ | JJungwoo/algorithm | /baekjoon/math1/1929.cpp | UHC | 559 | 3.390625 | 3 | [] | no_license | /*
[BOJ] 1929. Ҽ ϱ
https://www.acmicpc.net/problem/1929
*
#include <iostream>
using namespace std;
int factor[1000001];
void eratosthenes(int n) {
factor[0] = factor[1] = -1;
for (int i = 2; i <= n; ++i)
factor[i] = i;
int sqrtn = int(sqrt(n));
for (int i = 2; i <= sqrtn; ++i) {
if (factor[i] == i) {
for... | true |
31546286d8d4d16f4f6ed55ca35d225e1a3c0b1d | C++ | JanaSabuj/Light-OJ | /Graph Theory/1040 - Donation.cpp | UTF-8 | 1,895 | 2.578125 | 3 | [] | no_license | //Built by Sabuj Jana(greenindia) from Jadavpur University,Kolkata,India
//God is Great
#include <bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define int long long int
const int INF = 1e9 + 5; //billion
#define pb push_back
#define... | true |
eb513ce2d86f4baa23b69f624ecae3d934221bd5 | C++ | hailingu/leet_lint_code | /leet_lint_code/lint_code/binary_tree_level_order_traversal_ii.cpp | UTF-8 | 1,161 | 2.890625 | 3 | [] | no_license | // Copyright © 2018 Hailin Gu. All rights reserved.
// License(GPL)
// Author: Hailin Gu
// This is a answer of lint code problem 70.
#ifndef LEETLINTCODE_LINTCODE_BINARYTREELEVELORDERTRAVERSALII_CPP
#define LEETLINTCODE_LINTCODE_BINARYTREELEVELORDERTRAVERSALII_CPP
#include <queue>
#include <vector>
#include <math.h>... | true |
93985da8f15b1b6271fe2d15eddea6c26e785e9c | C++ | kgandhi09/C-Cpp | /Shape/src/main.cpp | UTF-8 | 1,912 | 3.703125 | 4 | [] | no_license | /*
* main.cpp
*
* Created on: Nov 21, 2019
* Author: kushal
*/
#include <string>
#include <stdlib.h>
#include <stdbool.h>
#include <iostream>
using namespace std;
class Shape{
protected:
string name;
public:
Shape(string n){
name = n;
}
//virtual ~Shape() = 0;
void setName(string n){
name = n;... | true |
d475f61da2c92b272907a8f3a81adcfe75c181eb | C++ | Pragad/LearnCpp | /ThreadsMutex.cpp | UTF-8 | 5,523 | 3.90625 | 4 | [] | no_license | #include <iostream>
#include <thread>
#include <mutex>
#include <vector>
using namespace std;
// -----------------------------------------------------------------------------------------
// PROBLEM 1. Increment a value using mutex
// -------------------------------------------------------------------------------------... | true |
cfabbb68b6d181db72203f0de8587f6d3dab7135 | C++ | salvomob/Esercitazioni_Prog2 | /14_05_2021/classe.h | UTF-8 | 274 | 2.5625 | 3 | [] | no_license | #ifndef CLASSE_H
#define CLASSE_H
#include<iostream>
class Classe{
private:
Studente **studenti;
int n;//numero massimo studenti in classe
int myn;//numero effettivo studenti in classe
public:
Classe(int n);
void setStudente(Studente& s);
void show();
};
#endif
| true |
0742ee3b722dcecdd019833de6eaef5c54db9875 | C++ | sagar-sam/Spoj-Solutions | /gopuDigitDiv.cpp | UTF-8 | 504 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int n;
scanf("%lld",&n);
long long int sum=0;
long long int m=n;
for(int i=1;i<=n;i=i*10)
{
sum=sum+m%10;
m=m/10;
}
while(true)
{
if(n%sum==0)
break;
else
{
... | true |
fa5b67e09da189f1ebf0e540dfa26269b14c2388 | C++ | Thibaut34/TP1_CPP | /chambre.cpp | UTF-8 | 1,066 | 3 | 3 | [] | no_license | #include "chambre.h"
#include<string>
#include "date.h"
#include <iostream>
Chambre :: Chambre(int identifiant, std::string type ,double prix){
_identifiant=identifiant;
_type=type;
_prix=prix;
}
int Chambre::getidentifiant() const{
return _identifiant;
}
std ::string Chambre::gettype() const{
return ... | true |
c932fdfe404d3dfb4282c234fdc5d40e09ccb10e | C++ | beatalochowska/programs | /przyjaciele/main.cpp | WINDOWS-1250 | 741 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include "przyjaciele.h"
using namespace std;
void judge(Point pkt, Rectangle p)
{
if((pkt.x >= p.x) && (pkt.x <= p.x + p.width) && (pkt.y >= p.y) && (pkt.y <= p.y + p.height))
cout << endl << "Punkt " << pkt.name << " nalezy do prostokata: " << p.name;
else
cout << endl <... | true |
737efe09e14ba01e09737d2b8af4a8e7458a4647 | C++ | vukics/cppqed | /CPPQEDcore/structure/Liouvillean.h | UTF-8 | 6,404 | 2.859375 | 3 | [
"BSL-1.0"
] | permissive | // Copyright András Vukics 2006–2022. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
/// \briefFileDefault
#ifndef CPPQEDCORE_STRUCTURE_LIOUVILLEAN_H_INCLUDED
#define CPPQEDCORE_STRUCTURE_LIOUVILLEAN_H_INCLUDED
#include "LiouvilleanAveragedCommon.h"
#include "TimeDepende... | true |
fdb545018e1a532e56d7ae13f511ab107d872045 | C++ | joaosfvieira/list2 | /equal/include/equal.h | UTF-8 | 2,198 | 3.796875 | 4 | [] | no_license | #ifndef GRAAL_H
#define GRAAL_H
#include <utility>
using std::pair;
#include <iterator>
using std::distance;
#include <algorithm>
using std::sort;
namespace graal {
/*!
* @tparam InputIt1 iterator para o range.
* @tparam InputIt2 iterator para o segundo range.
* @tparam Equal para a função eq.
*
* @param first... | true |
db293ea056542876ba0ebc043df87ea47e3b44e7 | C++ | SubhradeepSS/dsa | /String/Find the diff.cpp | UTF-8 | 610 | 3.453125 | 3 | [] | no_license | /* Given two strings s and t which consist of only lowercase letters.
String t is generated by random shuffling string s and then add one more letter at a random position.
Find the letter that was added in t.
Example:
Input:
s = "abcd"
t = "abcde"
Output:
e */
class Solution {
public:
char findTheDifference(str... | true |
a28afb4c5fdb01c9a0c101fdf18bbd5665ed385c | C++ | nahueldefazio/tp2 | /lista.h | UTF-8 | 1,655 | 2.765625 | 3 | [] | no_license | //
// Created by SuckMyPocket on 17/11/2020.
//
#ifndef UNTITLED_LISTA_H
#define UNTITLED_LISTA_H
#include <string>
#include "nodo.h"
#include "lista.h"
#include "agua.h"
#include "aire.h"
#include "fuego.h"
#include "tierra.h"
using namespace std;
class Lista {
private:
Nodo* primero;
int c... | true |
3d260aaae403d99202687046f848cbd201509ba5 | C++ | WeenyJY/year17 | /stage1/Cplusplus/Reference/Containers/common/common-print.hpp | UTF-8 | 710 | 3.28125 | 3 | [] | no_license | // file : common-print.hpp
#ifndef COMMON_PRINT_HPP
#define COMMON_PRINT_HPP
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <forward_list>
using namespace std;
template <class T>
void printInfo(string who, const vector<T>& myvector )
{
cout<<who<<" contains:";
for(auto & x : my... | true |
a18df84d2d2dcc23aef420b677f3dcfb90da5360 | C++ | brighthush/code-store | /projects/text2vec/src/VocabWord.h | UTF-8 | 1,493 | 2.515625 | 3 | [] | no_license | /*************************************************************************
> File Name: VocabWord.h
> Author: bright
> Mail: luzihao@software.ict.ac.cn
> Created Time: Mon 05 Jan 2015 09:47:17 AM CST
************************************************************************/
#ifndef __VOCAB_WORD__H__
#define __VOCA... | true |
df95ce207c096784614a7c3d58e7ddbe0f4120d9 | C++ | Solayman/Arduino | /2_led/2_led.ino | UTF-8 | 364 | 2.59375 | 3 | [] | no_license | #define led1 8
#define led2 9
void setup() {
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
}
void loop() {
//FOR FIRST LED
digitalWrite(led1,HIGH);
delay(2000);
digitalWrite(led1,LOW);
delay(3000);
//FOR SECOND LED
digitalWrite(led2,HIGH);
delay(2000);
digitalWrite... | true |
e7874c1631fe401dd1ec476bae1e2f53600e2003 | C++ | eibow1012/quadruped_control | /quadruped_controller/include/quadruped_controller/math/numerics.hpp | UTF-8 | 1,463 | 3.296875 | 3 | [] | no_license | /**
* @file numerics.hpp
* @date 2021-03-12
* @author Boston Cleek
* @brief Numerical utility functions
*/
#ifndef NUMERICS_HPP
#define NUMERICS_HPP
// Linear Algebra
#include <armadillo>
namespace quadruped_controller
{
namespace math
{
using arma::vec;
using arma::vec3;
constexpr double PI = 3.141592653589793... | true |
cb84639c8099b9ca8900ad285fa0aebc50220e14 | C++ | seshbot/new-cpp-project | /pcx/test/TestServiceRegistry.cpp | UTF-8 | 6,225 | 2.5625 | 3 | [] | no_license |
#include <boost/test/unit_test.hpp>
using namespace boost::unit_test;
#include <set>
#include <pcx/IndexPool.h>
#include <pcx/ServiceRegistry.h>
using namespace pcx;
BOOST_AUTO_TEST_SUITE( ServiceRegistrySuite )
BOOST_AUTO_TEST_CASE( overFillPool )
{
auto list = IndexPool(10);
long idx;
... | true |
e73f4fb36c19d657115a92ab63f43cfb292dfe26 | C++ | Idhrendur/RayTracingInSeveralWeekends | /Source/hittable.h | UTF-8 | 803 | 2.828125 | 3 | [
"MIT"
] | permissive | #ifndef HITTABLE_H
#define HITTABLE_H
#include "ray.h"
#include "vector.h"
#include <optional>
namespace RayTracer
{
struct HitRecord
{
Vector point;
Vector normal;
float t = 0.0F;
bool frontFace = true;
void setFaceNormal(const Ray& ray, const Vector& outwardNormal)
{
frontFace = ray.direction().dot(ou... | true |
ce1ff75a2aafa4b9a43a72d960a3965d1e93e9d6 | C++ | RullDeef/cg-lab | /lab_4/src/core/brescirren.cpp | UTF-8 | 2,128 | 2.890625 | 3 | [] | no_license | #include "brescirren.hpp"
void core::BresenhemCircleRenderer::draw(QImage& image, const Circle& circle, QColor color)
{
beginTiming();
if (circle.r == 0.0)
{
int x = std::round(circle.x);
int y = std::round(circle.y);
image.setPixel(x, y, color.rgba());
}
else
{
... | true |
a9272541469d7249bea2c7208117aefea7a51583 | C++ | gpard77/cs162 | /final/getChoice.cpp | UTF-8 | 588 | 3.28125 | 3 | [] | no_license | /************************************************************************
* getChoice
*
* This function validates the user's menu selection
************************************************************************/
int getChoice()
{
int choice;
while (!(cin >> choice))
{
cout <<... | true |
b09b8b32299641f26912f6ba64b72446460001dc | C++ | erzasilva/Arcade | /Vec2D.h | UTF-8 | 1,507 | 3.328125 | 3 | [] | no_license | #include <iostream>
#ifndef Vec2D_H
#define Vec2D_H
class Vec2D
{
public:
static const Vec2D ZERO;
Vec2D() : Vec2D(0, 0) {}
Vec2D(float x, float y) : mX(x), mY(y) {}
inline void SetX(float x) { mX = x; }
inline void SetY(float y) { mY = y; }
inline float GetX() const { return mX; }
inline float GetY(... | true |
a5611d2a46673f247167a2bb5de2b3a6c8c62e8a | C++ | yanggang98/PEViewMFC | /PEViewMFC/PEView.cpp | GB18030 | 25,140 | 2.59375 | 3 | [] | no_license | #include "pch.h"
#include "PEView.h"
#include <fstream>
#include "PEViewMFCDlg.h"
#include <thread>
using namespace std;
DWORD FileSize(CString Filepath)
{
//ļ
HANDLE hFile = CreateFile(Filepath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
//жļǷʧܣʧ
if (INVALID_H... | true |
3c2fe4d2327fcb6c2f29658ee21336889c24f93e | C++ | LeonardoDelgado1905/Programming-Language | /Lexico/anl_lexico.cpp | UTF-8 | 1,035 | 2.828125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
string caracteres[10];
int main(){
freopen("arreglos.txt", "w", stdout);
string symbols[] = {
"booleano",
"caracter",
"entero",
"real",
"cadena",
"fin_principal",
"fin_principal",
"leer",
"imprimir",
"si ",
"entonces",
"fin_si",
"si_no",
"mientras ",
"hacer",
"f... | true |
facfc30a132963609f9a51c7d5f8a521a5567a9f | C++ | robocupmipt/Communication | /test.cpp | UTF-8 | 2,346 | 2.75 | 3 | [] | no_license | #include"include/queue_config.h"
#include<iostream>
#define PERMISSION 0777
#define MESSAGE_TYPE 1
#define CHECK(nameFunction, retValue) \
do { \
if(retValue == -1) \
{ \
perror(nameFunction);\
return 1; \
} \
else \
printf("%s succeeded\n", nameFunction); \
} while(... | true |
f8a0e6dc7a0684291d94e638df1509d4cc07d82b | C++ | iampiyush/Algorithms_interview | /removeDuplicatesFromString.cpp | UTF-8 | 1,813 | 2.84375 | 3 | [] | no_license | // Find MISSING eLEMENTS using Sorting...
// time complexity 0(n)...
// space complexity 0(1)....
#include<iostream>
#include<cstdio>
#include<ctime>
#include<unistd.h>
#include<algorithm>
using namespace std;
// swap two variables...
void swap(int &x,int &y)
{
int temp;
temp=x;
... | true |
fd491bea3d0067e7f15fd3e5e8bc3741c09e5501 | C++ | KreiserLee/CPP-Study | /2/Ex2.9.cpp | UTF-8 | 212 | 2.71875 | 3 | [] | no_license | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
int a, b = 10;
int x(110);
a = b = 100;
cout << a << b << endl;
cout << x << endl;
return 0;
} | true |
ec3edf620eb743d2c06de14a27647822c3f35b1d | C++ | lnugentgibson/terrain-erosion | /graphics/analysis/calc_norm.cc | UTF-8 | 3,154 | 2.515625 | 3 | [] | no_license | #include <cstring>
#include <fstream>
#include <sstream>
#include "cxxopts/cxxopts.h"
#include "graphics/analysis/differential.h"
#include "graphics/image/binary/binimg.h"
using graphics::analysis::Differential;
using graphics::image::InputSpecifier;
using graphics::image::OutputSpecifier;
using graphics::image::bina... | true |
f4c72b4878741a02d304d01fe5fbbee31b765295 | C++ | jayantawasthi575/dsalgo450 | /ds323.cpp | UTF-8 | 846 | 3.078125 | 3 | [] | no_license | class Solution {
public:
void dfs(vector<vector<int>>& image,int sr,int sc,int newColor,int rows,int cols,int source)
{
if(sr<0 || sr>=rows || sc<0 ||sc>=cols)
return;
else if(image[sr][sc]!=source)
return;
image[sr][sc]=newColor;
dfs(image,sr-1,sc,newColo... | true |
cd7346eafc9ce43b37604e1ab67dafda12b23668 | C++ | RajatBachhawat/Railway-Booking-System | /src/BookingClasses.cpp | UTF-8 | 36,771 | 2.515625 | 3 | [] | no_license |
//Rajat Bachhawat
//Roll No: 19CS10073
//BookingClasses.cpp
#include "BookingClasses.h"
#include "Divyaang.h"
// Names defined as static constants
template<> const string BookingClasses::ACFirstClass::sName = "AC First Class";
template<> const string BookingClasses::ExecutiveChairCar::sName = "... | true |
cbf5cc809917ae42d9a1d98f2f1a5f1cc252983f | C++ | JINWOO-0715/Data-structure | /오목_step_3(스택,큐,무르기,파일입출력)/오목_step_3(스택,큐,무르기,파일입출력).cpp | UHC | 9,473 | 2.71875 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#define MAX 19
#define WHITE 1
#define BLACK 2
#define PAN 0
struct Point
{
int x;
int y;
int stone;
};
Point stack[361];
void makepan();
int point_x;
int point_y;
int baducpan[MAX][MAX];
int top = -1;
int save = -1;
int turn = 2;
//void findstone();
void MakeStone();
void ... | true |
cca0643e3e1ec16d7487235edc15cbf51bfc1239 | C++ | Tudat/tudat | /include/tudat/astro/aerodynamics/windModel.h | UTF-8 | 5,374 | 2.5625 | 3 | [] | permissive | /* Copyright (c) 2010-2019, Delft University of Technology
* All rigths reserved
*
* This file is part of the Tudat. Redistribution and use in source and
* binary forms, with or without modification, are permitted exclusively
* under the terms of the Modified BSD license. You should have received
*... | true |
ad6c0de3ff8a0cefe58a770a34714880aa7a9e73 | C++ | BobDeng1974/openGeeL | /openGeeL/renderer/shadowmapping/cascadedmap.h | UTF-8 | 1,428 | 2.59375 | 3 | [] | no_license | #ifndef CASCADEDSHADOWMAP_H
#define CASCADEDSHADOWMAP_H
#include <vec3.hpp>
#include <mat4x4.hpp>
#include "shadowmapconfig.h"
#include "shadowmap.h"
#define MAPCOUNT 4
namespace geeL {
struct CascadedMap {
float cascadeEnd;
float cascadeEndClip;
glm::mat4 lightTransform;
};
class CascadedShadowmap : pu... | true |
922218df57d432c2aca97ad8c4937152c0f07f28 | C++ | andrewli77/MINOBS-anc | /tabulist.cpp | UTF-8 | 415 | 3.03125 | 3 | [] | no_license | #include "tabulist.h"
#include "debug.h"
TabuList::TabuList(int size) : MAX_SIZE(size) { }
void TabuList::add(const Ordering &o) {
_list.push_back(o);
if (_list.size() > MAX_SIZE) {
_list.pop_front();
}
}
bool TabuList::contains(const Ordering &o) {
int n = _list.size();
for (int i = 0; i... | true |
5f574fdf87992fe479d61ab03db0d2f0cf81dfc9 | C++ | jonathlela/vast | /branches/VAST-0.3.4/ACE_wrappers/ace/Truncate.h | UTF-8 | 2,134 | 2.78125 | 3 | [] | no_license | // -*- C++ -*-
//=============================================================================
/**
* @file Truncate.h
*
* Truncate.h,v 4.3 2006/02/24 17:33:32 shuston Exp
*
* @author Steve Huston <shuston@riverace.com>
*/
//=============================================================================
#ifndef ACE_... | true |
5607b27c5604a8295eef2a389136d86884616bd2 | C++ | mrinalvig/CIS-17A---Final-Project | /Final Project/Final Project/Abilities.h | UTF-8 | 218 | 2.8125 | 3 | [] | no_license | #pragma once
#include <string>
class Abilities
{
private:
std::string abilities;
public:
Abilities(std::string abilities);
~Abilities();
std::string getAbilities() const { return " " + abilities; };
};
| true |
76a499af4c50f4c80c8f30fddd10193b47ca22d3 | C++ | ColinGilbert/grandpa-animation | /Include/IAnimation.h | UTF-8 | 905 | 2.78125 | 3 | [] | no_license | #ifndef __GRP_I_ANIMATION_H__
#define __GRP_I_ANIMATION_H__
namespace grp
{
enum AnimationMode
{
ANIMATION_SINGLE = 0,
ANIMATION_LOOP,
ANIMATION_PINGPONG
};
enum AnimationSampleType
{
SAMPLE_STEP = 0,
SAMPLE_LINEAR,
SAMPLE_SPLINE
};
class IAnimation
{
public:
virtual float getDuration(... | true |
16a272b9baa448ea1013d1f930a59b69e2491601 | C++ | HanpyBin/CP-Note | /leetcode/排序/1833/solution.cpp | UTF-8 | 632 | 2.53125 | 3 | [] | no_license | class Solution
{
public:
int maxIceCream(vector<int>& costs, int coins)
{
// int n = costs.size();
// vector<int> dp(coins+1);
// for (int i = 1; i <= n; i++)
// for (int j = coins; j >= 0; j--)
// if (j+costs[i-1] <= coins)
// dp[j] = max(... | true |
038fb6e7aaaa5d0dac41c5991be19f698ea1ad0e | C++ | w0lker/ACM | /leetcode/leetcode_Plus_One.cpp | UTF-8 | 621 | 3.109375 | 3 | [] | no_license | #include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<int> plusOne(vector<int> &digits) {
vector<int> tmp(digits);
reverse(tmp.begin(),tmp.end());
vector<int> vec;
int N = tmp.size();
int sum = 0;
int i=0;
for(;i<N && tmp[i]==9;i++){... | true |
261f73379edc464755a0320e33d04d843a0ebe89 | C++ | AlvioSim/kentosim | /src/statistics/median.h | UTF-8 | 772 | 2.84375 | 3 | [] | no_license | #ifndef STATISTICSMEDIAN_H
#define STATISTICSMEDIAN_H
#include <statistics/statisticalestimator.h>
#include <vector>
using namespace std;
using std::vector;
namespace Statistics {
/**
* @author Francesc Guim,C6-E201,93 401 16 50, <fguim@pcmas.ac.upc.edu>
*/
/**
* Implements the statistic of Median - given a set o... | true |
eff20ca55335e8940d7357805627f4e96514ef51 | C++ | originlake/leetcode | /src/c++/searchRange.cpp | UTF-8 | 1,038 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <conio.h>
#include <vector>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
if (nums.empty()) return vector<int>{-1,... | true |
29882f554c8ef76d2a146e743da8db77eb5360f2 | C++ | free-bit/PokeTournament-HW | /PokeWater.cpp | UTF-8 | 2,094 | 3.21875 | 3 | [] | no_license | #include "PokeWater.h"
PokeWater::PokeWater(int ID, const std::string& pokemonName): Pokemon(ID,pokemonName)
{
HP=700;
ATK=50;
MAG_DEF=10;
PHY_DEF=20;
drowning=false;
burning=false;
electrified=false;
rooted=false;
//Default values
defHP=700;
defATK=50;
defMAG_DEF=10;
defPHY_DEF=20;
}
void PokeWater::g... | true |
dc855ddebc9ff58552e93f82f9b153a2481a6c14 | C++ | Josh-G91/OOP-Projects | /Banking/savings.h | UTF-8 | 454 | 2.546875 | 3 | [] | no_license | //savings.h
#ifndef SAVINGS_H
#define SAVINGS_H
#include <string>
#include <iostream>
using namespace std;
#include "account.h"
class Savings : public Account
{
protected:
double interestRate;
public:
Savings();
Savings(Customer &c, double bal, double IRate);
virtual void makeDeposit(double deposit)... | true |
c96d38251f8f4417774e0ae765493e92192361ce | C++ | alexbie98/vm | /src/action/DirectionalMovementAction.cc | UTF-8 | 667 | 2.53125 | 3 | [] | no_license | #include "action/DirectionalMovementAction.h"
#include "state/State.h"
#include "state/File.h"
using namespace std;
namespace vm {
void DirectionalMovementAction::doAction(State& context){
context.getFile().moveCursor(d);
}
DirectionalMovementAction::DirectionalMovementAction(Direction d,
size_t multi, unique_ptr... | true |
af919efe9828568b64404b9e723986b351eefbf9 | C++ | Zadanka/pp_lista_1 | /zad16.cpp | UTF-8 | 609 | 3.28125 | 3 | [] | no_license | #include <iostream>
using namespace std;
float suma(float a, float b)
{
return a + b;
}
float roznica(float a, float b)
{
return a - b;
}
float iloczyn(float a, float b)
{
return a * b;
}
float iloraz(float a, float b)
{
return a / b;
}
float kwadrat(float a)
{
return a * a;
}
float szescian(... | true |
d9c3da3d7b7667ec4ed111ad68a7cced2193ec78 | C++ | Jshondra/CPP_modules | /cpp02/ex01/Fixed.hpp | UTF-8 | 536 | 2.75 | 3 | [] | no_license | #ifndef FIXED_HPP
#define FIXED_HPP
#include <cmath>
#include <iostream>
class Fixed
{
private:
int _fixed_n;
static const int _nbr_b = 8;
public:
Fixed();
Fixed( const int n );
Fixed( const float n );
Fixed( Fixed const & rhc );
~Fixed( void );
Fixed & operator=(Fixed const & rhc... | true |
c4be1c3b00308f2dc2bbaf786d8cf5bde22c25a3 | C++ | TheDoubleB/acpl | /src/Bits.h | UTF-8 | 1,026 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef ACPL_BITS_H
#define ACPL_BITS_H
namespace acpl
{
class Bits
{
private:
inline Bits() { }
inline virtual ~Bits() { }
public:
template <class tType, class tTypeCompat>
static inline tType Get(const tType &nVar, const tTypeCompat &nMask)
{
return (nVar & static_cast<tType>(nMask))... | true |
24089178c26d189701e332970261ddeabd49d1c1 | C++ | aqc112420/ML-by-c | /ImageAugment.cpp | GB18030 | 2,326 | 2.90625 | 3 | [] | no_license | //c++ǿתȶԱȶȵģ
#include<opencv2\core\core.hpp>
#include<opencv2\highgui\highgui.hpp>
#include<opencv2\imgproc\imgproc.hpp>
#include<iostream>
#include<opencv2\core.hpp>
using namespace cv;
using namespace std;
void Resize(Mat &img, int rows, int cols)
{
resize(img, img, Size(rows, cols), 0, 0, INTER_N... | true |
83926e69a3969a093d9026c8c33832229124f251 | C++ | djrieger/mjplusplus | /src/ast/Statement.hpp | UTF-8 | 800 | 2.6875 | 3 | [] | no_license | #ifndef STATEMENT_HPP
#define STATEMENT_HPP
#include "Node.hpp"
#include "../semantic_analysis/SemanticAnalysis.hpp"
namespace ast
{
namespace stmt
{
class Statement : public Node
{
public:
enum Type
{
TYPE_SINGLE,
TYPE_BLOCK,
TYPE_IF
};
virtual Type getType() const;
/**
... | true |
77e95101fd190bb756481899cc7c0e8666603773 | C++ | aabin/mapmatrix3d-2.0 | /mm3dMapperEvent/nbspAlgorithm.h | UTF-8 | 889 | 2.9375 | 3 | [] | no_license | #pragma once
#include <math.h>
#include <vector>
namespace nbsp {
class pointXYZ {
public:
pointXYZ(double a = 0, double b = 0, double c = 0)
{
x = a; y = b; z = c;
}
pointXYZ operator-(pointXYZ other)
{
pointXYZ t;
t.x = x - other.x;
t.y = y - other.y;
t.z = z - other.z;
... | true |
0d201b9b64ca8e06137d7563bf8796d5e3ec06ea | C++ | nick-keller/crusher_repack | /dialogs/brushselector.cpp | UTF-8 | 1,556 | 2.6875 | 3 | [] | no_license | #include "brushselector.h"
#include "ui_brushselector.h"
BrushSelector::BrushSelector(QWidget *parent) :
QDialog(parent), m_type(None),
ui(new Ui::BrushSelector)
{
ui->setupUi(this);
QObject::connect(ui->noFill, SIGNAL(clicked()), this, SLOT(setTypeNone()));
QObject::connect(ui->blackFill, SIGNAL(c... | true |
092697810e867875f66c8f50ac46b592cf32437a | C++ | psimn/Learning-Cpp | /ex3.23.cpp | UTF-8 | 301 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <vector>
int main() {
std::vector<int> ivec{1, 2, -85, 65, 42, -3, 7, 6, 50, 655};
for (auto it = ivec.begin(); it != ivec.end(); ++it) {
*it *= 2;
}
for (auto it = ivec.cbegin(); it != ivec.cend(); ++it) {
std::cout << *it << std::endl;
}
return 0;
} | true |
28f63df3ea4f3e4e84d16e9ae6898b7d4bc13bf9 | C++ | Ikaguia/maratona | /uFind.cpp | UTF-8 | 1,460 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define FOR(cont,max) for(int (cont)=0; (cont)<(int)(max);(cont)++)
#define FOR2(cont,start,max) for(int (cont)=(start); (cont)<(int)(max);(cont)++)
#define ABS(x) (((x)> 0 ) ? (x) :-(x))
#define MAX(x,y) (((x)>(y)) ? (x) : (y))
#define MIN(x,y)... | true |
694c08a3f5408a5a294d28414987dcb57e077242 | C++ | sandalovsergey/fractal | /Func.cpp | UTF-8 | 496 | 2.703125 | 3 | [] | no_license | #include "stdafx.h"
#include "Func.h"
COMPLEX Create(double a, double b)
{
COMPLEX res;
res.Re = a;
res.Im = b;
return res;
}
COMPLEX ComplAddCompl(COMPLEX a, COMPLEX b) {
COMPLEX res;
res.Re = a.Re + b.Re;
res.Im = a.Im + b.Im;
return res;
}
COMPLEX ComplMultCompl(COMPLEX a, COMPLEX b) {
COMPLEX res;
res.... | true |
091dfb3960194f929221df9d980b60255512da87 | C++ | SamuelLouisCampbell/chili_framework-1 | /Engine/Scene_FontRendering.cpp | UTF-8 | 2,305 | 3.0625 | 3 | [] | no_license | #include "Scene_FontRendering.h"
#include "Logger.h"
#include <sstream>
#include <algorithm>
Scene_FontRendering::Scene_FontRendering( Keyboard & Kbd, Graphics & Gfx )
:
Scene( Kbd, Gfx )
{
TextFormat::Properties props;
props.fontname = L"Consolas";
props.size = 18.f;
m_consola = Font{ props };
const auto long... | true |
23ee51f5f0b2c2d4e6d1295695b49ef89bbbcc62 | C++ | diseraluca/CompetitiveProgramming | /Sites/HackerRank/Arrays_Left_Rotation/C++/Arrays_Left_Rotation/Arrays_Left_Rotation/Arrays_Left_Rotation.cpp | UTF-8 | 878 | 2.96875 | 3 | [
"MIT"
] | permissive | // Copyright 2018 Luca Di Sera
// Contact: disera.luca@gmail.com
// https://github.com/diseraluca
// https://www.linkedin.com/in/luca-di-sera-200023167
//
// This code is licensed under the MIT License.
// More informations can be found in the LICENSE file in the root folder of this repository
//
// Solution ... | true |
93c30be49d300085436e582189b74fe9506813c7 | C++ | tliu526/ireg_CA | /RegularGridGenerator.cpp | UTF-8 | 4,346 | 2.890625 | 3 | [] | no_license | /**
Implementation of the RegularGridGenerator.
(c) 2016 Tony Liu.
*/
#include "RegularGridGenerator.h"
#include <cmath>
using namespace std;
const float RegularGridGenerator::OFFSET = 0.5;
RegularGridGenerator::RegularGridGenerator(int mi_x, int ma_x, int mi_y, int ma_y, bool b, int degen) {
min_x = mi_x;
... | true |
dc278bbb6ab34b1525fd9da5c506cc357f1cc755 | C++ | Rolight/Gao | /LeetCode/732. My Calendar III.cpp | UTF-8 | 2,162 | 3.390625 | 3 | [] | no_license | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
class SegNode {
public:
SegNode *lc, *rc;
int val;
int lazy;
SegNode() : lc(NULL), rc(NULL), val(0), lazy(0) {}
};
class MyCalendarThree {
void delete_tree(SegNode *root) {
if (root == N... | true |
dd812ab28ada575487c6145aa6e3581860dc98e3 | C++ | Prudhviyendluri/Data-Structures | /Dspgm/Queue_using_doubly_linked_list/main.cpp | UTF-8 | 917 | 3.234375 | 3 | [] | no_license | #include "Queue_doubly_Linked_List.h"
#include <string>
using namespace std;
int main(){
Queue_doubly_Linked_List<int> q;
string cmd;
int data;
while(1){
try{
cin >> cmd;
if(cmd == "push" ) cin >> data;
if(cmd == "push" ) q.push(data);
else if(cmd == "pop" ) q.pop();
... | true |
e7c3b4eeb19355af865b809b2431a6b06151fdab | C++ | lilijreey/class | /stl/it.cpp | UTF-8 | 1,911 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <iterator>
#include <forward_list>
#include <list>
#include <assert.h>
#include <set>
//template <typename Iter>
//void MyAdvance(Iter &it, int n)
//{
//for (int i = 0; int i < n; ++int i)
//{
//++it;
//}
//}
int main() {
std::list<int> v{1,2,3,4,5,6};
... | true |
275219f7165d3379c6797b782998b18b0e08fa16 | C++ | tfrichard/leetcode | /maximalRectangle.cxx | UTF-8 | 805 | 2.671875 | 3 | [] | no_license | class Solution {
public:
int maximalRectangle(vector<vector<char> > &matrix) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int res = 0;
int m = matrix.size();
if (m == 0) return res;
int n = matrix[0].size();
if (n == 0) return res;
int dp[m][n];
f... | true |
4f2c2f181a2dd41d93b1a35179df6037cc7c3475 | C++ | fivaladez/Learning-C- | /34_Namespace.cpp | UTF-8 | 1,301 | 3.890625 | 4 | [] | no_license | /*
Using namespace, you can define the context in which names are defined.
In essence, a namespace defines a scope.
Discontiguous Namespaces
A namespace can be defined in several parts and so a namespace is made up of
the sum of its separately defined parts. The separate parts of a namespace
can be spread over multipl... | true |
8454e7accac4328e7c5b1deb43c02592cdfd7fdb | C++ | zero-fox/battleship2.0 | /ship.h | UTF-8 | 921 | 2.8125 | 3 | [] | no_license | #ifndef SHIP_H_INCLUDED
#define SHIP_H_INCLUDED
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <SFML/Window.hpp>
#include <iostream>
#include <cmath>
#include "gun.h"
class Ship{
public:
Ship(); //set the origin for sprite
sf::Vector2f get_position();
float get_speed();
float get_rot... | true |
fceb7cb9de895659f1faead68bb5e8c892d07d8f | C++ | jlstr/acm | /438 - The circumference of the cirlce/438.cpp | UTF-8 | 585 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
struct point{
double x;
double y;
point(double X,double Y){
x=X;
y=Y;
}
};
double operator |(point &a,point &b){
//return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
return hypot(a.x-b.x, a.y-b.y);
}
const double pi = 2... | true |
efb36333b50668611d4319e5f0aa901ed1f47338 | C++ | wuwushrek/embedded_outer_ode | /aa/interval.cpp | UTF-8 | 2,214 | 3.21875 | 3 | [] | no_license | #include "interval.h"
#include <algorithm>
using namespace std;
Interval::Interval(real val)
{
this->l_elem = val;
this->r_elem = val;
}
Interval::Interval(real lo , real hi)
{
assert_af(lo <= hi);
this->l_elem = lo;
this->r_elem = hi;
}
Interval::Interval(const Interval &it)
{
this->l_elem = it.l_elem;
this... | true |
ce2d17adbdeb2ed6a99570154b8fbc01e2b0087e | C++ | AnatoliiShablov/DA_utils | /main.cpp | UTF-8 | 1,491 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include "format.hpp"
int main() {
std::cout << da::utils::format("This is string with bools: {0} and {1}", true, false) << std::endl;
std::cout << da::utils::format("This is string with ints and floats: {2} and {1} and {0}", 5.5f, 3.0, 12) << std::endl;
std::cout << da::utils::format(... | true |