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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3b49a44fac5f7aa1f47b734116e2296f75140b08 | C++ | wang-y-z/leetcode-algorithm | /290.单词规律.cpp | UTF-8 | 1,030 | 3.0625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=290 lang=cpp
*
* [290] 单词规律
*/
// @lc code=start
class Solution {
public:
bool wordPattern(string pattern, string s) {
vector<string> str;
string buf;
stringstream is(s);
while( is>> buf)
str.push_back(buf);
if(str.size() != patter... | true |
1584afc933c01c2fe68ca6fa1d8714c308038944 | C++ | bayuajik2403/observer-pattern-simple-example-c- | /src/statusObserver1.cpp | UTF-8 | 456 | 2.90625 | 3 | [] | no_license | #include "../include/statusObserver1.h"
using namespace std;
//this function will be called when there is status change
void statusObserver1::status(bool status){
if (status == false) {
//you can do anything here
cout<<"-statusObserver1 got status false, so I will say goodbye"<<endl;
}... | true |
fc10c7264dc3f34d3ea60dab66d2499fe98712fa | C++ | songkey7/leetcode | /283.move_zeroes/MoveZeroes.cpp | UTF-8 | 426 | 3.234375 | 3 | [] | no_license | //
// Created by Qi Song on 2/7/18.
//
#include "MoveZeroes.h"
void MoveZeroes::move_zeroes(vector<int> &nums) {
int b = 0;
for(int i = 0; i < nums.size(); i++){
if(nums[i] != 0) {
swap(nums[i], nums[b]);
b++;
}
}
}
void MoveZeroes::run() {
vector<int> nums = {... | true |
1fcd00ca593b1666490341e7d38ff35aadf49180 | C++ | krejgo/game-eater | /player.h | UTF-8 | 3,129 | 3.09375 | 3 | [] | no_license | #pragma once
//MEMORY
int cKey; //Last key pressed;
class player {
public:
player(int L) {
//Initialize Parameters
phase1 = ph1L;
phase2 = ph1L + ph2L;
phase3 = ph1L + ph2L + 1;
length = L;
dir = 0;
dirB = 0;
deltaDir = 0;
phase = 0;
//Initialize Entity Position
x = border... | true |
77f4b4e704108716083dbcfffe5b7595a50fe7a7 | C++ | lqcfcjx/ExampleQt | /TcpServer/server.cpp | UTF-8 | 1,134 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #include "server.h"
Server::Server(QObject *parent, int port) : QTcpServer(parent)
{
listen(QHostAddress::Any,port);
}
void Server::incomingConnection(int socketDescriptor){
TcpClientSocket *tcpClientSocket = new TcpClientSocket(this);
connect(tcpClientSocket,&TcpClientSocket::updateClients,this,&Server:... | true |
4e7fa3d3dfcd30d5453a3bd9e04fbc90a4f28479 | C++ | tom-code/bluepill | /opencm3-cppcomp/led.h | UTF-8 | 1,192 | 2.703125 | 3 | [] | no_license |
class status_led : public component_t {
int status = 0;
int state = 0;
int state_last_time = 0;
int pin = -1;
int port = -1;
public:
void set(int s) {
status = s;
state_last_time = 0;
state = 1000;
}
void setup(int _port, int _pin) {
port = _port;
pin = _pin;
gpio_set_mode(por... | true |
1396b1ea5479df2336512308ed755ee3fef14dc1 | C++ | flashpoint493/AyaRay | /src/Core/TriangleMesh.h | UTF-8 | 2,017 | 2.5625 | 3 | [
"MIT"
] | permissive | #ifndef AYA_CORE_TRIANGLEMESH_H
#define AYA_CORE_TRIANGLEMESH_H
#include "../Math/Vector2.h"
#include "../Math/Vector3.h"
#include "../Math/Transform.h"
#include "../Core/Memory.h"
#include "../Loaders/ObjMesh.h"
#include "../Core/Ray.h"
#include "../Core/Intersection.h"
#include "../Core/BSDF.h"
namespace Aya {
cla... | true |
e806e240b4ce8c5c036f2cdcc55d3bb6c95a3fd9 | C++ | srfunksensei/OS2 | /source/pokusajOS/pokusajOS/fs.cpp | UTF-8 | 1,048 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive |
#include "fs.h"
#include "kernelfs.h"
FS::FS(){
myImpl = new KernelFS();
}
FS::~FS(){
delete myImpl;
}
char FS::mount(Partition* partition){
return KernelFS::mount(partition);
}
char FS::unmount(char part){
return KernelFS::unmount(part);
}
char FS::format(char part){
return KernelFS::format(part);
}
BytesC... | true |
e19943810c127c092afaa314765e3e09cfb7d44b | C++ | shriki001/Pacman | /Project_Pacman/StaticObject.h | UTF-8 | 503 | 2.53125 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
#include "Settings.h"
class StaticObject
{
public:
virtual void draw(sf::RenderWindow&)const = 0; // draw object on the window
virtual sf::Vector2f getCenter() const = 0;// get object center
virtual sf::Vector2f getPosition() const=0; // get object position
sf::C... | true |
d8484355be7e19243180a89129ee74ec2c4964a4 | C++ | Stevensishernandez/ACE2_2S21_G16 | /Practica 1/Arduino/sketch_feb08a/sketch_feb08a.ino | UTF-8 | 3,279 | 2.71875 | 3 | [] | no_license | //Sensor de ritmo cardiaco variables
int PulseSensor = A0 ;
int PulseSensorAux = 0 ; // Conecte el cable rojo del sensor en pin analogico cero
int Signal = 0; //Valor del sensor de pulso
int Threshold = 520; //Dato analogico considerado como un pulso
//Sensor de temperatura variables... | true |
af7ce9065136cabe0a63e91415a5f1b85e08ddec | C++ | NordicArts/NordicEngine | /NordicEngine/Color/Color.cpp | UTF-8 | 3,642 | 2.875 | 3 | [] | no_license | #include <NordicEngine/Color/Color.hpp>
namespace NordicArts {
namespace NordicEngine {
const Color Color::Black(0, 0, 0);
const Color Color::White(255, 255, 255);
const Color Color::Red(255, 0, 0);
const Color Color::Green(0, 255, 0);
const Color Color::Blue(0, 0, 255);
... | true |
fa891c5be1fa52861cc1254c122ed4ba11f27df3 | C++ | HargovindArora/Programming | /Problems/countSubSequences.cpp | UTF-8 | 694 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
#define MOD 1000000007
#define ll long long int
using namespace std;
const int MAX_CHAR = 256;
ll distinctSubSeqDP(string s){
vector<int> last(MAX_CHAR, -1); // (size, intial value)
int n = s.size();
ll dp[n+1] = {0};
dp[0] = 1;
for(int i=1; i<=n; i++){
dp[i] = (dp... | true |
8f30aab12b9ea24a324d4280506ecc2c40fbf095 | C++ | Vijaydurga/c-assignments | /assignment-1/sum-of-digits/Source.cpp | UTF-8 | 226 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int n, r = 0, s = 0;
cin >> n;
getchar();
while (n > 0)
{
r = n % 10;
s = s + r;
n = n / 10;
}
cout << s;
getchar();
}
| true |
8ab68ef8f8b8b3eb3d31d6a7d2f4b9505ea892cd | C++ | Twinklebear/crafting-interpreters | /antlr4-interpreter/main.cpp | UTF-8 | 2,519 | 2.8125 | 3 | [
"MIT"
] | permissive | #include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "LoxLexer.h"
#include "LoxParser.h"
#include "antlr4-runtime.h"
#include "ast_builder.h"
#include "ast_printer.h"
#include "interpreter.h"
#include "resolver.h"
#include "util.h"
using namespace loxgrammar;
void run_file(const std::st... | true |
41610ae303ea60219b43ce9b8d086c11d4f14ecc | C++ | gnulnx/dynamol | /old_complete/dynamol/trunk/Main_Build/dynacomp/angle.h | UTF-8 | 1,058 | 2.640625 | 3 | [] | no_license | /*****************************************
* Copyright (C) 2004 by Dynamol *
* email: john.furr@dynamol.com *
* *************************************/
#ifndef DYNACOMPANGLE_H
#define DYNACOMPANGLE_H
namespace dynacomp {
class atom;
/** \brief A Molecular Mechanis/Dynamics Angle class
*
* Most (a... | true |
6ae4341ea0d4814dd19f4fb732baf98576b39565 | C++ | RishabhDevbanshi/C-Codes | /Bit-Manipulation/unique-element-in-array.cpp | UTF-8 | 130 | 2.828125 | 3 | [] | no_license | void unique(vec(int) arr)
{
int xorsum = 0;
loop(i, 0, arr.size())
{
xorsum = xorsum ^ arr[i];
}
cout << xorsum << endl;
}
| true |
5f10b76d66e5a6c2b61b6197e71e5596132af5e1 | C++ | gabrielegenovese/Esercizi-Programmazione-2020 | /Esercizi/Stringhe/Parametri/main.cpp | UTF-8 | 865 | 3.40625 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
void parola(char str[], char c, char dest[])
{
int j = 0, i = 1;
// trovo la parola (per trovare la prima parola bisogna mettere prima uno spazio)
while (str[i] != '\0' && (str[i] != c || str[i-1] != ' ')) i++;
// la inserisco in dest
while (str[i] != ... | true |
7f3ed4a5101dd166023ff9fe7a22046e1f1263ac | C++ | signalcompose/libSimpleControl | /example/macOS/01_Serialized_test/Serialized_test/main.cpp | UTF-8 | 2,264 | 3.25 | 3 | [] | no_license | //
// main.cpp
// Serializer_test
//
// Created by leico_studio on 2019/08/17.
// Copyright © 2019 leico_studio. All rights reserved.
//
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include "Serialized.hpp"
/**
* @brief dummy class to check copy function
*/
class dummy{
std :: si... | true |
2f4998c4e0202c3273fbd1111ed6fa063d89b20f | C++ | adityanjr/code-DS-ALGO | /CodeForces/Complete/1-99/17B-Hierarchy.cpp | UTF-8 | 612 | 2.8125 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <map>
int main(){
long n; scanf("%ld", &n);
for(long p = 0; p < n; p++){long x; scanf("%ld", &x);} //Irrelevant
long m; scanf("%ld", &m);
std::map<long, long> cost;
while(m--){
long x, y, c; scanf("%ld %ld %ld", &x, &y, &c);
if(cost.count(y) > 0){cost[y] ... | true |
277d90645417db87f0246f5f0c13e5ffd3a57f78 | C++ | DEAKSoftware/Panoramic-Rendering | /source/system/systimer.cpp | UTF-8 | 4,512 | 2.703125 | 3 | [
"MIT"
] | permissive | /*============================================================================*/
/* Cosmic Ray [Tau] - Dominik Deak */
/* */
/* System Timer Functions (at this stage Windows 9x and NT only) ... | true |
b14f5ebbc8caee91d7c9f6c36a9a44a7087636b5 | C++ | ChankiWu/parallel-computing | /hw2_matrix_thread.cpp | UTF-8 | 2,512 | 3.453125 | 3 | [] | no_license | #include<iostream>
#include<time.h>
#include<vector>
#include<mutex>
using namespace std;
using matrix = vector<vector<int> >;
// maximum size of matrix
#define MAX 256
// maximum number of threads
#define MAX_THREAD 256
matrix matA(MAX, vector<int>(MAX, 0));
matrix matB(MAX, vector<int>(MAX, 0));
matrix mat... | true |
a5d988b4817b0125b3929a1cf02831d9a8200941 | C++ | abdullah-abwisk/C-Plus-Plus | /021_Pascal_Triangle.cpp | UTF-8 | 2,309 | 3.78125 | 4 | [] | no_license | /* Programming Fundamentals : Assignment 03 : Q4
Abdullah Khan : DS-N : 20i-0894 : Pascal's Triangle */
#include <iostream>
using namespace std;
int main()
{
int row, ans = 1, space = 0, display_num, i, j, k;
cout << "Input number of rows : ";
cin >> row;
cout << "Enter the display number: ";
cin >> displa... | true |
3b5dc86c750640aa5b76bc90240ea9c781377cc4 | C++ | ZephyrZhng/code_ub | /cpp/pda2cfg/number.cpp | UTF-8 | 806 | 3.390625 | 3 | [] | no_license | #include "number.h"
Number::Number()
{
}
Number::Number(int _r): r(_r)
{
num.push_back(0);
}
void operator ++(Number& n)
{
int carry = 0;
n.num[n.num.size() - 1] += 1;
if(n.num[n.num.size() - 1] >= n.r)
{
n.num[n.num.size() - 1] -= n.r;
carry = 1;
}
for(int i = n.num.size() - 2; i >= 0 && carry != 0; --... | true |
1a06a9a321e507b376ff93c104a6411a14a59315 | C++ | Delicious-Goat/Groups | /Groups.cpp | UTF-8 | 1,762 | 2.53125 | 3 | [] | no_license | #include "stdafx.h"
#include "Groups.h"
Groups::Groups(QWidget *parent)
: QMainWindow(parent),
screenHeight(0),
screenWidth(0),
windowHeight(0),
windowWidth(0)
{
ui.setupUi(this);
}
//Extend show method of base class
void Groups::show()
{
centerAndResize();
setBackgroundColor(25... | true |
0e841e4bc0acd1beab4926145e45e6447af6223e | C++ | togekk/togekk.github.io | /wasm/array_index_of_object_array/string.cpp | UTF-8 | 757 | 3.265625 | 3 | [] | no_license | #include <stdio.h> // for 'printf' function
#include <string.h> // for 'strtok' & 'strcmp'
#include <stdlib.h> // for 'free' function
using namespace std;
extern "C" {
// get object array from javascript
int arrayIndexOf(char* arr, char* value_selected, int arr_length, int key_length)
{
char* a;
int id = 0... | true |
3ca1ec1ca42b10b582ddf4582829d597849bc3ba | C++ | thedeepestreality/diods | /Observer.cpp | UTF-8 | 5,217 | 2.65625 | 3 | [] | no_license | //#include "Observer.h"
#include <cstdio>
#include <sstream>
#include <cmath>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
//#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
#define pi 3.141593
class Observer
{
private:
... | true |
9f8528317ee1fe9de4a0d6fb630653ea056d3bdb | C++ | BSU2015gr09/Khmelnikova | /firstSemester/Sum_do_0.cpp | WINDOWS-1251 | 460 | 3.109375 | 3 | [] | no_license | /* */
#include <iostream>
#include <clocale>
#include <stdlib.h>
using std::cout;
using std::cin;
int main()
{
setlocale(LC_ALL, "Russian");
long int a = 0, y=0,s=0;
cout << " :" << "\n";
cin >> a ;
while (a % 10!= 0) {
y = a % 10;
s = s+y;
a = a / 10;
}
cout << " : " << s << "\n";
return 0;
}
| true |
82d758c1d46b9562efc359386030c266651387db | C++ | JosvanGoor/bbm | /old_code/engine/Font.hpp | UTF-8 | 2,892 | 3 | 3 | [] | no_license | #ifndef ENGINE_FONT_HPP
#define ENGINE_FONT_HPP
#include <string>
#include "../math/Vector3.hpp"
#include "../math/Matrix4x4.hpp"
#include "../extern/gl_core_4_4.h"
namespace engine
{
class RenderableString;
/*
This class describes a Spritesheet font (v1), such a font consists of 2 files... | true |
59672948270f3f92bd72634524fe8994b6438aea | C++ | symanli/just-p2p-live-p2pcommon2 | /base/ppl/data/buffer.h | GB18030 | 6,485 | 3.015625 | 3 | [] | no_license |
#ifndef _LIVE_P2PCOMMON2_BASE_PPL_DATA_BUFFER_H_
#define _LIVE_P2PCOMMON2_BASE_PPL_DATA_BUFFER_H_
#include <ppl/config.h>
#include <ppl/data/alloc.h>
#include <boost/noncopyable.hpp>
#include <algorithm>
template <typename T, typename AllocT>
class basic_buffer : private boost::noncopyable
{
public:
... | true |
e1728b8d51654eb1d4bc096ce31495c6c6ac0272 | C++ | jainans/My-Leetcode-Solution-In-CPP | /CPP, C++ Solutions/1027. Longest Arithmetic Subsequence.cpp | UTF-8 | 1,399 | 3.140625 | 3 | [
"MIT"
] | permissive | /************ Method-1 (TLE because of map, TC-O(N^2), SC-O(N^2)) ************
class Solution {
public:
int longestArithSeqLength(vector<int>& nums) {
int n = nums.size(), cd, res = 0;
vector<unordered_map<int, int>> dp(n);
for(int i = 0; i < n; i++) {
for(int j = i-1; j... | true |
2fbd11cd14ab5bf43c439c129f12d5a1f3601bc3 | C++ | h8liu/usaco | /starry/starry.cpp | UTF-8 | 6,342 | 2.859375 | 3 | [] | no_license | /*
ID: liulonn1
PROG: starry
LANG: C++
*/
#include <cstdio>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <vector>
using std::vector;
inline int _ind(int x, int y) {
return (x << 7) | (y & 0x7f);
}
struct Bound {
int minRow, maxRow;
int minCol, maxCol;
int _w, _h;
int count;
... | true |
79f3bf8009ad7f8b4af08629a19b936fcc28416e | C++ | gershGit/IceCaps | /Source/Core/AnimationSystem.cpp | UTF-8 | 5,563 | 2.75 | 3 | [] | no_license | #include "Core/AnimationSystem.h"
#include "Core/GameTimer.h"
#include "glm/gtx/matrix_decompose.hpp"
void AnimationSystem::start()
{
for (int id : *entities) {
animation * anim = getCManager<animation>(*managers, ANIMATION_COMPONENT)->getComponentAddress(id);
if (anim->playOnStartup) {
anim->startTime = GameT... | true |
27f110ec53196af25215dfa4c21e60d7d10c91dd | C++ | vishalpolley/Algorithms | /Greedy Algorithms/Job Sequencing With Deadlines.cpp | UTF-8 | 1,880 | 3.640625 | 4 | [] | no_license | // Author:- Jatin Kumar
// Job Sequencing with deadlines:- given n jobs with their deadlines and profits
// task is to maximize the profit and job should be completed before its deadline
// greedy approach is used
// pick the job with maximum profit and place it as near as to it's deadline so that
// jobs having less d... | true |
2214444001f83bcb0d51bf2275483c2e43dbb66c | C++ | icce-top/compiler | /codegen/flextest/stack-machine.cpp | UTF-8 | 3,639 | 2.890625 | 3 | [] | no_license | #include "stdafx.h"
#include "stack-machine.h"
/////////////////////////////////////
// instructions
void Stack_Instr_print(Stack_Instr_t s)
{
switch (s->kind){
case STACK_INSTR_PUSH:{
Stack_Instr_Push p = (Stack_Instr_Push)s;
printf("push %d", p->n);
break;
}
case STACK_INSTR_LOAD:{
... | true |
cb0476940bb9bb531f91e49cd2eeef1366b6408f | C++ | derklausberger/klausberger | /src/server/manager.cpp | UTF-8 | 2,024 | 3.484375 | 3 | [] | no_license | #include "manager.h"
#include <string>
#include <iostream>
using namespace std;
void Manager::print() {
for (auto& user : users) {
user.print();
}
}
User* Manager::get_user(string name) {
for (auto& user : users) {
if (user.get_name().compare(name) == 0) {
return &user;
... | true |
579a1e3fe0c847e6834ae670b9ea80f10e21e689 | C++ | vinaykumargb/Algorithms | /Quick sort.cpp | UTF-8 | 1,634 | 3.890625 | 4 | [
"MIT"
] | permissive | #include <iostream> // std::cout
#include <algorithm> // std::swap, std::generate
#include <ctime> // time()
#include <cstdlib> // srand(), rand()
using namespace std;
int rnd()
{return (rand()%101+1);}
int partition(int arr[], int first, int last){
// To swap values.
int i = first + 1;
// Pick the first e... | true |
d178a3f5b53c5cb437ed6189e7a450a835e845a2 | C++ | andrewrong/kvstore | /src/storage/impl/IteratorImpl.cpp | UTF-8 | 961 | 2.53125 | 3 | [] | no_license | //
// Created by fenglin on 2018/12/29.
//
#include "IteratorImpl.h"
storage::IteratorImpl::IteratorImpl(rocksdb::Iterator* iter) : Iterator() {
assert(iter);
iter_ = iter;
}
storage::IteratorImpl::~IteratorImpl() {
if(iter_) {
delete iter_;
}
}
bool storage::IteratorImpl::IsValid() {
as... | true |
bcf3879ad1870805d21397cce569173bdca72d3d | C++ | pkmital/NSCARPE | /src/ofxFbo.cpp | UTF-8 | 4,940 | 2.59375 | 3 | [] | no_license | #include "ofxFbo.h"
void ofxFbo::push() {
if(levels == 0)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
levels++;
}
void ofxFbo::pop() {
levels--;
if(levels == 0)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
ofTexture* ofxFbo::getAttachment() {
for(unsigned int i = 0; i < attachments.size(); i++)
if(... | true |
4d2a8bf80e0d18e7d71cc8c82e2b55689064f389 | C++ | paulot/uva | /10681.cpp | UTF-8 | 873 | 2.6875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int s, e, d, n, m;
bool dp[102][202], g[102][102];
// Still getting WA, but the recurrence is correct, probably some small bug
int main() {
while (cin >> m >> n and m and n) {
for (int i = 0; i <= m; i++) for (int j = 0; j <= m; j++) g[i][j] = false;
for (int i = 1... | true |
c63913036d59f6205b368cffc65fe74476efb392 | C++ | iynaur/solarsystem | /camera.h | UTF-8 | 1,408 | 2.796875 | 3 | [
"MIT"
] | permissive | /*Published under The MIT License (MIT)
See LICENSE.TXT*/
// Ryan Pridgeon COM2032 rp00091
#ifndef RYAN_CAMERA_H
#define RYAN_CAMERA_H
class Camera
{
private:
// a vector pointing in the directio nyoure facing
float forwardVec[3];
// a vector pointing to the right of where your facing (to describe orientation
... | true |
a9b22e2f908387c00b7975a910eaf4a80b25a629 | C++ | seppestas/arduino-client | /libraries/allthingstalk_arduino_gateway_lib/allthingstalk_arduino_gateway_lib.cpp | UTF-8 | 9,067 | 2.734375 | 3 | [] | no_license | /*
Not yet supported
allthingstalk_arduino_gateway_lib.cpp - SmartLiving.io Arduino library
provides a way to create devices & assets + send & receives asset values to/from the cloud.
Author: Jan Bogaerts
first version: october 2014
*/
#define DEBUG //turns on debugging in the IOT library. comment out thi... | true |
ff6ffb29916a3dbc375fb6121120a280f0380328 | C++ | Formation-C/SA_MediaPlayer | /State.h | UTF-8 | 334 | 2.578125 | 3 | [] | no_license | #pragma once
class Player;
#include "Player.h"
class State
{
protected:
Player* player;
public:
State() { player = nullptr; };
State(Player* _player);
virtual ~State();
Player* GetPlayer() { return player; };
void SetPlayer(Player *_player) { player = _player; };
virtual void onPlay() = 0;
virtual void onSto... | true |
d5ca45b85f6524b2215bc55234eef62d657ced7f | C++ | tomy0000000/YZU-Computer-Programming-I | /Midterm Exam 1/Midterm 1.cpp | UTF-8 | 9,114 | 3.296875 | 3 | [
"MIT"
] | permissive | // Huge integer division
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <fstream>
using std::ifstream;
using std::ios;
using std::istream;
using std::ofstream;
using std::ostream;
// enable user to input two positive huge integers from user
void inputTwoHugeInts(istream &inFile, unsign... | true |
e65dc675a0ac1261504ec3077e49f04dcb6746c8 | C++ | pvarouktsis/HooliGame | /src/Menu.h | UTF-8 | 1,027 | 3.0625 | 3 | [] | no_license | #pragma once
#include <functional>
#include <vector>
#include "glm/vec2.hpp"
#include "graphics.h"
struct MenuElement {
// Selectable element. Draw function is called when drawing it, on_select when selected.
// pos is the position the last element was drawn on. You can use it to draw this element below the last.
/... | true |
24f06487541666dd23eaab75f80bb6fc6ec5a844 | C++ | EasternEmperor/PokemonCS | /问题二/thread-service.cpp | GB18030 | 55,123 | 2.65625 | 3 | [] | no_license | #include <stdio.h>
#include <iomanip>
#include <cmath>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <cstring>
#include <WS2tcpip.h>
#include <Winsock2.h>
#include <Windows.h>
#pragma comment(lib, "ws2_32.lib")
#define USERNUM 50 //ܱû ûӵе
#define NAMELENGTH 50 //û
#define EXMAX 4 // = ... | true |
c5023ab4ce462bf3736a4391d5c94492ea67c32b | C++ | hexagonal-sun/mace | /testsuite/zobrist-tester.cpp | UTF-8 | 1,867 | 2.84375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "board.h"
static void checkZobrist(std::string fen)
{
Board b = Board::constructFromFEN(fen);
ZobristHash initialHash = b.getHash();
std::cout << "Initial hash: " << std::hex << initialHash << std::endl;
for (int i : {1,2,3,4})
{
std::cout << "Checking perft ... | true |
5034f402f12e8938904f7a68927a9d22c5bbb0b3 | C++ | reyhanlioglu/ITU-Courses | /Analysis of Algorithm ll/Homework 1/usecases/BreadthFirstSearch.h | ISO-8859-9 | 5,281 | 3.296875 | 3 | [] | no_license | /*****************************
* (C) 2020 Emre Reyhanlolu *
* All rights reserved. *
* *
* BLG 336E *
* HOMEWORK 1 *
* EMRE REYHANLIOGLU *
* 150140126 *
* *
*****************************/
// Breadth First Search algorithm
#ifndef BREADTHFIRSTSEARCH_H
... | true |
d48aee31e4cad502e79596fe5e1e5727fb535fd7 | C++ | vineetmidha/GFG | /CheckKthBitSet.cpp | UTF-8 | 284 | 2.78125 | 3 | [] | no_license | // https://practice.geeksforgeeks.org/problems/check-whether-k-th-bit-is-set-or-not-1587115620/1/?track=dsa-workshop-1-bit-magic&batchId=308
// Function to check if Kth bit is set or not
bool checkKthBit(int n, int k){
int mask = (1<<k);
return (n & mask);
}
| true |
d828f942b450fc20702684a0c0b4f6cda1175ad4 | C++ | markowanga/OI-OIG | /OIG/Obwarzanki.cpp | UTF-8 | 1,292 | 3.015625 | 3 | [] | no_license | /**
* V Olimpiada Informatyczna Gimnazjalistów
* Zadanie: Obwarzanki
* Wynik 100/100
* Wykonał: Marcin Wątroba
* http://main.edu.pl/pl/archive/oig/5/obw
*/
#include <iostream>
#include <cstdio>
#include <utility>
using namespace std;
int min(int a, int b) {
if (a > b)
return b;
return a;
}
int... | true |
ca98cf2885f3141bd8fa0a2a24742877eb83ddd1 | C++ | liuyehcf/Reflect | /Reflect/pattern2/demo.h | GB18030 | 1,311 | 2.859375 | 3 | [] | no_license | #pragma once
#include"object.h"
#include<vector>
#include<string>
#include<iostream>
class demo2;
class demo1 :public object {
/*
* Ҫʵַע
*/
REGISTE_MEMBER_HEAD(demo1)
private:
int age;
long time;
float woman;
double man;
void set_age(std::string age) {
this->age = stoi(age);
}
void print_age() {
std... | true |
caaf336255ec53fbbacd6071a8bf61a68be33432 | C++ | parksangwooyeahyeah/lab05 | /Lab05-DSLinkedList_HT/DoublyIterator.h | UTF-8 | 1,167 | 2.984375 | 3 | [] | no_license | #pragma once
#ifndef _DOUBLYITERATOR_H
#define _DOUBLYITERATOR_H
#include "DoublySortedLinkedList.h"
template<typename T>
struct DoublyNodeType;
template<typename T>
class DoublySortedLinkedList;
/**
* ���Ḯ��Ʈ���� ���̴� Iterator�� Ŭ����.
*/
template <typename T>
class DoublyIterator
{
friend class ... | true |
d7598016e9418c6fa475d4fae79e25aa94216344 | C++ | mikeypatt/IP_Address_Cache | /IP_Address_Tests.cpp | UTF-8 | 692 | 3.234375 | 3 | [] | no_license | //
// Created by Michael Patterson on 18/10/2020.
//
#include <gtest/gtest.h>
#include "IP_Address.h"
using testing::Eq;
struct IPAddressTests : public testing::Test
{
IP_Address* Address1;
IP_Address* Address2;
IPAddressTests() {
Address1 = new IP_Address(192,168,0,1);
Address2 = new IP... | true |
1bb6f2546c413f4ca2bdbb8832e7ab6dd1987723 | C++ | faemiyah/faemiyah-demoscene_2015-04_64k-intro_junamatkailuintro | /src/verbatim_vertex_buffer.cpp | UTF-8 | 1,796 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "verbatim_vertex_buffer.hpp"
const VertexBuffer* VertexBuffer::g_bound_vertex_buffer = NULL;
const VertexBuffer* VertexBuffer::g_programmed_vertex_buffer = NULL;
VertexBuffer::VertexBuffer()
{
dnload_glGenBuffers(2, m_id_data);
}
void VertexBuffer::bind() const
{
if(this == g_bound_vertex_buffer)
{
... | true |
e616251bf7821d4cba7c73c95398492db2f3ac6d | C++ | ritik99/comp_code | /10004.cpp | UTF-8 | 1,636 | 2.671875 | 3 | [] | no_license | #include<iostream>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<cstdio>
using namespace std;
int func(std::map<int, std::vector<int> > mp, int a){
//bool flag = true;
queue<int> q;
int color[100000] = {0};
bool discovered[100000] = {0};
vector<int> arr;
q.push();
int layer = 1;
w... | true |
3e80daa0f4627baf296ea4cf15804330c82d4f43 | C++ | sakshi-chauhan/DSCodes | /Stacks/AddNumbers.cpp | UTF-8 | 1,701 | 3.53125 | 4 | [] | no_license | //http://ideone.com/kneolB
//Add two numbers using stacks
#include <iostream>
#include<stack>
int reverseNumber( int num ){
int rev = 0;
while( num > 0 ){
rev = ( rev * 10 ) + ( num % 10 ) ;
num /= 10;
}
return rev;
}
void printStack( std::stack<int> s ){
while( !s.empty() ){
std::cout<... | true |
b96b87e6b2279d62d4e31a6eaf9359267553d7b0 | C++ | coolsnowy/leetcode | /007.Reverse_Integer.cpp | GB18030 | 1,791 | 4.03125 | 4 | [] | no_license | /*
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Note:
The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed integer overflows.
*/
#include <iostream>
#include <vector>
#include <string>
#include <cm... | true |
b325591f94d761e2145f78bc5599353d8c6cd8a3 | C++ | Baltoli/accsynt | /src/synth/src/affine_fragment.h | UTF-8 | 2,609 | 2.515625 | 3 | [] | no_license | #pragma once
#include "fragment.h"
#include <support/llvm_utils.h>
#include <support/random.h>
namespace synth {
class affine_fragment : public fragment {
public:
affine_fragment(std::vector<props::value> args, frag_ptr before);
affine_fragment(std::vector<props::value> args);
affine_fragment(affine_fragment... | true |
511f5aa4000f7c126b60ab04d60d1548aadc9519 | C++ | kapcom01/tcc2012-mlp-mpi-cuda | /src/mlp/mpi/RemoteOutLayer.cpp | UTF-8 | 3,213 | 2.578125 | 3 | [] | no_license | #include "mlp/mpi/RemoteOutLayer.h"
namespace ParallelMLP
{
//===========================================================================//
RemoteOutLayer::RemoteOutLayer(uint inUnits, uint outUnits, uint hid,
uint hosts)
: Layer(inUnits, outUnits), OutLayer(inUnits, outUnits)
{
this->hid = hid;
// Aloca os ve... | true |
8ca2ec72e91404cb0621b88f76a8797eaff53f8a | C++ | Suanec/BachelorOfIS | /work/_jobdu/_leetcode_/_leetcode_/_leetcode_326.cpp | UTF-8 | 832 | 3.078125 | 3 | [] | no_license | /*
326. Power of Three My Submissions QuestionEditorial Solution
Total Accepted: 40791 Total Submissions: 110615 Difficulty: Easy
Given an integer, write a function to determine if it is a power of three.
Follow up:
Could you do it without using any loop / recursion?
*/
#include"leetcode.h"
class Solution {
publ... | true |
1247f3c07cb6f0c12047b124c48b00a8e36e7cd0 | C++ | OC-MCS/prog5-mystring-danielmaher3 | /MyString/testMyString.cpp | UTF-8 | 723 | 3.609375 | 4 | [] | no_license | // test driver code goes here
#include <iostream>
#include "MyString.h"
using namespace std;
int main()
{
cout << "I am a test :)" << endl;
MyString s1;
MyString s2 = ":)";
MyString s3(s2);
cout << "First:" << endl;
cout << "s1: " << s1 << endl;
cout << "s2: " << s2 << endl;
cout << "s3: " << s3 << endl;... | true |
4fd28a0582052e1546deaadba0abfba430b12c0d | C++ | lauraaustin/Computer-Science-Minor | /121/hw1pr2.cpp | UTF-8 | 1,542 | 3.234375 | 3 | [] | no_license | //Laura Austin
//CSCE 121-506
//Due: February 1, 2016
//hw1pr2.cpp
//I got the formula for the area of a segment from:
// http://www.mathopenref.com/segmentarea.html
#include "std_lib_facilities_4.h"
int main()
{
double c, r,PI,a,C,S;
// c is chord length
// radius
// a is area of circle of 14 inches
// ... | true |
d54051f4f3e4413c60d173431f0e2bada5e9ed02 | C++ | BliZZeRxD/GodLanguage | /lab3/1t.cpp | UTF-8 | 423 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int a,b,c;
cin >> a >> b >> c;
if ((sqrt(pow(a,2)+pow(b,2))) == c)
cout << "YES";
else if ((sqrt(pow(c,2)+pow(b,2))) == a)
cout << "YES";
else if ((sqrt(pow(a,2)+pow(c,2))) == b)
cout << "YES"... | true |
5ee2c0aad713877a39d9eca9b551b524b2fc51d4 | C++ | punnu97/sanjivani | /project.cpp | UTF-8 | 11,272 | 2.796875 | 3 | [] | no_license | /*PROJECT :SANJIVANI- ONLINE MEDICINE PORTAL
NOTE :- Only ADMIN of the PORTAL can open a customer account
To join SANJIVANI group,
contact ADMIN -1800456789(TOLL FREE)
*/
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<dos.h>
#include<process.h>
#i... | true |
f6e1c493b51e8426ef3d71a9b7298502301a6c4e | C++ | AngelTorresParada/3DProgrammingLighting | /ugine3d/src/Entity.h | UTF-8 | 555 | 2.59375 | 3 | [] | no_license | #pragma once
#include "../lib/glm/glm.hpp"
#include "../lib/glm/gtc/quaternion.hpp"
class Entity {
public:
Entity();
virtual ~Entity();
const glm::vec3& getPosition() const;
void setPosition(const glm::vec3&);
const glm::quat& getRotation() const;
const void setRotation(const glm::quat&);
const glm::ve... | true |
114782caa9910e43ce3ddd3893113292db066313 | C++ | arcean/sketchit | /colorcellwidget.cpp | UTF-8 | 3,749 | 2.75 | 3 | [] | no_license | #include "colorcellwidget.h"
#include <QGraphicsSceneResizeEvent>
#include <QDebug>
#define NORMAL_STATE 0
#define SELECTED_STATE 6
ColorCellWidget::ColorCellWidget(QColor color, int width, int height, QGraphicsWidget *parent) :
MWidget(parent)
{
this->color = color;
this->width = width;
this->height... | true |
971061f9a88ed441eb6b1ddbbea715c36153622f | C++ | kurff/kurff | /test/add_path_label.cpp | UTF-8 | 334 | 2.703125 | 3 | [
"MIT"
] | permissive | #include <fstream>
using namespace std;
int main(int argc, char* argv[]){
ifstream f(argv[1], ios::in);
string name;
string path = argv[2];
ofstream fo(argv[3], ios::out);
int label;
while(f >> name >> label){
fo << path+name <<" "<< label<< endl;
}
fo.close();
f.close();
... | true |
6878bbadfadb027854f31ec2f1d45f8aad5c4dc6 | C++ | guilhermeleobas/maratona | /UFMG/treino0409/cavalos.cc | UTF-8 | 3,021 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <locale>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <utility>
#include <algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define endl "\n"
typedef long long i... | true |
69e15208ccec06ce79a74a6a136fe85bcf622512 | C++ | Foxclip/JackCompiler | /compiler.cpp | UTF-8 | 19,328 | 2.9375 | 3 | [] | no_license | #include <algorithm>
#include "compiler.h"
void Compiler::writeXML(std::string line) {
int braceCount = 0;
bool indentDone = false;
char previousChar = 0;
for(char c: line) {
if(c == '<' || c == '>') {
braceCount++;
}
}
if(braceCount == 2) {
for(char c: line)... | true |
5eb695c11ed5977fb4862044bd01ae64c33a3d84 | C++ | bergLowe/code-library | /BS_AllocateMinNumOfPages.cpp | UTF-8 | 916 | 3.390625 | 3 | [] | no_license | // https://practice.geeksforgeeks.org/problems/allocate-minimum-number-of-pages0937/1
#include <bits/stdc++.h>
using namespace std;
// Always try to change isValid method in different question.
bool isValid(int arr[], int n, int m, int max) {
int student = 1;
int sum = 0;
for (int i = 0; i < n; i++) {
... | true |
0356177f3d307cbf6950493ba5850ac2695ac1e3 | C++ | Tutlegoss/Beginner_Cpp | /inc/cppPDF/Examples/Fruit.cpp | UTF-8 | 4,275 | 4.21875 | 4 | [] | no_license | //Fruit.cpp
#include <iostream>
using std::cin; using std::cout; using std::endl;
class Fruits
{
//By default a class is private. However, convention lists public:
//first in a class. This means you have to specify public: as shown
public:
Fruits() : apple(0), orange(0), banana(0), strawberry(0) ... | true |
215176a8125a7206f04659bc3645318b21bb19b6 | C++ | isac322/BOJ | /1753/1753.cpp14.cpp | UTF-8 | 932 | 2.78125 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <limits>
#include <functional>
using namespace std;
typedef pair<int, int> INTP;
const int &INF = numeric_limits<int>::max();
int main() {
int e, v, start;
scanf("%d%d%d", &e, &v, &start);
start--;
vector<vector<INTP>> map(e);
ve... | true |
dfbb2326a5fec993e0d1d5dc94da0b6f8b6cb266 | C++ | smdi17/Laboratornie-raboty | /LR1/LR1/LR1.cpp | UTF-8 | 4,411 | 3.390625 | 3 | [] | no_license | // LR1.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
#include <string>
using namespace std;
void massiv() //замена всех чётных чисел в массиве на 0
{
int array[10]; // массив 10 элементов
for (... | true |
4862be87a68f037f607b657e7dee62308b0ee2c0 | C++ | bgianfo/serenity | /Userland/Libraries/LibWeb/DOM/NodeIterator.h | UTF-8 | 2,276 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | /*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/NodeFilter.h>
namespace Web::DOM {
// https://dom.spec.whatwg.org/#nodeiterator
class NodeIterator
: ... | true |
8360bd9f047b43cde5cff7bcec5cf83dd4ec7a57 | C++ | slepasteur/parse_it | /tests/parser/or_tests.cpp | UTF-8 | 1,352 | 3.28125 | 3 | [
"MIT"
] | permissive | #include <algorithm>
#include <array>
#include "parse_it/parser.h"
#include "parse_it/utils/byte_litterals.h"
#include <doctest/doctest.h>
using namespace parse_it;
using namespace parse_it::byte_litterals;
TEST_CASE("Operator ||")
{
constexpr auto parser = one_byte(0x01_b) || one_byte(0x02_b) || one_byte(0x03_b)... | true |
e3e3d739542fe9bddef61726ea470b177291de2c | C++ | geeksunny/Dweedee | /src/Router.cpp | UTF-8 | 7,304 | 2.546875 | 3 | [] | no_license | #include "Deques.h"
#include "Router.h"
// Queue macros
#define CLEAR(Queue) while (!Queue->empty()) { Queue->pop(); }
// Deque macros
#define FIND(Iterable, Value) (std::find(Iterable.begin(), Iterable.end(), Value))
#define HAS(Iterable, Value) (std::find(Iterable.begin(), Iterable.end(), Value) != I... | true |
26b56049a85507e992ca9904e2055ed452e9a349 | C++ | quaeast/DataStructure_2018 | /bjfu239.cpp | UTF-8 | 1,342 | 3.046875 | 3 | [] | no_license | //bjfu239
//
#include <iostream>
using namespace std;
typedef struct Node{
int datum;
struct Node *next;
}Node,*List;
void CirList(List &head, int n){
head = new Node;
head->next=NULL;
Node *cur=head;
head->datum=1;
for (int i = 1; i < n; ++i) {
Node *temp=new Node;
if(i==n... | true |
3491f700258f6b43ae692804cce4dae5c5e8d891 | C++ | denk1/its | /WRocketLauncher.h | WINDOWS-1251 | 667 | 2.59375 | 3 | [] | no_license | #ifndef WRocketLauncher_H
#define WRocketLauncher_H
#include <Ogre.h>
#include "Weapon.h"
namespace RAT
{
class WRocketLauncher: public Weapon
{
public:
WRocketLauncher(const WeaponDescription& desc);
virtual ~WRocketLauncher();
// .
virtual void create(Ogre::SceneNode* parentNode);
/... | true |
eed8281bc9ba44a87c10107dc66a42af65eb2c65 | C++ | Louis-tiany/tiny_rpc | /include/EventLoop.h | UTF-8 | 993 | 2.640625 | 3 | [] | no_license | /*
* File : EventLoop.h
* Author : *
* Mail : *
* Creation : Fri 25 Dec 2020 07:00:53 PM CST
*/
#ifndef _EVENTLOOP_H
#define _EVENTLOOP_H
#include <functional>
#include <vector>
#include <memory>
#include "Poller.h"
#include "Channel.h"
#include "Timer.h"
#include "TimerQueue.h"
class EventLoop{
public:... | true |
05e03dbc143b9434a69975b396c5210f86c1cd02 | C++ | mogemimi/daily-chicken | /daily/CommandLineParser.h | UTF-8 | 1,575 | 2.578125 | 3 | [] | no_license | // Copyright (c) 2015 mogemimi. Distributed under the MIT license.
#pragma once
#include "Optional.h"
#include <string>
#include <sstream>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <vector>
namespace somera {
enum class CommandLineArgumentType {
Flag,
JoinedOrSeparate,
}... | true |
d0fa60d33f63438b1834c325bbc225bb460317a2 | C++ | jmarcoares98/CptS122 | /PA 5/PA 5 CptSci122/wrapper.cpp | UTF-8 | 7,464 | 3.3125 | 3 | [] | no_license | #include "wrapper.h"
#include "list.h"
int Menu::displayMenu()
{
int select = 0;
cout << "Main Menu" << endl;
cout << "(1) Import Course List" << endl;
cout << "(2) Load Master List" << endl;
cout << "(3) Store Master List" << endl;
cout << "(4) Mark Absences" << endl;
cout << "(5) Generate Report" <... | true |
fd4b5a40214b0d9e89858a262e6a217e5f0a98ce | C++ | thecherry94/MazeMaker | /MazeMaker/Maze.hpp | UTF-8 | 1,447 | 2.546875 | 3 | [] | no_license | #pragma once
#include <SFML\System.hpp>
#include <SFML\Window.hpp>
#include <SFML\Graphics.hpp>
#include <memory>
#include <random>
#include "MazeCell.hpp"
class Maze : public sf::Drawable, public sf::Transformable
{
private:
std::vector<std::shared_ptr<MazeCell>> _cells;
sf::Vector2u _size;
sf::Vector2u _ce... | true |
ddf5d2b734f39e455327464dfbad0f84f66e4ad4 | C++ | pashazz/replacer | /func.h | UTF-8 | 220 | 2.765625 | 3 | [] | no_license | #pragma once
#include <string>
/*
Convert numbers in the folowing string to binary approx.
*/
void numbersToBinary(std::string &src);
/*
Convert decimal to binary
*/
std::string decimalToBinary(const std::string &s); | true |
6657dae43206440d6cb4a2a5baa64b0b862556c2 | C++ | Jeswang/leetcode-xcode | /src/problems/search-for-a-range.h | UTF-8 | 2,341 | 3.515625 | 4 | [
"MIT"
] | permissive | //
// search-for-a-range.h
//
// Created by jeswang 27/06/2014.
//
/*
Description:
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1].
Fo... | true |
3f3d0feae946796ac07b6e5dc12be405fa0eced2 | C++ | blurpy/8-bit-computer-emulator | /test/core/BusTest.cpp | UTF-8 | 1,825 | 3.140625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <doctest.h>
#include <fakeit.hpp>
#include "core/Bus.h"
using namespace Core;
TEST_SUITE("BusTest") {
TEST_CASE("read() should return 0 on new instance") {
Bus bus = Bus();
CHECK(bus.read() == 0);
}
TEST_CASE("read() should return value set with write()") {
Bus bus = Bu... | true |
8e92ef3049f76b134f14f73d6371dbefe90bb4f2 | C++ | sarahdarwiche/Compiler_Projects | /Project 1/Code/CrackingtheCodingInterview/LinkedList.cpp | UTF-8 | 2,882 | 3.90625 | 4 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <string.h>
#include <vector>
#include "LinkedList.h"
LinkedList::LinkedList() {
head = new Node(1);
head->next = NULL;
head->prev = NULL;
}
LinkedList::LinkedList(int data) {
head = new Node(data);
head->next = NULL;
head->prev = NULL;
}
LinkedList::~Link... | true |
16b0d126a6f3642da4067262c89e81a5d247e5d8 | C++ | zhenkunhe/LeetCode | /279_Perfect_Squares/main.cpp | UTF-8 | 891 | 3.46875 | 3 | [
"MIT"
] | permissive | #include <math.h>
#include <unistd.h>
#include <iostream>
using namespace std;
class Solution
{
public:
int numSquares( int n )
{
int resultArray[n + 1];
if ( n == 0 ) return 0;
if ( n == 1 ) return 1;
if ( n == 2 ) return 2;
resultArray[0] = 0;
resultArray[1] = 1;
resultArray[2] = 2;
fo... | true |
10f4f189989facb978e7f3f4d2e61ebf4c7c973c | C++ | atharvak71/QOSF_PROJECT | /qram.cpp | UTF-8 | 5,071 | 2.65625 | 3 | [] | no_license | #include "qram.h"
#include<stdexcept>
#include<cstring>
#include<iostream>
using namespace qcpp;
static inline void print_binary(std::ostream& oss,const std::size_t& val,const unsigned int& bits)
{
for(unsigned int bi=0;bi<bits;bi++)
{
unsigned int rbi=bits-bi-1;
oss << ( (val >> rbi) & 1 );
//oss << (int)((va... | true |
39ba63f64784481697449c987ab411fac860363d | C++ | mishikaraj/30-day-LeetCode-May-Challenge-2020 | /Week-2/Day-9.cpp | UTF-8 | 809 | 3.875 | 4 | [] | no_license | Valid Perfect Square
Solution
Given a positive integer num, write a function which returns True if num is a perfect square else False.
Note: Do not use any built-in library function such as sqrt.
Example 1:
Input: 16
Output: true
Example 2:
Input: 14
Output: false
class Solution {
public:
bool isPerfectSquare(... | true |
addf0309adcc14d4ada74aea8ad2d711571674cd | C++ | Tronf92/zi_din_an | /zi din an/Source.cpp | UTF-8 | 2,044 | 3.234375 | 3 | [] | no_license | //Nicorici Adrian, 08.03.2014
//Se considera o data calendaristica (zi, luna, an). Sa se verifice daca data respectiva este a secolului nostru sau nu.
#include <iostream>
using namespace std;
int verificare_data(int zi,int luna,int an){
if(zi<1 && luna <1 && an < 1){
cout << "Data nu este valida!" << endl;
return... | true |
2eeab8ed32d7160a94cf6565880f7b026f61db5e | C++ | muskan09/CppCodes | /cpp3/operatoroverloadingfriendfuncunary.cpp | UTF-8 | 341 | 3.0625 | 3 | [] | no_license | #include<iostream>
using namespace std;
class number{
int x;
public:
void setdata(int a){
x=a;
}
void disp(){
cout<<"value"<<x;
}
friend void operator-(number& t){
t.x=-t.x; // - operator overloading with frnd func
}
};
int main(){
number n;
n.setdata(-9);
n.disp();
-n;
n.... | true |
756bd8f5acef59c6ae1a95fca2975a7fcec005a0 | C++ | green-fox-academy/pengegyuri | /week-02/day-2/lookformx/main.cpp | UTF-8 | 911 | 4.3125 | 4 | [] | no_license | #include <iostream>
int main()
{
// Create a program which first asks for a number
// this number indicates how many integers we want to store in an array
// and than asks for numbers till the user fills the array
// It should print out the biggest number in the given array and the memory address of it... | true |
a1e2954b9739d592e717429a7f6b38223116a7ea | C++ | qurobert/CPP | /02/ex03/main.cpp | UTF-8 | 276 | 3.125 | 3 | [] | no_license | #include "Point.hpp"
bool bsp(Point const a, Point const b, Point const c, Point const point);
int main(void)
{
Point a(2, 3);
Point b(4, 7);
Point c(7, 1);
Point p(5.76f, 4.99f);
if (bsp(a, b, c, p))
std::cout << "In\n";
else
std::cout << "Out\n";
return (0);
}
| true |
ddde2eaa37aa12abcded5313f77fbdde5672f0da | C++ | jiaxin96/Projects | /CampusGuide/include/Spot.hpp | UTF-8 | 310 | 2.75 | 3 | [] | no_license | #ifndef SPOT_HPP
#define SPOT_HPP
#include <string>
using namespace std;
class Spot {
private:
string name;
int mark;
string introduction;
public:
Spot();
Spot(string n, int m, string i);
string get_name() const;
int get_mark() const;
string get_introduction() const;
};
#endif
| true |
c4f752fb00d1f293ca51cb3c3787643dff91e5b1 | C++ | HYAR7E/WorkAgency | /Files/database.cpp | UTF-8 | 6,071 | 3.046875 | 3 | [] | no_license | #ifndef DATABASE
#define DATABASE
// Arrays
// These arrays should be of variable type, no pointers cuz these store the structure data
static Person accounts[30]={0}; // It gets initializated with {0} cuz first element is int type
// Can't declarate with Person{0} cuz it requires array elements
static int _iac = 0;... | true |
dfbbe5e4f80020e0dee52056f4a3cd7138821753 | C++ | CS-205-S21/205-cia | /tag.cpp | UTF-8 | 260 | 2.6875 | 3 | [] | no_license | #include "tag.h"
#include <iostream>
using namespace std;
Tag::Tag(string n)
{
name = n;
}
Tag::Tag(string n, string t)
{
name = n;
type = t;
}
string Tag::getName()
{
return name;
}
string Tag::getType()
{
return type;
}
| true |
14e4a7c3dccc8834a9a45ab0b36fb33fe39ad17d | C++ | claris-yang/knowledge_planet | /cplusplus/basic/sample.cpp | UTF-8 | 380 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by yangtao on 20-11-12.
//
#include <iostream>
#include <stack>
using namespace std;
char t;
stack<int> s;
int n, cnt;
int main() {
cin >> n;
n *= 2;
for(int i = 0 ; i < n; i++) {
cin >> t;
if(t == '(') {
s.push(++cnt);
} else {
cout << s.top() ... | true |
6848b46b1f91721d4326a5eabdf3fcb1c2cfcb72 | C++ | taxuewill/opencv_study | /src/chapter5/c5t2.cpp | UTF-8 | 874 | 2.734375 | 3 | [] | no_license | #include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include "constants.h"
int main()
{
cv::Mat image = cv::imread(IMAGE_BINARY);
if (!image.data)
return 0;
// Display the image
cv::namedWindow("Image");
cv::imshow("Image", image);
cv::Mat element5... | true |
d20b1f076df5b710e4c1ba13d94ecf8310199d6a | C++ | davidatroberts/SoftwareRenderer | /src/Vector.hpp | UTF-8 | 1,690 | 3.21875 | 3 | [
"MIT"
] | permissive | #ifndef VECTOR_H
#define VECTOR_H
#include <array>
#include <ostream>
#include <tuple>
#include <vector>
class Vector {
public:
Vector(float x=0, float y=0, float z=0, float w=1);
float p_norm(float p);
float magnitude();
float dot(Vector &other);
Vector normalized();
Vector project_to_3d();
Vector reflect(Ve... | true |
164981336865ac6039a95961ef7284b5ffe61005 | C++ | kliment-olechnovic/voronota | /src/scripting/operators/import_figure_voxels.h | UTF-8 | 2,355 | 2.828125 | 3 | [
"MIT"
] | permissive | #ifndef SCRIPTING_OPERATORS_IMPORT_FIGURE_VOXELS_H_
#define SCRIPTING_OPERATORS_IMPORT_FIGURE_VOXELS_H_
#include "../operators_common.h"
namespace voronota
{
namespace scripting
{
namespace operators
{
class ImportFigureVoxels : public OperatorBase<ImportFigureVoxels>
{
public:
struct Result : public OperatorResu... | true |
ba6ee129329ca8a730c62c38bc5a8dcfa7c91787 | C++ | Annihilater/Cpp-Primer-Plus-Source-Code-And-Exercise | /Chapter 17/17_8_4/17_8_4.cpp | UTF-8 | 1,772 | 3.109375 | 3 | [] | no_license | //
// Created by klause on 2020/9/23.
//
//Program arguments:
// "/Users/klause/Documents/CLionProjects/Cpp Primer Plus/Chapter 17/17_8_4/test1.txt"
// "/Users/klause/Documents/CLionProjects/Cpp Primer Plus/Chapter 17/17_8_4/test2.txt"
// "/Users/klause/Documents/CLionProjects/Cpp Primer Plus/Chapter 17/17_8_4/test3.t... | true |