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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0a7e17df64f57e5b6f924ea977a870487a7e5103 | C++ | aditya803/GFG-Solutions | /MATRIX/MEDIANMATRIX.CPP | UTF-8 | 1,816 | 3.8125 | 4 | [] | no_license | #QUESTION
Given a row wise sorted matrix of size RxC where R and C are always odd, find the median of the matrix.
Example 1:
Input:
R = 3, C = 3
M = [[1, 3, 5],
[2, 6, 9],
[3, 6, 9]]
Output: 5
Explanation:
Sorting matrix elements gives us
{1,2,3,3,5,6,6,9,9}. Hence, 5 is median.
Example 2:
Input:... | true |
f547935a846fd965b925078d67a3455aba71c10c | C++ | SunnyJaiswal5297/Basic_c_programs | /MCM_Memorization.cpp | UTF-8 | 1,345 | 2.671875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int dp[1001][1001];
int bracket[1001][1001];
void parenthesis(int i,int j,int n,char &ch)
{
if(i>=j)
{
cout<<ch++<<" ";
return ;
}
cout<<"(";
parenthesis(i,bracket[i][j],n,ch);
parenthesis(bracket[i][j]+1,j,n,ch);
cout<<")";
}
int... | true |
a968329f7ae8d2f3c65c10920fadd26467a44746 | C++ | Mohamed742/C-AIMS-SA-2018 | /second.cpp | UTF-8 | 322 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | #include<iostream>
#include<cmath>
using namespace std ;
double sumpro(int x,int y){
if (y == 0)
return 1;
else
return x*sumpro(x,y-1);
}
int main(){
int x;
int y;
cout <<"Enter value of x ";
cin >> x;
cout<<"Enter value of y " ;
cin >> y;
cout <<sumpro(x,y)<<endl;
return 0;
}
... | true |
8f5472f0f08b34977cb7327dac4cadecee8f74fb | C++ | JehanneDussert/ft_containers_test | /srcs/vector/test_utils.cpp | UTF-8 | 3,276 | 2.875 | 3 | [] | no_license | #include "../../includes/vector_test.hpp"
bool mycomp (char c1, char c2) { return std::tolower(c1)<std::tolower(c2); }
int iterator_traits(std::ofstream &monFlux1, std::ofstream &monFlux2)
{
int err = 0;
typedef std::iterator_traits<int*> traits;
typedef ft::iterator_traits<int*> traits1;
if ((typeid(traits::ite... | true |
bb3b9fb2c0aae389d4b9403d91e81300a8e6df92 | C++ | DaEunKim/SW_coding | /2178미로탐색_2/2178미로탐색_2/main.cpp | UTF-8 | 1,362 | 2.78125 | 3 | [] | no_license | //
// main.cpp
// 2178미로탐색_2
//
// Created by 김다은 on 2020/03/26.
// Copyright © 2020 김다은. All rights reserved.
//
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
int N, M;
int vis[101][101] = {0,};
int arr[101][101] = {0,};
queue<pair<int, int>> q;
void bfs(int a, int b){
... | true |
2b141c88d52d0cb591344dda265c596921b9ebd8 | C++ | EvanMcGorty/expression-evaluator | /documentation/minimal_example.cpp | UTF-8 | 2,641 | 3.359375 | 3 | [] | no_license | /*
this is a simple, minimal example use of the evaluator
when the terminal opens, try entering the following lines:
_funcs
prod(2,3)
push(8.4)
=my_double/
swap(=my_double,num.make(3.14))
=my_double
push(prod(=my_double,-1/2))
rotate(=my_double)
=my_double
print(glv)
swap(=my_vec/,vec.copy-make(glv))
... | true |
166f604dba68340f2a36d49df5862108454401c1 | C++ | SangaviPandian/vowel1 | /digit.cpp | UTF-8 | 201 | 3.03125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int num,n=0;
cout<<"enter the number";
cin>>num;
while(num>0)
{
num=num/10;
n++;
}
cout<<"no of digits in an integer"<<n;
return 0;
}
| true |
48696ae66fd6768e728f2586b2afba5dd0bd17ec | C++ | t3kt/bkb | /bkbTextureTool/src/main.cpp | UTF-8 | 1,735 | 2.828125 | 3 | [] | no_license | #include <ofMain.h>
#include <ofxOBJModel.h>
#include <sstream>
#include <iomanip>
static void generateImage(const ofxOBJFace& face, int i) {
ofFbo fbo;
fbo.allocate(1024, 1024);
fbo.begin();
ofClear(ofFloatColor(0, 0, 0, 0));
ofPath path;
path.setColor(ofFloatColor(1, 1, 1, 1));
bool first = true;
for... | true |
27971c632043d8fc2cff22f672aa485354b664e6 | C++ | bartekz93/JumpAndRun | /JumpAndRun/Source/Renderer/Particles.cpp | UTF-8 | 2,350 | 2.65625 | 3 | [] | no_license | #pragma once
#include<time.h>
#include"Particles.h"
#include"../Framework/Messages.h"
using namespace FRAMEWORK;
using namespace RENDERER;
int super_rand()
{
return (rand() << 15) | rand();
}
float fRandom(float beg, float end)
{
UINT f = (end-beg)*100;
if (!f) return beg;
return (float)((super_rand()%f) + beg... | true |
edcfd57a66eeea78aac6b7c6d4408f5aecc5319f | C++ | malvarez27/lmu-cmsi386 | /homework3/say.cpp | UTF-8 | 507 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <cassert>
using namespace std;
struct Adder {
//private:
string phrase = "";
public:
Adder operator()(string word) {
return Adder {phrase + (phrase != "" ? " " : "") + word };
}
string operator()() {
return phrase;
}
};
Adder f;
int main() {
assert(f() == "");
as... | true |
9026c895d02d8a9400abadf54da772b9da5c82be | C++ | arshjot/Cpp-Practice | /Accelerated-Cpp/ch_5/ex_5-1/src/rotate.cpp | UTF-8 | 1,016 | 3.515625 | 4 | [] | no_license | #include <string>
#include <vector>
#include <numeric>
#include "rotate.h"
#include "split.h"
using std::string;
using std::accumulate;
using std::vector;
using std::copy;
// function to define the comparison of splitted strings
// comparison to be done in lowercase
bool compare(const Rotated_line& x, const Rotated_l... | true |
7af4a3d83ca5704bd40bcbaf9704a7041f262b5c | C++ | Kangar000/KangIsaac_CSC5_Summer16_42576 | /Homework/Assignment_2/Gaddis_7thEd_Chapter3_Problem11_Currency/main.cpp | UTF-8 | 885 | 3.890625 | 4 | [] | no_license | /*
* File: main.cpp
* Author: Isaac Kang
* Created on July 5, 2016, 2:36 PM
* Purpose: Currency
*/
//System Libraries
#include <iostream> //Input/Output Library
#include <iomanip>
using namespace std; //Namespace of the System Libraries
//User Libraries
//Global Constants
//Function Prototypes
//Execution... | true |
63a086e2cf235d58797cfac8ba9a64522fcccaaa | C++ | dwivedir/coding | /codeforces/340D.cpp | UTF-8 | 669 | 2.984375 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<vector>
using namespace std;
vector<int> seq;
int binary(int p,int q, int x)
{
if(q<p) return -1;
if(p==q)
{
if(seq[p] >= x) return p;
return -1;
}
int mid = (p+q)/2;
if(seq[mid]>=x)
return binary(p,mid,x);
else
return binary(mid+1,q,x);
}
i... | true |
8a84e91dc17500fbaceb37c3692e24c165f5e6cc | C++ | kmichaelfox/phase_01 | /src/ScoreManager.hpp | UTF-8 | 1,037 | 2.53125 | 3 | [] | no_license | //
// ScoreManager.hpp
// phase_01
//
// Created by Kelly Fox on 5/9/16.
//
//
#ifndef ScoreManager_hpp
#define ScoreManager_hpp
#include <iostream>
#include <vector>
#include "Player.hpp"
#include "ScoreScene.hpp"
class ScoreManager {
ScoreScene scene;
std::vector<Player *> players;
Sequence seq;
... | true |
513505129f4ab352f1d1f1855555b5ff9b4e0d71 | C++ | hshachor/CPP-Lab | /Algorithms/removeIf.cpp | UTF-8 | 678 | 3.8125 | 4 | [] | no_license | // remove_if & remove_copy example
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int myints[] = { 9,20,35,30,20,12,10,20 };
int* pbegin = myints;
int* pend = myints + 8;
pend = remove_if(pbegin, pend, [](int x) {return x % 3 == 0; });
cout << "range... | true |
b612281406b26325d83e7045d1feda9f60c0efb6 | C++ | MdAbuNafeeIbnaZahid/Competitive-Programming | /CODEFORCES/Educational Codeforces Round 21/808 B. Average Sleep Time.cpp | UTF-8 | 1,238 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
// Order Statistic Tree
/* Sp... | true |
fee6aebb5116eeab4977cf7cf982e0041477e961 | C++ | Girl-Code-It/Beginner-CPP-Submissions | /Aayushi/milestone 5/check for prime number.cpp | UTF-8 | 696 | 3.609375 | 4 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
int num, i, prime;
cout<<"enter a number : \n";
cin>>num;
for(i=2; i<num; i++) //a prime number is divisible by 1 and the number itself only
{
if(num%i==0)
{
prime=0; //prime is a flag... | true |
d66335768057301f6498eaabffc62ae1c469a09d | C++ | metal32/tutorial_c | /smart_pointers/unique_pointer.cpp | UTF-8 | 350 | 3.453125 | 3 | [] | no_license | #include<iostream>
#include<memory>
using namespace std;
class Rectangle {
int width, height;
public:
Rectangle(int x, int y): width(x), height(y) {}
int area() {
return width * height;
}
};
int main() {
unique_ptr<Rectangle> p1(new Rectangle(5, 10));
unique_ptr<Rectangle> p2;
p2 = move(p1);
cout<<... | true |
c54bbdaaa40701e7e7f33949ed566613f63b3d4b | C++ | UPC-DESARROLLO-JUEGOS-1/DJ1-2017-II-TileEngine3D | /EngineUPC/FrameworkUPC/Vector3.h | UTF-8 | 2,211 | 3.265625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <math.h>
#include <glm\glm.hpp>
#include <glm\gtc\type_ptr.hpp>
class Vector3
{
public:
Vector3()
{
this->x = 0;
this->y = 0;
this->z = 0;
}
Vector3(float x, float y, float z)
{
this->x = x;
this->y = y;
this->z = z;
}
~Vector3() {}
float x, y, z;
float Magnitude()
{
r... | true |
c957912fa48e781ab457822976cfbb6f836e5121 | C++ | geg-antonyan/IntegerCalculator | /IntegerCalculator/src/utilites/EventData.h | WINDOWS-1251 | 729 | 2.859375 | 3 | [] | no_license | /* *** EventData.h ***
Event .
() CommnadDispatcher
*/
#ifndef EVENT_H
#define EVENT_H
#include <string>
class Event
{
public:
virtual ~Event() { }
protected:
Event() { }
};
class CommandEnteredEvent : public Event
{
public:
CommandEnteredEvent(std::string& command) : command_(command)
... | true |
872f8670ef2f6cfaf9cae630188146aaaeeb07f3 | C++ | sebseb7/gorge | /old-code/src/badguy.hpp | UTF-8 | 1,745 | 2.828125 | 3 | [] | no_license | class Bullet : public Object {
public:
Bullet(Vec2 pos, Vec2 velocity) {
init("media/bullet.png");
setPosition(pos);
vel = velocity;
playSound("media/bullet.wav", pos);
alive = true;
}
virtual bool update() {
move(vel);
updateCollisionPoly();
Vec2 pos = getPosition();
if (walls.checkCollision(poly... | true |
d7c1de603c4f58db6e9130017d717596bc0f5aad | C++ | KaushalPrajapat/Programming_CPP | /Using_CPP/CPP Advance/Initializer.cpp | UTF-8 | 631 | 3.78125 | 4 | [] | no_license | //initializer used to initialize a variable with some value
//initializer have to used in class when a const variable is decleard\
//Kaushal Prjapat 10.05.2021
//Example
#include<iostream>
using namespace std;
class test
{
private:
int var1=12;
const int var2; // We can't initialize a cont variable here
publi... | true |
d7141d23031efb0e4e405df2d430b1a8b8536486 | C++ | Uros2323/System-Software | /assembly/src/main.cpp | UTF-8 | 864 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include "AssemblyParser.h"
using namespace std;
#include <regex>
int main(int argc, const char *argv[])
{
string input_file;
string output_file;
string current = argv[1];
// cout << argv[1] << "#-o" << endl;
// cout << argv[2] << endl;
// cout << ... | true |
c46873324853dccc83e788a3d3aaa8b718841c6e | C++ | MirunaRux/Dynamic-Programming | /prob2.cpp | UTF-8 | 2,725 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <limits.h>
using namespace std;
fstream f("date.in", ios :: in);
fstream g("date.out", ios :: out);
const int NMAX = 100;
int n, m, table[NMAX][NMAX], smax[NMAX][NMAX];
void citire()
{
f>>n>>m;
for(int i = 1; i <= n ; i++)
for(int j =... | true |
5abd418cc4ba204e6e6a90f62863a1cf360a1ce7 | C++ | darkassazi/CourseDashboard | /src/models/AccountDAO.cpp | UTF-8 | 1,500 | 2.765625 | 3 | [] | no_license |
#include "AccountDAO.hpp"
AccountDAO::AccountDAO(
const String& email,
const ID& profileID,
const ID& id)
: m_Email(email),
m_ProfileID(profileID),
m_ID(id)
{}
//---------------------------------------------------------------------------------------
String AccountDAO::toStr... | true |
f4bbe2cb024fe8ed92d32a6f99bfb52daf2af534 | C++ | KamalDGRT/ProgrammingPractice | /Fundamentals_Of_Programming/08_2D_Array/Question_14/question_14.cpp | UTF-8 | 364 | 2.78125 | 3 | [
"MIT"
] | permissive | // Uniformity Matrix
#include <iostream>
using namespace std;
int main() {
int n, i, j, c = 0;
int a[5][5];
cin >> n;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++) {
cin >> a[i][j];
if (a[i][j] % 2)
c++;
}
(c == 0 || c == (n * n)) ? cou... | true |
83441f4827de3be0aa0e2d4ae281f156e993a166 | C++ | amandewatnitrr/Cpp | /String/identifying_and_counting_max_occurance_of_char_in_string.cpp | UTF-8 | 544 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;
int main()
{
string str;
cout<<"\nEnter the string --> ";
getline(cin,str);
char maxc='a';
int count=0,max=0;
for(int i=97;i<=123;i++)
{
count = 0;
for(int j=0;j<str.length();j++)
{
if(str[j]==(char)i)
{
... | true |
e9ff00a114f6f944c14c84468d9868b9745ecacf | C++ | sienkiewiczkm/shabui | /source/cli/Main.cpp | UTF-8 | 678 | 2.5625 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
#include "shabui/GLSLLoader.hpp"
int main(int argc, char **argv)
{
if (argc == 1)
{
std::cout << "usage: " << argv[0] << " shaderfile";
return EXIT_FAILURE;
}
sb::GLSLLoaderFileDependencyResol... | true |
be822c1cee6fa752129a3637d431812ab308da79 | C++ | xjayleex/problem_solving | /boj/data_structure/boj9202/main.cpp | UTF-8 | 3,817 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <memory.h>
#include <algorithm>
using namespace std;
bool compare(const string &a, const string &b){
if(a.length() == b.length()){
return a < b;
} else {
return a.length() > b.length();
}
}
int toNumber(char ch) {
return ch... | true |
873e89cc66b8330bd0b37119f85d9ac0ea3e4430 | C++ | ShubhJ-coder/ELEC2018-19 | /NeoPixel/NeoPixel.ino | UTF-8 | 844 | 2.578125 | 3 | [] | no_license | // NeoPixel test sketch
// UBC: the UBC Submarine Design Team
#include <Adafruit_NeoPixel.h>
#define JEWEL_PIN 7
#define NEOPIXEL_COUNT 7
Adafruit_NeoPixel jewel(NEOPIXEL_COUNT, JEWEL_PIN, NEO_GRB + NEO_KHZ800);
int i=0,j=0;
uint32_t settings[3]={jewel.Color(153,51,0),jewel.Color(0,0,102),jewel.Color(128,0,128)};
ui... | true |
997740159e0965ca7f263000da1f11c3da42fd71 | C++ | robojan/EmuAll | /Support/graphics/ShaderProgram.cpp | UTF-8 | 12,339 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive |
#include <emuall/graphics/ShaderProgram.h>
#include <emuall/graphics/texture.h>
#include <emuall/graphics/texture3D.h>
#include <emuall/graphics/BufferObject.h>
#include <emuall/graphics/bufferTexture.h>
#include <emuall/graphics/graphicsException.h>
#include <GL/glew.h>
#include <GL/GL.h>
#include <fstream>
#include... | true |
412bda16f22f52b9886e263110495939e3d7ae93 | C++ | vctralcaraz/AlcarazVictor_46090 | /Lab/Lab16/Savitch_8thEd_Chap7_Prob4/main.cpp | UTF-8 | 5,130 | 3.53125 | 4 | [] | no_license | /*
* File: main.cpp
* Author: Victor Alcaraz
* Created on July 16, 2015, 11:24 AM
* Purpose: To calculate the mean and standard deviation
*/
//System Libraries
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <ctime>
using namespace std;
//User Libraries
//... | true |
bd721281e7f1d3825bb31b4604f2206accff404e | C++ | AlexanderDBolton/Regimes_RJMCMC | /Code/binary.h | UTF-8 | 1,045 | 3.109375 | 3 | [
"MIT"
] | permissive | #ifndef BINARY_H
#define BINARY_H
class binary {
public:
binary(const double & log_likelihood = 0, const int & left_index = 0);
double get_log_likelihood() {return m_log_likelihood;}
void set_log_likelihood(const double & log_likelihood) {m_log_likelihood = log_likelihood;}
void increase_log_likel... | true |
c4b0aea4a2a1015a491f1cde9082c07c7cfee64a | C++ | AlfredoPiedra/Vector_Processor | /vector_processor/clock.cpp | UTF-8 | 445 | 2.984375 | 3 | [] | no_license | #include "clock.h"
unsigned char Clock::clock = 0;
Clock::Clock(){
pthread_t clock_tid;
pthread_create(&clock_tid,0,ClockThread,0);
pthread_detach(clock_tid);
}
void* Clock::ClockThread(void *ptr){
while(1){
usleep(10000);
clock = !clock;
std::cout << "Hola desde el cloc... | true |
e8579d134b8258a43584c74f1cacf4cf2224eef2 | C++ | S-Hucks/cs2400 | /files2.cc | UTF-8 | 890 | 3.21875 | 3 | [] | no_license | /*
* File: files.cc
* Author: Nasseef Abukamail
* Date: February 25, 2019
* Description: A program to demonstrate text files.
*/
#include <iostream>
#include <iomanip>
#include <cstdlib>
//1
#include <fstream>
using namespace std;
//function prototypes
int main(int argc, char const *argv[]) ... | true |
0cd6649cbb5ee3f634656fa77e171cc82a80d973 | C++ | mdjmedellin/PlanetaryEngine | /TempEngine/MathUtilities.cpp | UTF-8 | 9,285 | 3.203125 | 3 | [] | no_license | #include "MathUtilities.hpp"
#include "Vector2.hpp"
#include "Vector3.hpp"
#include "Vector4.h"
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
int GetNearestInt(float f)
{
return static_cast< int > ( floor( f + .5f) );
}
float RoundFloatToNearestInt(float f)
{
return floor ( f + .5f );
}... | true |
7ce55a353f20460a2b5f9500e459f50c0924b1e7 | C++ | qianlv/learning | /cplusplusprimer/10/generic_algorithm.h | UTF-8 | 1,099 | 2.6875 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: generic_algorithm.h
*
* Description: generic_algorithm.h
*
* Version: 1.0
* Created: 2016年01月01日 16时33分25秒 CST
* Revision: none
* Compiler: gcc
*
* Author... | true |
6b1afb0901724614ea039dcd21aef5c9aef6ee2f | C++ | aruskey/katiss | /speedlimit/speedlimit/speedlimit.cpp | UTF-8 | 443 | 2.921875 | 3 | [] | no_license | // speedlimit.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int start;
int time, speed;
while(cin >> start){
if (start == -1) {
break;
}
int sumD = 0;
int past = 0;
for (int i = 0;i < start;i++) {
cin >... | true |
440eea7ff0de4484781d55135ad480a2256c7772 | C++ | Imran4424/C-Plus-Plus-Object-Oriented | /1. Input Output/3. IO manipulators/5.showbase_noshowbse.cpp | UTF-8 | 948 | 3.5625 | 4 | [
"MIT"
] | permissive | /*
write a program to demonstrate I/O manipulators showbase, noshowbase
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, char const *argv[])
{
int num = 200;
cout<< endl <<"Hexadecimal: "<<endl;
cout << hex << showbase << num <<endl;
cout << hex << noshowbase << num <<endl<<en... | true |
116e1326551ae7bb5d168f8a4554e16c9b58c21c | C++ | catch4/taehunlee | /2020_09_week_2/b5884_감시카메라.cpp | UTF-8 | 584 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int N;
unordered_map<int, int> mapX;
unordered_map<int, int> mapY;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> N;
int count = 0;
for(int i = 0; i < N; i++) {
int x, y;
... | true |
cdeed8b81c4517ca45607d3350b6674474f10924 | C++ | ramnathj/CodeArena | /C++Codes/HackerEarth/SpecialStrings.cpp | UTF-8 | 1,202 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <limits.h>
#include <map>
using namespace std;
map<string, bool> M;
vector<string> A;
vector<int> B;
bool Check( string s ) {
if( M[ s ] ) {
return false;
}
M[ s ] = true;
int i, n = A.size(), val;
for( i = 0;i < n;i++ ) {
val = A[ i ].find... | true |
194973dd898caee18c039c388aaa0326eef408d9 | C++ | n-fallahinia/UoU_Genral_Class | /src/TimeHandler.cpp | UTF-8 | 1,947 | 3.1875 | 3 | [
"MIT"
] | permissive | // Function definitions for the TimeHandler class
#include "TimeHandler.h"
#include <sched.h>
// Constructor
TimeHandler::TimeHandler()
{
// Set up the one-second timespec structure
one_second.tv_sec = 1;
one_second.tv_nsec = 0L;
// Define the number of nanoseconds in one second
nanoseconds ... | true |
9ac8b6f3fd3fdbcbd400090b38cd1421b7f8427a | C++ | Davidah121/GLib | /include/ext/GLFont.h | UTF-8 | 2,119 | 2.78125 | 3 | [] | no_license | #pragma once
#ifdef USE_OPENGL
#include "MathExt.h"
#include "ext/GLSingleton.h"
#include "ext/GLSprite.h"
#include "ext/GLModel.h"
#include "BitmapFont.h"
namespace glib
{
class GLFont : public Font
{
public:
/**
* @brief Creates a GLBitmapFont Object.
* GLBitmapFont extends from the Font ... | true |
3070256808de54775f31e48f8e61bfea387a6912 | C++ | shobhit-saini/DP | /Factorial/mfact.cpp | UTF-8 | 365 | 2.90625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int dp[INT_MAX];
int fact(int N)
{
if(N == 0)
{
return 1;
}
else if(dp[N] != -1)
{
return dp[N];
}
else
{
dp[N] = N*(dp[N-1] = fact(N-1));
}
return dp[N];
}
int main()
{
int N, result;
cout << "Enter the no.:";
cin >> N;
for(int i = 0; i <= N; i++... | true |
5052706a25656e811f6494e6c309dc7471fd958f | C++ | rqgao0422a/OCS | /multi-way-semi-OCS.cpp | UTF-8 | 1,449 | 2.890625 | 3 | [] | no_license | /*
input:
n, number of elements in each tuple
output:
gmin, minimum Gamma that appears in a feasible solution of the stricter LP
gmax, maximum Gamma that appears in a feasible solution of the stricter LP
latex link:
https://www.overleaf.com/3486144463wrhdwyywfqhy
*/
#include<bits/stdc++.h>
using namespace std;
co... | true |
0b82a3067400d23a2ed5fe3981f0668ea43438f5 | C++ | copiner/cplus | /Primer/swap/rswap.cpp | UTF-8 | 321 | 3.53125 | 4 | [] | no_license | #include<iostream>
using namespace std;
void rswap(int &,int &);
int main(){
int i = 10;
int j = 20;
int &ri = i, &rj = j;
cout<<"Before swap: "<< i <<"--"<<j<<endl;
rswap(i,j);
cout<<"After swap: "<< i <<"--"<<j<<endl;
return 0;
}
void rswap(int &v1,int &v2){
int tmp = v2;
v2 = v1;
v1 = tmp;
}
... | true |
cc536027e2a1f948b70a4589f93aba1eea3675fc | C++ | LargeDumpling/Programming-Contest | /OnlineJudges/UVa(29)/10943 How do you add/code.cpp | UTF-8 | 601 | 2.59375 | 3 | [] | no_license | /*
Author: LargeDumpling
Email: LargeDumpling@qq.com
Edit History:
2016-03-15 File created.
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int C[205][205];
void calc_C()
{
C[0][0]=1;
for(int i=1;i<=200;i++)
{
C[i][0]=1;
for... | true |
9076626c732d35e9b636458814c8717573456492 | C++ | BenjaminTanguay/COMP345_Pandemic | /A1/Nick's Roles&Actions/RoleCard.h | WINDOWS-1252 | 3,739 | 3.140625 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
//#include "Role.h"
//#include "EventCard.h"
class RoleCard {
protected:
std::string name;
std::string description;
public:
RoleCard(std::string) {
this->name = name;
}
RoleCard() {};
std::string getName() {
return this->name;
}
std::s... | true |
e4f21222465b8cb94fe09ad368a1339a3f3cda06 | C++ | nwaiting/wolf-ai | /wolf_alg/Data_structures_and_algorithms_cpp/20181228-dp.cpp | UTF-8 | 1,975 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <stdint.h>
#include <algorithm>
using namespace std;
/*
* 编辑距离:
* 编辑距离又叫Levenshtein(莱文斯坦)距离
* 指两个字串之间,由一个转成另一个所需的最少编辑操作次数
* 俄罗斯科学家Vladimir Levenshtein在1965年提出这个概念
*
* 编辑操作:
* 1、替换一个字符
* 2、插入一个字符
* 3、删除一个字符
*
*/
int edit_dis(const ... | true |
32f002f385f2cbff9f8215640455c7e313041262 | C++ | KarimIO/Microelectronics-Mosfet-Logic | /graph.hpp | UTF-8 | 3,580 | 2.9375 | 3 | [] | no_license | #ifndef GRAPH_H
#define GRAPH_H
#include <iostream>
#include <string>
#include <map>
enum Network {
PUN = 0,
PDN
};
enum NodeType {
INNODE = 0,
NOTNODE,
ORNODE,
ANDNODE
};
typedef unsigned int uint;
class Node {
public:
virtual NodeType GetType() const = 0;
virtual std::string Traverse() const = 0;
virtua... | true |
99e130099112434fd4043f0439c6816e918f1d17 | C++ | bryanmlyr/School-Projects | /cpp_pool/cpp_d06/ex00/main.cpp | UTF-8 | 537 | 2.984375 | 3 | [] | no_license | //
// EPITECH PROJECT, 2018
// piscine cpp
// File description:
// ex00
//
#include <string>
#include <fstream>
#include <iostream>
int main(int ac, char **av)
{
std::string str;
if (ac <= 1)
std::cout << "my_cat: Usage: "
<< av[0] << " file [...]" << std::endl;
for (int x = 1; x < ac; x++) {
std::ifstream ... | true |
9e502ae9e40a098d9ab795250183205417afee2c | C++ | AsiaKorushkina/msu_cpp_autumn_2019 | /02/LinearAllocator.h | UTF-8 | 681 | 3.46875 | 3 | [] | no_license | #include <iostream>
class LinearAllocator
{
size_t maxsize;
size_t cursize;
char* beg;
public:
LinearAllocator(size_t max_Size){
maxsize = max_Size;
cursize = 0;
beg = new char[maxsize];
};
char* alloc(size_t size){
if (size + cursize > maxsize){
r... | true |
f061720226313017aed049769f6db6d50b2fa0dd | C++ | yossy2/Tactics | /MonsterTacics/MonsterTacics/Input/Mouse.cpp | SHIFT_JIS | 2,160 | 2.71875 | 3 | [] | no_license | #include "Mouse.h"
#include <algorithm>
#include <DxLib.h>
#include "../Common/Common.h"
#include "../Mouseable/MouseableObject.h"
int Mouse::CurrentButtonState()const
{
return buttonState_[currentBufferNum_];
}
int Mouse::OldButtonState()const
{
return buttonState_[Wrap(currentBufferNum_ - 1, 0, static_cast<int>(_... | true |
4c9613481f68f51f8f50167aa22e64778f13cdce | C++ | marcelgreim/ifi10bcpp | /Notenrechner.cpp | ISO-8859-1 | 1,497 | 3.609375 | 4 | [
"Unlicense"
] | permissive | #include <iostream> // Laden I/O Bibliothek
#include <iomanip> // Laden der Konsolenmanipulationsbibliothek
using namespace std; // Standard Namespace verwenden
int main (void) { // Einsprungpunkt Hauptprogramm
float note; // Variable fr Noteneingabe
float summe; // Variable zum zusammenrechnen
flo... | true |
c408b0773b81a827aa5292af6f9bff0e35ef3497 | C++ | 99002478/Genisis_Mini_Project_2478 | /Aviation_management_c--main/passenger.h | UTF-8 | 729 | 2.78125 | 3 | [] | no_license | #ifndef __PASSENGER_H
#define __PASSENGER_H
#include<string>
#include"Flight.h"
class Passenger: public Flight{
protected:
std::string PID;
std::string P_name;
std::string email;
std::string phno;
public:
// Constructor
Passenger();
Passenger(std::string ,std::string,std::string ,std::stri... | true |
1acd136b6504576f5489edb9c340dcdd47353773 | C++ | redexpress/CppPrimer5thSolutions | /Sales_data.cpp | UTF-8 | 1,421 | 3.125 | 3 | [] | no_license | //
// Sales_data.cpp
//
// Created by Gavin Yang on 14-7-26.
// Copyright (c) 2014年 redexpress.github.com. All rights reserved.
//
#include "Sales_data.h"
using std::cout;
using std::cin;
std::istream& read(std::istream &in, Sales_data &s){
double price;
in >> s.bookNo >> s.units_sold >> price;
if (in... | true |
2dd5e8277a12316a87d97c688e9f7ed49f6bcce9 | C++ | hemant1170/myprojects | /minmax.cpp | UTF-8 | 8,535 | 3.328125 | 3 | [] | no_license | //This is implementation of Mini-Max algorithm on Tic-Tac-Toe game using C/C++
//This code is not complete as I am working on it nowadays
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
typedef struct data_returned_from_minmax
{
int value;
int path;
}MOVE;
void Go(int n,int turn,int *board)... | true |
46cd29c11ac0fa0bbb8fa729280bcdf0daad58b5 | C++ | github-jiang/serial_port | /source/test.cpp | GB18030 | 754 | 2.765625 | 3 | [] | no_license | #include <iostream>
#include "SerialPort.h"
using namespace std;
int main()
{
unsigned int Serial_N1 = 1;
CSerialPort mySerialPort1;
if (!mySerialPort1.InitPort(Serial_N1))
{
cout << " ʼ ʧ !" << std::endl;
}
else
{
cout << " ʼ ɹ !" << std::endl;
}
if (!mySerialPort... | true |
c5954f34b746afc62363b0a46a394508fa11c5bc | C++ | JMarcu/CS1D | /CS1D Final Project/DateMethods.cpp | UTF-8 | 3,369 | 3.171875 | 3 | [] | no_license | /*************************************************************************
* CS1D Final Project
* -----------------------------------------------------------------------
* AUTHORS : James Marcu & Phillip Doyle
* STUDENT IDs : 374443 & 911579
* CLASS : CS1D
* SECTION : TTh 3:30 PM
* DUE ... | true |
c6925906ca493a14cf1b819034a4599d691a32ec | C++ | mnunberg/epoxy | /src/buffer.h | UTF-8 | 3,591 | 2.75 | 3 | [] | no_license | #ifndef LCBPROXY_BUFFER_H
#define LCBPROXY_BUFFER_H
#include <cstdlib>
#include <vector>
#include "common.h"
// This is a miniature version of rdb_ROPE implemented in C++
// rather than C
namespace Epoxy {
class BufferPool;
class Buffer;
class BufferPool {
public:
BufferPool();
~BufferPool();
void put(Bu... | true |
a81c35ad9360d887010ff69ce640fd47ea692d3f | C++ | Nadezhda-Frantseva/Object-oriented-programming | /MyAccount.hpp | UTF-8 | 576 | 2.9375 | 3 | [] | no_license | #pragma once
#include <string>
#include "Cart.hpp"
class MyAccount
{
public:
MyAccount();
MyAccount(const std::string& name, const std::string& email, const std::string& password);
void enter_name(std::string name);
void enter_emai(std::string email);
void enter_password(std::string password);
void set_name(co... | true |
2aef8a6f4418e07a392e3ea7e7a9f675a0dd1e31 | C++ | jpeterson1823/AdventOfCode | /2021/c/day6/day6.cpp | UTF-8 | 672 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(int argc, char* argv[]) {
// get input
string input;
cin >> input;
// create fish vector
vector<unsigned long> days = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// log initial fish
for (char c : input) {
if (c != ',')
days[c - '0'... | true |
50ca90f8718ca8e95c1514ce2d4560955dc72e8c | C++ | Jesse-Rug/ComputerGraphics | /raytracer/raytracerframework_cpp/Code/shapes/sphere.cpp | UTF-8 | 2,803 | 3.265625 | 3 | [
"MIT"
] | permissive | #include "sphere.h"
#include "solvers.h"
#include <cmath>
using namespace std;
Hit Sphere::intersect(Ray const &ray)
{
// Sphere formula: ||x - position||^2 = r^2
// Line formula: x = ray.O + t * ray.D
Vector L = ray.O - position;
double a = ray.D.dot(ray.D);
double b = 2 * ray.D.dot(L);
d... | true |
1918e3e5b23eaa15bfa82c1822114b5f45df049e | C++ | v-str/SpecialCalculator | /Styles/label_styler.cpp | UTF-8 | 1,407 | 2.875 | 3 | [] | no_license | #include "label_styler.h"
#include <QLabel>
#include <QString>
void LabelStyler::SetLabel(QLabel *label, int style) {
QString label_text = label->text();
QString background_format = "color";
QString image = "";
if (label_text == "Number:") {
background_format = "image";
image = "url(:/motogp_logo.jpg... | true |
6f8702c2c16d7eae336d439ab8935e8d493426a1 | C++ | breezy1812/MyCodes | /Algorithm/ACM-POJ/POJ-2155-SegmentTree/solution.cpp | UTF-8 | 2,223 | 2.546875 | 3 | [] | no_license | // Author: David
// Email: youchen.du@gmail.com
// Created: 2016-07-05 14:38
// Last modified: 2016-07-06 10:10
// Filename: solution.cpp
// Description:
#include <cstdio>
#include <cstring>
using namespace std;
#define ll long long
#define N 1010
int A[N];
int x1, y1, x2, y2;
int n, t;
bool tree[N<<2][N<<2];
int ans... | true |
5fdad067f60e0f7dd73417168bf938309ab8c259 | C++ | huaweicloud/huaweicloud-sdk-cpp-v3 | /gaussdb/src/v3/model/ModifyPortRequest.cpp | UTF-8 | 1,327 | 2.53125 | 3 | [] | permissive |
#include "huaweicloud/gaussdb/v3/model/ModifyPortRequest.h"
namespace HuaweiCloud {
namespace Sdk {
namespace Gaussdb {
namespace V3 {
namespace Model {
ModifyPortRequest::ModifyPortRequest()
{
port_ = 0;
portIsSet_ = false;
}
ModifyPortRequest::~ModifyPortRequest() = default;
void ModifyPortRequest::v... | true |
fb4498fd17a098b233e1a4aaefca6502a1ec6be7 | C++ | aminb7/SuperMario | /source/Koopa.cpp | UTF-8 | 1,627 | 3.109375 | 3 | [] | no_license | #include "Koopa.hpp"
Koopa::Koopa(Point _position ) :position(_position){}
Point Koopa::getPosition(){
return position;
}
void Koopa::setDirection(string _direction){
direction = _direction;
}
void Koopa::setSituation(string _situation){
situation = _situation;
}
void Koopa::setFallingVelocity(int velocity)... | true |
addb967fdd75595c12405116e90fb242b645c14d | C++ | xb-hub/PAT-Advanced-Level-Practice | /1047 Student List for Course/main.cpp | UTF-8 | 666 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int n, k, c, course;
scanf("%d %d", &n, &k);
vector<string> record[2501];
for(int i = 0; i < n; i++)
{
string name;
cin >> name >> c;
for(int j = 0; j < c; j++)
{
... | true |
f7ac737709de1198fdc720f93ebb42db0a354379 | C++ | rjtsdl/CPlusPlus | /Interview Play CPP/a261GraphValidTree.cpp | UTF-8 | 1,060 | 2.921875 | 3 | [] | no_license | //
// a261GraphValidTree.cpp
// Interview Play CPP
//
// Created by Jingtao Ren on 9/18/20.
// Copyright © 2020 Jingtao Ren. All rights reserved.
//
#include <stdio.h>
#include <vector>
#include <list>
using namespace std;
class Solution {
public:
bool validTree(int n, vector<vector<int>>& edges) {
i... | true |
f10b719d99487d570fe44605c0de38eb5f1bcd9a | C++ | isongbo/MyCode | /01_Code/10_STL/day01/macro.cpp | UTF-8 | 407 | 3.46875 | 3 | [] | no_license | #include <iostream>
using namespace std;
#define MAX(T) \
T max_##T (T x, T y) { \
return x > y ? x : y; \
}
MAX (int) // int max_int (int x, int y) {...}
MAX (double)
MAX (string)
#define max(T) max_##T
int main (void) {
cout << max(int) (123, 456) << endl;
// cout << max_int (123, 456) << endl;
cout << max(double)... | true |
49be7d8041c0474eb475131e753ecfc33fe77438 | C++ | joaovicmendes/ic | /src/list.cpp | UTF-8 | 1,838 | 3.21875 | 3 | [] | no_license | #include <queue>
#include "./list.h"
unsigned int List::Schedule(unsigned int no_machines, std::queue<unsigned int> job_list)
{
unsigned int makespan;
unsigned int *loads = new unsigned int[no_machines];
for (unsigned int i = 0; i < no_machines; i++)
loads[i] = 0;
while (!job_list.empty())
... | true |
d133a1849c564274711755a3634b37b971d01f6d | C++ | Orb-H/nojam | /source/nojam/1865.cpp | UTF-8 | 1,326 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <tuple>
#define INF 1073741823
#define ti3 tuple<int, int, int>
using namespace std;
int main() {
int tc;
int n, m, w;
int src, dst, dis;
cin >> tc;
for (int i = 0; i < tc; i++) {
cin >> n >> m >> w;
vector<ti3> path;
vecto... | true |
44377577ff628f9a9ee05eb9fbdeb9b8c52a0568 | C++ | jang7y/BJ | /BJ_10868.cpp | UTF-8 | 373 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> arr;
int a, b;
int x, y;
int main()
{
scanf("%d %d", &a, &b);
arr.resize(a + 1, 0);
for (int i = 1; i <= a; i++)
{
scanf("%d", &arr[i]);
}
for (int i = 1; i <= b; i++)
{
scanf("%d %d", &x, &y);
printf("%d\n", *mi... | true |
61f71e53fa3e0c8c0ae045d8409d698af136e321 | C++ | tonisor/ext | /src/testing.cpp | UTF-8 | 16,082 | 2.796875 | 3 | [] | no_license | #include <random>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <utility>
#include <tuple>
#include <array>
#include <regex>
#include <string>
#include <memory>
#include "ext/type_traits.hpp"
#include "ext/cmath.hpp"
#include "ext/bigint.hpp"
#include "ext/enum.hpp"
template <typename T>
T Rand... | true |
683051f71ccddf4381702f1ab4590d733026a017 | C++ | niyaznigmatullin/nncontests | /utils/IdeaProject/archive/unsorted/2019.12/20191214_vkcup/f.cpp | UTF-8 | 4,365 | 2.59375 | 3 | [] | no_license | /**
* Niyaz Nigmatullin
*/
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(time(NULL));
struct interactor {
virtual long long ask(int i, int j) = 0;
virtual void answer(long long ans) const = 0;
};
struct myinteractor : interactor {
vector<vector<long long>> z;
map<pair<int, int>, long long> asked;... | true |
9be86fe26815fa6a7d51bd70531fe2cc3d9c09fa | C++ | green-fox-academy/hbence97 | /week-01/day-03/13 - SecondsInADay/main.cpp | UTF-8 | 880 | 3.96875 | 4 | [] | no_license | #include <iostream>
int main(int argc, char* args[]) {
// Write a program that prints the remaining seconds (as an integer) from a
// day if the current time is represented by the variables
int currentHours = 14;
int currentMinutes = 34;
int currentSeconds = 42;
int a = 24 - currentHours;
... | true |
a01119037549809ba2878e4780ae89c441aa647f | C++ | volzkzg/Tempus-Fugit-Code-Machine | /TeamTraining/7_25/K.cpp | UTF-8 | 2,473 | 2.53125 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
int m, n, p, q;
struct Plane {
int a, b, c, d;
void read() {
scanf("%d%d%d%d", &a, &b, &c, &d);
}
}plane[110];
struct Sphere {
int x, y, z, r;
void read() {
scanf("%d%d%d%d"... | true |
e59c1aad6e87bc2914a4a7ba76740daf7dd694a1 | C++ | ngoquanghuy99/Graph-Theory-Implementations | /counting_components_adjlist.cpp | UTF-8 | 865 | 3 | 3 | [] | no_license | /*
Author: Ngo Quang Huy
Problem: Counting the number of paths in an unweighted undirected graph
*/
#include <iostream>
#include <stack>
#include <vector>
#include <cstring>
using namespace std;
int const MAX = 1001;
int n, m;
vector <int> ke[MAX];
bool unused[MAX];
void init(){
cin >> n >> m;
memset(unused, true, ... | true |
0c35b72ef51a02b22203a7a76dff377682aa7fc8 | C++ | mariatomy9/DSA-DIARIES | /DSA/Array/search.cpp | UTF-8 | 321 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int arraySearch(int arr[], int n, int x)
{
for(int i = 0; i < n; i++)
{
if(arr[i]==x)
{
return i;
}
}
return -1;
}
int main()
{
int A[] = {1,2,3,4};
int n = sizeof(A)/sizeof(A[0]);
cout<<arraySearch(A,n,2);
}... | true |
35841396badce8e2141523ed72f2590563fb4991 | C++ | MichelleZ/leetcode | /algorithms/cpp/sequentialDigits/sequentialDigits.cpp | UTF-8 | 589 | 3.1875 | 3 | [] | no_license | // Source: https://leetcode.com/problems/sequential-digits/
// Author: Miao Zhang
// Date: 2021-04-21
class Solution {
public:
vector<int> sequentialDigits(int low, int high) {
vector<int> res;
for (int i = 1; i < 10; i++) {
int num = i;
for (int j = i + 1; j < 10; j++) {
... | true |
b50038f2b5d5523873ea56df51c17120047ad920 | C++ | diogodutra/board_cpp | /board.hpp | UTF-8 | 626 | 2.71875 | 3 | [] | no_license | #ifndef BOARD_H
#define BOARD_H
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
#include "note.hpp"
using namespace std;
class Board
{
public:
const int indexNotFound = -1;
void addNote(const string title
, const string text
, const vector<string> tags);
void... | true |
e07512540979964ebe752b3077600893948972d4 | C++ | gauravsingh9891/INDL_CPP | /Lecture-6/Pattern2.cpp | UTF-8 | 422 | 2.90625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
char ch='A';
int number=1;
for(int line=0;line<=n;line++){
for(int spaces=1;spaces<=n-line;spaces++){
cout<<" ";
}
for(int j=1;j<=2*line-1;j++){
if(j==1||j==2*line-1){
cout<<ch;
ch++;
}
else if(j==line){
cout<<num... | true |
f3df08e527b9a3de2cd598477a87e46abd98a489 | C++ | mingkaic/CNNet | /tenncor/src/graph/variable/constant.ipp | UTF-8 | 1,152 | 2.640625 | 3 | [
"MIT"
] | permissive | //
// constant.ipp
// cnnet
//
// Created by Mingkai Chen on 2016-08-29.
// Copyright © 2016 Mingkai Chen. All rights reserved.
//
#ifdef constant_hpp
namespace nnet
{
// CONSTANT IMPLEMENTATION
// template <typename T>
// constant<T>::constant (const constant<T>& other, std::string name) :
// ileaf<T>(other, ... | true |
df236a992a1268e3d8c855dfc96b8c5f6a1dc7ab | C++ | mastersin/charybdis | /include/ircd/buffer/unique_buffer.h | UTF-8 | 3,329 | 2.609375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | // Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice... | true |
338b62409399380861afabb369450fa364f5feb9 | C++ | 99002613/Genesis | /Set 2/Currency/currency.cc | UTF-8 | 1,529 | 3.234375 | 3 | [] | no_license |
#include<iostream>
#include "currency.h"
Currency::Currency():m_rupees(0),m_paise(0) {
}
Currency::Currency(int a,int b):m_rupees(a),m_paise(b) {
}
Currency::Currency(int d):m_rupees(d) {
}
Currency Currency::operator+(const Currency &ref) {
int tmins = m_paise + ref.m_paise;
int thrs = m_... | true |
1986525591be6a121b96ca1b8c7fc16a24083c08 | C++ | kunal-k2/AdvanceCPP | /initialization_fiasco/sol_1/singleton.cpp | UTF-8 | 385 | 2.90625 | 3 | [] | no_license | #include "singleton.h"
#include "dog.h"
#include "cat.h"
Dog* Singleton::pd = 0;
Cat* Singleton::pc = 0;
Cat* Singleton::getCat()
{
if(!pc) pc = new Cat("xyz");
return pc;
}
Dog* Singleton::getDog()
{
if(!pd) pd = new Dog("abc");
return pd;
}
Singleton::~Singleton()
{
if(pd)... | true |
bf6056c07e73f53dbe62b8629ddcfbec9c34f49a | C++ | MosmannJuan/AED | /10-Tipo Polígono/Poligono.h | UTF-8 | 2,260 | 3.3125 | 3 | [] | no_license | /*Mosmann, Juan Ignacio
AED 2020
Curso K1051
16/09/2020*/
#pragma once
#include <array>
#include <cstdint>
#include <cstring>
struct Punto{double x,y;};
struct Color {uint8_t r, g, b ;};
struct Nodo{
Punto p;
Nodo* SigNodo;
};
struct Poligono {
Nodo* PrimerPunto;
Color c;};
... | true |
bcc674a43370568618174c277f1fd52a6304da87 | C++ | peterlopez/CS-coursework | /COMSC 165/assignments/07-Function-Templates/Assignment07-1.cpp | UTF-8 | 1,085 | 3.890625 | 4 | [] | no_license | /***************************************************************
Problem: Function Templates
Question: 1 - Minimum/Maximum Templates
Name: Peter Lopez Ruszel
ID: 1611543
Date: 4/9/19
Status: complete
****************************************************************/
#include <iostream>
#include <string>
#inc... | true |
f67b714dba161d1c76ce1b0a4fd2303d88aa0118 | C++ | yash12khatri/codechef | /Temple_Land.cpp | UTF-8 | 436 | 2.84375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool valid(int arr[],int n)
{
if(!(n&1))
return false;
int l=n/2;
n--;
for(int i=0;i<=l;i++)
{
if(arr[i]!=i+1||arr[i]!=arr[n-i])
return false;
}
return true;
}
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n];
... | true |
1f0501a2eb58f624800144d710e91650d68c0513 | C++ | getSideEffect/AntVM | /main.cpp | UTF-8 | 615 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include "AntVM.h"
using namespace ant_vm;
int main() {
//create an ant-vm instance
AntVM myVM;
//create a place-holder for the final solution
Variable finalValue;
//instructions for final_value = 1.0 + 2.0
myVM.addInstruction(Ins(InsCode::LOAD_CONST, 1.0));
myVM.add... | true |
5c8fcf1c986578cb98c442e65e084367541c730b | C++ | GamesTrap/LearnCPP | /StringView/src/main.cpp | UTF-8 | 741 | 3.640625 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include "StringView.h"
int main()
{
StringView emptyStringView;
std::cout << "Empty StringView. Length = " << emptyStringView.length() << '\n';
StringView stringView("Hello");
std::cout << "Hello: Length = " << stringView.length() << '\n';
display(std::cout, stringView);
std::cout << '\n' ... | true |
ec6a535cb1936297e8781674e609f1c74f99381a | C++ | saxenism/testRCppPackage | /src/rcpp_hello_world.cpp | UTF-8 | 529 | 3.015625 | 3 | [] | no_license | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
double addCpp(NumericVector x)
{
double total = 0.0;
int n = x.size();
for(int i = 0; i < n; i++)
total += x[i];
return total;
}
// [[Rcpp::export]]
double multiplyCpp(NumericVector x)
{
double total = 1.0;
int n = x.size();
for(int i = 0; ... | true |
3a34a4dcad712b2d5bc8f6d6eeb95ddebb5a26c1 | C++ | cramacha/practice | /ctci/chp5/6.cpp | UTF-8 | 625 | 3.859375 | 4 | [] | no_license | #include <iostream>
using namespace std;
int
flip(int a, int b)
{
/*
* e.g a = 1001, b = 0110
* a ^ b = 1111. This gives the number of bits which are
* different between a and b.
*
* The bits can be counted in the Kernighan way i.e. n & n - 1
* This will keep resetting the least significant bit until we... | true |
afdc1c58dbe31bb58e02c8b0b4fff1540508d4ba | C++ | aqfaridi/Competitve-Programming-Codes | /SPOJ/SPOJ/GARDENAR.cpp | UTF-8 | 1,534 | 3.3125 | 3 | [
"MIT"
] | permissive | /**
* SPOJ Problem Set (classical)
* 5240. Area of a Garden
* Problem code: GARDENAR
*
* One rich person decided to make himself a great garden. The garden
* should have a from of equilateral triangle. There should be a
* gazebo inside the garden. The gazebo will be connected with the
* triangle vertexes by roa... | true |
b815ea82e28c6cf2cb69b2214fee9c0114a5a05f | C++ | henry-banks/NovExercises | /Exercises/DataStuff/tvector.h | UTF-8 | 2,530 | 3.640625 | 4 | [] | no_license | #pragma once
#include <cassert>
//THIS IS GOING TO BE VERY CLUTTERED BECAUSE ALL THE TEMPLATES HAVE TO BE DECLARED AND DEFINED IN THE SAME FILE.
template<typename T>
class tvector
{
private:
T *m_data;
size_t m_size;
public:
tvector()
{
m_size = 0;
m_data = new T;
}
~tvector()
{
m_size = 0;
if (m_dat... | true |
f5b6515d8a6aa7057d2f0a37ae5832dcab85368d | C++ | deep-bansal/C-Lectures | /STRINGS AND CHAR ARRAY/STRING ROTATION/main.cpp | UTF-8 | 474 | 2.859375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void rotatestring(char* ch,int k)
{
int i=strlen(ch);
while(i>=0)
{
ch[i+k]=ch[i];
i--;
}
i=strlen(ch);
int j=i-k,s=0;
while(j<i)
{
ch[s]=ch[j];
j++;
s++;
}
ch[i-k]='\0';
... | true |
caeb5b80b294eb9358e30ad092cf61ce0736bb15 | C++ | redru/Pacman2D | /Pacman2D/src/Triangle.cpp | UTF-8 | 1,127 | 2.953125 | 3 | [] | no_license | #include "Triangle.h"
static const float vertices[] = {
0.0f, 0.5f, 0.0f, 1.0f,
0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.0f, 1.0f
};
const float* Triangle::_vertices = vertices;
Triangle::Triangle(Engine& engine) : Entity(engine) {
vbo = 0;
vao = 0;
glGenBuffers(1, &vbo); // Generato VBO
glBindBuffer(GL... | true |
f6fde5fd8539719e8e71104c6fb183f65b40d616 | C++ | iElden/MyGIMP | /src/ImageOperations/Selection/ShrinkSelection.hpp | UTF-8 | 1,168 | 2.609375 | 3 | [
"MIT"
] | permissive | /*
** EPITECH PROJECT, 2020
** MyGimp
** File description:
** ShrinkSelection.hpp
*/
#ifndef MYGIMP_SHRINKSELECTION_HPP
#define MYGIMP_SHRINKSELECTION_HPP
#include "../ImageOperation.hpp"
namespace Mimp {
//! @brief Define the ShrinkSelection.
class ShrinkSelection : public ImageOperation {
public:
//! @brief D... | true |
cecc115fa9896aee539a4be2d53c9ea11dc65f9d | C++ | dascheltfortner/pl-survey | /examples/vec-add/normal_vec-add.cpp | UTF-8 | 1,003 | 3.671875 | 4 | [] | no_license | /**
*
* This is an example of a simple C++ program to add together two arrays.
* This comes from the Easy introduction to cuda from the Developer's
* website:
*
* https://devblogs.nvidia.com/even-easier-introduction-cuda/
*
* */
#include <iostream>
#include <math.h>
// function to add the elements of two... | true |
91bc924336cb279c01d8bcbb8f969dbf4a830b9a | C++ | ashish25-bit/data-structure-algorithms | /Trees/Kth-Largest-Smallest.cpp | UTF-8 | 1,650 | 3.8125 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = NULL;
right = NULL;
}
};
Node* insert(Node* root, int value) {
if (!root) return new Node(value);
if (value > root->data)
root->right = insert(roo... | true |