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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2101cac27376828737ecc61cc306e05424810cd7 | C++ | minecraburn/cs144- | /cs144/libsponge/network_interface.cc | UTF-8 | 6,303 | 2.59375 | 3 | [] | no_license | #include "network_interface.hh"
#include "arp_message.hh"
#include "ethernet_frame.hh"
#include <iostream>
// Dummy implementation of a network interface
// Translates from {IP datagram, next hop address} to link-layer frame, and from link-layer frame to IP datagram
// For Lab 5, please replace with a real implemen... | true |
fd09c0d0f2f1cd2254c5d38a53b1c4e9e9553586 | C++ | Lincoln12w/OJs | /PAT/C_C++_Java/Loop-06.cpp | UTF-8 | 294 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
using std::string;
using std::istringstream;
int main()
{
string s;
string word;
int cnt = 0;
getline(std::cin, s);
istringstream iss(s);
while(iss >> word)
cnt++;
std::cout << cnt;
return 0;
}
| true |
2a5377b8f157f761d6bed241df3cf6b4b9e443eb | C++ | thuleqaid/boost_study | /filesystem/src/fs-utility.cpp | UTF-8 | 1,775 | 2.9375 | 3 | [
"MIT"
] | permissive | #include "fs-utility.hpp"
#include <cstdlib>
void makedirs(const bfs::path& inpath)
{
/* path must exist for bfs::canonical(path) */
bfs::path fpath=bfs::absolute(inpath);
if (!bfs::is_directory(inpath))
{
bfs::path cur;
for(auto item=fpath.begin();item!=fpath.end();++item)
{
/* concatenation */
cur/=*i... | true |
a253c48674cb04b66a81e7b2cc94a0ef3ea28859 | C++ | dipta007/Competitive-Programming | /@DOC by DIPTA/dipta007_final/String/tokenizer.cpp | UTF-8 | 421 | 2.859375 | 3 | [
"MIT"
] | permissive | int main ()
{
char str[] ="- This, a sample string.";
char * pch;
// by which charcters string is tokenized that should be given into "(here)"
pch = strtok (str," ,.-");
while (pch != NULL)
{
printf ("%s\n",pch);
// by which charcters string is tokenized that should be given into... | true |
bdc67e6a2ac41c483b8a40cabc7664b782378a4f | C++ | virenvarma007/Data-Structures-and-Algorithms | /Sherlock and Numbers.cpp | UTF-8 | 738 | 2.5625 | 3 | [] | no_license | #include <iostream>
using namespace std;
long long int binarySearch(long long int low, long long int high, long long int key, long long int a[]){
int mid;
while(low<=high){
mid=(low+high)/2;
if(a[mid]<key){
high=mid-1;
}
else if(a[mid]>key){
low=mid+1;
}
else{
return mid;
}
}
return -1;
}
i... | true |
d8c5618dd47a2d2635bab48da7d26e1779615e12 | C++ | kimdy003/AlgorithmStudy | /Study/8_week/6_11437.cpp | UTF-8 | 1,392 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <vector>
const int Level = 18;
const int MAX = 50001;
using namespace std;
int n;
int depth[MAX];
int ac[MAX][20];
vector<int> graph[MAX];
void Make_Tree(int cur, int parent){
depth[cur] = depth[parent]+1;
ac[cur][0] = parent;
for(int i=1; i<=Level; i++){
int pp = ac... | true |
a4e3f7b6f4e76bf5ef2d1f75d52991910f56deac | C++ | alexandraback/datacollection | /solutions_5744014401732608_1/C++/gridnevvvit/main.cpp | UTF-8 | 1,059 | 2.546875 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <vector>
typedef long long li;
using namespace std;
inline void solve(int test) {
int n;
li m;
cin >> n >> m;
vector < li > d(n);
vector < vector < int > > ans(n, vector < int > (n, 0));
d[n - 1] = 1;
for(int i = n - 2; i >= 0; i--) {
... | true |
716eb6574112f9c8339d6aa53747a3f97083a522 | C++ | asucato2/datastructures | /include/DataStructures/RBTree.hpp | UTF-8 | 16,007 | 3.390625 | 3 | [
"MIT"
] | permissive | //
// Created by ansucato on 11/11/19.
//
#ifndef DATASTRUCTURES_RBTREE_HPP
#define DATASTRUCTURES_RBTREE_HPP
#include <iostream>
#include <list>
#include <vector>
namespace DataStructures
{
template<typename keyType, typename valueType>
class RBTree
{
public:
RBTree();
RBTree(const keyType *t_key, c... | true |
a4f2d6bff890a40f3517e9aca8ec5f8aea578823 | C++ | Sparrow-hawks/C-Primer-Plus-Exercises | /Chapter9/golf.cpp | UTF-8 | 755 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include "golf.h"
bool setgolf(Golf& g, const char *name, int hc) {
if (name != nullptr && strlen(name) != 0) {
strncpy(g.fullname, name, Len - 1);
g.handicap = hc;
return true;
} else {
return false;
}
}
bool setgolf(Golf& g) {
std::cout << "Enter Playe... | true |
992624bef242bc0ba90ee5b6055d26470cd87ef0 | C++ | Anujith123/s2lab4 | /lab4.2.cpp | UTF-8 | 7,608 | 4.09375 | 4 | [] | no_license | //Program to implement queue using 2 stacks
// including library
#include<iostream>
//using namespace
using namespace std;
// class
class Node
{
public:
//storing data
int data;
//pointer to move to next node
Node* next;
//initializing next poin... | true |
aeaf95353d8a01cf0e0e1409cd62935ef3d57807 | C++ | Ashish-012/Ds-Algo | /Linked-list/linked-list-recursive-printing.cpp | UTF-8 | 877 | 4.03125 | 4 | [] | no_license | // Printing the linked list using recursion
#include<iostream>
#include<conio.h>
#include<stdlib.h>
struct node{
int data;
struct node* next;
};
node* head;
void print(node* temp){
if(temp==NULL) return;
printf("%d ",temp->data);
print(temp->next);
}
void printrev(node* temp){
if(temp==NU... | true |
d5617378e9a911d92f97a1953672b163e5e27cf0 | C++ | lmatsuki/LEM-Engine | /LEM Engine/src/Message.h | UTF-8 | 416 | 2.84375 | 3 | [] | no_license | #pragma once
#include <string>
#include <ctime>
#include "MessageType.h"
// The default message struct used by the MessageBus.
struct Message
{
Message() : type(MessageType::Console), consoleMessage("") {}
Message(const MessageType type, const std::string & consoleMessage) : type(type), consoleMessage(consoleMessag... | true |
24dd79e326ec6b3298bae7fb2d0f039527ab3285 | C++ | anjali9811/Programming-in-Cpp | /BaseMemberMethodusingObjectAsArg.cpp | UTF-8 | 463 | 3.578125 | 4 | [
"Apache-2.0"
] | permissive | #include<iostream>
using namespace std;
class Person {
public:
void getname() {
cout<<"Hi I am Anish"<<endl;
}
};
//we can access the public members of a class in any other function defined which takes a var of that class type as argument
//or which takes a object of that class as argument
void printName... | true |
696c1bc36a6d33144efe62d5d25a3b11e0eec304 | C++ | kirikiko5/Telesilla | /Telesilla/ColaGondola.cpp | UTF-8 | 1,735 | 3.21875 | 3 | [] | no_license | //
// gondola.cpp
// Telesilla
//
// Created by Enrique on 30/10/15.
// Copyright © 2015 Enrique. All rights reserved.
//
#include "Gondola.h"
#include "ColaGondola.h"
#include <stdio.h>
#include <iostream>
#define MAX 5
using namespace std;
//
/*colaGondola::~colaGondola(){
while (primero) desencolar();
... | true |
8110d4664f0f3e115df10a9bf791b50c7d0945fb | C++ | jrs023/ProjectEuler | /C++/project07.cpp | UTF-8 | 415 | 3.3125 | 3 | [] | no_license | //ProjectEuler Number 7
//by Josh Smith
#include <iostream>
using namespace std;
bool isPrime(size_t n){
if(n < 0){
cout << "n must be larger than zero" << endl;
return false;
}
for(int i = 2; i < sqrt(n)+1; i++){
if(n%i == 0){
return false;
}
}
return true;
}
int main() {
size_t i = 0;
size_t x =... | true |
72562135b26a44d0916dbb7d7376f0e77d86e373 | C++ | Petrosz007/uni | /2_félév/objektum_elvű_programozás/előadás/shapes/shapes.h | UTF-8 | 3,709 | 3.265625 | 3 | [] | no_license | //Athor: Gregorics Tibor
//Date: 2017.12.15.
//Title: classes of different shapes
#pragma once
#include "area.h"
// class of abstract shapes
class Shape
{
public:
virtual ~Shape();
virtual double volume() const = 0;
static int piece() { return _piece; }
protected:
Shape(double size);
do... | true |
19bcea45716861d5334a1b8da201356ba1a137b1 | C++ | nievesnu/ED | /DOMJUDGE/Ejercicio 53/ListaIntercambia.h | ISO-8859-2 | 881 | 2.84375 | 3 | [] | no_license | //lvaro Miguel Rodrguez Mateos
//A63
#ifndef ListaIntercambia_h
#define ListaIntercambia_h
#include <iostream>
#include "queue_eda.h"
template <class T>
class ListaIntercambia : public queue<T> {
using Nodo = typename queue<T>::Nodo;
public:
void intercambia() {
Nodo* actual = this->prim, * aux = nullptr;
in... | true |
bfc1ccbbf85b9cd2ecfc9fdd175e9b1412cb3eb0 | C++ | zahidabasher/leapfrog-triejoin | /src/globalFunctions/globalFunctions.h | UTF-8 | 1,774 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | /*******************************************************************
Database Systems Implementation Exam 2013
Copyright 2013 - Candidate Number 152051 - , University of Oxford
*******************************************************************/
#ifndef GLOBAL_FUNCTIONS_H
#define GLOBAL_FUNCTIONS_H
#include <sstream... | true |
ed3180b1f57ee9baf955b3056e2eb29bc78162db | C++ | UltiXstorm/TowerForce | /src/sfml/Message.cpp | UTF-8 | 1,940 | 3.078125 | 3 | [] | no_license | #include "Message.h"
////////////////////////////////////////////////////////////////////////////////////////
// Constructeurs et Destructeur //
////////////////////////////////////////////////////////////////////////////////////////
Message::Message() {
}
Messag... | true |
94dca5f77348d5e57af8079795ebcf7555b3809e | C++ | SachinMeier/Contacts | /main.cpp | UTF-8 | 8,588 | 2.8125 | 3 | [] | no_license | #include "main.h"
#include <functional>
const int TESTS = 10;
bool runTests(int);
int main(int argc, const char * argv[]){
People ppl;
ppl.read("tests/test.fcc", false);
cout << ppl.size() << endl;
ppl.print();
// int passed = 0, failed = 0, taken = TESTS;
// string fails = "";
// if(argc ==... | true |
0f14fb65b0f08705bdc457267e5f7c7ae2fa1f38 | C++ | tangsancai/algorithm | /PAT-A/1067. Sort with Swap.cpp | UTF-8 | 577 | 2.53125 | 3 | [] | no_license | #include<stdio.h>
#include<algorithm>
using namespace std;
int num[100005];
int main()
{
int N;
int tag=1;
int step=0;
int number=0;
scanf("%d",&N);
for(int i=0;i<N;i++)
{
scanf("%d",&num[i]);
if(num[i]==i)
number++;
}
while(number!=N)
{
if(num[0]==0)
{
for(int i=tag;i<N... | true |
db276831ad10ecc3320eae6c9e33aaa9db4859d0 | C++ | JPTIZ/fuzzytruck | /tools/socket/test.cpp | UTF-8 | 813 | 2.8125 | 3 | [] | no_license | #include "socket.h"
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std::string_literals;
auto parse_args(int argc, char* _argv[]) {
auto args = std::map{
std::pair
{"host"s, std::string(_argv[1])},
{"port"s, std::string(_argv[2])},
};
retur... | true |
00cefe56a32ca56b45d4e8da2c95a0443092c919 | C++ | Phytolizer/vktut | /Include/vktut/vulkan/instance.hpp | UTF-8 | 2,695 | 3 | 3 | [] | no_license | #pragma once
#include <array>
#include <iostream>
#include <string>
#include <string_view>
#include <vector>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
namespace vktut::vulkan
{
struct instance
{
private:
VkInstance m_handle;
public:
template<std::size_t N>
instance(const std::string& application_nam... | true |
69375ad73ba771241da2c8fd28312faafed3448a | C++ | eyhl/issm | /trunk/src/c/classes/Contours.h | UTF-8 | 1,097 | 3.015625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | /*!\brief Declaration of Contours class.
*/
#ifndef _CONTAINER_CONTOURS_H_
#define _CONTAINER_CONTOURS_H_
#include "../datastructures/datastructures.h"
#include "./Contour.h"
class Contours: public DataSet{
public:
/*constructors, destructors*/
Contours();
~Contours();
};
/*Methods that relate to datase... | true |
7022b343b206e81626d1b5037e0ca944eb453849 | C++ | wangshiy/cc | /Generate_Pascal_Triangle.cpp | UTF-8 | 1,096 | 3.9375 | 4 | [] | no_license | /*
Problem:
**********************************************************************************
*
* Given numRows, generate the first numRows of Pascal's triangle.
*
* For example, given numRows = 5,
* Return
*
* [
* [1],
* [1,1],
* [1,2,1],
* [1,3,3,1],
* [1,4,6,4,1]
* ]
*
*
*********... | true |
d12dc95533e6c89d9bb2dc4d6f6e68d55e3d64d1 | C++ | ChenFan1995/C-Programming-1 | /Assignments/week8/q5.cpp | UTF-8 | 257 | 2.59375 | 3 | [] | no_license | #include <iostream>
using namespace std;
#include <iomanip>
int main(){
int n,i;
cin >> n;
int a,b;
i = 10;
while (i<n){
a = i / 10;
b = i % 10;
if (i % (a+b) == 0) cout << i << endl;
i = i + 1;
}
} | true |
4429b694a79e7b415a6d619c66312cbc07840138 | C++ | Manasvi070902/Problem-Solving | /magicsquare.cpp | UTF-8 | 1,272 | 2.921875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
// Complete the formingMagicSquare function below.
int formingMagicSquare(vector<vector<int>> s) {
int d[8][3][3]={
{{8,1,6},{3,5,7},{4,9,2}},
{{6,1,8},{7,5,3},{2,9,4}},
{{4,9,2},{3,5,7},{8,1,6}},
{{2,9,4},{7,5,3},{6,1,8}},
{{8,... | true |
27e738ca13ad9c38de36d19038a5c592b9501bbc | C++ | colinhp/WangdaoCPP | /20170731/work/queue.cc | UTF-8 | 3,109 | 3.5625 | 4 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
template <typename T>
class Queue
{
public:
Queue(int size = 10)
:_front(0)
,_back(0)
,_maxSize(size + 1)
,_qu(new T[size + 1]())
{}
~Queue()
{
if(_qu != NULL)
{
delete [] _qu... | true |
741f2b5140c9a11a6d6a80de0850bb50116d8674 | C++ | PolandBall133/SprotxEngine | /include/game/example_fun/snake/snake.hpp | UTF-8 | 726 | 2.671875 | 3 | [] | no_license | #pragma once
#include <vector>
#include "game_core/helpers/mapping_keyboard_handler.hpp"
#include "limiter.hpp"
enum class Way{
none,
up = 1, down = -1,
left = 2, right = -2
};
class Snake{
public:
using BodySegment = struct{ int x, y; };
using Body = std::vector<BodySegment>;
public:
Sna... | true |
f14bf133720ab6baf11c6ee5d8edf33f5f413920 | C++ | hogdahl/udptcp | /udptcp/src/UdpSocket.h | UTF-8 | 1,245 | 2.859375 | 3 | [] | no_license | /*
* UdpSocket.h
*
* Created on: Sep 5, 2013
* Author: johan
*/
#ifndef UDPSOCKET_H_
#define UDPSOCKET_H_
#include <netdb.h>
#include "FdList.h"
#include "Buffer.h"
class UdpSocket: public FdList {
public:
struct sockaddr_in si_from;
struct sockaddr_in si_to;
int _som;
int _eom;
Buffer buf... | true |
ba51a569d2665cf5c151ff0727c0873d46023492 | C++ | Seanb19/BrainGrid | /DynamicSpikingSynapse.cpp | UTF-8 | 9,549 | 2.734375 | 3 | [] | no_license | /**
** \file DynamicSpikingSynapse.cpp
**
** \authors Allan Ortiz & Cory Mayberry
**
** \brief A dynamic spiking synapse (Makram et al (1998))
**/
#include "DynamicSpikingSynapse.h"
/**
* Create a synapse and initialize all internal state vars according to the synapse type.
* @post The synapse is setup accor... | true |
81e7a3feece2cfbefb3362f67bfbcb72e815b3ef | C++ | okalitova/RayTracing | /scene/Screen.h | UTF-8 | 1,552 | 2.9375 | 3 | [] | no_license | //
// Created by okalitova on 16.04.16.
//
#ifndef RAYTRACING_SCREEN_H
#define RAYTRACING_SCREEN_H
#include "../geometry/Geometry.h"
class Screen {
public:
int getHeight() const {
return height;
}
void setHeight(int height) {
Screen::height = height;
}
int getWidth() const {
... | true |
e194e62d591b4e0936338d57d684f33ce6f4f211 | C++ | ahmedelsaie/AlgorithmsProblems | /UVA/1350 - Pinary.cpp | UTF-8 | 1,227 | 2.640625 | 3 | [] | no_license | #include <stdio.h>
#include <cstring>
#define MAX 38
long long fn(int curr, int before);
void trace(int with_me, int curr, int before);
int get_start();
long long dp[MAX + 5][2];
int x, cases, first;;
int main()
{
memset(dp, -1, sizeof(dp));
fn(MAX, 0);
scanf("%d", &cases);
while(cases--)
{
... | true |
712b7fe41dd3f935975d6eb3c84e7da6a2d53463 | C++ | touyou/CompetitiveProgramming | /aoj/1074.cpp | UTF-8 | 1,004 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef pair<int, string> P;
bool comp(const P& a, const P& b) {
if (a.first!=b.first) return a.first<b.first;
return a.second<b.second;
}
int main() {
int n;
while (scanf("%d",&n)) {
... | true |
9345aad264c11ce941494ef4c52988c638cd9bf8 | C++ | JimmyDdotEXE/jpl | /src/value/Equation.cpp | UTF-8 | 230 | 2.71875 | 3 | [
"MIT"
] | permissive | #include "value/Equation.h"
Equation::Equation(oper o, Num *l, Num *r){
op = o;
lhs = l;
rhs = r;
}
oper Equation::getOp(){
return op;
}
Num *Equation::getLeft(){
return lhs;
}
Num *Equation::getRight(){
return rhs;
}
| true |
a9b4e702de7a310cd81e57338daf3ac3791461d4 | C++ | CabernetSauvignon/OpenGL_3DScene | /main.cpp | WINDOWS-1251 | 4,605 | 2.515625 | 3 | [] | no_license | #pragma comment(lib, "glfw3.lib")
#pragma comment(lib, "opengl32.lib")
#include "glad/glad.h"
#include "GLFW/glfw3.h"
#include <iostream>
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"
#include "Scene.h"
#include "Camera.h"
#include "Projection.h"
//#include <windows.h... | true |
f1a44682993153a05dfd9daf9a55fa3a090cb82a | C++ | akademi4eg/distri-net | /src/IDataReader.h | UTF-8 | 736 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <memory>
#include <vector>
typedef std::vector<double> DataEntry;
struct SDataKey
{
SDataKey(const std::string& fname = std::string(), uintmax_t idx = 0) : sSource(fname), iIndex(idx) {};
std::string toString() const {
return sSource + "\n" + std::to_string(iIndex);
};
std::string toPrett... | true |
209926d237b9e4ade7c12723c925f2207a3b29c3 | C++ | DKU-STUDY/Algorithm | /BOJ/2644.촌수계산/6047198844.cpp | UTF-8 | 763 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector <int> vt[101];
bool check[101];
int bfs(int x, int y) {
queue <int> q;
q.push(x);
check[x] = true;
int cnt = 0;
int q_size;
while (!q.empty()) {
q_size = q.size();
while (q_size--) {
int point = q.front();
q.pop();
... | true |
3092f744224a3c9eda8ff2023105302bbd303951 | C++ | FannyGallais/Projet_3BiM | /gyllenberg.cpp | UTF-8 | 2,939 | 3.25 | 3 | [] | no_license | /*
-------------------------------------------------------------------------------------------------------------
Gyllenberg-Webb
-------------------------------------------------------------------------------------------------------------
dpc = [b - ro(tc)]*pc + ri(tc)*qc
dqc = ro(tc)*pc - [ri(tc) + mu]*qc
tc = pc + q... | true |
2c614e9ebff314eae94a92f4f98edd85a2ec7dda | C++ | bloodMaster/ProducerConsumer | /ProducersConsumers/consumer.cpp | UTF-8 | 986 | 2.625 | 3 | [
"MIT"
] | permissive | //
//
// user define
#include "consumer.hpp"
#include "utilities.hpp"
//standard
namespace antel
{
// init static members
std::mutex consumer::m_mutex;
void consumer::deploy()
{
while (m_consumers_should_work) {
std::unique_lock<std::mutex> lock(m_mutex);
if ( m_con... | true |
c5470f5508d7687ff1a8872473202ca1168b8803 | C++ | ntomitov/IOTrainingCamp | /Basics/fibonaci.cpp | UTF-8 | 459 | 3.421875 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int MAX_SIZE = 200;
int fib(int);
int fibIterative(int);
int main() {
cout << fibIterative(100) << endl;
system("pause");
}
int fib(int n) {
if (n < 3) {
return 1;
}
return fib(n - 1) + fib(n - 2);
}
int fibIterative(int n) {
if (n < 2) {
return 1;
}
int ... | true |
56c89c5c34cd506347eb50f7e3f8652bd1fce193 | C++ | northWindPA/cpp_modules | /Module_04/ex01/AWeapon.cpp | UTF-8 | 607 | 3.296875 | 3 | [] | no_license | #include "AWeapon.hpp"
AWeapon::AWeapon(std::string const & name, int apcost, int damage)
: _name(name), _ap_cost(apcost), _damage(damage)
{}
AWeapon::~AWeapon()
{
std::cout << _name << " weapon destroyed" << std::endl;
}
AWeapon::AWeapon(AWeapon const ©)
{
*this = copy;
}
AWeapon &AWeapon::operator = (const ... | true |
bcc65a41baa1a70c0b3bb94305aa2e41a5c54854 | C++ | Chirag-tech/Learning-sprint | /2.cpp | UTF-8 | 753 | 2.890625 | 3 | [] | no_license | //question:Coins And Triangle
#include <iostream>
#include <vector>
#define ll long long
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
ll first = 1;
ll last = n;
ll ans = 0;
while (first != last - 1)
{
... | true |
fea688328f6a60ff83d07f652b977fc4f5d00c57 | C++ | 15831944/ZaoQiBu | /ZaoQiBu/Course.h | UTF-8 | 1,575 | 3.21875 | 3 | [] | no_license | #pragma once
#include <vector>
#include "Chapter.h"
#include "tstring.h"
class PlayRecord
{
public:
void SetLastPlayChapterIndex(int lastPlayChapterIndex)
{
m_lastPlayChapterIndex = lastPlayChapterIndex;
}
int GetLastPlayChapterIndex() const
{
return m_lastPlayChapterIndex;
}
void SetLastPlayChapterTime(i... | true |
a3c23b05c158bf919ae32832beb917ed481232d5 | C++ | elanahelou/ASTE499-HW7 | /Vec.h | UTF-8 | 1,309 | 3.25 | 3 | [] | no_license | //
// Vec.h
// ASTE499 HW7 Part1
//
// Created by Elana Helou on 3/9/21.
//
#ifndef Vec_h
#define Vec_h
#include <ostream>
#include <math.h>
template<typename T>
class _vec3{ // generic 3D vector of type T
public:
_vec3<T>(): d{0,0,0} {}
_vec3<T>(T a, T b, T c): d{a,b,c} {}
T& o... | true |
dc619ce5d5e74b7b356253d2ec3c4bf1c4d3cfc4 | C++ | RobotLocomotion/drake | /common/symbolic/codegen.cc | UTF-8 | 9,675 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | #include "drake/common/symbolic/codegen.h"
#include <sstream>
#include <stdexcept>
#include <fmt/format.h>
namespace drake {
namespace symbolic {
using std::ostream;
using std::ostringstream;
using std::runtime_error;
using std::string;
using std::to_string;
using std::vector;
CodeGenVisitor::CodeGenVisitor(const ... | true |
88cf9d4e67db73ea298a456e789921bedf0977dd | C++ | elrinor/cmc-cg | /2006 - Task4 {19 of 24} [m]/src/Vector.cpp | UTF-8 | 1,808 | 3.28125 | 3 | [
"MIT"
] | permissive | #include "vector.h"
CVector::CVector()
{
v[0] = 0;
v[1] = 0;
v[2] = 0;
}
CVector::CVector(CVector &vec)
{
v[0] = vec.v[0];
v[1] = vec.v[1];
v[2] = vec.v[2];
}
CVector::CVector(float x, float y, float z)
{
v[0] = x;
v[1] = y;
v[2] = z;
}
CVector& CVector::operator=(CVector &vec)
{
... | true |
c7013cbea297b15a88047947fc3e89975d56ee10 | C++ | somewhatlurker/SlidA | /src/SlidA/debugTimer.cpp | UTF-8 | 476 | 2.671875 | 3 | [
"MIT"
] | permissive | #include "debugTimer.h"
void debugTimer::reset() {
lastMicros = 0;
minMicros = (unsigned long)-1; // equal to max value
maxMicros = 0;
totalMicros = 0;
nSamples = 0;
}
void debugTimer::log() {
if (lastMicros == 0) {
lastMicros = micros();
}
else {
unsigned long t = micros() - lastMicros;
l... | true |
b488feec96d3b38c0571fc95cdf2e414a0fd2dad | C++ | minhdatplus/amibroker-plugin | /CB180080-SOICT-BKHN/Utils.cpp | UTF-8 | 2,037 | 2.546875 | 3 | [] | no_license | #include "pch.h"
#include "Utils.h"
#include <string>
#include <codecvt>
HRESULT Utils::OLEMethod(int nType, VARIANT* pvResult, IDispatch* pDisp, LPOLESTR ptName, int cArgs ...)
{
if (!pDisp) return E_FAIL;
va_list marker;
va_start(marker, cArgs);
DISPPARAMS dp = { NULL, N... | true |
ed6b3cf89f2d9fc6f60bb583578c0112a4f2f373 | C++ | SatyamJindal/Competitive-Programming | /CodeChef/TRIMETER.cpp | UTF-8 | 1,071 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int dfs(int node,vector<int> g[],int level[],int vis[])
{
vis[node]=1;
for(auto i:g[node])
{
if(!vis[i])
{
level[i] = level[node]+1;
dfs(i,g,level,vis);
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
int n;
cin>>n;
vector<int> g[n+5];
int level[... | true |
217d2cb2852d233590cdeac9aa5c5fc7ec134e05 | C++ | Lecureur-Arthur/Apprendre_Cpp | /15--Fonction_virtuelle_polymorphisme/catalogue.cpp | UTF-8 | 767 | 3.375 | 3 | [] | no_license | #include "catalogue.h"
#include <iostream>
using namespace std;
//Constructeur catalogue
catalogue::catalogue(const int _nbBarres):nbBarres(_nbBarres)
{
lesBarres = new Barre *[nbBarres];
index = 0;
}
//Destructeur catalogue
catalogue::~catalogue()
{
delete[] lesBarres;
}
//Peremet d'ajouter un barre gr... | true |
760526043f0d2e0c2cec6dcf1788f301cc204c2f | C++ | blockspacer/phd | /benchmarks/optional/source/references.transparent.cpp | UTF-8 | 3,881 | 2.546875 | 3 | [] | no_license | // Copyright � 2018-2020 ThePhD
#include "ensure.hpp"
#include "data.hpp"
#include "stats.hpp"
#include "optional.hpp"
#include "bench.hpp"
#include <benchmark/benchmark.h>
#include <barrier/barrier.hpp>
#include <algorithm>
#include <numeric>
#include <random>
static void int_by_ref_transparent_succ... | true |
53b7d651b9ead17b76315b1f7fbc99b3932be74d | C++ | kunhuicho/crawl-tools | /codecrawler/_code/hdu5051/12360196.cpp | UTF-8 | 1,000 | 2.609375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <iostream>
#include<string>
#include<sstream>
using namespace std;
int test,n,b,q;
double L,R,del;
string i2s(int x)
{
string y;
stringstream f;
f << x; f >> y;
return y;
}
bool check()
{
string sn,sb;
sn=i2s(n); sb=i2s(b);
for (int i=0; i<sn.le... | true |
c7488b4f8283d1dcdabfab58602fdb7533684d48 | C++ | 17326867021/ccf | /第一题/201512-1.cpp | UTF-8 | 176 | 2.6875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
long long n, sum = 0;
cin >> n;
while(n){
sum += n%10;
n /= 10;
}
cout << sum << endl;
return 0;
}
| true |
b8fe53d0162c21c0ba176731f7b8b4a5b95ee7b7 | C++ | RedSkiesIO/catalyst-network-simulation | /c++/scheduler.cpp | UTF-8 | 929 | 3.15625 | 3 | [] | no_license | #include "scheduler.h"
#include <iostream>
using simulation::scheduler;
void scheduler::run () {
while (! event_queue.empty () && !exit_called) {
event * next_event = event_queue.top ();
event_queue.pop ();
time = next_event->time;
next_event->process_event ();
delete next_event;
}
}
v... | true |
f04493496603dec4366bd483ad9d03be0a5cac99 | C++ | AhmetMelihIslam/crynn | /src/Core/Transform.h | UTF-8 | 3,365 | 3.09375 | 3 | [
"MIT"
] | permissive | #pragma once
#include "glm/glm.hpp"
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>
#include <iostream>
#include <memory>
#include <unordered_set>
#include "Math/Math.h"
#include <memory>
namespace crynn
{
/// <summary>
/// Matrix representation with easy functions to transform it.
/// T... | true |
430575f63653e66a13dec447b181ffb1a444a4c8 | C++ | starsnow/tuyaSmartLED | /tyCube2812/cube2812.cpp | UTF-8 | 5,546 | 2.78125 | 3 | [] | no_license | // cube2812.cpp
// Created by seesea 2021-07-07
// 2812 立方体的实现文件
#include <arduino.h>
#include "cube2812.h"
#include "rainbowMode.h"
#include "colourfulDreamMode.h"
#include "starSkyMode.h"
#include "rainMode.h"
#include "hackerMatrixMode.h"
#include "bubbleMode.h"
#include "energyCubeMode.h"
#include "snowMode.h"
#in... | true |
2fa662b70b1b5907e3b9001856a24888acc81358 | C++ | geegatomar/Algorithms | /GraphAlgo/ShortestPaths/floyd_warshall.cpp | UTF-8 | 1,081 | 2.984375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define inf 1e7
int n, m;
vector<vector<int>> g;
void floyd()
{
// taking each vertex as intermediate each time
for(int intr = 0; intr < n; intr++)
{
for(int u = 0; u < n; u++)
{
for(int v = 0; v < n; v++)
{
if(u == intr || v == intr || u == v)
contin... | true |
28f0c4aa4c37cddf8fc47dfefb96fc36add9e84d | C++ | newmri/API | /WarmmingUPLast/WarmmingUPLast/Question3.cpp | UTF-8 | 904 | 3.1875 | 3 | [] | no_license | #include "Question3.h"
void Question3::GetSentence()
{
cout << "Input sentence: ";
cin.ignore();
getline(cin, m_sentence);
}
void Question3::ShowSentence()
{
cout << "You entered " << m_sentence << endl;
}
void Question3::ModifySentence()
{
string tempstr;
string resultstr;
int paddingnum{};
srand((unsign... | true |
2511f36bd6dff5026d56c81103a3c64c7adbcedf | C++ | houwenqi/Tool-program | /other-program/stringreplace.cpp | UTF-8 | 481 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main()
{
string a = "123%40qq.com";/////指定串,可根据要求替换
string b = "%40";////要查找的串,可根据要求替换
string c = "@";
int pos;
pos = a.find(b);////查找指定的串
while (pos != -1)
{
a.replace(pos,b.length(),c);////用新的串替换掉指定的串
pos = a.find(b);//////继续查找指定的串,直到所有的都找到... | true |
273be274de260f47e6c762ab622a35172f396876 | C++ | Yang-Pi/Pure-Cpp | /B-tasks/B3/task2.cpp | UTF-8 | 391 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include "factorial-container.hpp"
void task2()
{
FactorialContainer factorialCont;
std::copy(factorialCont.begin(), factorialCont.end(), std::ostream_iterator<size_t>(std::cout, " "));
std::cout << '\n';
std::reverse_copy(factorialCont.begin(), factorialCont.end(), ... | true |
0e80bfd981a4dfd0a6a3fa86a73b11801747ab76 | C++ | jayouimet/FirstMathEngine | /F4DVector3.h | UTF-8 | 1,582 | 2.921875 | 3 | [] | no_license | #pragma once
#include <iostream>
namespace F4DEngine {
class F4DVector3 {
private:
public:
// Directions
float x, y, z;
// Constructors
F4DVector3();
F4DVector3(float uX, float uY, float uZ);
// Destructor
~F4DVector3();
// Copying constructor
F4DVector3(... | true |
ac8968de336a00a922b33a9e6dbdcd832fa1e367 | C++ | lihuafeng108/string_vector_iterator_test | /string_vector_iterator_test.cpp | GB18030 | 1,051 | 3.96875 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(void)
{
string str1 = "string͵һЩ:"; //string C++ͣһֳ
string str2 = "piece1: one, ";
string str3 = "piece2: two, ";
string str4 = "piece1: one, ";
cout << str1 << endl;
cout << "str1 size:" << str1.size() << e... | true |
40d5c1ef7646220383adb30d3a0283df31a0a210 | C++ | babu-thomas/ds-algos | /dutch_national_flag.cpp | UTF-8 | 1,054 | 4.25 | 4 | [
"MIT"
] | permissive | // Given an array containing only 0’s, 1’s and 2’s, sort the array in linear time and using
// constant space.
// For example,
// Input - 1, 1, 0, 2, 0, 1
// Output - 0, 0, 1, 1, 1, 2
// 1. Count occurrences of 0, 1 and 2. Then put them in correct order. Time - O(N), Space - O(1).
// 2. Use three way partitioning. Tim... | true |
6c650bcd8bcb37b4da52097ad2ab868349f6915a | C++ | anagovitsyn/oss.FCL.sftools.dev.build | /imgtools/imglib/memmap/include/memmap.h | UTF-8 | 1,816 | 2.515625 | 3 | [] | no_license | /*
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.ecli... | true |
bd0db8c349013d0cb7759dbe2b8b19ef153f03f7 | C++ | HonestJack/acade-us | /project-cpp/src/Display.cpp | UTF-8 | 2,215 | 3.3125 | 3 | [] | no_license |
#include "Display.h"
Display::Display(/* args */)
{
}
Display::~Display()
{
}
void Display::print(char ch)
{
m_lcd.print(ch);
}
void Display::print(char string[])
{
m_lcd.print(string);
}
void Display::goto_display(unsigned char linha, unsigned char coluna)
{
if(linha == 2)
{
coluna |= 0x40;
}
m_l... | true |
18152947a885be8ee610e0b660743025435b4e97 | C++ | lm-chinhtran/atcoder | /src/love_golf.cpp | UTF-8 | 602 | 2.796875 | 3 | [] | no_license | //
// love_golf.cpp
// learningCplusplus
//
// Created by Tran Duc Chinh on 2020/04/04.
// Copyright © 2020 Tran Duc Chinh. All rights reserved.
//
#include <iostream>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define PI 3.14159265
int main(int argc, const ... | true |
82b938f62108060b3e3d6080dda95b283270a020 | C++ | gabriel-bri/ccufcqx | /3º semestre/Estruturas de dados avançada/atividades/bin_tree/mexendo_folhas_arvores/main.cpp | UTF-8 | 424 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "Tree.h"
using namespace std;
int main()
{
string line;
int value;
getline(cin, line);
cin >> value;
Tree bt(line);
cout << bt.count_leaves() << endl;
bt.delete_leaves();
bt.preorder();
cout << "\n";
bt.inorder();
cout << "\n";
... | true |
2f1bfefd2943cd015bde23f98f442b3ae797b6c5 | C++ | makbaranov/DependencyAnalyzer | /DependencyAnalyzer/DependencyNode.h | UTF-8 | 401 | 2.59375 | 3 | [] | no_license | #pragma once
#include <vector>
#include <string>
#include <memory>
class DependencyNode {
public:
DependencyNode(std::string name) {
name_ = name;
}
bool in_additional_dirs_ = false;
bool exist_ = false;
std::string name_;
std::string path_;
std::shared_ptr<DependencyNode> parent... | true |
dc7f5875354f8ac232eeb65a92829d6801792777 | C++ | Lenium37/SigLight | /src/core/lib/lightshow/channel.cpp | UTF-8 | 650 | 2.984375 | 3 | [] | no_license | //
// Created by Johannes on 05.05.2019.
//
#include "channel.h"
Channel::Channel(int channel) {
this->channel = channel;
}
Channel::~Channel() {
}
int Channel::get_channel() const {
return this->channel;
}
std::vector<ValueChange> Channel::get_value_changes() {
return this->value_changes;
}
void Channel::... | true |
896cb2be57370272d28a082f5f8c0ed84b8a1ef6 | C++ | cainiao22/lintcode-xcode | /lintcode-xcode/minimum-genetic-mutation.cpp | UTF-8 | 2,749 | 3.578125 | 4 | [] | no_license |
/**
1244. 最小基因变化
描述
基因序列可以用8个字符的字符串表示,可选择的字符包括 "A", "C", "G", "T"。
假设我们需要调查基因突变(从“起始点”到“结束点”突变),其中一个突变被定义为基因序列中的单个字符发生突变。
例如,"AACCGGTT" -> "AACCGGTA"是1个突变。
此外,还有一个给定的基因“库”,它记录了所有有效的基因突变。 基因必须在基因库中才有效。
现在,给出3个参数 - 起始点,结束点,基因库,你的任务是确定从“起始点”到“结束点”变异所需的最小突变数。 如果没有这样的突变,则返回-1。
假设起始点一定是合法的,它不一定在基因库中。
... | true |
d187f4819b285cd732fc6377b95e9e7e36642783 | C++ | AryansRathi/Algorithms-and-Data-Structure | /Hw11/Greedy.cpp | UTF-8 | 799 | 3.546875 | 4 | [] | no_license | #include <algorithm>
#include <iostream>
using namespace std;
struct Activity
{
int start, finish;
};
bool compare(Activity s1, Activity s2)
{
return (s1.finish < s2.finish);
}
void printMaxActivity(Activity arr[], int n)
{
sort(arr, arr + n, compare);
cout << "Selected activity" << endl... | true |
6c1af5ab8da069e1a8d66ba8a570f39dfaca424d | C++ | face4/yukicoder | /Level2/0306.cpp | UTF-8 | 263 | 2.53125 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
using namespace std;
typedef long double ld;
int main(){
ld xa, ya, xb, yb;
cin >> xa >> ya >> xb >> yb;
ld ans = xa * (yb-ya) / (xa+xb) + ya;
cout << fixed << setprecision(6) << ans << endl;
return 0;
} | true |
88f1975927ff9a98ac8ec9acafcde915adc98fc2 | C++ | githublizhipan/cppLearningNotes | /17.inherit_constructor.cpp | UTF-8 | 1,143 | 2.9375 | 3 | [] | no_license | /*************************************************************************
> File Name: 17.inherit_constructor.cpp
> Author: lizhipan
> Mail:
> Created Time: 2020年07月28日 星期二 19时55分36秒
************************************************************************/
#include <iostream>
#include <cstdio>
#include <cstdlib... | true |
0b8f6aa30a29bc23f323208d27e22624d2061f5c | C++ | Salimlou/Class-Work | /cs442/project.orig/project2/src/EntityQueue.cpp | UTF-8 | 1,875 | 2.9375 | 3 | [] | no_license | /****************************************************************************
Scott Harper, Tom Mancine, Ryan Scott
EntityQueue.cpp
The documentation within this file is sparse, and is only intended to provide
an overview of coding practices. For a more detailed description of
EntityQueue, see EntityQueue.h.
*****... | true |
45245aae4ed648101dc0450027ea29f9166bd259 | C++ | bugaevc/lets-write-sync-primitives | /src/condvar.h | UTF-8 | 445 | 2.71875 | 3 | [
"MIT"
] | permissive | #include <atomic>
#include <functional>
class Mutex;
class CondVar {
public:
CondVar(Mutex &mutex);
void wait();
void wait(std::function<bool()> condition);
void notify_one();
void notify_all();
private:
constexpr static uint32_t need_to_wake_one_bit = 1;
constexpr static uint32_t need_... | true |
137ddb8cd7ad732ca7bce7617b9ee4b1ce216a90 | C++ | ashwat-thama/Cpp_Programs | /cpp/for-tabel.cpp | UTF-8 | 216 | 2.828125 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
int main(){
int n,i;
int ans=0;
cout<<"ENTER THE NUMBER: ";
cin>>n;
for(i=1;i<=10;i++){
ans=i*n;
cout<<i<<"*"<<n<<": "<<ans<<"\n";
}
}
| true |
b420b92676d6c9cc130e461d1102e2f5d1a56234 | C++ | roddamatthew/uni | /2020/s1/oop/practical-02/function-1-3.cpp | UTF-8 | 872 | 3.5 | 4 | [] | no_license | #include <iostream>
void count_numbers(int array[4][4]){
int zeros=0;
int ones=0;
int twos=0;
int threes=0;
int fours=0;
int fives=0;
int sixes=0;
int sevens=0;
int eights=0;
int nines=0;
for(int i=0; i<4; i++){
for(int j=0; j<4; j++){
switch(array[i][j]){
case 0:
zeros++;
break;
case... | true |
a21f78c317600d5ba224f1ac13b649241e4faa0b | C++ | IRLSCU/QtController | /GpsBufferConsumeRunThread.cpp | UTF-8 | 2,231 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #include "GpsBufferConsumeRunThread.h"
#include <QDebug>
GpsBufferConsumeRunThread::GpsBufferConsumeRunThread(GpsRingBuffer* gpsRingBuffer,QObject *parent=0):QThread(parent){
this->gpsRingBuffer=gpsRingBuffer;
m_startInit=false;
}
GpsBufferConsumeRunThread::~GpsBufferConsumeRunThread(){
qDebug()<<"GpsBuffe... | true |
98ed72172220e3d18de1a6fed4c953ad38fad4cb | C++ | xielongen/cpp_demo | /tests/Concurrent/test_thread.cpp | UTF-8 | 1,944 | 3.234375 | 3 | [] | no_license | //
// Created by x on 2020/4/18.
//
#include <gtest/gtest.h>
#include <thread>
#include <iostream>
#include <future>
class ThreadGuard{
std::thread& thread;
public:
explicit ThreadGuard(std::thread& t):thread(thread){}
~ThreadGuard(){
if(thread.joinable()){
thread.join();
}
... | true |
b83bb9baf5a0af5d73d80245d8471f5ffa28f385 | C++ | Nerja/EDA031 | /lab2_N/word.cc | UTF-8 | 630 | 3.28125 | 3 | [] | no_license | #include <string>
#include <vector>
#include "word.h"
using namespace std;
Word::Word(const string& w, const vector<string>& t) : word(w), trigrams(t) {}
string Word::get_word() const {
return word;
}
unsigned int Word::get_matches(const vector<string>& t) const {
unsigned int found = 0;
unsigned int t_index = ... | true |
d46f8f6cd9a59caffcec64f6776bc71fe70bf0d7 | C++ | egorzainullin/workspace | /Old_projects/Projects/шаблоны и всякие нужные штуки/ConsoleApplication4/ConsoleApplication4/ConsoleApplication4.cpp | WINDOWS-1251 | 983 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | // ConsoleApplication4.cpp: .
//
#include <iostream>
using namespace std;
bool isInside(char s[], char s1[], int first)
{
int number = strlen(s);
int number1 = strlen(s1);
int count = 0;
for (int i = 0; i < number1; ++i)
{
if (s1[i] = s[i + first])
{
count++;
}
}
if (count = number1)
{
return true;... | true |
747fd837a893a35877fd15f0f7415566c7347225 | C++ | ahuertaalberca/C-Plus-Plus | /Chapter-7-Arrays/Review Questions and Exercises/Programming Challenges/05.cpp | UTF-8 | 4,164 | 4 | 4 | [
"MIT"
] | permissive | /************************************************************
*
* 05. Monkey Business
*
* A local zoo wants to keep track of how many pounds of
* food each of its three monkeys eats each day during a
* typical week. Write a program that stores this
* information in a two-dimensional 3 × 5 array, where
* ... | true |
1471b010d4e80e49a364a6f407c3d11369b12841 | C++ | DDHickey/dungeon-crawlers | /nationals.cpp | UTF-8 | 7,944 | 3.40625 | 3 | [] | no_license | /*
Legend for in game:
# is a wall
. is a floor
$ is a gold coin
x is a trap
s is the start of the level
f is the end of the game
@ is the player
2-5 is a level transition to the next level (indicated by the number)
Controls:
W forward
A left
S down
D right
(not case sens)
// NOTE TO SELF
Understan... | true |
b0220d33b360ed83c5b3af62d774a698c8969248 | C++ | Anshnrag02/aglo-and-problem-solving | /arrayadt.cpp | UTF-8 | 2,607 | 3.53125 | 4 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int main(){
int length;
cout<<"Enter the number of elements in array.\n";
cin>>length;
int*arr=new int[length];
int size=0,num;
char resp='y';
do{
do{
cout<<"1.Add/Append\n2.Insert\n3.Change size\n4.Delete\n5.Search Index\n6.Searc... | true |
5e8c01d4124eda367a467cce40e5cf0138a48c47 | C++ | philsmeby/SimpleJumpGame | /dasher.cpp | UTF-8 | 5,068 | 2.640625 | 3 | [] | no_license | #include "raylib.h"
#define global_variable static
global_variable int windowHeight;
global_variable int windowWidth;
struct AnimData
{
Rectangle rec;
Vector2 pos;
int frame;
float updateTime;
float runningTime;
};
bool isOnGround(AnimData *data)
{
return data->pos.y >= windowHeight - data->rec.height;
}
Ani... | true |
76512c74618d9ff4011144a98fa7b720bb92d2fd | C++ | even-wei/uva-practice | /679.cpp | UTF-8 | 501 | 2.71875 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
using namespace std;
int main(void)
{
int T, D, I;
int power[20];
power[1] = 2;
for (int i = 2; i < 20; ++i)
power[i] = power[i - 1] << 1;
scanf("%d", &T);
while (T--) {
scanf("%d %d", &D, &I);
int v = (I - 1) % power[D - 1], w = 0... | true |
00996ae92422d33e77ea3fbf3b31880daeeb4439 | C++ | timothyqiu/playground | /bilibili-live-danmaku/src/api.hpp | UTF-8 | 2,182 | 3.0625 | 3 | [] | no_license | #ifndef BLD_API_HPP_
#define BLD_API_HPP_
#include <cstdint>
#include <functional>
#include <string>
#include <vector>
namespace api {
// 直播状态
enum class LiveStatus
{
Live = 1, // 直播中
Preparing = 2 // 准备中(包括轮播)
};
// 直播间信息
struct WebRoomInfo
{
int room_id; // 房间号
std::string title... | true |
169e39f26d3d08b9b788a10ea5578096350b3101 | C++ | SwitchDreams/simulador-tr1 | /src/CamadaFisicaTransmissora.cpp | UTF-8 | 2,653 | 3.0625 | 3 | [] | no_license | #include "../include/CamadaFisicaTransmissora.hpp"
BitArray *CFTBinaria::execute(BitArray *quadro) {
std::cout << "Codificação Binária: ";
quadro->print();
std::cout << std::endl;
return quadro;
}
BitArray *CFTManchester::execute(BitArray *quadro) {
int streamSize = 2*quadro->tam()*BYTE_SIZE;
... | true |
fe2a52907aa30ec4c2fa387d6674b98f04236eaf | C++ | danielasun/ddd-oculus | /socket_stream/src/client_new/new_client.cpp | UTF-8 | 2,290 | 2.9375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <iostream>
#include <sstream>
#include <string.h>
#include "Packet.h"
void error(const char* msg)
{
perror(msg);
exit(0);
}
using std... | true |
732f752594c1119db62e55fe84dc98bd3e34e3d8 | C++ | litrod1733/210713_Minimum-Heap_LIS | /main.cpp | UTF-8 | 635 | 2.515625 | 3 | [
"MIT"
] | permissive | //
// Created by 이인성 on 2021/07/08.
//
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
int main() {
// ios_base :: sync_with_stdio(false);
// cin.tie(NULL);
// cout.tie(NULL);
priority_queue<int, vector<int>, greater<>> pq;
int N;
int x;
// cin >> N;
scanf("%d", &N);
for(int... | true |
2a162d65300523fc72316fb172da89d705827877 | C++ | degarashi/spinner | /random/matrix.hpp | UTF-8 | 707 | 2.671875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "../structure/range.hpp"
namespace spn {
namespace random {
// --------------- matrix ---------------
constexpr float DefaultRMatValue = 1e4f;
// ランダム値のデフォルト範囲
constexpr RangeF DefaultRMatRange{-DefaultRMatValue, DefaultRMatValue};
//! 要素の値がランダムな行列
template <class MT, class RDF>
au... | true |
d9b789238918ffb87cb02ba28af60ef8c170b1c8 | C++ | sy2es94098/ITSA | /itsa/i33.cpp | UTF-8 | 781 | 3.09375 | 3 | [] | no_license | #include<iostream>
#include<cstdlib>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;
int main(){
int i, sum, space = 0;
string str = "\n";
while(getline(cin, str))
{
space = 0 ;
sum = 0 ;
str=str.insert(str.size(), " ");
for( int i = 0 ; i < str.... | true |
bbef4cb5ee6d6e2d685d59ad4ffbd6fa4f08aa81 | C++ | Zzhc3321/cpp | /命名空间/05_共享数据的保护.cpp | GB18030 | 801 | 3.96875 | 4 | [] | no_license | #include <iostream>
using namespace std;
// ݳԱֵڶڼ䲻ܸı䡣
// гʼҲܱ¡
/*
const ˵ ;
Ա ˵ const;
ݳԱ const ˵ .
*/
class A{
public:
A(int i);
void print();
private:
const int a;
static const int b;
};
const int A::b = 10; //̬ݳԱ˵ͳʼ
A::A(int i):a(i){}//ݳԱֻͨʼбóֵ
void A::print(){
cout<<a<<":"<<b<<endl;
}
// õĶܱ¡
// ... | true |
3919aa50bb39d2243f73f0f9fedd93eb1043dea4 | C++ | duttaANI/AL_Lab | /GFG/April2021/Longest Span in two Binary Arrays.cpp | UTF-8 | 522 | 2.5625 | 3 | [] | no_license | int longestCommonSum(bool arr1[], bool arr2[], int n) {
// code here
unordered_map<int,int> mp;
mp[0] = -1;
int X=0,Y=0;
int result =0;
for(int i=0;i<n;++i){
X += arr1[i];
Y += arr2[i];
int diff = X - Y;
if(mp.... | true |
cf6dadb6910d25e8861fa7f75fe0cf1e9e533516 | C++ | jhke01/xolotl | /xolotl/xolotlCore/flux/PulsedFitFluxHandler.h | UTF-8 | 3,457 | 2.875 | 3 | [] | no_license | #ifndef PULSEDFITFLUXHANDLER_H
#define PULSEDFITFLUXHANDLER_H
#include "FluxHandler.h"
#include <cmath>
#include <MathUtils.h>
namespace xolotlCore {
/**
* This class realizes the IFluxHandler interface to calculate the incident V and I flux
* for tungsten material with a flux amplitude being intermittent.
*/
cla... | true |
44a487cfe5a46be5517cedc225af8921f88ae2be | C++ | shubhamguptaji/CPP | /4.cpp | UTF-8 | 1,662 | 3.1875 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
int size;
class bill
{
protected:
int items[10];
float price[10];
public:
virtual void total()=0;
virtual void display()=0;
};
/*bill::bill(int items[],float price[],int size)
{
size=size;
for(int i=0;i<size;i++)
{
items[i]=items[i];
pric... | true |
8ce25f08db260a8384a2971ca272cdf558d3261e | C++ | yasir18/ncrwork | /CPP_Assignments/Assignment1/p7-matrix.cpp | UTF-8 | 1,280 | 3.3125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class Matrix{
vector<vector<int> > vec;
public:
Matrix(){
// cout<<"Enter number of rows and columns :";
// int r,c;
// cin>>r>>c;
// vec.resize(r);
// for(int i=0;i<r;i++)
// {
// vec[i].resize(c);
// for(int j=0;j<vec[i].size();j++){
// vec[i][j]=0... | true |
cfbc0156ec137f04fab449f1a7369d922111e18c | C++ | modernrio/Schulaufgaben | /06-3.3 ASCII-Alphabet/main.cpp | UTF-8 | 308 | 2.71875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int x = 0;
for (int i = 65; i <= 90 || i >= 96 && i <= 122; i++) {
x++;
printf("%c\t", i);
if (!(x % 7)) {
printf("\n");
}
if (i == 90) {
i = 96;
x = 0;
printf("\n\n");
}
}
printf("\n\n");
system("PAUSE");
return 0;
} | true |
139db5e1aad49cfb25fea9a33ee6665615ba782d | C++ | sniperswang/dev | /leetcode/leetCode/leetCode/nextPermutation.h | UTF-8 | 1,655 | 3.421875 | 3 | [] | no_license | //
// nextPermutation.h
// leetCode
//
// Created by Yao Wang on 9/28/13.
//
//
#ifndef leetCode_nextPermutation_h
#define leetCode_nextPermutation_h
class Solution { //my way
public:
void nextPermutation(vector<int> &num) {
// Start typing your C/C++ solution below
// DO NOT write int main() f... | true |