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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3f85b889a9eecf609392d46a81104384fdec88e0 | C++ | tilak30/babbar-450 | /Arrays/neg_pos_rearrange.cpp | UTF-8 | 509 | 3.296875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void neg_pos_rearrange(vector<int> v, int n){
//two pointer approach
int x=0,y=n-1;
while(x<y){
if(v[x]<0){
x++;
}
if(v[y]<0){
swap(v[x],v[y]);
x++;
}
y--;
}
//PRINT ARRAY
... | true |
9e3d802dab0a81eb84c819bf0f4ee58270080769 | C++ | leejaeseung/Algorithm | /BOJ/C++/15686_치킨 배달.cpp | UHC | 5,045 | 3.453125 | 3 | [] | no_license | /*
ũⰡ NN ð ִ. ô 11ũ ĭ ִ. ĭ ĭ, ġŲ, ϳ̴. ĭ (r, c) · Ÿ, r c Ǵ r° ĭ, ʿ c° ĭ ǹѴ. r c 1 Ѵ.
ÿ ġŲ ſ Ѵ. , "ġŲ Ÿ" ַ Ѵ. ġŲ Ÿ ġŲ Ÿ̴. , ġŲ Ÿ , ġŲ Ÿ ִ. ġŲ Ÿ ġŲ Ÿ ̴.
ĭ (r1, c1) (r2, c2) Ÿ |r1-r2| + |c1-c2| Ѵ.
, Ʒ ø 캸.
0 2 0 1 0
1 0 1 0 0
0 0 0 0 0
0 0 0 1 1
0 0 0 1 2
0 ĭ, 1 , 2 ġŲ̴.
(2, 1) ִ (1... | true |
5860175cc4a8ae9586aedad3f55bd80f06835d2c | C++ | Arjunann/competitive-programming | /MinimumTimetoMeet.cpp | UTF-8 | 1,514 | 3.90625 | 4 | [] | no_license |
// Efficient C++ program to find minimum time
// required to produce m items.
#include<bits/stdc++.h>
using namespace std;
// Return the number of items can be
// produced in temp sec.
int findItems(int arr[], int n, int temp)
{
int ans = 0;
for (int i = 0; i < n; i++)
ans += (temp/arr[i])... | true |
f398da8f9ab021334de0f6cf230b3f33b08c315d | C++ | ZeroZhong/ACM2- | /第07章_2010_Day1/7.1.xiaoqiao/xiaoqiao.cpp | GB18030 | 2,664 | 3.046875 | 3 | [] | no_license | #include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;
const int COLOR = 3;
const int RANK = 13;
int cnt[COLOR][RANK];
int max_group[RANK];
char answer[1594324]; // 3 ^ 13 == 1594324
// a洢3ÿһλget_slotת
inline int get_slot(int a[]) {
int slot = 0;
for (int ... | true |
e23000ecde7b0abc71c588098d6a0cb2142bf376 | C++ | krishna-NIT/100DaysCodingChallenege | /Day26/Number of students unable to eat lunch.cpp | UTF-8 | 941 | 2.8125 | 3 | [] | no_license | /*
Platform :- Leetcode
Approach :- Bruteforce and eliminate the types and studets choice accordingly
*/
class Solution {
public:
int countStudents(vector<int>& t, vector<int>& q) {
int c=0,d=0;
for(auto x:t)if(x)c++;
for(auto x:q)if(x)d++;
if(c==d){return 0;}
vec... | true |
e1cfd19f3af43f51f36876ddd794e42c3b71cacb | C++ | MrClassic/patch-ware | /patch-ware/DynamicOutputDevice.cpp | UTF-8 | 3,839 | 3.375 | 3 | [] | no_license | /* **********************************************************************
* File: DynamicOutputDevice.cpp
* Author: Nate Gallegos
*
* Log:
* 8/29/19
* File Created
********************************************************************** */
#include "DynamicOutputDevice.h"
/*
Default Const... | true |
00f19711bc7bd2e88e616564b354746d75b44f2c | C++ | hex0d/ADSL | /Newton-EulerConvergenceTransformation.cpp | UTF-8 | 642 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <limits>
#include <cmath>
#include "windows.h"
#include <iomanip>
unsigned long long fat(int n){
unsigned long long fat = 1;
while (n)
{
fat *= n;
n--;
}
return fat;
}
double newt_euler_pi(int termos){
double pi = 0.0;
double aux = 0.0 ;
for (int i = 0; i < termos; i++){
... | true |
222073b6d10d88032a966d40a68a288bd145ee98 | C++ | RockyYHL/gocpp | /ch03/test2_1.cpp | UTF-8 | 8,011 | 3.609375 | 4 | [] | no_license | #include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
/*
2 STL初识
2.1 STL的诞生
- 长久以来,软件界一直希望建立一种可重复利用的东西
- C++的面向对象和泛型编程思想,目的就是复用性的提升
- 大多情况下,数据结构和算法一直都未能有一套标准,导致被迫从事大量重复工作
- 为了建立数据结构和算法的一套标准,诞生了STL
2.2 STL基本概念
- STL(Standard Template Li... | true |
ec38473e9a4c3690e3be3f60a7d64cd33e63f7ce | C++ | liuyuwang2016/-C- | /Final/Final 2/Source.cpp | GB18030 | 786 | 3.203125 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
if (n % 3 == 0) {//Ȱܱ3Ķֱ
if (n % 5 == 0) {
if (n % 7 == 0)
cout << "3 5 7" << endl;
else
cout << "3 5" << endl;
}
if (n % 7 == 0 && n % 5 != 0)
cout << "3 7" << endl;
if (n % 7 != 0 && n % 5 != 0)
... | true |
4ca3b8f16a6f431cf1363a5001c0f1e129711484 | C++ | Jamil132/DSA-COMPLETE-SERIES | /Practise Code 1/Friend function in cpp.cpp | UTF-8 | 541 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
class Y;
class X
{
int data;
public:
void setValue(int value){
data = value;
}
friend void sumdata(X,Y);
};
class Y
{
int num;
public:
friend void sumdata(X,Y);
void setValue(int value){
num = va... | true |
14efb35ca7fff58d1b184af4e44952bbb35f6333 | C++ | semiessessi/jEngine | /jen/Source/pngtex.h | UTF-8 | 693 | 2.515625 | 3 | [] | no_license | // .png texture loader by Semi Essessi
// only supports loading 3/4 channel pngs to a rgba/rgb0 unsigned int bitmap
// can be easily updated to support further types or perhaps ALL using the libpng functions
#ifndef PNGTEX_H
#define PNGTEX_H
#pragma comment(lib, "libpng.lib")
#pragma comment(lib, "zlib.lib")
... | true |
8ef23518e312e063bd8709f7a66e6e71e4130d56 | C++ | miguelcarvalhosa/CAV-20-21 | /examples/classes/example.cpp | UTF-8 | 421 | 3 | 3 | [] | no_license | //
// Created by Antonio J. R. Neves on 16/10/2020.
//
#include "Img.h"
#include <iostream>
using namespace std;
int main() {
Img i1;
Img i2(1024, 768);
cout << i1.getNCols() << endl;
try {
i1.putPixel(10, 1, 255);
}
catch (std::out_of_range e){
std::cout << e.what() << std:... | true |
bb3d2cfe074460b3804cb7ef72b8f2d35b567065 | C++ | shuz/TinyGraphics | /project/016/src/TinyGraphics/TinyGraphics/Kernel/Primitive3D.h | UTF-8 | 2,762 | 3.359375 | 3 | [] | no_license | #ifndef PRIMITIVE_3D_INCLUDED__
#define PRIMITIVE_3D_INCLUDED__
#include "Real.h"
#include "Vector3D.h"
#include "Matrix4D.h"
#include <vector>
namespace TinyGraphics {
class Point3D {
public:
real x, y, z;
Point3D() {
assign(0, 0, 0);
}
Point3D(real x, real y, real z) {
assign(x, y... | true |
cabb273b4314a208421e1487c7f96a23fda46871 | C++ | jjzhang166/QT43 | /patedit/patternEdit/pattimagemodel.cpp | UTF-8 | 2,509 | 2.5625 | 3 | [] | no_license | #include <QtGui>
#include <QtCore>
#include "pattimagemodel.h"
pattImageModel::pattImageModel(QObject *parent)
: QAbstractTableModel(parent)
{
for (int i = 0; i < 16; i ++)
{
QString name;
name.sprintf(":/colorImage/%d.bmp", i);
itemDisplay[0][i].load(name); // 正色图片
name.sp... | true |
50d5cb516f270872771884a13786d12f86e57338 | C++ | Mingchenchen/raptorx-zy | /contrib/BALL/include/BALL/MOLMEC/PARAMETER/quadraticBondStretch.h | UTF-8 | 2,410 | 2.59375 | 3 | [] | no_license | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: quadraticBondStretch.h,v 1.18 2005-12-23 17:01:54 amoll Exp $
//
#ifndef BALL_MOLMEC_PARAMETER_QUADRATICBONDSTRETCH_H
#define BALL_MOLMEC_PARAMETER_QUADRATICBONDSTRETCH_H
#ifndef BALL_FORMAT_PARAMETERSECTION_H
# include <BALL/FORMAT/parameterSection.h>
... | true |
4038df33d70ca38c1ae2da2d716de5d4c1d6e906 | C++ | Deven-14/CPP_Lab | /asgn1/sqrt.cpp | UTF-8 | 206 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a;
cout << "Enter a number : " << endl;
cin >> a;
cout << "Square root of " << a << " = " << sqrt(a) << endl;
return 0;
}
| true |
a5eef7027d7c1572984374603457de492ef2aa54 | C++ | zywww/regex_engine | /regex_engine/Lexer.h | UTF-8 | 313 | 2.578125 | 3 | [] | no_license | #ifndef LEXER_H
#define LEXER_H
#include <fstream>
#include <string>
#include "Token.h"
class Lexer
{
public:
Lexer(const std::string ®ex);
Token GetNextToken();
private:
void Error(char ch);
std::string regex_;
std::string::size_type index_ = 0;
bool error_ = false;
};
#endif | true |
97d71bedcd527db1af65046bb10a66f86a3108e6 | C++ | SiggiSigmann/adventofcode2020 | /04/_2/04.cpp | UTF-8 | 7,029 | 3.421875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
/*##############################################################################
# depicts a database
# byr (Birth Year)
# iyr (Issue Year)
# eyr (Expiration Year)
# hgt (Height)
# hcl (Hair Color)
# ecl (Eye Color)
# pid (Passport ID)
# c... | true |
e3eb37ce0f9b1e934af570aae12b2dd584f21a7a | C++ | UNKJay/Data_Structure_Algorithm | /Data_Structures_ZJU/Chap9/Sort.cpp | UTF-8 | 4,677 | 3.078125 | 3 | [] | no_license | #include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 100010;
const int CUTOFF = 100;
int N;
long long int A[MAXN];
long long int TempA[MAXN];
void BubbleSort();
void InsertSort(int l, int r);
void ShellSort();
void HeapSort(); void PercDown(int L , int R);
void MergeSort(); void Merge(int... | true |
d630b692d2f1464b1901d69264e29d2c68a75c1b | C++ | fantasydreams/usually-coding | /ACM/3n+1problem.cpp | UTF-8 | 602 | 3.40625 | 3 | [] | no_license | #include <iostream>
/*
3n+1 problem
*/
using namespace std;
void calculate(int * a, const int number, int num);
int main()
{
int size;
cin >> size;
int * p = new int[size];
for (int i = 0,temp; i < size; i++)
{
cin >> temp;
calculate(p, temp, i);
}
for (int i = 0; i < size; i++)
{
cout << p[i]<<endl;
... | true |
839391cb865ad935fb0791c9a8291bfa219721bf | C++ | wjslager/KO2 | /teensy3.2/ldr_recorder/recording.ino | UTF-8 | 2,067 | 3.21875 | 3 | [] | no_license | void recordMotion() {
if (recording) {
// Display the users actions using the led
outputLight = light;
// Record LDR values
// One sample per 10ms
if (millis() % 10 == 0) {
// Take a sample
recordedValues[playbackPos] = light;
// Advance one step
playbackPos++;
Seria... | true |
ff764f420e86a750e7e89d1d9fdf6457b00810f8 | C++ | acc-cosc-1337-spring-2021/acc-cosc-1337-spring-2021-24SergioA | /src/classwork/03_assign/main.cpp | UTF-8 | 989 | 3.984375 | 4 | [
"MIT"
] | permissive | #include "decision.h"
#include <iostream>
//Write the include statement for decisions.h here
//Write namespace using statements for cout and cin
//Prompt the user for a number and if the number is between 0 and 100
//call both get_letter_grade_using_if and get_letter_grade_using_switch
//functions to display the le... | true |
b04c64380d29433493189e2b04aad441e794a383 | C++ | IssaShane/upgraded-waffle | /src/Level.h | UTF-8 | 503 | 2.53125 | 3 | [] | no_license | #ifndef LEVEL_H
#define LEVEL_H
#include <SDL.h>
#include <SDL_image.h>
#include <fstream>
#include <vector>
#include "Subject.h"
class Level : public Subject
{
public:
Level( const char *filename, int CollY );
Level(const Level&);
void draw( SDL_Surface *Screen );
bool IsColliding... | true |
cdad99d37ae4554494523f932bec5b7b0b1dbb6c | C++ | cnsuhao/myown | /FsGame/SystemFunctionModule/CoolDownModule.h | GB18030 | 2,992 | 2.515625 | 3 | [] | no_license | //--------------------------------------------------------------------
// ļ: Server\FsGame\SkillModule\CoolDownModule.h
// : ȴϵͳ
// ˵ :
// : 2008/01/28
// :
// :
//--------------------------------------------------------------------
#ifndef __CoolDownModule_h__
#define __CoolDownModule_... | true |
087736d1bf947fcbd2f9105cc2fb88e624bd6c1a | C++ | proRamLOGO/high-school | /pnc.cpp | UTF-8 | 551 | 2.703125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
const long long MAX = 999999999;
bool seen[10];
bool isRepFree(long long i)
{
if(i == 0) return false;
memset(seen, false, sizeof(seen));
while(i)
{
if(i % 10 == 0 or seen[i % 10]) return false;
seen[i % 10] = true;
i /= 10;
}
return true;
... | true |
481afc24dfaa0b7af06e973ea1407535535eaabf | C++ | fledmer/MushroomsGame | /hackgamewidget.cpp | UTF-8 | 8,158 | 2.609375 | 3 | [] | no_license | #include "hackgamewidget.h"
#include <random>
#include <time.h>
#include <QtCore>
#include <QKeyEvent>
#include <QGridLayout>
CandyWorld::CandyWorld(int w_count, int h_count):candyEatCount(0)
{
srand(time(0));
this->w_count = w_count*2+1;
this->h_count = h_count*2+1;
playerPosition = new QPoint(1,1);
... | true |
bc83f4ba9c20cd622ba25e70f35d8a4b89c02806 | C++ | SelvaBalasubramanian/SPOJ-Submissions | /ADDREV - Adding Reversed Numbers.cpp | UTF-8 | 1,234 | 2.953125 | 3 | [] | no_license | /*
http://www.spoj.com/problems/ADDREV/
Author : Selva Balasubramanian
*/
#include<iostream>
#include<vector>
using namespace std;
vector<int>add(vector<int>a , vector<int>b){
vector<int>::reverse_iterator ait , bit , cit;
vector<int>::iterator rit;
ait = a.rbegin();
bit = b.rbegin();
int carry = 0;
for(... | true |
074b52643a99ea4624bc459db05c5564853fcee0 | C++ | cash2one/mygametool | /Client/Common/engine.h | GB18030 | 1,576 | 2.578125 | 3 | [] | no_license | //*******************************************************************************
// Ȩ(C) 2012 All right reserved
// ļ : engine.h
// ǰ汾 : 1.0.0.1
// : fuzhun (339448261@qq.com)
// : 20121212
// ˵ :
//*******************************************************************************
#pragma once
#in... | true |
0dc9ab68785cb342d3b6fd046137eb9558ad86cb | C++ | bolidezhang/socketlite | /include/SL_Utility_Memory.h | GB18030 | 3,510 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | #ifndef SOCKETLITE_UTILITY_MEMORY_H
#define SOCKETLITE_UTILITY_MEMORY_H
#include <cstring>
#include "SL_Config.h"
class SL_Utility_Memory
{
public:
SL_Utility_Memory()
{
}
~SL_Utility_Memory()
{
}
//ڴ濽
//: window7-32 vc2010 cpu: 4*i5-2310 memory: 4G:
// 1)Сڴʱ, 8ֵֽ,;
... | true |
23629bf0cac831ed2abf34a03e9e8a50bc241ab7 | C++ | albertoavs06/SisOp-UFPB | /src/projeto1_CiceroMarcelo_11121217.cpp | UTF-8 | 7,769 | 2.640625 | 3 | [] | no_license | // Tempo de retorno: tempo no qual o processo espera para ser finalizado (espera + execução)
// Tempo de resposta: tempo esperando para iniciar execução;
// Tempo de espera: tempo gasto na fila de prontos;
// Para executar, fazer uso do CAT
// EXEMPLO: cat entrada.txt | ./projeto2
// Espera e resposta so sao diferentes... | true |
14d172bedc03e3186c977a175f91758ce03d4cb0 | C++ | ShinBei/C_pratice | /buythings.cpp | BIG5 | 3,516 | 3.0625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
struct product {
int id;
char name[10];
int num;
int sale;
int cost;
};
int cal(struct product *produce, int i)
{
int id, num;
int money = 0;
char keep = 'y';
do
{
printf("пJniXإ<1 2R>\n");
scanf("%d", &i);
if (i == 1)
... | true |
31e3b28ec106026dce66ecfb4e6000803d99977c | C++ | ifkas/newsfeeder | /shareddblib/src/FeedController.cpp | UTF-8 | 10,648 | 2.984375 | 3 | [] | no_license | #include "FeedController.h"
#include <cppconn/prepared_statement.h>
#include <sstream>
using namespace std;
using namespace sql;
using namespace nfdb;
/**
* Initialising Constructor for FeedController, opens a database connection
*/
FeedController::FeedController()
{
dbc = new DatabaseController();
conn = dbc->Co... | true |
f22bdc219699d65ced4feed34f2f2723e0ee71c6 | C++ | atemple84/DataStructureAlgorithms | /GraphLesson.cpp | UTF-8 | 2,285 | 3.3125 | 3 | [] | no_license | #include <iostream>
#include <queue>
#include "GraphLesson.h"
vector<vector<int> > adjacencyMatrix()
{
int n, e;
cin >> n >> e;
vector<vector<int> > matrix(n, vector<int>(n, 0));
for (int i = 1; i <= e; ++i)
{
int fv, sv;
cin >> fv >> sv;
matrix[fv][sv] = 1;
matri... | true |
0c20c3b0e6033214c994300c3229278fcee795c9 | C++ | RebeccaCheng910/CHAMBER-CRAWLER | /include/player.h | UTF-8 | 733 | 2.84375 | 3 | [] | no_license | #ifndef _PLAYER_H_
#define _PLAYER_H_
#include "character.h"
#include <string>
#include <memory>
class Enemy;
// abstract class
class Player: public Character {
int goldValue;
std::string action;
bool isDead = false;
protected:
int maxHP;
public:
Player(); // constructor
// int getHP() override;
// int ge... | true |
17af4849a49594de1a29a365f89ed7bf94052154 | C++ | RoboMark9/ocs2 | /ocs2_thirdparty/include/cppad/cg/smart_containers.hpp | UTF-8 | 6,683 | 2.953125 | 3 | [
"GPL-3.0-only",
"EPL-1.0",
"EPL-2.0",
"GPL-2.0-only",
"BSD-3-Clause"
] | permissive | #ifndef CPPAD_CG_SMART_CONTAINERS_INCLUDED
#define CPPAD_CG_SMART_CONTAINERS_INCLUDED
/* --------------------------------------------------------------------------
* CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
* Copyright (C) 2014 Ciengis
*
* CppADCodeGen is distributed under mul... | true |
9b34f88e1df784676571a4b8cb114c279d1730d0 | C++ | njoy/ACEtk | /src/ACEtk/block/AngularDistributionData/src/verifyIncidentEnergyIndex.hpp | UTF-8 | 483 | 2.765625 | 3 | [
"BSD-2-Clause"
] | permissive | void verifyIncidentEnergyIndex( const std::size_t index ) const {
if ( ( index < 1 ) || ( index > this->numberIncidentEnergies() ) ) {
Log::error( "Illegal incident energy index argument into {} block",
this->name() );
Log::info( "Index value: {}", index );
Log::info( "{} accepts an inci... | true |
48b505bec0c840d40b10be6fda615719a4670ab5 | C++ | ysouyno/daobell | /src/bencode_list.cpp | UTF-8 | 606 | 2.703125 | 3 | [] | no_license | #include "bencode_list.h"
void bencode_list::print_member()
{
for (value_type::iterator it = value_.begin(); it != value_.end(); ++it) {
(*it)->print_member();
}
}
void bencode_list::crawl(bencode_crawler *p)
{
p->crawl(this);
}
void bencode_list::insert_to_list(std::shared_ptr<bencode_value_base> value)
{... | true |
7e1b43e12414db89173ae4d249b75c23d53e2c55 | C++ | s13shok/Labs_Cpp | /Lab_2/Lab_2/Matrix.cpp | UTF-8 | 2,319 | 3.203125 | 3 | [
"MIT"
] | permissive | #include "Matrix.h"
#include <iomanip>
#include "Vector.h"
Matrix::Matrix(int i, int j) {
array_ = new int* [i];
i_ = i;
j_ = j;
for (size_t l = 0; l < i_; ++l)
{
array_[l] = new int[j_];
}
for (size_t i = 0; i < i_; ++i)
{
for (size_t j = 0; j < j_; ++j)
{
array_[i][j] = 0;
}
}
}
Matrix::Matrix(con... | true |
297f457594fd52a2a8b45fd2f8f33054d969b74f | C++ | debordem/arduino-basics | /_displays/LED_Matrix/MAX7219/MAX7219_Adafruit-Multiple-SPI-Graphics/MAX7219_Adafruit-Multiple-SPI-Graphics.ino | UTF-8 | 3,949 | 2.875 | 3 | [] | no_license | // https://github.com/markruys/arduino-Max72xxPanel
/* THis works with 1X4 Module
* Download the library zip files and Add Zip file
*/
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel.h>
/* PIN Connections
* _______|_______________|____
* | VCC | | +5V
* | CLK | -CLOCK |... | true |
98da3131b73db395713f4b84e1140954a4de3470 | C++ | Bunty9/GSM_Home_Auto | /gsm-a2/gsm-a2.ino | UTF-8 | 4,465 | 2.734375 | 3 | [] | no_license | #include <SoftwareSerial.h>
//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(3, 2); //SIM800L Tx & Rx is connected to Arduino #3 & #2
int temp=0,i=0;
#define Fan 6
#define Light 4
#define TV 5
char str[25];
String msg;
char ph[] = "+919420490305";
void setup()
{
//Begin seri... | true |
a2a9010134d87bbc700ee1385601691877747e46 | C++ | tnie/see-the-world | /1.语言怎么用/pFunc_learn/lambda/for.cpp | UTF-8 | 760 | 3.53125 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
// 依据参数 n,过滤集合中单词
int main(void)
{
const vector<string> words = {"niel",
"has",
"many",
"books"};
cout << "-------------use for()" << endl;
cout << "长度大于3的单词:";
for (auto citor = words.cbegin(); citor != ... | true |
fca759551450eeefb91e569302317e077acf3b37 | C++ | PabloMessina/Competitive-Programming-Material | /Solved problems/others/HyperactiveGirl.cpp | UTF-8 | 1,740 | 2.609375 | 3 | [] | no_license | #include <cstdio>
#include <set>
#include <algorithm>
#include <cstring>
#include <map>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define MAXN 100
#define MOD 100000000
int M, N;
struct Activity {
int S;
int F;
};
Activity activities[MAXN];
int times[2 * MAXN];
map<int, int> time2In... | true |
05fdfd8845468d01e2c28f207374a018de730f77 | C++ | askarakshabayev/PP1-2018 | /week1/1/4.cpp | UTF-8 | 298 | 3.3125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
// Example 1
string s1, s2; // s1 = "hello world" s2 = "abc"
cin >> s1 >> s2; // s1 = "45" s2 = "5"
cout << s1 + s2;
// Example 2
// string s1;
// cin >> s1;
// char b = s1[3];
// cout << b;
return 0;
} | true |
28570d58ca8f6953b09854a167c3e49d375a968b | C++ | perutilli/project_euler | /prob3/prob3.cpp | UTF-8 | 703 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
#include <math.h>
const long long NUM = 600851475143;
using namespace std;
bool multiple_of_factor(vector<int>, int);
int main()
{
int max = 0;
int max_fact = sqrt(NUM);
vector<int> prime_factors;
for (int i = 2; i <= max_fact; i++)
{
if ((NU... | true |
8a43dff705415bd4ac3052e7154bd31f685d666c | C++ | laziestcoder/Problem-Solvings | /C++ C141018/Private_Shoab_Vai/PROG_102.CPP | UTF-8 | 243 | 3.046875 | 3 | [] | no_license | //#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a;
char ch;
cin >> a;
cout << a << endl;
cin.get(ch); // it is taking the enter key('\n') as input
cout << ch << endl;
return 0;
}
| true |
270227eb30ed540322adffbfd811df2ad3ffad45 | C++ | catunlock/Dementia | /Dementia/src/Camera.cpp | UTF-8 | 3,788 | 2.765625 | 3 | [] | no_license | #include "Camera.h"
#include "MathHelper.h"
namespace Dementia{
Camera::Camera()
: m_position(XMVectorSet(0.0f, 0.0f, -15.0f, 0.0f)),
mRight(XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f)),
mUp(XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f)),
mLook(XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f))
{
SetLens(0.25f*MathHelper::Pi, 1.... | true |
fcffcb915eb18b022a8d2f1327e1c6fd05271793 | C++ | illusivedmg/Dijkstra-Graph-Solver | /MinHeap.h | UTF-8 | 1,450 | 3.375 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
#include <iostream>
#include <cmath>
struct Node {
Node(int lab, int k)
: mLabel(lab), mKey(k) {}
int mLabel, mKey;
};
class MinHeap {
public:
// init vectors as 1-indexed
MinHeap();
// delete Nodes in both lists
~MinHeap();
... | true |
93dd1bdd30128263a6606b7813cdc4c236a834fe | C++ | tito-kimbo/Online-Judge-Solutions | /AceptaElReto/AceptaElReto_212/AceptaElReto_212/Source.cpp | WINDOWS-1250 | 792 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
typedef vector<int> VI;
//TEOREMA 1: Un multigrafo tiene un camino (=>No circular) euleriano sii
//todos sus vrtices tienen orden par salvo 2
//TEOREMA 2: Un multigrafo tiene un circuito (ciclo) euleriano sii
//todos sus vrtices tienen grado par
bool resolv... | true |
9fdad9a195fd6723642b4f37ee1c024e2bc78122 | C++ | MegaRizwan20/Programming-Assignments-4 | /extension.cpp | UTF-8 | 4,782 | 3.25 | 3 | [] | no_license | /*
* Authors: Rizwan Khan, Yiming Cai
* Date: 6/5/17
*
* This is the main executable program that runs the code to make the graph
* and obtain the information on the paths to the graph
*/
#include <fstream>
#include <iostream>
#include <string.h>
#include <errno.h>
#include <math.h>
#include "ExtensionGraph.h"
... | true |
6975d3d5e79f5c24b78e3102c0969ff0531b0774 | C++ | xueliuxing28/Medusa | /Medusa/MedusaCore/Core/Action/IAction.h | UTF-8 | 1,959 | 2.515625 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2015 fjz13. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#pragma once
#include "Core/Pattern/Runnable/DefaultRunnable.h"
#include "Core/Pattern/IClone.h"
#include "Core/String/HeapString.h"
MEDUSA_BEGIN;
enum class Action... | true |
227cece31dbcbaf16c166d5b4ff1a105dc572bfc | C++ | WFCSC112AlqahtaniFall2019/project6-Phaddi | /InsertionSort.cpp | UTF-8 | 1,537 | 3.484375 | 3 | [] | no_license | //Ryan Phadnis
#include <iostream>
#include <vector>
#include "BinaryInsertionSort.h"
#include "Node.h"
#include <cassert>
#include <ctime>
#include "LinkedList.h"
using namespace std;
int main() {
cout << "Enter seed, length: " << endl;
int seed, length;
cin >> seed >> length;
srand(seed);
Link... | true |
8568032eea37eaf29600ca59ab8cd08c08f1e9f3 | C++ | yashkatta/search_algorithms | /src/LinearSearch.hpp | UTF-8 | 360 | 3.140625 | 3 | [] | no_license | #pragma once
class LinearSearch {
public:
LinearSearch() {}
~LinearSearch() {}
template <typename T>
int LinearSearchOnArray(T arr[], unsigned int size, T x);
};
template <typename T>
int inline LinearSearch::LinearSearchOnArray(T arr[], unsigned int size, T x) {
for (int i = 0; i < size; i++) {
if (a... | true |
8170056fcdb6730fc70d34d931c3c646e25ff329 | C++ | small-cat/myCode_repository | /language_implementation_pattern/sql_query/parser/sqlquery_parser.cpp | UTF-8 | 3,291 | 2.609375 | 3 | [] | no_license | /**
* @copyright (c) Copyright 2020 Secsmart. All Rights Reserved.
* @license
* @file : sqlquery_parser.cpp
* @author: Jona
* @email : wuzhenyu@secsmart.net
* @date : 2020-08-11
* @brief : parser for iso/iec sql:1999
*/
#include "sqlquery_parser.hpp"
SqlQueryParser::SqlQueryParser(CommonTokenStream* tokens) ... | true |
69967b80aaa60508642e360735acf9b32a33e80c | C++ | tuyen-nnt/BigO | /Lesson9/Recursion04/main.cpp | UTF-8 | 273 | 3.015625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int findFirst(int n) {
int mod = n % 10;
if ((n / 10) == 0) {
return abs(mod);
} else {
return findFirst(n/10);
}
}
int main() {
int n;
cin >> n;
cout << findFirst(n);
return 0;
}
| true |
ceeb3dda9ddbfcd28fe1f9ca444a1ae26f04a9e7 | C++ | tommyang/autoCompleter_GUI | /wordlist.h | UTF-8 | 955 | 2.640625 | 3 | [] | no_license | /*
* Author: Huayin Zhou
* Description: WordList is a customized QListWidget to keep track of the text
* changes in QLineEdit and print strings to the changes accordingly by
* calling pa3 function:
* vector<std::string> autocomplete(unsigned int num_words, std::string prefix).
* Date: 01/28/2015
*/
#ifndef WORDL... | true |
fa42fd4f5bd996fe92effdffd97b44936f7a30fe | C++ | imVPandey/codesnippet | /code.cpp | UTF-8 | 696 | 2.984375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool isprime(int n){
int flag = 0;
int sqr = sqrt(n);
for (int i = 2; i <= sqr; ++i)
{
if(n%i==0){
flag++;
break;
}
}
if(flag == 0){
return true;
}else{
return false;
}
}
vector<int> find(int n){
vector<int>... | true |
2a6d60b1729d67201107175334cd500c8c475000 | C++ | WolverinDEV/CXXTerminal | /include/CString.h | UTF-8 | 844 | 2.75 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
#define STYLE_MAGIC 0
#define STYLE_BOLD 1
#define STYLE_ITALIC 2
#define STYLE_UNDERLINED 3
#define STYLE_CURSIVE 4
struct CChar {
char _char = -1;
uint16_t attributes = 17;
int color();
CChar& color(int color);
bool hasStyle(int type);
CCha... | true |
1a5c66ba1e5dfe1323e0bb71896ce5c72c771833 | C++ | Twinklebear/Charm-experiments | /pathtracer/pt/plane.cpp | UTF-8 | 1,452 | 2.6875 | 3 | [
"MIT"
] | permissive | #include "plane.h"
namespace pt {
Plane::Plane(const glm::vec3 ¢er, const glm::vec3 &normal, float half_length,
std::shared_ptr<BxDF> &brdf)
: Geometry(brdf), center(center), normal(glm::normalize(normal)), half_length(half_length)
{}
bool Plane::intersect(Ray &ray) const {
const float d = -glm::dot(center, n... | true |
476cbdcf4764184a06f9e59cb3bc1ec6bf6be151 | C++ | anirul/JavascriptIntegration | /javascript/duktape_impl.h | UTF-8 | 1,066 | 2.5625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <any>
#include <istream>
#include "javascript.h"
#include "duktape.h"
namespace javascript {
class DuktapeImpl : public Javascript
{
public:
DuktapeImpl();
virtual ~DuktapeImpl();
void AddFromString(const std::string& ... | true |
540831ebde476b3b0a044732243caf684477e2d8 | C++ | jeffphi/advent-of-code-2018 | /jeff/day-07/part-2.cpp | UTF-8 | 4,635 | 3.015625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <string>
#include "jefflib.h"
#include <boost/tokenizer.hpp>
#include <map>
#include <set>
#include <iomanip>
#include <thread>
#include <chrono>
using namespace std;
using namespace boost;
struct stepInfo_t {
set<char> prereqs;
bool workerAssigned = false;
... | true |
2848cc2a2068337f0cb74b4f5bb859b44505167b | C++ | eefortunato/Cplusplus-Codes | /Project5/SAE.cpp | UTF-8 | 3,981 | 3.40625 | 3 | [] | no_license | /**
* @file
* @author Eric Fortunato
* @version 1.0
*
* @section DESCRIPTION
*
* Source file for SAE class implementation.
*/
#include <sstream>
#include <exception>
#include <stdexcept>
#include <cmath>
#include "SAE.h"
using namespace std;
/**
* Default constructor that initializes feet and dimension
*/
... | true |
235b7fbfe7321dfeb1974678e1e1a299cf41a811 | C++ | Murgowt/CodeBase | /Freelancing/cppAssignment.cpp | UTF-8 | 280 | 2.640625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
double dec1 = 2.5;
double dec2 = 3.8;
double *p, *q;
p = &dec1;
*p = dec2 - dec1;
q = p;
*q = 10.0;
*p = 2 * dec1 + (*q);
q = &dec2;
dec1 = *p + *q;
cout << dec1 << " " << dec2 << endl;
cout << *p << " " << *q << endl;
} | true |
521fa437b27365e7a4758d6827f3cdbed643192e | C++ | zee7985/LeetCode | /Random/Find Permutation-Arrays(I,D).cpp | UTF-8 | 1,355 | 3.578125 | 4 | [] | no_license | Given a positive integer n and a string s consisting only of letters D or I, you have to find any permutation of first n positive integer that satisfy the given input string.
D means the next number is smaller, while I means the next number is greater.
Notes
Length of given string s will always equal to n - 1
Your s... | true |
58f1c87e829453deeb8f107ed759e0accb793240 | C++ | etlapale/tencatl | /include/tencatl/lexer.h | UTF-8 | 2,136 | 3.203125 | 3 | [] | no_license | #pragma once
#include <memory>
#include <queue>
#include <stack>
namespace tencatl {
enum class Token {
NoToken,
Double,
Long,
Int,
String,
Variable,
Symbol,
Operator,
EndOfExpression,
BlockBegin,
BlockEnd,
EndOfFile
};
std::ostream& operator<<(std::ostream& os, Token token);
class Lexer
... | true |
5c831a643bb512aa046f915e883f5a66b0f869f8 | C++ | kapyar/--- | /KR2013/KR2013/Products.h | WINDOWS-1251 | 1,913 | 3.453125 | 3 | [] | no_license | // Goods
// Product.
// .
#ifndef _PRODUCTS_H
#define _PRODUCTS_H
class Products : public Goods
{
private:
Date _exDate;
virtual const Date& do_get_date_of_expiry()const{return _exDate;}
virtual void do_set_date_of_expiry(const Date& d){_exDate = d;return;}
virtual void do_get_spec()const
{
Goods::... | true |
81567b0533f6ef05c2eb3cdf44483e9b7dcf0cf0 | C++ | shrey/templates_cpp | /ConceptsAndQuestions/BinarySearch/binary_search_stl.cpp | UTF-8 | 1,311 | 2.84375 | 3 | [] | no_license |
//Shrey Dubey
//Contact Me at wshrey09@gmail.com
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<list>
#include<iomanip>
#include<queue>
#include<stack>
#define prDouble(x) cout<<fixed<<setprecision(10)<<x //to print decimal n... | true |
37a9c267955335359fd4d61663552dc4aa7c0d89 | C++ | rajephon/programmers_training | /cpp/level3_longest_palindrome.cpp | UTF-8 | 1,047 | 3.140625 | 3 | [
"MIT"
] | permissive | //
// level3_longest_palindrome.cpp
// programmers_training
//
// Created by Chanwoo Noh on 2018. 06. 24..
// Copyright © 2018년 Chanwoo Noh. All rights reserved.
//
#include <iostream>
#include <string>
using namespace std;
int solution(string s) {
int answer=1;
if (s.length() <= 1) {
return (int)s... | true |
5585a4b3ee7449bde077a0c02bab53212c892c99 | C++ | kamonson/BibleReaderCpp | /source_code/Books.cpp | UTF-8 | 8,719 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include "Books.h"
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
Select_Book::Select_Book(){};
Bible::Bible(){};
void Bible::Bible_Select()
{ //Master Class-choose between saved data, Bibles, book
system ("CLS");//for looking good
int user_selection;
v_verse.clear();/... | true |
f00fe5d69d75c576c86312b236b09938651dcfd3 | C++ | StewiiE/OpenGL_SDL-Dodgeball_Project | /OpenGL_SDL Dodgeball Project/object3DS.h | UTF-8 | 932 | 2.84375 | 3 | [] | no_license | #pragma once
#ifndef _OBJECT3DS_H_
#define _OBJECT3DS_H_
#include "Commons.h"
#include <string>
#include <SDL.h>
using std::string;
class Object3DS
{
public:
Object3DS(Vector3D startPosition, string modelFileName, string texturePath);
~Object3DS() {}
void Update(float deltaTime, SDL_Event e);
void Render()... | true |
81914e27f27791da4c701c23461b0e866bd40ccc | C++ | tsydd/missile-win32 | /Controller.cpp | UTF-8 | 4,360 | 2.625 | 3 | [] | no_license | #include "Controller.h"
#include <windows.h>
#define VK_C 0x43 // not defined in winuser.h
enum class KeyEvent {
UNKNOWN,
EXIT,
LEFT_PRESSED,
LEFT_RELEASED,
RIGHT_PRESSED,
RIGHT_RELEASED,
UP_PRESSED,
UP_RELEASED,
DOWN_PRESSED,
DOWN_RELEASED,
FIRE_PRESSED,
FIRE_RELEASED
};
enum class DeviceS... | true |
3494a10adabc3ebb66a7536202cd21412dd9bbe1 | C++ | Yamoneta/Stuff-for-class | /802b.cpp | UTF-8 | 382 | 3.5 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int num1, num2, product, count;
product = 0;
count = 1;
cout << "What is the first number: ";
cin >> num1;
cout << "What is the second number: ";
cin >> num2;
while (count <= num1)
{
product += num2;
++count;
}
cout << num1 <<... | true |
12b57ff32bfbeb96a9ac5bd84a21d577fd68e025 | C++ | adityaiiitL/OOM-Project | /admin.cpp | UTF-8 | 82,782 | 3.234375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#include "admin.h"
void admin::lib_add_book()
{
string book_name;
cout << "Enter the name of the book " << endl;
cin >> book_name;
int choice;
cout << "1 for student book" << endl;
cout << "2 for teacher book" << endl;
cin >> choice;
obj... | true |
81d60e266b4b8ceb26919b8f77134954fead66e7 | C++ | GabeOchieng/ggnn.tensorflow | /program_data/PKU_raw/43/825.c | UTF-8 | 262 | 2.796875 | 3 | [] | no_license | int jud(int k)
{
int s=sqrt(k);
for(int i=2;i<=s;i++)
if(k%i==0)
return 0;
return 1;
}
int main()
{
int m, t, s;
cin>>m;
for(t=3;t<=m/2;t++)
{
s=m-t;
if(jud(s)+jud(t)==2)
cout<<t<<' '<<s<<endl;
}
return 0;
} | true |
89ce916e6ebfc0f4236d7eae52983941e9cdda40 | C++ | bsmith19/chip8-emu-sub | /cpu/include/instructions/InstDisp_DXYN.hpp | UTF-8 | 843 | 2.796875 | 3 | [] | no_license | #ifndef __INSTDISP_DXYN_HPP__
#define __INSTDISP_DXYN_HPP__
#include "instructions/Inst.h"
#include "cpu/CpuData.h"
class InstDisp_DXYN : Inst
{
public:
InstDisp_DXYN(unsigned short opcode) : Inst(opcode) {};
~InstDisp_DXYN() {};
public:
virtual bool Handle(std::shared_ptr<CpuData> systemData)
{
... | true |
f6ba21383b0015c765f133e672ad49452b31ddf3 | C++ | haozha111/algo | /41.cpp | UTF-8 | 1,129 | 3.28125 | 3 | [] | no_license | #include "leetcode.h"
using namespace std;
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
return firstMissingPositive2(nums);
}
//similar to bucket sort, A[i] -> i + 1
int firstMissingPositive1(vector<int>& nums) {
int n = nums.size();
int i = 0;
while (i < n) {
... | true |
3d5b707fa513b7c091a52adc4e725de33d9dafa0 | C++ | Jackwin/mipt-mips | /simulator/risc_v/riscv_register/t/unit_test.cpp | UTF-8 | 1,736 | 2.859375 | 3 | [
"MIT"
] | permissive | /**
* Unit tests for RISCV register
* @author Alexander Misevich
* Copyright 2018 MIPT-MIPS
*/
// generic C
#include <cassert>
#include <cstdlib>
// Catch2
#include <catch.hpp>
// MIPT-MIPS modules
#include "../riscv_register.h"
static_assert(RISCVRegister::MAX_REG == 32);
// Testing methods of the class
TEST_... | true |
ad8e413868b3594599398a242f48f6029e351f13 | C++ | Busiu/ProblemSolving | /Project Euler/Project Euler #10/main.cpp | UTF-8 | 695 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
bool czy_pierwsza(long long int n)
{
for(int i=2; i*i<=n; i++)
{
if(n%i==0)
return false;
}
return true;
}
int main()
{
long long int t, n;
vector <long long int> suma;
suma.push_back(0);
suma.push_back(0)... | true |
d5407a9506fdbd39c792f9c3abe0851403996062 | C++ | EishaMazhar/Semester2-Resources | /CP_LabTasks/lab 5/task 2.cpp | UTF-8 | 1,069 | 3.578125 | 4 | [] | no_license | #include<iostream>
#include<string.h>
#include<iomanip>
using namespace std;
class Calculator{
private:
float rentPerDay;
string Customer_name;
int NoOfdays;
float CustomerRent;
public:
Calculator(){}
Calculator(string s,int n)
{
Customer_name=s;
NoOfdays=n;
rentPerDay=1000.85;
... | true |
b5695acb5ff3222e9de51c5fa441fe0ed4bc94ef | C++ | eitama7/semestral_work_cpp_2020 | /src/CInterface.h | UTF-8 | 5,373 | 3.046875 | 3 | [] | no_license | #pragma once
#include "CCharacter.h"
#include "CPlayer.h"
#include "constants.h"
class CInterface
{
public:
/**
* Draws the start menu.
*/
void StartMenu ();
/**
* Choosing mode : [Pl. vs Pl.] or [Pl. vs PC]
*/
void ChooseMode ();
/**
* For CHelp call. Shows the ru... | true |
c615f940a4a8cc8d3e50906d799b6e962259f12d | C++ | notozeki/ave637kbps-season1 | /GL.cpp | UTF-8 | 4,228 | 2.53125 | 3 | [] | no_license | #include <GL/glut.h>
#include <GL/freeglut_ext.h>
#include <stdio.h>
#include "Map.hpp"
#include "GL.hpp"
#include "Vector.hpp"
#include "StructureManager.hpp"
#include "SimpleStructure.hpp"
Map* GL::mMap = 0;
StructureManager* GL::mStructureManager = 0;
GL::MouseButton GL::mMouseButton;
int GL::mMouseBuf[2];
int GL... | true |
b4b9ddd78998f1324f47f690a4b486e06fa50f04 | C++ | Psyc-d/C- | /Multiplication.cpp | UTF-8 | 218 | 2.671875 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
int main()
{
int Num,It=10,A;
printf("Enter The number \n");
scanf("%d",&Num);
for(A=1;A<=10;A++)
{
printf("%d * %d = %d \n",Num,A,Num*A);
}
}
| true |
7a55314df30fd09f6afe9a73f459daffe71c6d97 | C++ | acyclics/ENGG1340_Group98 | /main.cpp | UTF-8 | 6,801 | 3.515625 | 4 | [] | no_license | /*
File: main.cpp
Purpose: Combine all modules to find optimal solution to problem
*/
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include "main.h"
#include "testcase_generator.h"
#include "simulator.h"
/*
Function: main
Description: This function runs the program.
... | true |
256080ddfea09092bf956bb57c16455339c98d9b | C++ | lsw9021/DexterousManipulation | /fem/Tensor3333.h | UTF-8 | 894 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef __FEM_TENSOR_3333_H__
#define __FEM_TENSOR_3333_H__
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Sparse>
#include <Eigen/Geometry>
namespace FEM
{
class Tensor3333
{
public:
Tensor3333();
Tensor3333(const Tensor3333& other);
Tensor3333& operator=(const Tensor3333& other);
Tensor3333 operator+(... | true |
0733519442211b4acddc9666cc533248746c459a | C++ | nealwu/UVa | /volume131/13189 - Humbertov and the Triangular Spiral.cpp | UTF-8 | 788 | 2.703125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
pair<long long, long long> triangle_spiral(long long n) {
if (n == 1)
return make_pair(0, 0);
long long bx = 0, by = 0, lv = 1;
n--;
long long k = sqrt(n/4);
lv = k+1, bx += 2*k, by -= k, n -= 4*k*k;
for (; n > (lv-1)*8+4; lv++)
n -= (lv-1)*8+4, bx += 2, by--;
b... | true |
adc960ce7cb67802b6fd3c2404452cbb37506977 | C++ | Alexander-Saad/Newtech | /Операторы/Упражнение_14.cpp | UTF-8 | 415 | 2.625 | 3 | [] | no_license | #include <clocale>
#include <iostream>
#include <Windows.h>
#include <math.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
// Число человек между i-тым и k-тым членом очереди
int i = 3, k = 10;
cout << abs(i - k) - 1 << endl; //Только зачем в условии кол-во человек?
system... | true |
519f4552dda427716b57790e337269010935a4e9 | C++ | Zilby/Graphics-Final | /monorepo-Zilby/Assignment4_NormalMappedModelParser/src/ObjParser.cpp | UTF-8 | 4,001 | 2.90625 | 3 | [] | no_license | #include "ObjParser.h"
ObjParser::ObjParser(std::string fileName) {
// Get filepath of the object file's directory
std::size_t endOfPath = fileName.find_last_of("/");
relFilePath = fileName.substr(0, endOfPath + 1);
std::ifstream objFile;
objFile.open(fileName);
// Parse obj file
if(objFile.is_open()) {
... | true |
fae60201a43dff832413a32a730307f5c4e5ae3e | C++ | waxmar/PIC16C84 | /PIC/ram.cpp | ISO-8859-1 | 3,566 | 2.71875 | 3 | [] | no_license | #include "ram.h"
#include <stdlib.h>
#include "bitoperationen.h"
#include "steuerwerk.h"
#include "programmspeicher.h"
#include "programmzaehler.h"
#include <iostream>
Ram::Ram(Steuerwerk* steuerwerk)
{
this->steuerwerk = steuerwerk;
for (int i=0; i<0x50;i++)
{
// Alle Adressen z... | true |
d7711d5a37a068c63e1cce222948fda708dc7d78 | C++ | ifsmirnov/jngen | /printers.h | UTF-8 | 6,279 | 2.734375 | 3 | [
"MIT"
] | permissive | #pragma once
#include "repr.h"
#include <iostream>
#include <tuple>
#include <type_traits>
#include <typeinfo>
#include <utility>
#include <vector>
namespace jngen {
namespace detail {
// TODO: maybe make it more clear SFINAE, like boost::has_left_shift<X,Y>?
// TODO: make these defines namespace independent
#def... | true |
9a25a0dc96e246905f99e3f96f1e38b00ec75dc4 | C++ | 218478/PAMSI-SORT | /Lab5/MergeSortArray.cpp | UTF-8 | 384 | 2.828125 | 3 | [] | no_license | #include "MergeSortArray.hh"
#include <cstdlib> // to deal with pseudo-randomness
bool MergeSortArray::Prepare(int size) {
ExpandingType alloc_type = two_times;
srand(time(NULL));
for (int i = 0; i < size; i++) // adding with doubling array size
tablica.Add(alloc_type, static_cast<int>(rand()));
return... | true |
f2221cf5f67b77644867b41c0e67e38c43885790 | C++ | Manan007224/street-coding | /Leetcode/add_to_num.cpp | UTF-8 | 1,102 | 3.59375 | 4 | [] | no_license | #include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
//ListNode(int x) : val(x), next(NULL) {}
};
ListNode* new_node(int val){
ListNode *l1 = new ListNode;
l1->val = val;
l1->next = NULL;
return l1;
}
class Solution {
public:
ListNode* addTwoNumbers(ListNo... | true |
c0203744fbd539f1011c785940c52dfdf48060e8 | C++ | shaybarak/Tomasulo | /simulator/MIPS32/GPR.h | UTF-8 | 584 | 3.015625 | 3 | [] | no_license | #pragma once
#include "ISA.h"
#include <ostream>
/**
* MIPS32 general purpose registers.
*/
class GPR {
public:
// Returns whether GPR index is valid
static bool isValid(int index);
// Initializes all registers to zero
#pragma warning(disable:4351) // gpr array init to zero is the desired behavior
GPR() : gpr... | true |
728efa0dbd3df88818c36299d5b901ede24bc1e8 | C++ | dculp94/School-Assignments | /CULPDE/Radix.h | UTF-8 | 897 | 2.84375 | 3 | [] | no_license | /********************************************
* Header file for Radix.h
*
* Richard Walker
* 06/12/2014
*
**/
#ifndef RADIX_H
#define RADIX_H
#include <vector>
#include <string>
#include "../../Utilities/Utils.h"
#include "../../Utilities/Scanner.h"
using namespace std;
class Radix
{ public:
Radix();
... | true |
823e4771dc37cafbad9111b1245ba72bdbb09c42 | C++ | ephi/GraphMaximalSimplePath | /task_3/Graph.cpp | UTF-8 | 746 | 2.75 | 3 | [] | no_license | #include "Graph.h"
#include "ListForEachGraphTranspose.h"
#include "ListForEachGraphPrint.h"
#include "ListForEachGraphResetForScan.h"
Graph::Graph()
{
vertices = new ListVertices();
}
void Graph::transpose() {
ListForEachGraphTranspose * lfegt = new ListForEachGraphTranspose();
vertices->ForEach(lfegt);
... | true |
b7bd56f3cc7b6d2d9377a82eec72ddbc1e9ed938 | C++ | saturn1mc/puls4r | /C++/src/Phong.h | UTF-8 | 1,829 | 2.8125 | 3 | [] | no_license | /*
* Phong.h
* puls4r
*
* Created by Camille on 23/01/08.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*
*/
#ifndef PHONG_H
#define PHONG_H
#include <list>
#include "Enlightment.h"
#include "Light.h"
class Phong : public Enlightment{
private:
Color* oa; //ambient color
Color* od; //diffus... | true |
49f82949ba58d8f612db1fb9c2313c5aa77e7fbd | C++ | SP0N9E/Study4Job | /LeetCode/494.目标和.cpp | UTF-8 | 2,981 | 3.0625 | 3 | [] | no_license | /*
* @Author: SP0N9E
* @Description: Edit
* @Date: 2020-08-01 17:44:02
* @LastEditors: SP0N9E
* @LastEditTime: 2020-08-01 18:07:41
* @FilePath: \C++_Code\LeetCode\494.目标和.cpp
*/
/*
* @lc app=leetcode.cn id=494 lang=cpp
*
* [494] 目标和
*
* https://leetcode-cn.com/problems/target-sum/description/
*
* algorith... | true |
fd1432c2a25b79e21f476bcf36591edca0784b32 | C++ | Muikkunen/Lieburo | /src/BananaGun.cpp | UTF-8 | 931 | 2.75 | 3 | [
"MIT"
] | permissive | #include "BananaGun.hpp"
#include "Banana.hpp"
#include <iostream>
BananaGun::BananaGun(Game* game): Weapon(4, 0.5f, 5, 25.0f, "texture/bananagun.png", game){
ammo = clipSize;
(void) game;
}
void BananaGun::shoot(float angle, b2Vec2 position, b2Vec2 preSpeed, Game* game){
(void) game;
//Checking the fire rate
... | true |
afd3f1de14777c72ba549219d3403993dcc97585 | C++ | jstty/OlderProjects | /Games/SuperShooter/SuperShooter_source/code/sprite.cpp | UTF-8 | 6,021 | 2.765625 | 3 | [] | no_license | //////////////////////////////////////////////////////////////////////////////
// Program Name: sprite.cpp
// Programmer: Joseph E. Sutton
// Description: Sprint
// Course: cs371
// Start Date: 10/23/2004
// Last Updated:
// Version: 1.00
///////////////////////////////////////////////////... | true |
8549426a406f5440fd40668dd9c7e1f869bba747 | C++ | ramandeepladda/pepcoding | /Lec31Aug/BTree.cpp | UTF-8 | 1,891 | 3.765625 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <math.h>
using namespace std;
void swap(vector<int> &arr, int l, int r)
{
for (int i = l, j = r; i < j; i++, j--)
{
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
void reverseK(vector<int> &arr, int k)
{
k = k < 0 ? k + arr.s... | true |
c70cb555f419ccb275dd1fc95f063f1802c07245 | C++ | MicrosoftDocs/cpp-docs | /docs/mfc/reference/codesnippet/CPP/casyncsocket-class_3.cpp | UTF-8 | 1,034 | 2.578125 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | // CMyAsyncSocket is derived from CAsyncSocket and defines the
// following variables:
// CString m_sendBuffer; //for async send
// int m_nBytesSent;
// int m_nBytesBufferSize;
void CMyAsyncSocket::OnSend(int nErrorCode)
{
while (m_nBytesSent < m_nBytesBufferSize)
{
int dwBytes;
... | true |
a8c46b2b6c429077d936702ac7dd92cc18839d49 | C++ | davidwang318/LeetCode | /Easy/155_MinStack.cpp | UTF-8 | 650 | 3.3125 | 3 | [] | no_license | // First Attemp. Feels good to have think of using List.
// Time: 91.94%, Memory: 100.00%
class MinStack {
public:
/** initialize your data structure here. */
MinStack() {
}
void push(int x) {
s.push(x);
if(minList.empty() || x <= minList.front()) minList.push_front(x);
... | true |