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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1b8a31a97a0326e9054a59ce4c73bf3a82fddeee | C++ | antoniofrigo/ssf | /src/scenario/falling_object_scenario.cpp | UTF-8 | 1,600 | 3.1875 | 3 | [] | no_license | #include "scenario/falling_object_scenario.hpp"
FallingObjectScenario::FallingObjectScenario(int iterations, double timestep)
: s_rows(iterations),
s_cols(4),
s_set_initial(false),
h(timestep),
model(1, s_cols),
integrator(&model, s_cols),
window() {
// Allocate memory for st... | true |
ff9caf5c8cc53e37b728f08e456e05afe88a55f4 | C++ | tonyxwz/leetcode | /9.Graph/1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance.cc | UTF-8 | 1,094 | 2.984375 | 3 | [] | no_license | #include "leetcode.h"
// all pairs shortest path
// floyd warshall
class Solution
{
public:
int findTheCity(int n, vector<vector<int>>& edges, int distanceThreshold)
{
// Matrix
vector<vector<int>> M(n, vector<int>(n, INT_MAX));
for (int i = 0; i < n; ++i)
M[i][i] = 0;
for (const auto& e : e... | true |
a3b7238903ce9677a87e76091de3b1ca2181f90b | C++ | luckhoi56/girsLabBackEndEngine | /src/global/MetropolisGenerator.h | UTF-8 | 1,504 | 2.71875 | 3 | [] | no_license | // MetropolisGenerator.h: interface for the MetropolisGenerator class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_METROPOLISGENERATOR_H__2BDE07A9_4FBF_11D4_9894_002018557056__INCLUDED_)
#define AFX_METROPOLISGENERATOR_H__2BDE07A9_4FBF_11D4_9894_002018557056__INCLUDE... | true |
110600495c95b2bf5a2cd82620f0842d05736c28 | C++ | Christinekrm02/c-learning | /foundations/conditionals/loops/while-loop.cpp | UTF-8 | 378 | 3.625 | 4 | [] | no_license | //while loops loops UNTIL the condition is false
#include <iostream>
using namespace std;
int main(){
int password;
int tries = 0;
cout << "Enter password \n";
cin >> password;
while(password != 54321 && tries < 2){
cout << "Try again: ";
cin >> password;
tries++;
}
if(password =... | true |
7667bb69b38c7af98864da9b9a2b569c68185e50 | C++ | ansiwen/chromiumos-platform2 | /debugd/src/dbus_utils_unittest.cc | UTF-8 | 4,968 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "debugd/src/dbus_utils.h"
#include <limits>
#include <memory>
#include <vector>
#include <base/strings/string_number_conversions.h>
#inc... | true |
9d0c15ca880ad1154bab75fdc575a6e9255586df | C++ | vayupranaditya/data-structure-final-task | /app.cpp | UTF-8 | 21,531 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include "main.h"
#include "app.h"
#include "customer.h"
#include "product.h"
#include "rate.h"
using namespace std;
string GetOsName(){
#ifdef _WIN32
return "Windows 32-bit";
#elif _WIN64
return "Windows 64-bit";... | true |
3d71d7dc5ab0e0458beceee3000f4f795a26836c | C++ | alexdreamwalker/qt-graph-builder | /graph.cpp | UTF-8 | 5,540 | 2.765625 | 3 | [] | no_license | #include "graph.h"
#include <QDebug>
Graph::Graph(QGraphicsItem *parent) :
QGraphicsObject(parent)
{
nodes.clear();
relations.clear();
setFlag(QGraphicsItem::ItemHasNoContents,true);
}
QRectF Graph::boundingRect() const
{
return childrenBoundingRect();
}
void Graph::paint(QPainter *painter, const... | true |
507a167026752273703f8a7dba986d1ad6511eed | C++ | rishabh26malik/Karumanchi-Codes | /Linked lists/y_in_list_way_1.cpp | UTF-8 | 2,137 | 3.734375 | 4 | [] | no_license | /*
Suppose there are two singly linked lists both of which intersect at some point
and become a single linked list. The head or start pointers of both the lists are known, but
the intersecting node is not known. Also, the number of nodes in each of the lists before
they intersect is unknown and may be different in each... | true |
51fa26be8de51ac4775a83f5a2de52fc2ec5c580 | C++ | superrabbit11223344/c--Tutorial | /src/operators/arrowOperator2.cpp | UTF-8 | 556 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <string>
class Entity
{
public:
int x;
void Print() const { std::cout << "Hello!" << std::endl; }
};
class ScopedPtr
{
private:
Entity* m_Obj;
public:
ScopedPtr(Entity* entity)
: m_Obj(entity)
{
}
~ScopedPtr()
{
delete m_Obj;
}
... | true |
78dfc87c458f13dbaeee69b0f9aad75c16639ff6 | C++ | shruti-2522/c- | /OOPS/Inheritancee/multiple_inheeritance.cpp | UTF-8 | 624 | 3.9375 | 4 | [] | no_license | #include<iostream>
using namespace std;
class A
{
protected:
int a;
public:
void get_a(int n)
{
a=n;
}
};
class B
{
protected:
int b;
public:
void get_b(int n)
{
b=n;
}
};
class C:public A,public B
{
public:
void displa... | true |
bb65753564ba5646f0da6bf1ead13ae30065b959 | C++ | masmowa/samples | /JobSearchLog1/include/EmployerContact.h | UTF-8 | 3,282 | 3.328125 | 3 | [] | no_license | #ifndef EMPLOYERCONTACT_H
#define EMPLOYERCONTACT_H
#include <string>
class EmployerContact
{
public:
EmployerContact(unsigned int type=0, const char* position="", unsigned int howcontacted=0, const char* employername="");
EmployerContact(const EmployerContact &other);
EmployerContact& ope... | true |
1fbe69ed5c81af27862a6a790d1a533b30c3f7ba | C++ | thaarres/ExoDiBosonAnalysis | /src/BinomialEff.cc | UTF-8 | 1,941 | 2.796875 | 3 | [] | no_license | #include "Analysis/PredictedDistribution/interface/BinomialEff.h"
#include <cmath>
double BinomialEff::eup() const
{
double upper;
int imax = (int) std::floor(Np);
double CL = 0.1585;
if ( Np == Nt ) {
upper = 1.0;
} else {
double d = 1.0;
double p = 1.0;
double s = 0.0;
double d... | true |
de2a5c1afd1352392488c2616f030e18dfc4cd71 | C++ | joshuaba/CPSC350 | /Assignment1.cpp | UTF-8 | 11,277 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(int argc, char** argv)
{
string inputFile;
if (argc > 1)
{
inputFile = argv[1];
}
else
{
cout << "Need an input, please!" << endl;
exit(1);
}
//declare inputSt... | true |
6f832a7c8d5c71ba81489d4834a3bf2233266405 | C++ | bholst/OceanVisServer | /src/lib/DimensionTrim.cpp | UTF-8 | 2,579 | 2.65625 | 3 | [] | no_license | //
// Copyright 2011 Bastian Holst <bastianholst@gmx.de>
//
// Qt
#include <QtCore/QDebug>
#include <QtCore/QVariant>
// Project
#include "DimensionSubset_p.h"
// Self
#include "DimensionTrim.h"
class DimensionTrimPrivate : public DimensionSubsetPrivate {
public:
DimensionTrimPrivate(Dimension dimension)
... | true |
78501e105c761b52aa6d343fa2123a093acec43e | C++ | trxo/cpp_study_notes | /chapter3-Function and function template/3.10函数返回对象的例子/main.cpp | UTF-8 | 442 | 3.453125 | 3 | [
"AFL-3.0"
] | permissive | #include <iostream>
#include <string>
using namespace std;
string input(const int);
int main()
{
int n;
cout << "Input n = ";
cin >> n;
string str = input(n);
cout << str << endl;
}
string input(const int n)
{
string s1,s2;
for(int i = 0; i < n; i++)
{
cin >> s1;
s2 =... | true |
e4b949836fe32c8280064cf0ecd2da415e20bbe1 | C++ | asad14053/My-Online-Judge-Solution | /All code of my PC/operator_overloading(-).cpp | UTF-8 | 363 | 3.25 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class my
{
public:
int x,y;
my()
{
}
my(int a,int b)
{
x=a,y=b;
}
my operator-(my);
};
my my::operator-(my p)
{
my t;
t.x=x-p.x;
t.y=y-p.y;
return t;
}
int main()
{
my a(20,30);
my b( 10,10);
my c=a-b;
... | true |
0fa24afef131afd14526af91937327dcd7600560 | C++ | azhe12/LeetCode | /InsertInterval.cpp | UTF-8 | 2,089 | 3.3125 | 3 | [] | no_license | //azhe
//2014/6/22
/**
* Definition for an interval.
*/
#include <iostream>
#include <vector>
using namespace std;
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
class Solution {
public:
vector<Interval> insert(vector... | true |
19584262fdb2b43765cd9947b2c00b0a8da6df8d | C++ | Pi0trS/ConfigReader | /ConfigReader/ConfigReader.h | UTF-8 | 685 | 2.78125 | 3 | [
"MIT"
] | permissive | #pragma once
#include<map>
class ConfigReader
{
public:
ConfigReader();
ConfigReader(std::string path);
ConfigReader(std::istream &stream);
void checkData();
std::string getHash();
std::string getHashType();
std::string getSalt();
std::string getDictionaryPath();
int getNumberOfThrede();
private:
std::m... | true |
67f2368c728cf00987a21ba5e1d3b6deceb6e550 | C++ | pgonzbecer/snippet-training | /cpp/snippet-training/BinaryTree.cpp | UTF-8 | 1,806 | 3.640625 | 4 | [] | no_license | // Created by Paul Gonzalez Becerra
#include<iostream>
#include<stdio.h>
#include<ctime>
#define SIZE(a) (sizeof(a)/sizeof(*a));
using namespace std;
class Node
{
public:
// Variables
int id;
Node* left;
Node* right;
// Constructors
Node(int n)
{
id= n;
left= (Node*)0;
right= (Node*)0;
}... | true |
3f021d9276524305a575685629f7add98741ed28 | C++ | DahaiXiao/BCIT-COMP-2618-Assignment- | /Assign 01 Solution/Shape.cpp | UTF-8 | 876 | 3.328125 | 3 | [] | no_license | // Assignment 1 Solution: Shape.cpp
// Member-function definitions for class Shape.
// Author: Bob Langelaan
// Date: Sept. 20th, 2014
#include "Shape.h"
int Shape::mObjectCount = 0; // init. static member
const double Shape::pi = 3.141592654; // init. static member
// constructor
Shape::Shape(void)
:... | true |
b6980559d847872d456281a39019df9cdedecbbb | C++ | cocahack/Missions | /algorithm/may-19/190508/1194.cpp | UTF-8 | 2,599 | 2.953125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
char board[51][51];
int n, m, s_y, s_x;
struct node{
int y, x, move;
string keys;
node(int y_, int x_, int move_):y(y_),x(x_),move(move_),keys(""){}
node(int y_, int x_, int move_, string keys_):y(y_),x(x_),move(move_),keys(keys_){}
bool operator == (con... | true |
cad13004a9cae3defbb1b4acc102b8e9ddd40967 | C++ | jwebb68/nel | /src/nel/test_manual.cc | UTF-8 | 6,674 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | // -*- mode: c++; indent-tabs-mode: nil; tab-width: 4 -*-
#include "manual.hh"
#include <catch2/catch.hpp>
namespace test
{
namespace manual
{
struct Stub
{
static int instances;
static int move_ctor;
static int move_assn;
static void reset()
{
instances = 0;
... | true |
457bf1fa1c0dbc60b16feb9612e54df1b0c5b4fe | C++ | dnfwlq8054/coding_test | /baekjoon/Silver/Binary_Search_Tree_5639.cpp | UTF-8 | 948 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <random>
#include <map>
#include <set>
#pragma warning(disable: 4996)
using namespace std;
class tree {
public:
tree() {}
tree(int _num) : num(_num) {
left = NULL;
right = NULL;
}
void insert(int n) {
if... | true |
f465cd415f2dbe10ee92ada33449104205bd4bf4 | C++ | looke/CPP_Projects | /GeneralMatrix/src/matrix/basic/util/MatrixTransposer.cpp | GB18030 | 971 | 2.703125 | 3 | [] | no_license | /*
* MatrixTransposer.cpp
*
* Created on: 2017225
* Author: looke
*/
#include "MatrixTransposer.h"
#include <iostream>
using namespace std;
MatrixTransposer::MatrixTransposer(BasicMatrix* input_matrix)
{
this->init(input_matrix);
};
void MatrixTransposer::init(BasicMatrix* input_matrix)
{
};
void Matrix... | true |
c839f6112da08156d39e0836b174cad9f53d6dae | C++ | Yotta2/Stanford_CS106B | /Assignment3-vs2008/0B Random Subsets/Random Subsets/RandomSubsets.cpp | UTF-8 | 875 | 3.53125 | 4 | [] | no_license | /*
* File: RandomSubsets.cpp
* ----------------------
* Name: [TODO: enter name here]
* Section: [TODO: enter section leader here]
* This file is the starter project for the Random Subsets problem
* on Assignment #3.
* [TODO: extend the documentation]
*/
#include <iostream>
#include "set.h"
#include "random.h"... | true |
2d564f0bb07bab7ef86b38d97963ae76aaa991f2 | C++ | pkubik/tin | /targets/Network/Abortable.hpp | UTF-8 | 2,231 | 2.984375 | 3 | [] | no_license | /*
* TIN 2015
*
* Pawel Kubik
*/
#pragma once
#include "Socket.hpp"
namespace network {
/**
* @brief abortableRead Reads specified amount from the socket and allow aborting
*
* Blocks if there is nothing to read. Might return less then required number of bytes.
*
* @param socket socket object
* @param ... | true |
eb1d88d2d8cf024a472290767af625254f43e5e3 | C++ | rortian/oldjava | /JCppXref/WinNTCpp/Microsoft/IOSDemo/IOSDemo.cpp | UTF-8 | 7,569 | 2.765625 | 3 | [] | no_license | #include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
const char * filenameA [] = {
"",
"OS01A.TXT", "OS02A.TXT", "OS03A.TXT", "OS04A.TXT",
"OS05A.TXT", "OS06A.TXT", "OS07A.TXT", "OS08A.TXT",
"OS09A.TXT", "OS10A.TXT"
... | true |
3fdde3db15c8220216612f84265bfca1e5596a20 | C++ | Jorjatorz/LastStand | /LastStand/FRenderer.h | UTF-8 | 1,344 | 2.65625 | 3 | [] | no_license | #pragma once
#include "Singleton.h"
#include "FDeferredFrameBuffer.h"
#include "FStaticMesh.h"
#include <gl/glew.h>
class FWorld;
class Matrix4;
class FScene;
class FCameraComponent;
//Class incharge of rendering all the FObjects in the world.
class FRenderer : public Singleton<FRenderer>
{
public:
FRenderer(unsig... | true |
caeda5e7dabf67a30365175f977f7aa8c0795ee9 | C++ | anilsevici/Cpp | /Ogrenci.cpp | UTF-8 | 1,409 | 2.734375 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
#include "String.h"
#include "Tarih.h"
#include "Bilgisayar.h"
#include "Ogrenci.h"
using namespace std;
Ogrenci::Ogrenci(int no,String ogr_ad,String ogr_soyad,Tarih ogr_dogum,Tarih ogr_kayit,
Bilgisayar tasinabilir,int ogr_sinif,float ogrenci_ort):ogr_no(no),ad(... | true |
2b914919f004b46e58622f8185a74f24970a1a40 | C++ | pcw109550/problem-solving | /LeetCode/minimum-number-of-removals-to-make-mountain-array.cpp | UTF-8 | 936 | 3.21875 | 3 | [] | no_license | // 1671. Minimum Number of Removals to Make Mountain Array
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int minimumMountainRemovals(vector<int>& nums) {
// O(N ** 2) LIS
int N = nums.size();
int result = N;
vector<int> D1(N... | true |
7756f25f2fb096ca4e1d11bfb279a4fd625950a2 | C++ | shang766/multiview | /multiview/multiview_cpp/src/testcases/file-io/file-system_tc.cpp | UTF-8 | 3,202 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive |
#include <algorithm>
#include <filesystem>
#include <iterator>
#define CATCH_CONFIG_PREFIX_ALL
#include "perceive/contrib/catch.hpp"
#include "perceive/utils/file-system.hpp"
namespace perceive
{
static std::string sentence = "The quick brown fox jumped over the lazy dog.";
// Data for test cases
static std::vector... | true |
ce08b819b07156ad8dd8565c6be85341373c9b17 | C++ | kaurgurpal/AirlineReservationSystem | /AirlineReservationSystem/FlightScheduleDatabase.cpp | UTF-8 | 2,298 | 2.625 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include "FlightScheduleDatabase.h"
#include <Windows.h>
using namespace std;
namespace ARS
{
FlightScheduleDatabase::FlightScheduleDatabase()
{
Flight f1{ "AA001", "American Airline", "Seattle SEA", "NEW York JFK", 0700, 1500, 380};
Flight f2{ "ALK001", "Alaska Airline", "S... | true |
65339b12a47651230598c9bc86cab408e37fe02c | C++ | funeralbot/sanchezkalonnie_CSC5_fall2017 | /hmwk/Assignment 1/Sales Tax/main.cpp | UTF-8 | 1,350 | 3.84375 | 4 | [] | no_license | /*
* File: main.cpp
* Author: Kalonnie Sanchez
* Created on September 14, 2017, 12:00 AM
* Purpose: Determine sales tax based off state and county.
*/
//System Libraries
#include <iostream> //Input/Output Stream Library
using namespace std; //The Standard namespace for system libraries
//User Libraries
/... | true |
0eff3d1d85ef77e68fac30d09b8448769f95cd6b | C++ | bartoszstelmaszuk/SPOJ | /PA05_POT/PA05_POT/Source.cpp | UTF-8 | 631 | 2.75 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main (void)
{
long int a, b, c, l, e, x, result;
int tab[29];
int n;
for(int i=0; i<30; i++)
{
tab[i]=0;
}
cin >> n;
for (int i=0; i<n; i++)
{
cin >> a;
cin >> b;
l=0;
for (int j = 1; j*2<=b; j=j*2)
{
l++;
e=j*2;
}
for(int j=l;j>=0;j-... | true |
f034787a951bdb0b9b85662312ff59114404fce9 | C++ | VeniVidiReliqui/LinkedList | /main.cpp | UTF-8 | 1,234 | 3.125 | 3 | [] | no_license | /*
* main.cpp
* Name: Benjamin Hunt
*
* This file has NO PURPOSE, other than allowing you to 'play'
* with your List(s) and verify operation. What you do here
* will probably be what you should put in your unit tests!
*
* Nov 19 ,2013
*/
#include <iostream>
#include "List.h"
using namespace std;
int main(... | true |
3537fd1d342a471b9c6ed582a7498eb0260301b2 | C++ | Soonwook34/My-Baekjoon-Code | /18258.cpp | UTF-8 | 980 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <vector>
using namespace std;
int main() {
int N;
scanf("%d", &N);
char cmd[6];
vector<int> myQueue; //큐 구현
int front = 0, back = 0;
for (int i = 0; i < N; i++) {
scanf("%s", cmd);
//push
if (strcmp(cmd, "push") == 0) {
int x;
scanf("%d", &x);
my... | true |
3b4b7f58d970e93cc64e73514337a60bcd45d6f3 | C++ | cerww/tictactoe | /include/ticTacToeAI.h | UTF-8 | 896 | 2.734375 | 3 | [] | no_license | #ifndef TICTACTOEAI_H
#define TICTACTOEAI_H
#include "tictactoe.h"
#include <vector>
#include <unordered_map>
#include "vecFuncs.h"
struct tictactoeBoard{
friend class tictactoe;
tictactoeBoard(){};
tictactoeBoard(tictactoe b){
Xs = b.m_Xs;
Os = b.m_Os;
};
~tictactoeBoard(){};
sh... | true |
87392a9dea1b223d10daec702451e33846444415 | C++ | frenchjam/CodaRTnetExamples | /CodaRTnetSDK/examples/rtnetdemo/Alignment.cpp | UTF-8 | 5,073 | 2.734375 | 3 | [] | no_license | #include <conio.h>
#include <iostream>
#include <strstream>
#include <iomanip>
#include "codaRTNetProtocolCPP/RTNetClient.h"
#include "codaRTNetProtocolCPP/DeviceOptionsAlignment.h"
#include "codaRTNetProtocolCPP/DeviceInfoAlignment.h"
#include "Alignment.h"
Alignment::Alignment()
{
RegisterParameter("origin", origin... | true |
7f34ba7c557baa645c7795b50049e3340aaf92a3 | C++ | Masters-Akt/CS_codes | /leetcode_sol/223-Rectangle_Area.cpp | UTF-8 | 420 | 3.15625 | 3 | [] | no_license | class Solution {
public:
int computeArea(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2) {
int area1 = (ax2-ax1)*(ay2-ay1), area2 = (bx2-bx1)*(by2-by1);
if(!(max(ax1, bx1)<min(ax2, bx2) && max(ay1, by1)<min(ay2, by2))) return area1+area2;
int common_area = (min(ax2, b... | true |
e68fbb116ff2cba0ec39232196a2bd7e3efdcd03 | C++ | lzgjxh/SpaceWireRMAPLibrary | /source_IPSocketLibrary/t-kernel/IPSocket.cc | UTF-8 | 1,444 | 2.953125 | 3 | [] | no_license | #include "IPSocket.hh"
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
using namespace std;
///////////////////////////////////
//IPSocket
///////////////////////////////////
IPSocket::IPSocket(){
status=IPSocketInitialized;
timeoutDurationInMilliSec=0;
setPort(-1);
}
IPSocket::~IPSocket(){}
int I... | true |
24471f7918f32d1f7e35f86b9925df6919345555 | C++ | lexingsen/Data-Structure | /Algorithm/Greedy/452.cc | UTF-8 | 545 | 2.8125 | 3 | [] | no_license | /*
* @Description
* @Language:
* @Author:
* @Date: 2020-10-28 10:51:11
*/
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
bool cmp(const pii &a, const pii &b) {
return a.second < b.second;
}
int findMinArrowShots(vector<pii> &points) {
sort(points.begin(), points.... | true |
427c9d031a6861868eac1fe0485ca49cfb7734e3 | C++ | Yancyzhan/lab2 | /square.cpp | UTF-8 | 839 | 2.96875 | 3 | [] | no_license | // square.cpp
// ENSF 480 - Lab2 - Exercise A
// Author: Yanzhao Zhang 30031217 and Kazi Ashfaq 30021563
//
// Date: Sept 21, 2018
#include "square.h"
#include <string.h>
#include <iostream>
using namespace std;
/*Square::Square(double x, double y, double side,char* name):Shape(x,y,name){
side_a = side;
... | true |
89ed6ca02f1a3113f2fb3416e3e67714299092e7 | C++ | Woloda/Lab_5_1_F | /Lab_5.1(F)/Triad.cpp | UTF-8 | 2,484 | 3.5625 | 4 | [] | no_license | #include <stdexcept>
#include <iostream>
#include <string>
#include "My_Error_Range.h"
#include "Triad.h"
Triad::Triad() { x = 3; y = 4; z = 5; } //конструктор за умовчанням(без параметрів)
Triad::Triad(const number v_x, const number v_y, const number v_z) throw(My_Error_Range) { //конструктор ініціалізації
if... | true |
b761b331a3896584ae88c34dc62db7ac27f9fdd3 | C++ | harrywhite-sd/TCPIP | /TCPIP/ServerSocket.cpp | UTF-8 | 1,451 | 2.796875 | 3 | [] | no_license | #include "ServerSocket.h"
#pragma warning(disable:4996)
int ServerSocket::ServerThread()
{
cout << "Starting up TCP server\r\n";
WSADATA wsaData;
sockaddr_in local;
int wsaret = WSAStartup(0x101, &wsaData);
if (wsaret != 0)
{
return 0;
}
//Now we populate the sockaddr_in structure
local.sin_family = ... | true |
d0ab21733264d430f99b81b3d17184466a234797 | C++ | shacl/optional | /include/shacl/optional/Type/test/equality.test.cpp | UTF-8 | 8,819 | 3.15625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | #include "shacl/optional.hpp"
#include "catch2/catch.hpp"
struct RightFalseEquality {};
template<typename T,
std::enable_if_t
<not shacl::optional::IsInstance_v<T>, bool> = true>
bool operator==(const T&, RightFalseEquality){ return false; }
struct RightTrueEquality {};
template<typename T,
... | true |
c0c7f5bfb46980c31c63791d13f4334e7c6bfecc | C++ | ssehuun/langStudy | /data_structure/stack/stack_stl.cpp | UTF-8 | 564 | 3.3125 | 3 | [] | no_license | /*
19.02.14
<Stack implemented with STL>
input value
8
size
push 4
push 3
top
size
pop
top
size
output value
0
3
2
4
1
*/
#include <stack>
#include <iostream>
#include <string>
using namespace std;
int N, val;
string cmd;
int main(){
stack<int> st;
cin >> N;
for(int i=0; i<N; i++){
cin >> cmd;
if(cmd[0] =... | true |
db7ec73179d90f6061733ca1816fe7368aa8e31b | C++ | cjmms/MimicEngine | /Mimic/Mimic/src/Core/Model.h | UTF-8 | 1,170 | 2.71875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Mesh.h"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
/*
* .obj model file
* Architecture of Model:
* Each model contains a tree of nodes
* Each node contains meshes
* Each mesh contain vertices, indices, Material(textures)
*/
class Model
{
public:... | true |
3b445f17fb6d1933233b868395cf90b138011c7c | C++ | C-mmon/Ray_Tracer | /skeleton.cpp | UTF-8 | 536 | 2.796875 | 3 | [] | no_license | #include <iostream>
const int image_width=256;
const int image_height=256;
using namespace std;
int main()
{
cout<<"P3"<<endl;
cout<<image_width<<" "<<image_height<<endl;
for(int j=image_height-1;j>=0;--j)
{
for(int i=0;i<image_width;i++)
{
auto r=double(i)/(image_width-1);
auto g=double(i)/... | true |
61f37ac4387c06772c3ed686d656a6934cf311c7 | C++ | jinyung2/csci-140 | /Lab_6/quartsal.cpp | UTF-8 | 3,458 | 3.8125 | 4 | [] | no_license | /* Program: quartsal.cpp
Author: Jin Choi
Class: CSCI 140
Date: 10/10/2018
Description: Program that prints 2d array but with different values for first col of table.
I certify that the code below is my own work.
Exception(s): book code, editted to fill out function calls.
*/
#incl... | true |
2dcfdbb2c0d76589f732b433f8b039f63457062e | C++ | guyueshui/JianZhiOffer | /ReversePrint.cpp | UTF-8 | 1,846 | 3.703125 | 4 | [] | no_license | // Problem: print from the end to begining of
// a given linked list.
/*
* 1. use stack
* 2. use recursion
*/
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
class ListNode {
public:
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution {
... | true |
f48ed94bda0cd5c14a6e00d8826b9847102f0322 | C++ | MLambeva/Raster-graphics | /RGB.h | WINDOWS-1251 | 692 | 2.9375 | 3 | [] | no_license | #ifndef RGB_H
#define RGB_H
#include<string>
#include<iostream>
#include<cassert>
#include "Formats.h"
// .ppm , .
class RGB
{
private:
int red;
int green;
int blue;
public:
RGB() :red(0), green(0), blue(0) {};
int getRed() const;
int getGreen() const;
int getBlue() const;
vo... | true |
e4458dd2df4da2ad14c7af4b30fe6d423ad71d6b | C++ | WhiZTiM/coliru | /Archive2/26/207a256baf3eb2/main.cpp | UTF-8 | 1,260 | 2.96875 | 3 | [] | no_license | #include <math.h>
#include <stdio.h>
#include <emmintrin.h>
#include <xmmintrin.h>
__m128 my_exp2(__m128 x){
/* x = u + n where u in [0, 1] */
__m128i n = _mm_cvttps_epi32(x);
__m128 d, u = _mm_sub_ps(x, _mm_cvtepi32_ps(n));
/* taylor series for 2^u */
d = _mm_set1_ps(0.013670309453328856f);
d... | true |
d8a52742c478e37c3fd520d8772c8f110b8eaa58 | C++ | shashank9aug/DSA_CB | /Dynamic_Programming/DP_Base/count_subset_with_given_diff.cpp | UTF-8 | 1,175 | 3.203125 | 3 | [] | no_license | /*
$ ./a.exe
4
1
1 1 2 3
3
*/
#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
int countSubsetSum(vector<int>arr, int sum, int n)
{
int t[n + 1][sum + 1];
//Initialization :
for (int i = 0; i <= n; i++)
{
t[i][0] = 1;
}
for (int i = 1; i <= sum;... | true |
84a65dbbf2ef4af2113f532eda23db600bd39d44 | C++ | pauek/ccjs | /tests/aprox_e.cc | UTF-8 | 325 | 3.046875 | 3 | [] | no_license |
#include <iostream>
using namespace std;
// e^x: 1 + x + x^2/2! + x^3/3! + x^4/4! + ...
// en nmax = 35 --> inf...
int main()
{
int nmax, fact = 1, i = 1;
double e = 1.0;
cin >> nmax;
while ( i < nmax )
{
e += 1.0 / float(fact);
i++;
fact *= i;
}
cout.precision(15);
cout << e << end... | true |
e712d8628d37f90b707069a95901ec355eb220b3 | C++ | cdsupina/Arduino-Examples | /Arduino Uno/Gripper_Control/Gripper_Control.ino | UTF-8 | 942 | 2.890625 | 3 | [] | no_license | /* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo;
char val;
boolean opened;
boolean closed;
int openSpeed = 30;
void setup() {
myservo.attach(8); /... | true |
63d6190b65cd4389791d169e5d9a651a30560e83 | C++ | keineahnung2345/cpp-code-snippets | /time_t(long_int)_to_and_from_string.cpp | UTF-8 | 564 | 3.3125 | 3 | [] | no_license | #include <time.h>
#include <string>
#include <iostream>
//https://stackoverflow.com/questions/37505001/how-do-i-convert-a-unix-timestamp-string-to-time-t-in-c11
int main()
{
time_t timer;
std::string timer_str;
time_t timer_back;
time(&timer);
std::cout << "time_t: " << (long int)timer << std::en... | true |
0c3ee8e5eef9c48c92e633b7b0bdc3e2ac6fb8b7 | C++ | ab4295/C_plusplus_Training | /Cpp(6)/exercise/pe12/pe12-2/pe12-02.cpp | UHC | 1,317 | 3.8125 | 4 | [] | no_license | // pe12-02.cpp -- 12 α 2
// string2.cpp Բ Ѵ
#include <iostream>
using namespace std;
#include "string2.h"
int main()
{
String s1(" and I am a C++ student.");
String s2 = " ̸ ԷϽʽÿ: ";
String s3;
cout << s2; // ε <<
cin >> s3; // ε >>
s2 = "My name is " + s3; // ε =, +
cout << s2 << ".\n";
... | true |
6b978887a11ee6df03e6670c3a5c8dfa0b71201f | C++ | CodeOpsTech/DesignPatternsCpp | /dp/cpp/dps/decorator/visualcomponent/DecoratorMain.cpp | UTF-8 | 806 | 2.890625 | 3 | [] | no_license | #include "DecoratorMain.h"
VisualComponent::~VisualComponent() { }
void TextView::draw()
{
std::cout << std::string("Calling TextView.draw()") << std::endl;
}
Decorator::Decorator(VisualComponent *component)
{
this->component = component;
}
void Decorator::draw()
{
if (component != nullptr)
{
... | true |
b483f5e6a5a91bdf7745400cba825c83b1fc061e | C++ | charles-pku-2013/CodeRes_Cpp | /Templates/Example_Code/examples/meta/sqrt4.hpp | UTF-8 | 1,099 | 2.875 | 3 | [] | no_license | /* The following code example is taken from the book
* "C++ Templates - The Complete Guide"
* by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley, 2002
*
* (C) Copyright David Vandevoorde and Nicolai M. Josuttis 2002.
* Permission to copy, use, modify, sell and distribute this software
* is granted provi... | true |
ca24246da83ee4ea52192f4419fd5ace8f1aba1a | C++ | keisuke-kanao/my-UVa-solutions | /Problem Set Volumes/Volume 13 (1300-1399)/UVa_1347_Tour.cpp | UTF-8 | 1,442 | 3.203125 | 3 | [] | no_license |
/*
UVa 1347 - Tour
To build using Visual Studio 2012:
cl -EHsc -O2 UVa_1347_Tour.cpp
*/
#include <algorithm>
#include <vector>
#include <utility>
#include <limits>
#include <cstdio>
#include <cmath>
using namespace std;
const double infinite = numeric_limits<double>::max();
int main()
{
int n;
while (scanf("... | true |
66b599dc8b14a8c8851851e6c5bdb030951ba0b9 | C++ | shaylagrymaloski/CodingProjects | /CSC 226/Lab3.cpp | UTF-8 | 1,739 | 3.5 | 4 | [] | no_license | // Example program
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
int calcHashVal(std::string str, int n){
int result = 0;
for(char& c : str) {
result = int(c) + result;
}
return result%11;
}
void insertHash(std::vector<std::vector<std::string> > &vec, std::string... | true |
05a5ec4ec5d312335fafe48afbfbc683f784f5e1 | C++ | DanyilSomin/Somin_Tetris | /Somin_Tetris/Button.cpp | UTF-8 | 2,270 | 3.078125 | 3 | [] | no_license | #include "Button.h"
bool Button::lastUpdateMouseDown = false;
Button::Button(const sf::Vector2f &position,
const std::string &text,
const std::function<void(void)> &onClickEvent)
: m_position{ position }, m_onClickEvent{ onClickEvent }, m_text{ text }
{
m_font.loadFromFile(FONT_PATH);
m_texts.resize(ButtonSta... | true |
e179ecc2f4b445c9b3ca9e91a5e010dabfc9353b | C++ | TheAlgorithms/C-Plus-Plus | /geometry/graham_scan_algorithm.cpp | UTF-8 | 3,473 | 3.3125 | 3 | [
"MIT",
"CC-BY-SA-4.0"
] | permissive | /******************************************************************************
* @file
* @brief Implementation of the [Convex
* Hull](https://en.wikipedia.org/wiki/Convex_hull) implementation using [Graham
* Scan](https://en.wikipedia.org/wiki/Graham_scan)
* @details
* In geometry, the convex hull or convex enve... | true |
e85c9f57128634ed2edf3ffcfe4f66af972f91fd | C++ | HelenaGD/AEDA_Tema_2_Busqueda | /P6_Tabla_Hash_con_dispersion_cerrada/src/main.cpp | UTF-8 | 2,986 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include "tablahash.hpp"
#include "vector.hpp"
//#include "funciondispersion.hpp"
#include "fdmodulo.hpp"
#include "fdpseudoaleatoria.hpp"
//#include "funcionexploracion.hpp"
#include "felineal.hpp"
#include "fecuadratica.hpp"
#include "fedobledispersion.hpp"
#include "feredispersion.hpp"
#define ... | true |
c719008d8cf53fbdf2a307c24b6f98a432c255ce | C++ | igortakeo/Competitive-Programing | /Laboratório de Algoritmos Avançados 1/29/ex29.cpp | UTF-8 | 950 | 2.671875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#define pii pair<int,int>
using namespace std;
vector<tuple<int, int, int>>v;
vector<int> lis(int n){
vector<pii>dp[n];
vector<int>ans;
dp[0].push_back({get<1>(v[0]), get<2>(v[0])});
for(int i=1; i<n; i++){
for(int j=0; j < i; j++... | true |
dddd4d731c75cf09de8b859ea70c1b601f450322 | C++ | pijastrzebski/DesignPatternsBattlefield | /Behavioral/Visitor/Visitor/Triangle.h | UTF-8 | 314 | 2.65625 | 3 | [] | no_license | #pragma once
#include "IShape.h"
#include "IVisitor.h"
class Triangle : public IShape
{
public:
virtual void acceptVisitor(IVisitor* visitor) override
{
visitor->visitTriangle(this);
}
virtual void draw() override
{
std::cout << "Draw Triangle\n";
}
}; | true |
483ad620865bc024a50da442aae763bf0c378721 | C++ | shuvra-mbstu/Uva-problems | /acm.11417 - GCD.cpp | UTF-8 | 503 | 2.703125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int GCD(int b, int a )
{
int t;
while(b!=0)
{
t=b;
b = a%b;
a=t;
}
return a;
}
int main()
{
int a, b, i, j, g, num;
while(scanf("%d",&num)==1)
{ g = 0;
if(num == 0)
break;
... | true |
eeab2815df39266188f2ac604d4e033e6fc75c3a | C++ | Wicho1313/Estructuras-de-datos | /1 parcial/Evidencia/cola/cola.cpp | UTF-8 | 1,030 | 3.25 | 3 | [] | no_license | #include <iostream.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
struct cola {
int dato;
struct cola *s;
};
struct cola *p,*aux,*u;
void push (int dat)
{
aux=(struct cola *)malloc(sizeof(cola));
aux->dato=dat;
if(u)
{
u->s=aux;
aux->s=NULL;
u=aux;
}
else
{
p=u=aux;
}
}
void... | true |
45fc125af7ab039a0c948e4bbbd9f8721b7d9d86 | C++ | nerissa123456/IndoorPaperSim | /index_operator.inl | UTF-8 | 1,154 | 2.765625 | 3 | [] | no_license | #include "ParticleFilter.h"
#define TYPE vector<ParticleFilter::index>
inline TYPE operator + (const TYPE& lo,const TYPE& ro){
TYPE result(lo);
for(int i = 0; i < ro.size(); i++){
bool flag = false;
for(int j = 0; j < result.size(); j++){
if (result[j].tagID == ro[i].tagID){
... | true |
8db75810022b29baa661d8b72301b545f05ba67e | C++ | drb8w/StereoVision2015 | /StereoMatcher/StereoMatcher/SelectDisparity.cpp | UTF-8 | 1,477 | 2.78125 | 3 | [] | no_license | #include "SelectDisparity.h"
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
#include <opencv2\opencv.hpp>
void _selectDisparity(cv::Mat &display, std::vector<cv::Mat> &costVolume)
{
int maxDisp = costVolume.size();
for(int rowNr = 0; rowNr < display.rows; rowNr++ )
for(int columnNr = 0; co... | true |
2a5fb795d7c63883abd6d41ede77d48113cb0dcb | C++ | to0d/leetcode | /LT014001/LT014001.cpp | UTF-8 | 2,041 | 2.921875 | 3 | [] | no_license | #include <lt_help/lt.h>
class Solution {
public:
vector<string> wordBreak(string s, vector<string>& wordDict) {
vector<string> rst;
m_wordSet.clear();
m_maxWordLen = -1;
static char buf1[26], buf2[26], buf3[26];
cal(buf1, s);
memset(buf3, 0, 26);
for(auto w : wordDict)
{ ca... | true |
9cc089cd33c096aa441d9a1fa3dac66741173b07 | C++ | ElickC/Older-Projects | /C++/Comp4/Project Portfolio/PS3b/main.cpp | UTF-8 | 3,234 | 2.65625 | 3 | [] | no_license | #include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <memory>
#include <cmath>
#include <fstream>
#include "Body.hpp"
using namespace std;
using namespace sf;
const double gravity = 6.67 * 1e-11;
float findRadius(float dX, float dY);
float calculateForce(float massA, float massB... | true |
ec3e1ca6fdb947368375676309e52cff0032ed97 | C++ | liquidmetalcobra/shittyshooter | /testgame/gameObject.cpp | UTF-8 | 1,975 | 2.78125 | 3 | [] | no_license | //
// gameObject.cpp
// testgame
//
// Created by Sasha Han on 10/14/17.
// Copyright © 2017 __. All rights reserved.
//
#include "gameObject.hpp"
void gameobject::collide(gameobject *go)
{
// std::cout << "oops";
}
void gameobject::update()
{
}
void gameobject::draw(ALLEGRO_DISPLAY *display)
{
}
void gam... | true |
d597db9e49e279837a3b8235a379be1f2cd781cf | C++ | hislittlecuzin/TopDownEngine | /AnimationSystem.h | UTF-8 | 1,123 | 2.9375 | 3 | [] | no_license | #pragma once
#include "Globals.h"
#include <SFML/Graphics.hpp>
class AnimationSystem {
public:
/// Used for Constructor to define what animations will exist.
enum AnimatedType { wall, person };
enum Animations { inPlace, idle, walking, };
void Setup(sf::Texture &texture, AnimatedType typeOfAnimat... | true |
987e3f6ac373f3f8599b1e53090c4a758ce59f84 | C++ | Cryptogroup/universalcircuit | /src/Eu/EugNode.h | UTF-8 | 1,377 | 2.609375 | 3 | [] | no_license |
//#pragma once
#ifndef _EugNode_h_
#define _EugNode_h_
#include "EugComponent.h"
#include <iostream>
#include <cstdint>
#include "../Simple/SimpleGate.h"
#include "../Dag/DagNode.h"
using namespace std;
class SimpleGate;
class EugComponent;
enum EugNodeType
{
EUG_NODE_POLE,
EUG_NODE_NORMAL,
EUG_NODE_IN, // H... | true |
50404d8765492956c93825bd677558ef47b82a1d | C++ | zhouxiaoy/pat | /第四届决赛/猜灯谜.cpp | UTF-8 | 578 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int check(int a[],int n){
int i=5;
int b[10]={0};
while(n>0){
if(i==1){
if(b[n%10]==1)
b[n%10]++;
else
return 0;
}
else{
if(b[n%10]!=0)
return 0;
else
b[n%10]++;
}
a[i--]=n%10;
n/=10;
}
return 1;
}
int main(){
for(int i=100;i<=999;i+... | true |
34286ed29ced885b1b90ea130908f5758b2e1995 | C++ | RedYurii/CrazyTanks | /battleCityConsole/GameObjectBase.h | UTF-8 | 527 | 2.859375 | 3 | [] | no_license | #pragma once
enum direction { LEFT= 27, RIGHT = 26, UP = 24, DOWN = 25
};
class GameObjectBase
{
float xPos_;
float yPos_;
int velocity_;
char sprite_;
short color_;
direction dir_;
public:
GameObjectBase(float x, float y, int v, char sp, direction dr, short color);
~GameObjectBase();
float getXPos();
float g... | true |
feed3c2992f87bfa055cf031f9276e1beabc8514 | C++ | xTunqki/VariadicTemplateAlgorithms | /tests/algorithms.cpp | UTF-8 | 18,419 | 3.125 | 3 | [
"BSL-1.0"
] | permissive | #include "vta/algorithms.hpp"
#include <boost/test/unit_test.hpp>
#include <algorithm>
#include <iostream>
#include <type_traits>
#include <string>
namespace {
struct printer {
printer(std::ostream& str)
: m_str{&str} {
}
template <typename T>
void operator()(T const& obj) {
*m_str << obj;
}
std::ostream... | true |
c32c944f22606023fcceef9d06c71ff8ea1d538c | C++ | unixpickle/anarch | /src/memory/malloc.cpp | UTF-8 | 2,258 | 2.796875 | 3 | [] | no_license | #include "malloc.hpp"
#include <anarch/api/panic>
#include <anarch/critical>
#include <anarch/align>
namespace anarch {
Malloc::Malloc(size_t pool, Allocator & _allocator, bool _bigPages)
: poolSize(pool), bigPages(_bigPages), allocator(_allocator) {
}
Malloc::~Malloc() {
AssertNoncritical();
while (firstSegme... | true |
8656a9de6404e54ce84f670f860074f060e4208e | C++ | yagi2/Competitive_programming | /AOJ/Vol.100/Solved/10020.cpp | UTF-8 | 342 | 3.015625 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main(void){
int i,num;
char ch;
int count[26]={0};
while(cin >> ch){
if(ch>='A' && ch<='Z'){
ch += 0x20;
}
num = ch-'a';
count[num]++;
}
ch = 'a';
for(i=0;i<26;i++){
cout << ch << " : " << count[i] << endl;
ch+... | true |
2d0b022f081314d970e449db63a77c301c4c6f01 | C++ | zauberfuchs/OpenGLCherno | /OpenGL/src/tests/Test.cpp | ISO-8859-1 | 487 | 2.890625 | 3 | [] | no_license | #include "Test.h"
#include "imgui/imgui.h"
namespace test {
TestMenu::TestMenu(Test*& currentTestPointer)
: m_CurrentTest(currentTestPointer)
{
}
void TestMenu::OnImGuiRender() // erzeugt die buttons fr jeden test im Vector m_Tests
{
for (auto& test : m_Tests)
{
if (ImGui::Button(test.first.c_str())) /... | true |
68c9227a64c993692fc0235a4752fc2fc5af6a4b | C++ | JGonzalezRodriguez/prog4 | /src/clase.cpp | UTF-8 | 3,008 | 2.671875 | 3 | [] | no_license | #include "../include/clase.h"
int Clase::seed = 0;
int Clase::getSeed() {
return seed;
}
void Clase::incSeed() {
seed = seed + 1;
}
void Clase::setDocente(Docente* doc){
this->doc = doc;
}
Docente* Clase::getDocente(){
return this->doc;
}
DtFecha *Clase::getFechayhoracomienzo(){
return this->f... | true |
b352f180afb949766322866f35c2054bf3d94863 | C++ | Paulels/Unistuff | /2015/s2/oop/practical-01/program1-1.cpp | UTF-8 | 279 | 3.265625 | 3 | [] | no_license | #include <iostream>
int sum_array(int array[], int n){
int number=0;
int i=0;
for(i=0;i<n;i++){
number=number+array[i];
}
return number;
}
#ifndef WEBSUBMIT
int main(){
int array[5] = {7,6,2,10,7};
std::cout << sum_array(array,5) << std::endl;
}
#endif //WEBSUBMIT
| true |
d920d6635259ab321234c9ef2d78fa1c69d642a3 | C++ | karlhickel/Data-Structures | /Data Structures/Assignment5/faculty.h | UTF-8 | 1,391 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include "student.h"
#include "doubleLinkedList.h"
//faculty class
using namespace std;
class Faculty
{
public:
//Faculty constructor
Faculty();
Faculty(int facultyID1, string facultyName1, string facultyJob1, string facultyDepartment1);
Faculty(int facultyID1);
~Faculty();
//Variabl... | true |
0ff0d7f9f94495a605ebed3e837df5e7bd9557ab | C++ | leslier94/RodriguezLeslie_CSC17A_42824 | /homework/Assignment 5/ch16_problem2/main.cpp | UTF-8 | 1,053 | 3.421875 | 3 | [] | no_license | /*
* File: main.cpp
* Author: Ariana & Gilbert
*
* Created on May 31, 2016, 1:25 AM
*/
#include <cstdlib>
#include <iostream>
#include "Time.h"
#include "MilTime.h"
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
int hour;
int sec;
char choice;
cout << "Enter hour " << endl;... | true |
8045fc1071264ad4f3de1b25b1776d8a06217619 | C++ | JaniTomati/programmiersprachen-raytracer | /framework/sdfloader.cpp | UTF-8 | 11,337 | 2.703125 | 3 | [
"MIT"
] | permissive | // SDFloader.cpp (Ray-Tracer 7.1)
#include "sdfloader.hpp"
#include <map>
Scene loadSDF(std::string const& fileIn) {
std::ifstream file;
std::string line;
file.open(fileIn); // opens input file
std::map<std::string, std::shared_ptr<Shape>> findeShape; // added with 7.2 composite
Scene loadedScene;
if ... | true |
12de1d536058f4a053d02067bcac415f5aa6133e | C++ | baiwei1106/BTTC-Online-Judge | /problem/2018夏·西北工业大学”字节跳动杯“程序设计竞赛/C.董与黑的碰撞-侵入/main.cpp | UTF-8 | 1,073 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int indegree[1005];
int n, m, T, a, b;
vector <int> Map[1005];
int main()
{
ifstream fin("in.txt");
ofstream fout("out.txt");
fin>>T;
int Case = 0;
while (T--){
int flag = 1;
fin>>n>>m;
for (int i=1; i<=n; i++){
Map... | true |
d023237133014f4c89dc9e008bae9df8a7a960d2 | C++ | Michaelborsellino/Postfix-to-Infix | /bet.h | UTF-8 | 1,100 | 2.890625 | 3 | [] | no_license | #ifndef BET_H
#define BET_H
#include<iostream>
#include<string>
#include<stack>
#include<vector>
class BET{
private:
struct BinaryNode{
std::string data;
BinaryNode * left;
BinaryNode * right;
BinaryNode(const std::string & d = std::string{}, BinaryNode *p = nullptr, BinaryNode *n = nullptr)
... | true |
0045e41de00b8f91387c2c7aae145adf67ce7e64 | C++ | RiyaGupta89/C-Coding-problems-for-beginners | /2D Arrays/spiralPrint.cpp | UTF-8 | 985 | 3.375 | 3 | [] | no_license | #include <iostream>
using namespace std;
void spiralprint(int a[1000][1000], int m, int n)
{
int startRow = 0;
int endRow = m - 1;
int startCol = 0;
int endCol = n - 1;
while (startRow <= endRow && startCol <= endCol)
{
for (int i = startCol; i <= endCol; i++)
{
co... | true |
600c0250f12402c24eb2bfe11518cec013a36c59 | C++ | Hongze-Wang/TargetOffer | /Tencent09062.cpp | UTF-8 | 1,410 | 3.0625 | 3 | [] | no_license | // 求解多项式方程 模拟
// 就是一个一个试 取x范围[-5000, 5000] 每次间隔 eps = 0.0005
// 如果当前多项式接近0(取+-1e-8) 那我就认为是解
// 为了提高精度 求 f(i+eps) 和 f(eps) 如果两者符号相反 一个在坐标轴上 一个在坐标轴下
// 则i+eps/2 是一个精度更高的解 i+eps/2能大致将其定位到坐标轴上 即是解
// 这是一个加速的trick
// 如果不使用这个trick 你可以把eps取更小 但这样你可能会超时
// [-1000, 1000]貌似也行 笔试的时候可以试试
#include <bits/stdc+... | true |
f3812f9bff83e5b08ca319a63964a4ba29c337d8 | C++ | piotrek-szczygiel/cpp | /lab6/main.cpp | UTF-8 | 2,544 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include "Person.h"
#include "Random.h"
int main() {
random_seed();
const int size = 5;
std::vector<Person> v_people;
std::set<Person> s_people;
std::map<std::string, Person> m_people;
for (int i = 0; i < ... | true |
641ff831f6c55d1634c2381bd1499467f9572a81 | C++ | mariokonrad/marnav | /include/marnav/nmea/zdl.hpp | UTF-8 | 1,661 | 3.140625 | 3 | [
"BSD-3-Clause",
"BSD-4-Clause"
] | permissive | #ifndef MARNAV_NMEA_ZDL_HPP
#define MARNAV_NMEA_ZDL_HPP
#include <marnav/nmea/sentence.hpp>
#include <marnav/nmea/time.hpp>
#include <marnav/units/units.hpp>
#include <optional>
namespace marnav::nmea
{
/// @brief ZDL - Time and Distance to Variable Point
///
/// @code
/// 1 2 3
/// | ... | true |
9c035692413a08f9e4440dd8aa56eb7665094759 | C++ | seanemo/arcadesystem | /GUI_files/headers/OptionsButton.h | UTF-8 | 1,920 | 3.21875 | 3 | [] | no_license |
// OptionsButton.h
// This is a specific type of button
// Abstractly, the OptionsButton class is a way to customize the screen view
// The main purpose of the OptionsButton is customizability
#ifndef OPTIONS_BUTTON_H
#define OPTIONS_BUTTON_H
#include "Button.h"
class OptionsButton : public Button
{
public:
// o... | true |
3b295cbdea91463fef2ded00303ba216882b5ca5 | C++ | coding-blocks-archives/vmc-codingblocks-2017 | /17-11-29/twoDFunc.cpp | UTF-8 | 234 | 2.53125 | 3 | [] | no_license | // Deepak Aggarwal, Coding Blocks
// deepak@codingblocks.com
#include <iostream>
using namespace std;
void display(int arr[100][10], int nr, int nc){
}
int main() {
int arr[10][10];
int nr, nc;
cin >> nr >> nc;
display(arr, nr, nc);
} | true |
6d773882bc1cbee85ec06ee12b93461733879e55 | C++ | toblich/UDrive | /include/server.h | UTF-8 | 2,922 | 2.625 | 3 | [] | no_license | #ifndef SERVER_H_
#define SERVER_H_
#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <fstream>
#include <stdexcept>
#include "logger.h"
#include "profile.h"
#include "session.h"
#include "metadata.h"
#include "folder.h"
#include "file.h"
#include "mongoose.h"
#include "bd.h"
#include "pa... | true |
5ca9682dbf08350e5711cc88d3b16a86b5a3012a | C++ | diziqian/tinyBind | /tinytest.cpp | UTF-8 | 3,474 | 2.765625 | 3 | [] | no_license | #include "tinybind.cpp"
#include <stdio.h>
#include <vector>
#include <list>
struct MyData
{
int i;
double d;
char const * s;
std::vector<int> vec;
int iref;
void setIntvalue( int in ) {
i = in;
}
int intvalue() {
return i;
}
int & getIRef() {
return iref;
}
};
TiXmlBinding<MyDa... | true |
1304a45db34974c9fe9d84e1a73959a1d333f7dc | C++ | jramosss/Codeforces | /122A-LuckyDivision/luckydivision.cpp | UTF-8 | 1,668 | 4.1875 | 4 | [] | no_license | /*
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose
decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4
are lucky and 5, 17, 467 are not.
Petya calls a number almost lucky if it could be evenly divided by some lucky number.
Help him... | true |
eeb0f24c64629abc6c3637831a489256d265a012 | C++ | theVelislavKolesnichenko/CPlusPlusOOP | /Overloading/Point.cpp | UTF-8 | 800 | 3.5625 | 4 | [] | no_license | #include "Point.h"
Point::Point()
{
num_x = Num();
num_y = Num();
}
Point::Point(Num x, Num y)
{
num_x = x;
num_y = y;
}
Num Point::get_x()
{
return num_x;
}
Num Point::get_y()
{
return num_y;
}
Point Point::operator++()
{
this->num_x = Num(this->num_x.getNum() + 1);
this->num_y ... | true |
f19391c159e15d27f77f7f2dd98884e8163c6f4c | C++ | diogoesnog/MIEI | /3rd Year/2nd Semester/Computação Gráfica/Aulas/Aula 2/main.cpp | UTF-8 | 2,555 | 3.03125 | 3 | [] | no_license | // Aula 2
#include <GL/glut.h>
#include <math.h>
void changeSize(int w, int h) {
// Prevent a divide by zero, when window is too short
// (you cant make a window with zero width).
if(h == 0)
h = 1;
// compute window's aspect ratio
float ratio = w * 1.0 / h;
// Set the projection matrix as current
glMatri... | true |
37b1d1dcf71e645a2278ad7e7b104fa8414fc6da | C++ | yuan-luo/Leetcode-2 | /Leetcode/字符串/0005_longestPalindrome.cpp | UTF-8 | 2,157 | 3.546875 | 4 | [] | no_license | // https://leetcode-cn.com/problems/longest-palindromic-substring/
#include <string>
#include <iostream>
using namespace std;
int is_Palindrome(const string &s, int &left, int right)
{
while (left >=0 && right < s.size() && s[left] == s[right]) {
left--;
right++;
}
// [left, right... | true |