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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
547232620f3ea16e813c8e9db17e4e6c0ef349c2 | C++ | RobPang/Algorithm_study | /백준알고리즘/BOJ-11049 행렬 곱셈순서.cpp | UTF-8 | 633 | 2.796875 | 3 | [] | no_license | //행렬 곱셈 순서 - dp 각각을 분리
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int r[501];
int c[501];
long long dp[501][501];
long long dfs(int a, int b) {
if (b - a == 1) {
int temp = r[a] * c[a] * c[b];
}
if (a == b) return 0;
long long& res = dp[a][b];
if (res != -1) {
return r... | true |
0db452bd351fe7340772802296fbed2e548329c9 | C++ | Maesly/TareaCortaDatos2 | /Singly_Linked_List.h | UTF-8 | 4,491 | 3.390625 | 3 | [] | no_license | //
// Created by parallels on 9/10/17.
//
#ifndef TAREA_SINGLY_LINKED_LIST_H
#define TAREA_SINGLY_LINKED_LIST_H
#include <iostream>
#include <stdlib.h>
using namespace std;
/**
* Inicializa el nodo
*/
struct nodo{
int nro;
struct nodo *sgte;
};
typedef struct nodo *Tlista;
/**
* Inserta valores al inici... | true |
df3e070d90226ba4ce7aaa40e05571f10f95a597 | C++ | jjsuper/leetcode | /leetcode-viewer/solutions/228.summary-ranges/summary-ranges.cpp | UTF-8 | 1,259 | 2.765625 | 3 | [] | no_license | class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
vector<string> vec;
queue<int> que;
int i;
if(nums.empty()) return vec;
que.push(nums[0]);
for(i=1;i<nums.size();++i)
{
if(nums[i-1]+1!=nums[i]... | true |
2195aa33c236771d4518ef3c06c53c1696ae5e96 | C++ | dmccreary/moving-rainbow | /src/arduino/hsb-lab/hsb-lab.ino | UTF-8 | 4,829 | 2.625 | 3 | [] | no_license |
/*
Control a RGB led with Hue, Saturation and Brightness (HSB / HSV )
Hue is change by an analog input.
Brightness is changed by a fading function.
Saturation stays constant at 255
getRGB() function based on <http://www.codeproject.com/miscctrl/CPicker.asp>
dim_curve idea by Jims
created 05-01-2... | true |
d2c92d4e66c75c447eb7f741a83a2ee0ead910c6 | C++ | SashiRin/protrode | /atcoder/abc104/B.cpp | UTF-8 | 1,179 | 2.65625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <stack>
#include <set>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
string s;
cin >> s;
if (s[0] != 'A') {
cout <<... | true |
6cf4c1a7cf6db109e0a827fa3eca6f01cdc50f7b | C++ | debanjan877/Shipping-And-Bidding | /ShippingBiddingC.cpp | UTF-8 | 14,490 | 2.8125 | 3 | [] | no_license | #include<stdlib.h>
#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
#include"headers\Globals.h"
#include"headers\BidInfo.h"
#include"headers\ShipInfo.h"
#include"headers\File.h"
using namespace std;
/* Non Static Functions */
BidInfo::BidInfo()
{
_id=_shipItemId=_shipperId=... | true |
dd9810e0ad7e8e0ec97023e351a061ab624484d5 | C++ | aashrayjain/Simple-Mobile-Phone | /AT_by_serial.ino | UTF-8 | 915 | 3.375 | 3 | [] | no_license | /*
* Author: Devvrat arya
*
* The code enable user to directly enter AT command in Serial window
* The response of GSM also printed on the Serial window
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX // can be replaced to any other PWM pin
/*
* GSM module is connected to software... | true |
5cb98a34a5a3c959be3dd875e80bde737af89254 | C++ | MKwiatosz/Programming | /KURS C++ PRATA/Rozdział 3/2.4/2.4/2.4.cpp | UTF-8 | 777 | 3.015625 | 3 | [] | no_license | // 2.4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int main()
{
using namespace std;
const int MIN = 60;
const int GODZ = 3600;
const int DZIEN = 3600 * 24;
long long sekundy;
cout << "Podaj liczbe sekund: ";
cin >> sekundy;
int dni = sekundy /... | true |
838a7625193af5d195763e43ff661ce69a56cd0b | C++ | mickebackman/EDA031 | /clientserver/memorydatabase.cc | UTF-8 | 2,066 | 3.234375 | 3 | [] | no_license | #include "memorydatabase.h"
#include <string>
#include <iostream>
#include "article.h"
#include "newsgroup.h"
#include <vector>
#include <map>
using namespace std;
void MemoryDatabase::addArticle(int newsGroupId, string name, string author, string text){
try{
groups.at(newsGroupId).addArticle(name, author, text);... | true |
474fa25442c88f85ea05511572277a754565aa21 | C++ | ayushsherpa111/GBEmu | /GameBoyEmulator/WRAM.h | UTF-8 | 221 | 2.78125 | 3 | [] | no_license | #pragma once
class WRAM
{
public:
WRAM();
~WRAM();
virtual int ReadByte(long address);
virtual void WriteByte(int value, long address);
protected:
virtual void InitializeRAM();
unsigned char *RAM;
long RAMSize;
};
| true |
0bf1800a441102e95ed4e65b848b02e32566ce90 | C++ | newspring97/coding_test | /Dongju/boj1874.cpp | UTF-8 | 495 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
int main(int argc, char** argv) {
int n,x;
cin>>n;
stack<int> stck;
int idx=1,t=0;
vector<char> ans(2*n);
for(int i=0;i<n;i++){
cin>>x;
while(stck.empty() || stck.top()!=x)
{
if(idx>n)
{
printf("NO");
ret... | true |
ad49bfb87644e99af872449901b057e79cf6d072 | C++ | P17seongbin/Graphics_Assn | /Assn4/Project File/Assn1/ObjLoader.hpp | UHC | 6,006 | 2.828125 | 3 | [] | no_license | //Reference : http://www.opengl-tutorial.org/kr/beginners-tutorials/tutorial-7-model-loading/
#pragma once
#include "State.h"
#include "RenderManager.h"
#include <vector>
#include <map>
#include "Const.h"
using namespace std;
class ObjLoader
{
public:
ObjLoader(RenderManager* t);
int findID(std::string name);
bool ... | true |
7b098e4886000a76ce9762e03e337a712fcabe19 | C++ | 1red2blue4/Paradox-Billiards | /BallPhysics.cpp | UTF-8 | 1,651 | 2.828125 | 3 | [] | no_license | #pragma once
#include "BallPhysics.h"
BallPhysics::BallPhysics()
{
netForce = vector3();
velocity = vector3();
speedCap = 1.5f;
gravity = vector3();
freedom = 0.035;
name = "default";
}
BallPhysics::~BallPhysics()
{
//NO MEMORY ALLOCATED
}
void BallPhysics::SetGravity(vector3 yfrc)
{
grav... | true |
08c5b10fff7741f8e80980432bc81d35b6378708 | C++ | srimedhabc/Data-Structures | /DS/lab 1/ADD_MAX.CPP | UTF-8 | 687 | 2.921875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int A[20][20],B[20][20],C[20][20],i,j,a,b,m,n;
cout<<"enter the number of rows and columns in A and B respectively"<<endl;
cin>>a>>b>>m>>n;
if(a!=m||b!=n)
cout<<"Comparision not possible"<<endl;
else
{
cout<<"enter the elements of A"<<endl;
for(i=0;i<... | true |
99680dacf9daf5e82f1370abad92b347a24b9c5b | C++ | jandy14/LinkedListInCPP | /List.h | UTF-8 | 1,783 | 3.15625 | 3 | [] | no_license | template <class T>
class List {
class Node; //전방선언
public:
class Iterator {
public:
Node* current;
private:
bool isReversed;
public:
Iterator():isReversed(false) {}
Iterator(bool pIsReversed):isReversed(pIsReversed) {}
Iterator(bool pIsReversed, Node* pCurrent):isReversed(pI... | true |
84805b5ed4a7b3432a20dcd08fc16f056a790040 | C++ | singhshu250/Os_Simulator | /scheduling.cpp | UTF-8 | 26,717 | 3.046875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void roundRobin()
{
cout << "Enter the number of processes: ";
int n, i, j;
cin >> n;
while (n < 0)
{
cout << "Wrong input, try again\nEnter number of processes: ";
cin >> n;
}
vector<tuple<int, int, int, int, int>> times(n); // {... | true |
66d18e5dfbd6d22420853e49046eaf0c44129c69 | C++ | MintYiqingchen/learnByCode | /c++/template/variableTuple.cpp | UTF-8 | 2,363 | 3.3125 | 3 | [] | no_license | #include <memory>
#include <vector>
#include <iostream>
#include <numeric>
#include <utility>
using namespace std;
// test 1
namespace test {
template <typename T, typename... Args>
inline unique_ptr<T> make_unique(Args&&... args)
{
return unique_ptr<T>(new T(forward<Args>(args)...));
}
}
// tes... | true |
5b502e33330149d38c1add2a780b83c3b1918b60 | C++ | ethanmick/Blowfish482 | /Blowfish.cpp | UTF-8 | 4,661 | 2.84375 | 3 | [] | no_license | #include "Blowfish.h"
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
Blowfish::Blowfish() {
hexStart = 0;
}
uint32_t Blowfish::blockSize(){
return 8;
}
uint32_t Blowfish::keySize(){
//56 is the maximum, this is variable
return 8;
}
void Blowfish::setKey(uint8_t* key){
... | true |
54dff18e0e92589ce104112c9700b511459492da | C++ | patrickfreed/regency | /world/Region.cpp | UTF-8 | 4,102 | 3.078125 | 3 | [] | no_license | #include <regency/world/Region.h>
#include <regency/Game.h>
namespace regency::world {
Region::Region(Location a, Location b, bool checks):
_world(Game::get_instance().get_world()), _a(a), _b(b) {
_min_x = std::min(_a.get_x(), _b.get_x());
_min_y = std::min(_a.get_y(), _b.get_y());
_max_x = std:... | true |
b3f56d29340c5f2c6fbfebf6882309fa5c81bb6f | C++ | zhufangda/Telecom-Paristech | /IGR201/QT/paintExample/paintarea.cpp | UTF-8 | 3,892 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #include "paintarea.h"
#include <QApplication>
#include<iostream>
PaintArea::PaintArea(QWidget *parent):QWidget(parent)
{
QPalette pal = palette();
pal.setColor(QPalette::Background, Qt::white);
this->setAutoFillBackground(true);
this->setPalette(pal);
this->setMinimumSize(500,400);
myPenColor=... | true |
8d5e34e6e9ebcaf4cf2d02bb5518b945f6d5272e | C++ | tvphu20th2/baitapOOP | /QL_Sach.cpp | UTF-8 | 2,324 | 2.53125 | 3 | [] | no_license | #include <conio.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include<stdlib.h>
#include <iomanip>
#include <iostream>
using namespace std;
#define MAX_NXB 50
//Class Nhanvien
class QLSach
{ protected:
char MaSach[12];
char NgayNhap[12];
float DonGia;
int SoLuong;
char NXB[5... | true |
f8e650ca87d01577e2e20dbd2118759c01c471a2 | C++ | zhrv/heat_2d | /src/methods/heat_bnd.cpp | WINDOWS-1251 | 2,269 | 2.796875 | 3 | [] | no_license | #include "heat_bnd.h"
const char* HeatBoundary::TYPE_CONST = "BOUND_CONST";
const char* HeatBoundary::TYPE_FLOW = "BOUND_FLOW";
const char* HeatBoundary::TYPE_NOFLOW = "BOUND_NOFLOW";
HeatBoundary* HeatBoundary::create(TiXmlNode* bNode)
{
HeatBoundary * b = 0;
TiXmlNode* node = 0;
TiXmlNode* node1 = 0;
const c... | true |
ee565ea6ded26ca2b301cdeaa3984bf667b75d89 | C++ | deathcod/mycode | /My_Algorithmic_CODES/DP_0-1knapsack.cpp | UTF-8 | 718 | 2.640625 | 3 | [] | no_license | /*
0-1 knapscak
by chinmay rakshit
date:20/11/2015
*/
#include <bits/stdc++.h>
int max(int a,int b)
{
return(a>b)?a:b;
}
int main()
{
int dp[101][101]={0},w[101]={0},val[101]={0},n,m;
scanf("%d %d",&n,&m);
for(int i=1;i<=m;i++)
scanf("%d %d",&w[i],&val[i]);
for(int i=1;i<=m;i++)
{
... | true |
ee74de25ca38acd421c554ad4fec30497333b8d5 | C++ | KaPrimov/cpp-courses | /Advance/d_classMembers/e_lectures/LecturesMain.cpp | UTF-8 | 843 | 2.9375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
#include <set>
#include <map>
#include "ResourceType.h"
#include "Resource.h"
#include "Lecture.h"
int main() {
using SoftUni::Resource;
using SoftUni::Lecture;
using SoftUni::ResourceType;
Lecture lecture;
std::map<ResourceType, int> numberOfResourcesByType;... | true |
b3ecf3790f8d10a151f03a2eafb3b94925521861 | C++ | asnows/opencv_vs2013 | /opencv_algorithm/opencv_algorithm/fpga_imgsharp.cpp | UTF-8 | 971 | 2.640625 | 3 | [] | no_license | #include"include.h"
void laplacian_sharp(cv::Mat srcImg, cv::Mat dstImg)
{
int lalp_delt1;
int lalp_delt2;
int value;
cv::Mat tmpImg(srcImg.rows,srcImg.cols,CV_8U);
unsigned int rows = srcImg.rows;
unsigned int cols = srcImg.cols;
for (int y = 1; y < rows - 1; y++)
{
for (int x = 1; x < cols - 1; x++)... | true |
6fe9076099c478f3735fa0707889e27be022449b | C++ | TrueElement/CPlusPlus | /Simple Game/include/Creature.h | UTF-8 | 2,391 | 3.28125 | 3 | [] | no_license | #ifndef CREATURE_H
#define CREATURE_H
#include <iostream>
class Room;
/*
* Creature Superclass Declaration
*/
class Creature {
public:
Creature();
~Creature();
void print();
void performAction(bool type);
void speak(bool pos_neg);
bool move(int direction);
... | true |
272ef7ccac301f85596c51b4de9703eb60f87188 | C++ | JasbirCodeSpace/du-CS-4th-Sem-Algorithms | /Practicals CPP files/selection sort/SLSRT100.CPP | UTF-8 | 999 | 2.8125 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
#include<time.h>
#include<limits.h>
#include<stdlib.h>
#include<fstream.h>
double selsort(int [],int);
void main()
{
clrscr();
time_t t;
fstream f;
f.open("abc.txt",ios::out);
srand((unsigned) time(&t));
int Test;
int *A;
int n,size=20;
double counter;
cou... | true |
6679b8ddef601edfe4d86fff13cee83b52ed47e0 | C++ | amanmaldar/LinuxPerf | /main.cpp | UTF-8 | 840 | 3.328125 | 3 | [] | no_license | //new
#include <iostream>
#include <cstdlib>
#include <vector>
#include <ctime>
using namespace std;
void bar();
void foo();
vector <int> data;
vector <int> ans;
int lenght = 20000;
int sum = 0;
void foo(void) {
for(int i = 0; i < lenght ; i++){
sum = 0;
for(int j = 0; j < lenght ; j++){
sum += data.at(j); ... | true |
ea4ee1e4249332fcddab83aa39f65f0e2b5d5e6d | C++ | cedricxs/LeetCode | /56-merge-intervals.cpp | UTF-8 | 1,009 | 3.078125 | 3 | [] | no_license | /*author : cedricxs
*level : middle
*/
/**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/
static const auto _____ = []()
{
ios::sync_with_stdio(false);
cin.... | true |
12fbdae650e49730457a6d0dece65e20262a34ae | C++ | eriqwalker/algo | /Assign_01/assign_01/rgi.cc | UTF-8 | 1,076 | 3.328125 | 3 | [] | no_license | /*
* Eriq Walker
* z1908120
* CSCI-340-2
*
* I certify that this is my own work and where appropriate an extension
* of the starter code provided for the addignment.
*
* */
#include "rgi.h"
// Add needed constants
const int VEC_SIZE = 200,
LOW = 1,
HIGH = 10000,
SEED = 1;
// ... | true |
b5642110b9f81af70c3ba04996d266d768f01106 | C++ | Martisum/Algorithm | /邻接表建图深搜(实例)/adjacency list.cpp | GB18030 | 773 | 2.671875 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
using namespace std;
const int maxm=1001;
int p,s,a,b;
struct edge{
int u,v,next;
}e[maxm];
int head[maxm],js;
int book[maxm];
void addedge(int u,int v){
e[++js].u=u;
e[js].v=v;
e[js].next=head[u];
head[u]=js;
return;
}
void dfs(int x){
book[x]=1;
for(int i=head[x];i;i=e[i... | true |
50cb1bb83c1e8bf0b197b0970db6e4434fd6b1d6 | C++ | wisdom-weaver/c_cpp_mini | /data-structures_using_cpp/q-queue/queue_using_stack/queue_using_stack_rec_pop.cpp | UTF-8 | 785 | 3.4375 | 3 | [] | no_license | #include "bits/stdc++.h"
using namespace std;
class queue_s2{
stack<int> s1;
public:
void push(int x){
s1.push(x);
}
int pop(){
if(s1.empty()){ cout<<"Queue is empty"<<endl; return -1; }
// get the top element
int x = s1.top(); s1.pop();
// base case=> if stack is empty ... | true |
b5a1e0793d60527375fde7295cf88107a145a21f | C++ | uwuser/MCsim | /IntegrationWithMacSim/src/MCsim/system/PipeCAS/RequestScheduler_PipeCAS.h | UTF-8 | 2,370 | 2.546875 | 3 | [
"MIT"
] | permissive | #ifndef REQUESTSCHEDULER_PIPECAS_H
#define REQUESTSCHEDULER_PIPECAS_H
#include "../../src/RequestScheduler.h"
namespace MCsim
{
class RequestScheduler_PipeCAS: public RequestScheduler
{
private:
bool newRound;
bool firstACT;
RequestType bundlingType;
vector<unsigned int> scheduledCmdQueue;
bool isSchedul... | true |
65bd36282801e530e83f4429be0612dd6ee6d8b1 | C++ | ziggyman/stella | /cpp/msetapstozero/src/MSetApsToZero.cpp | UTF-8 | 3,393 | 2.625 | 3 | [] | no_license | /*
author: Andreas Ritter
created: 03/20/2007
last edited: 03/20/2007
compiler: g++ 4.0
basis machine: Ubuntu Linux 6.06
*/
#include "MSetApsToZero.h"
int main(int argc, char *argv[])
{
cout << "MSetApsToZero::main: argc = " << argc << endl;
if (argc < 4)
{
cout << "MSetApsToZero::main: ERROR: Not enough pa... | true |
99961e0c99e7478805865bba763c21477ad4eef9 | C++ | winshining/common_algorithms | /findmaxin/findmaxin.cpp | UTF-8 | 1,682 | 3.296875 | 3 | [] | no_license | #include "findmaxin.h"
/*
* More details refer to: http://blog.csdn.net/winshining/article/details/50389596
*/
static bool gt(const int a, const int b)
{
return a > b;
}
static void swap(int* buff, const int i, const int j)
{
assert(buff);
int temp = buff[i];
buff[i] = buff[j];
buff[j] = temp;
}
void ... | true |
63c267484078678d88ab1cd4426f969ce1a34f87 | C++ | yeonie/Algorithm | /bokli_Calculate/bokli_Calculate/main.cpp | UTF-8 | 595 | 3.171875 | 3 | [] | no_license | //
// main.cpp
// bokli_Calculate
//
// Created by 이동연 on 2021/01/23.
//
#include <iostream>
#include <cmath>
using namespace std;
int bokli(long long money, int n, float interest){
for(int i = 0 ; i < n ; i++){
money = money*interest;
}
cout<<n<<"일 후 "<<"잔액 :"<< money<< endl;
return 0;
}
i... | true |
ca5874a2668dcbd1815593276f2957316e68dc59 | C++ | chronos-cosine/Chronos | /src/Collections/Concurrent/Queue.h | UTF-8 | 2,286 | 3.15625 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Collections/ConcurrentQueue.h
* Author: Chronos Cosine <chronos.cosine@gmail.com>
*
* Created on 12 October 2018, 10... | true |
ff1413a53ad715ade4b4e8d9694f5accff58543d | C++ | iChenLei/c-_primer_plus | /day25.cpp | UTF-8 | 159 | 2.578125 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
typedef string str;
int main(){
str s = "string";
cout<<"typedef------->"<<s<<endl;
}
| true |
de5f8762ab5dcab149ce7f12d70a4cf7073e4af6 | C++ | haz/fd-multisearch | /downward/search/operator_registry.h | UTF-8 | 1,042 | 2.640625 | 3 | [] | no_license | #ifndef OPERATOR_REGISTRY_H
#define OPERATOR_REGISTRY_H
#include "globals.h"
#include <vector>
class Operator;
class OperatorRegistry {
std::vector<const Operator *> canonical_operators;
inline int get_op_index(const Operator *op) const;
int num_vars;
int num_operators;
int num_canonical_operat... | true |
3438f2b12a17691b71274f25cc0f803542bcc73d | C++ | mwiegant/CS480_wiegant | /PA7/include/object.h | UTF-8 | 1,834 | 2.703125 | 3 | [] | no_license | /**
* @file object.h
*
* @brief Definition file for object class
*
* @author Cactus Coolers
*
* @details Specifies all methods and variables for object class
*
* @version 1.00
*
* @Note None
*/
#ifndef OBJECT_H
#define OBJECT_H
#include <vector>
#include <string>
#include <cstdio>
#include <fstream>
#in... | true |
ce378156419bd845830b3c9be9005b9faddad1a4 | C++ | DriftingLQK/TrainCamp | /TrainTask/Solve_Question_Code/NimGame.cpp | GB18030 | 754 | 3.34375 | 3 | [] | no_license | #include<iostream>
using namespace std;
/*****************************************ʮһ*************************************
[Ҫ]
ѣһ Nim Ϸһʯͷÿõ1-3ʯͷ õһʯͷ˾ǻʤߡ
Ϊ֣
ǴˣÿһŽ⡣ дһжǷڸʯͷӮϷ
*****************************************************************************************/
bool NimGame(int n)
{
if (n <= 0 )
{
return false... | true |
4b80dd932ea96030254714a68ab602bb40bbcd13 | C++ | ang421/Pacman2 | /src/pacman.cpp | UTF-8 | 9,256 | 3.25 | 3 | [] | no_license | #include "pacman.h"
#include "pacmangame.h"
#include "ghost.h"
#include "wall.h"
#include "ghostwall.h"
Pacman::Pacman(PacmanGame* pacmangame, int row, int col, Character* (*board)[31][28], Mode mode) :
Character(row, col, board),
pacmangame(pacmangame),
direction(Dir::NONE),
mode(mode),
... | true |
a4da165598587b565f5984c72bac05b50397e415 | C++ | chanmufeng/data_structure | /heap/SortTestHelper.h | GB18030 | 1,502 | 3.78125 | 4 | [] | no_license | #ifndef BASIC_SORT_GENERATION_H
#define BASIC_SORT_GENERATION_H
#include <iostream>
#include <ctime>
#include <cassert>
namespace SortTestHelper {
//nԪص飬ÿԪصΧΪ[rangeL,rangeR]
int* generateRandomArray(int n,int rangeL,int rangeR) {
assert(rangeL <= rangeR);
int* arr=new int[n];
srand(time(NULL))... | true |
2c7d96827f6632bb21c110679d09b739d9525412 | C++ | Floopion/Home-Projects | /C++ Rouglike/Checkpoint/TileList.h | UTF-8 | 1,013 | 2.640625 | 3 | [] | no_license | /*
Program name: Rougelike
Project file name: TileList.h
Date: 15/05/2020
Language: C++
Platform: Microsoft Visual Studio 2017 - 2019
Purpose: To specify the methods and variables needed, whether they are public or private.
Description: Header file for the TileList, contains the variables... | true |
920ed967f040e545f917e84948748274557ecb9a | C++ | yuxz09/algsLearning | /程序员代码面试指南/KsortedlistToOne/KsortedlistToOne.cpp | UTF-8 | 2,004 | 3.8125 | 4 | [] | no_license | /*
给定k个有序链表的头节点,怎么把他们merge成一个有序的链表。
*/
#include <iostream>
#include <queue>//using std::priority_queue
using namespace std;
struct Node
{
int val;
Node* next;
Node(int value)
{
val = value;
}
};
struct cmp
{
bool operator()(Node* node1, Node* node2)
{
return node1->val > n... | true |
66a58180dde0aabb1b694d9b2e1279e030414bbb | C++ | Noele/Cherri | /Response.h | UTF-8 | 418 | 2.65625 | 3 | [
"MIT"
] | permissive | #include "sleepy_discord/sleepy_discord.h"
class Response {
public:
enum type {embed, message, action};
std::string rmessage;
SleepyDiscord::Embed rembed;
Response::type rtype;
Response (std::string rmessage, SleepyDiscord::Embed rembed, Response::type responseType) {
this->rmessage = rmessa... | true |
8fc7138eacd4b06d7898bb0b0fb72839cc5f976b | C++ | jkrecek/ShutdownApp | /NOSA-Server/src/mainsocket.cpp | UTF-8 | 1,542 | 2.765625 | 3 | [] | no_license | #include "mainsocket.h"
#include <iostream>
#include <ctime>
#include "defines.h"
#ifndef _WIN32
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#endif
MainSocket::MainSocket(TCPSocket socket, sockaddr_in info)
: NetworkSocket(socket, info)
{
}
MainSocket* MainSocket::createSocket(Configur... | true |
b65ceeee4017bdd57e8950629a4071bc1ece6047 | C++ | Ioann87/houses | /main.cpp | UTF-8 | 2,801 | 3.421875 | 3 | [] | no_license | #include <cstring>
#include <ctime>
#include <iostream>
#include <vector>
using namespace std;
vector<char*> names = {
"Ivan",
"Petr",
"Viktor",
"Stepan",
"Josiph",
"Vladimir",
"Kiryll",
"Anton",
"Jury",
"Boris"
};
vector<char*> surnames = {
"Ivanov",
"Petrov",
"Vi... | true |
4eb2776dd60cb3d61c93b913d4e3ffeaf94a437e | C++ | kentatakiguchi/GameCompetition2016_2 | /DXBase/DXBase/sources/Actor/Person/Enemy/FloorSearchPoint.cpp | SHIFT_JIS | 3,082 | 2.515625 | 3 | [] | no_license | #include "FloorSearchPoint.h"
#include "../../../ResourceLoader/ResourceLoader.h"
#include "../../Base/ActorGroup.h"
#include"../../Body/CollisionBase.h"
#include "../../../World/IWorld.h"
#include "../../../Math/Math.h"
#include "../../../Define.h"
FloorSearchPoint::FloorSearchPoint(
IWorld * world,
const Vector2&... | true |
a20d34ddf142dc31402d4dc46a9dfbf4a7947de5 | C++ | georgiosdoumas/ProgrammingCplusplus- | /CplusplusPrimer_5thEd_2012/chapter10/Exercise10.07.cpp | UTF-8 | 1,628 | 4.0625 | 4 | [] | no_license | /* Exercise 10.7: Determine if there are any errors in the following programs and, if so, correct the error(s):
(a) vector<int> vec; list<int> lst; int i;
while (cin >> i)
lst.push_back(i);
copy(lst.cbegin(), lst.cend(), vec.begin());
(b) vector<int> vec;
vec.reserve(10); // reserve is covered in § 9.... | true |
3b9970aa939518f8835e786596f735af68d9969b | C++ | ZhongZeng/Leetcode | /lc944dltColSrt.cpp | UTF-8 | 606 | 2.90625 | 3 | [] | no_license |
/*
Leetcode 944. Delete Columns to Make Sorted
Test Cases:
["cba","daf","ghi"]
["a","b"]
["zyx","wvu","tsr"]
Runtime: 48 ms
*/
class Solution {
public:
int minDeletionSize(vector<string>& A) {
// remove all unsorted columns
if(A.size()<2||A[0].size()<1) return 0;
int... | true |
7d090bc836a90fff1280d8287309ad2e54e62e9d | C++ | aditya865/LeetCode-June-Challenge | /week_1/day7.cpp | UTF-8 | 488 | 2.625 | 3 | [] | no_license | class Solution {
public:
int change(int amount, vector<int>& coins) {
int n=coins.size();
int table[amount+1];
memset(table,0,sizeof(table));
table[0]=1;
for(int i=0; i<n; i++)
{
for(int j=coins[i];j<=amount; j++)
table[j] += table[j-coins[i... | true |
85b50cad28d08f98dbd000ace9ad223cec8a6f85 | C++ | emctague/Tasks | /examples/Sensor Polling/SensorPolling.ino | UTF-8 | 774 | 3 | 3 | [] | no_license | #include <Tasks.h>
class SensorPolling : public Task {
private:
uint16_t lastReading;
const uint8_t pin;
void update()
{
lastReading = analogRead(pin);
}
public:
SensorPolling(uint8_t pin , uint16_t pollingInterval) : Task(pollingInterval), pin(pin) {
}
SensorPolling(uint8_t ... | true |
2016d9506dd745a0e5da847f3c20e3e4552e205e | C++ | n1ghtk1ng/Interview-Coding-Questions | /wormhole_without_dijkstra.cpp | UTF-8 | 960 | 2.734375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int cost=INT_MAX;
struct wormhole{
int sx;
int sy;
int ex;
int ey;
int cost;
wormhole(){}
wormhole(int a,b,c,d,e){
sx=a;
sy=b;
ex=c;
ey=d;
cost=e;
}
};
int sx,sy,dx,dy;
int calcdist(int i,wormhole w[],int a,int b){
... | true |
7fc5dcab357b897936ca105dc99c61ce3e9fa96a | C++ | AlixAbbasi/fsfw | /unittest/testtemplate/TestTemplate.cpp | UTF-8 | 955 | 3.015625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | #include <fsfw/unittest/catch2/catch.hpp>
#include <fsfw/unittest/core/CatchDefinitions.h>
/**
* @brief Template test file
* @details
* In each test case, the code outside the sections is executed
* for EACH section.
* The most common macros to perform tests are:
* - CHECK(...): assert expression and continue... | true |
65a6411816d9e3492b9d4eed1c6c7835b7b02b66 | C++ | zimkjh/-vmware_data_save | /algo/picnic1.cpp | UTF-8 | 1,296 | 3.234375 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int goodcase(int human, int group, int *groups){
bool checkL[human];
for (int i4 = 0; i4<human; i4++){
checkL[i4]= false;
} // make default false
}
int main() {
int cases;
cin >> cases;
for(int i1 = 0; i1<cases ; i1++) { // cases
int human, group;... | true |
e76d3fa61ecaa1de6e575991e2d02bfeec18592c | C++ | singhankush01/datastructure-algorithms | /maximum_sum_colum.cpp | UTF-8 | 568 | 2.9375 | 3 | [] | no_license | #include<iostream>
#include<limits>
using namespace std;
int main()
{
int m,n;
int ar[100][100];
cin>>m>>n;
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>ar[i][j];
}
}
int max = INT_MIN,column;
for(int i=0;i<m;i++)
{
int sum = 0;
... | true |
5557d59cd03130b46bde6ac49f32b0b2108d956f | C++ | Tybus/AVLTree | /include/AVLTree.h | UTF-8 | 1,051 | 3.046875 | 3 | [] | no_license | #ifndef AVLTREE_H
#define AVLTREE_H
#include <stdexcept>
#include <iostream>
#include "AVLNode.h"
#include <string>
class AVLTree{
public:
//! Creates a empty AVLTREE
AVLTree();
//! Creates a AVLTree based on arrays of strings and cedulas
AVLTree(int i_ammount, AVLNode::NameAndID * i_aNameAndID);
//! Creates an A... | true |
98b576c4efe263933c5540000952a465155a11c3 | C++ | ChenGuyc/Projects | /silver_lining/include/singleton.hpp | UTF-8 | 1,715 | 3.421875 | 3 | [] | no_license |
/*
Singleton ensures a class only has a single instance and provides global point of access to it
T must have a default private ctor
Singleton must be a friend class T
Singleton has self-destruction
Version Date Comments
0.1 7.12.20 mentor approval
*/
#ifndef ILRD_HRD14_SINGLETON_HPP
#... | true |
c3b1dae5741636ff0acedac81afe5c624571854e | C++ | QinghuiXing/BinaryTree | /HuffmanTree.cpp | GB18030 | 6,082 | 2.578125 | 3 | [] | no_license | #include "pch.h"
#include "HuffmanTree.h"
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<algorithm>
void HuffmanCoding(HmTree & HT, HuffmanCode & HC, int * w, int n)
{
if (n < 1)return;
int m = 2 * n - 1;
HT = (HmTree)malloc((m+1)* sizeof(HTNode));
HC = (HuffmanCode... | true |
ea88f4b2f15baa684cc415d268db8783949d8e46 | C++ | alexsawyer13/TheGauntletCpp | /GauntletCpp/src/MoveContainer.h | UTF-8 | 687 | 3.640625 | 4 | [] | no_license | #pragma once
#include "Move.h"
#include <vector>
class MoveContainer
{
public:
Move Punch() { return Move("Punch", "Throws a punch at the target", 90, 30); }
Move BodySlam() { return Move("Body Slam", "Slams into the target.", 60, 90); }
Move GetMove(int index)
{
switch (index)
{
case 1: r... | true |
ea4b69c54cd28852d09d63c07e314d3acd55b018 | C++ | DriftingLQK/TrainCamp | /TrainTask/UnitTest_Solve/Test6.cpp | GB18030 | 1,358 | 2.546875 | 3 | [] | no_license | #include "stdafx.h"
void Test6(CString Title)
{
//// ȡ
int TestNum = GetPrivateProfileInt(Title, TestNumKey, 0, FILEPATH);
CString TitleFind, ArrayFind, ValueFind; //ʽϢ
ArrayFind = TestInputKey_Input;
ValueFind = TestOutputKey;
char SSS[DATASUM_BUFFER];
for (int i = 0; i < TestNum; i++) //for ѭԲ
{
_i... | true |
441306cd242253272b4d6c2adee63dc8dec6fa8b | C++ | nfb1799/IGME-209 | /Exam2/Exam2/Ogre.cpp | UTF-8 | 711 | 3.046875 | 3 | [] | no_license | #include "Ogre.h"
#include <iostream>
using namespace std;
Ogre::Ogre() : MovableObject()
{
inventoryIds = new int[3]{ 3, 9, 12 };
}
Ogre::Ogre(int _xPosition, int _yPosition) : MovableObject(_xPosition, _yPosition)
{
inventoryIds = new int[3]{ 3, 9, 12 };
}
Ogre::Ogre(int _xPosition, int _yPosition, int* _invent... | true |
1df971e9bef6da5d9f915e0f30f6be1d2d403791 | C++ | hustlyhang/WSlyh | /http/timer.cpp | UTF-8 | 3,201 | 2.84375 | 3 | [] | no_license | #include "timer.h"
#include <string.h>
CHeapTimer::CHeapTimer(int _delaytime) {
m_iExpireTime = time(NULL) + _delaytime;
m_iPos = 0;
}
CTimerHeap::CTimerHeap(int _capacity):m_iCapacity(_capacity), m_iCurNum(0) {
m_aTimers = new CHeapTimer*[m_iCapacity]();
if (!m_aTimers) throw std::exception();
}
C... | true |
1db3b3503e1a65195e0d6609b44c2b860f406d6b | C++ | shubha360/CPP-Practice-Codes | /DS & Algo (Bari tutorial)/Stack/Infix to postfix 1/main.cpp | UTF-8 | 1,156 | 3.53125 | 4 | [] | no_license |
// only supports +,-,*,/
#include<iostream>
#include<stack>
using namespace std;
bool isOperand(char c) {
if (c == '+' || c == '-' || c == '*' || c == '/')
return 0;
return 1;
}
int precedence(char c) {
if (c == '+' || c == '-')
return 1;
else if (c == '*' || c ... | true |
f3f68376718cf24cefacac920649899716f6af25 | C++ | orangewangjie/Algorithm-Dryad | /05.LinkedList/143.重排链表.cpp | UTF-8 | 2,326 | 3.484375 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=143 lang=cpp
*
* [143] 重排链表
*
* https://leetcode-cn.com/problems/reorder-list/description/
*
* algorithms
* Medium (59.50%)
* Likes: 500
* Dislikes: 0
* Total Accepted: 77.9K
* Total Submissions: 130.9K
* Testcase Example: '[1,2,3,4]'
*
* 给定一个单链表 L:L0→L1→…→Ln-1→Ln ,
* ... | true |
39b2c6e57c36c1d2051f62fe9d7ed7df7484f1cb | C++ | zitanguo/sph_cpp_serial | /calculate_variables.cpp | UTF-8 | 3,459 | 2.609375 | 3 | [] | no_license | #include <mpi.h>
#include <hdf5.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <iterator>
#include "particle.h"
void calculate_sml_den_prs(int NumoNgb, int NumoPar, std::vector<Particle *> VecoPtr2Par,
double ga... | true |
6b523e25a1f00eda90df0f4b7e6a743c55d64f20 | C++ | ankenman/CS162_Winter2020 | /Final/final.cc | UTF-8 | 3,646 | 4.15625 | 4 | [] | no_license | #include <iostream>
using namespace std;
// TODO: use a loop and pointers to add all elements in array ptr
// There shouldn't be any square brackets [] in the solution
// 15 points
double sumLoop(double* ptr, size_t size) {
return 0.0;
}
// TODO: use recursion to sum all the elements in array ptr
// Define your b... | true |
f923a919ab982a68db19d4671d574859ac982bfc | C++ | nchkdxlq/Algorithm | /Algorithm/Algorithm/Graph/SparseGraph.hpp | UTF-8 | 1,478 | 3.15625 | 3 | [
"MIT"
] | permissive | //
// SparseGraph.hpp
// Algorithm
//
// Created by nchkdxlq on 2017/9/13.
// Copyright © 2017年 nchkdxlq. All rights reserved.
//
#ifndef SparseGraph_hpp
#define SparseGraph_hpp
#include <stdio.h>
#include <vector>
using namespace std;
/*
稀疏图 邻接表
缺点:
1.
*/
class SparseGraph {
private:
int m_v;... | true |
cc59cb549447be754a3fbefb6062fefdbab55e28 | C++ | mvdsanden/mvds | /Process/execute.cc | UTF-8 | 1,835 | 2.953125 | 3 | [] | no_license | #include "process.ih"
#include <cstdlib>
#include <fcntl.h>
#include <iostream>
#include "../FDStream/fdstream.hh"
#include "../IOError/ioerror.hh"
int Process::execute(std::string const &command)
{
d_inPipe[0] = 0;
d_inPipe[1] = 0;
// Create the pipes
if (pipe(d_inPipe) < 0)
throw IOError(errno,"Process:... | true |
ca4b0600873cb8ded22578c9e3bc8534102b1070 | C++ | hobbang2/Algorithm | /legacy/백준알고리즘/boj6044_애너그램.cpp | UTF-8 | 1,060 | 3.109375 | 3 | [] | no_license | //#include <iostream>
//#include <string>
//#include <vector>
//#include <set>
//#include <algorithm>
//using namespace std;
//
//int main()
//{
// int N;
// cin >> N;
// getchar();
//
// vector <vector <char> > word_dict(N);
// char alpha = '0';
//
// for(int i = 0; i < N ; i++)
// {
// while (scanf("%c", &alpha), a... | true |
2a25ad3edcb6b83415b771ebb691a34959ecf916 | C++ | d3v1c3nv11/eduArdu | /SOFTWARE/3_eduArdu_LightSensor/Light_Sensor.cpp | UTF-8 | 259 | 3 | 3 | [
"Apache-2.0"
] | permissive | #include "Light_Sensor.h"
Light_Sensor::Light_Sensor (int _Pin)
{
Pin = _Pin;
pinMode (Pin, INPUT_PULLUP);
}
int Light_Sensor::Read ()
{
return analogRead(Pin);
}
float Light_Sensor::ReadPercentage ()
{
return Read() * 100.0/1023.0;
}
| true |
7d07a07c3c573fb1b779eb6a8701dffdb42f80f0 | C++ | ruher/libcanon | /include/libcanon/eldag.h | UTF-8 | 35,799 | 2.890625 | 3 | [
"MIT"
] | permissive | /** Canonicalization of edge-labelled directed acyclic graphs.
*
* Edge-labelled directly acyclic graphs (ELDAGs) are generalization of the
* normal DAGs with a label for each edge. And the labels for the edges can
* possibly be permuted. The algorithm here is based on the spirit of the
* algorithm by B McKay fo... | true |
7d154998f07095fd1f467eaa0ec4a087177878ea | C++ | tomaszkrysiuk/szkolenieWroclaw | /buyablesquare.cpp | UTF-8 | 684 | 2.6875 | 3 | [] | no_license | #include "buyablesquare.h"
void BuyableSquare::onEnter(Player& enteringPlayer)
{
if(owner)
chargeFee(enteringPlayer);
else
proposePurchase(enteringPlayer);
}
void BuyableSquare::chargeFee(Player& playerToCharge)
{
auto fee = getFee();
if(owner)//todo
(*owner)->giveMoney(player... | true |
c4bdfcaf5be8e883514c2064626b6f7c4aa8edc8 | C++ | attkke/FuckCATS | /subject-4/OPT.cpp | UTF-8 | 2,722 | 3.109375 | 3 | [] | no_license | // FILENAME: OPT.cpp
#include <iostream>
using namespace std;
int main() {
int memory[4] = {-1, -1, -1, -1};
int page[12] = {0, 6, 1, 5, 3, 7, 6, 7, 4, 3, 6, 1}; // the test pages
int count = 0; // missing page count
int replace[12]; ... | true |
27ad147e0ed12ed969f7baae1f362726e7987e4c | C++ | Aya-ZIbra/Dijkstra | /Heap.h | UTF-8 | 1,943 | 3.40625 | 3 | [] | no_license |
/**
* A simple Heap class.
*
* @author
* Aya Zaki Ibrahim <aya.zaki.2012@gmail.com>
*/
/* supported operation
- extractMin
- removeMin
- insert(key)
- delete(key)
- decreaseKey(key)
*/
#ifndef HEAP_H
#define HEAP_H
#include <vector>
template <typename T>
class Heap{ // no brackets afte... | true |
215a6633727dd09991dd2c16f691a0f516a6188e | C++ | PeachChen/test | /public/libutil/MyStream.h | GB18030 | 9,258 | 2.953125 | 3 | [] | no_license | //ݲ
#pragma once
#include "DefineHeader.h"
enum
{
STREAM_MAX_STRING_LEN=1024*1024*10,
STREAM_MAX_VECTOR_LEN=1024*1024*10,
STREAM_MAX_MAP_LEN=1024*1024*10,
};
enum EStreamError
{
EStreamError_Error,
EStreamError_OK,
EStreamError_BufferFull,
EStreamError_BadArg,
};
//ݽӿ
class BaseStream
{
... | true |
e18cbc630434a91791542ad8ca5ef8030f7bd5ff | C++ | m43/fer-ooup | /lab3/ex1-3/myfactory.h | UTF-8 | 1,613 | 3.125 | 3 | [] | no_license | //
// Created by m43 on 18. 05. 2020..
//
#ifndef FER_OOUP_MYFACTORY_H
#define FER_OOUP_MYFACTORY_H
#include <map>
#include <memory>
using namespace std;
template<typename PRODUCT>
class MyFactory {
public:
typedef PRODUCT *(*CREATORFUN)(const string &);
static MyFactory<PRODUCT> &instance();
int regi... | true |
73310cce16aff975853ef18e261608f0b3dcfe17 | C++ | akuzdeuov/kangaroo_x2_sabertooth32 | /include/motorControl.h | UTF-8 | 1,442 | 2.859375 | 3 | [] | no_license | //
// Created by askat on 1/6/20.
//
#ifndef MOTORCONTROL_MOTORCONTROL_H
#define MOTORCONTROL_MOTORCONTROL_H
#include <iostream>
#include <utility>
// C library headers
#include <string.h>
// Linux headers
#include <fcntl.h> // Contains file controls like O_RDWR
#include <termios.h> // Contains POSIX terminal control... | true |
4b69ae59d313f7dac7ba9743a530776436ea0577 | C++ | danlipsa/foamvis | /AverageCacheT1KDEVelocity.h | UTF-8 | 952 | 2.75 | 3 | [] | no_license | /**
* @file AverageCacheT1KDEVelocity.h
* @author Dan R. Lipsa
* @date 10 March 2011
* @ingroup model
* @brief Cache of 2D averages for T1KDE and velocity.
*/
#ifndef __AVERAGE_CACHE_T1KDE_VELOCITY_H__
#define __AVERAGE_CACHE_T1KDE_VELOCITY_H__
/**
* @brief Cache of 2D averages for T1KDE and velocity.
*/
cla... | true |
904162db3b5d16ba335e2b04d1487bb274616368 | C++ | NUC-NCE/algorithm-codes | /codes - ac/Gym/101653W/19564434_AC_15ms_236kB.cpp | UTF-8 | 1,555 | 2.515625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e7 + 5;
const int maxn = 2e5 + 5;
const int inf = 2e9;
int T;
int p, w, q;//点数,虫洞数,询问数
double a[100][100];
map<string, int>mp;
struct Node {
double x, y, z;
}point[100];
double dist(double x1, double y1, double z1, double x2, double y... | true |
586e2977ed3c251494c24e20d2ddb161e29cbcfc | C++ | bmstu-ics7/computer-graphics | /lab_07/mymath.cpp | UTF-8 | 378 | 2.9375 | 3 | [
"MIT"
] | permissive | #include "mymath.h"
int absx(int x)
{
return x >= 0 ? x : -x;
}
double absx(double x)
{
return x >= 0 ? x : -x;
}
int myRound(double x)
{
return int(x + 0.5 * (x / x));
}
int signx(double x)
{
return x == 0.0 ? 0 : x > 1 ? 1 : -1;
}
int signx(int x)
{
return x == 0 ? 0 : x > 1 ? 1 : -1;
}
int ... | true |
5e8cf6b43db3669af58e1154151df8e6002dc224 | C++ | Yangmila/c_code | /4/4-10-11.cpp | UTF-8 | 184 | 2.828125 | 3 | [] | no_license | #include <iostream.h>
int a[8]={1,3,5,7,9,11,13};
void fun(int b[],int n)
{
for(int i=0;i<n-1;i++)
b[7]+=b[i];
}
void main()
{
int m=8;
fun(a,m);
cout<<a[7]<<endl;
}
| true |
18742e25209c7fa3d831451c8c4f9ec360100b0a | C++ | protim2001/LeetCode | /power-of-two/power-of-two.cpp | UTF-8 | 895 | 3.375 | 3 | [] | no_license | class Solution {
public:
bool isPowerOfTwo(int n)
{
//1. doing AND: O(1)
/* if(n <= 0)
return false;
return n && (!(n & n - 1)); */
//2. taking log: log2(n)
/*if(n <= 0)
return false;
return floor(log2(n)) == ceil(log2(n));... | true |
74ac70a85dda14bf8194ab40071e162b62f76083 | C++ | BackhausL/cgv | /libs/vr/vr_kit.cxx | UTF-8 | 941 | 2.671875 | 3 | [] | permissive | #include "vr_kit.h"
namespace vr {
/// construct
vr_kit::vr_kit(vr_driver* _driver, void* _handle, const std::string& _name, bool _ffb_support, bool _wireless) :
driver(_driver), device_handle(_handle), name(_name), force_feedback_support(_ffb_support), wireless(_wireless) {}
/// declare virtual destructor
vr_k... | true |
cd8402bb15547ac5561e86ad7241b5400c254d3d | C++ | troytoman/Project4 | /StockServer/stock.cpp | UTF-8 | 2,766 | 3.15625 | 3 | [] | no_license | /*
* stock.cpp
* StockServer
*
* Created by Troy Toman on 4/17/10.
* Copyright 2010 Troy Toman. All rights reserved.
*
*/
#include "stock.h"
void Stock::createlisting (string ssymbol, float sprice, string coname) {
stocksymbol = ssymbol;
price = sprice;
companyname = coname;
}
void Stock::updatePrice (... | true |
19fddaa94973a12b4bb7eccad6ad99cc35bf4fab | C++ | amikai/flv2ts | /src/bin/parse-flv.cc | UTF-8 | 3,479 | 2.546875 | 3 | [] | no_license | #include <flv/parser.hh>
#include <iostream>
#include <inttypes.h>
int main(int argc, char** argv) {
if(argc != 2) {
std::cerr << "Usage: parse-flv FLV_FILE" << std::endl;
return 1;
}
const char* filepath = argv[1];
flv2ts::flv::Parser parser(filepath);
if(! parser) {
std::cerr << "Can't open... | true |
d43b483367eb8b8ae0e921429ff43500ce843055 | C++ | flourpower/cpp | /rev/rev.cpp | UTF-8 | 1,202 | 3.6875 | 4 | [] | no_license | //reverse the words in an input string
#include <iostream>
#include <vector>
using namespace std;
void tokenize(const string& str,
vector<string>& tokens,
const string& delimiters = " \t")
{
// Skip delimiters at beginning.
string::size_type lastPos = str.find_firs... | true |
076234d23fa0a561af0e3436ae7bdbf2d262c21b | C++ | Karlodun/c- | /Milestone 1/Spiel_des_Lebens_GUI/raptors.cpp | UTF-8 | 2,280 | 3.046875 | 3 | [] | no_license | #include "raptors.h"
#include "Raptors.h"
Raptors::Raptors()
{
Locations = new int [Population];
Age = new int [Population];
}
Raptors::~Raptors()
{
delete [] Locations;
delete [] Age;
}
int Raptors::Grow(int newID){
// create and fill BackPack:
BackPack = new int [Population];
for (int ... | true |
0f7150238ac741733af85aeb20fc41db7ae0816b | C++ | platinum78/cs_learning | /04_Programming Exercise/SWExpertAcademy/7853/7853.cpp | UTF-8 | 1,069 | 2.9375 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#define DIV 1000000007
char strBuf[1001];
long tripleCmp(long n1, long n2, long n3)
{
if (n1 == n2)
{
if (n2 == n3)
return 1;
else
return 2;
}
else
{
if (n2 == n3)
return 2;
else if (n1 == n3)
... | true |
970cd139ea2e575e3279187965de7974cc0951f4 | C++ | venkat78/agrid | /surface_mesh/hole_filler.hpp | UTF-8 | 3,045 | 2.765625 | 3 | [] | no_license | /*
* hole_filler.hpp
*
* Created on: Nov 28, 2011
*/
#ifndef _SURFACE_MESH_HOLE_FILLER_HPP_
#define _SURFACE_MESH_HOLE_FILLER_HPP_
#include <queue>
using namespace std;
#include "surface_mesh_class.hpp"
class cHOLE_VERTEX_RECORD {
public:
cHOLE_VERTEX_RECORD();
VOID VertexIndex(cSURFACE_MESH::cVERT... | true |
194c787d2b50bb744d10e0fcaf1d6b5dd7b74432 | C++ | Aarafat77VU/Data-Structure-Lab-Linked-List | /l.cpp | UTF-8 | 521 | 3.203125 | 3 | [] | no_license | #include<iostream>
#include<list>
using namespace std;
class Queue
{
list<int>mylist;
public:
void Push(int x)
{
mylist.push_back(x);
}
void Pop()
{
mylist.pop_front();
}
int Front()
{
cout<<mylist.front()<<endl;
}
int Back()
{
... | true |
22436f642d2d56414b48bff272255531b860112c | C++ | yumdeer/daily_practice | /vs_project/extern/extern/extern.cpp | UTF-8 | 272 | 2.84375 | 3 | [] | no_license | #include <iostream>
using namespace std;
//fun.h
template <typename T>
void fun(T t) {
cout << t << endl;
}
//use1.cpp
void test1() {
fun<int>(1);
}
//use2.cpp
//extern template void fun<int>(int);
void test2() {
fun<int>(2);
}
int main()
{
test1();
test2();
} | true |
d3497eba634af586e32fe818db6f1fcd7f43b740 | C++ | WhiZTiM/coliru | /Archive2/ce/969fb443886ae9/main.cpp | UTF-8 | 388 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <type_traits>
struct A {
int m;
};
struct B {
int m1;
private:
int m2;
};
struct C {
virtual void foo();
};
int main()
{
std::cout << std::boolalpha;
std::cout << std::is_standard_layout<A>::value << '\n';
std::cout << std::is_standard_layout<B>::value <<... | true |
6e3f8ed7e6789b4e9e0bbad23691f5999c25ad9a | C++ | google/fully-homomorphic-encryption | /transpiler/examples/calculator/calculator_test.cc | UTF-8 | 1,265 | 3.0625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | // Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | true |
16607cd7d9e74cfd95926e05463b56b5255806d4 | C++ | Josedm92/UD2 | /pipiiiii.cpp | UTF-8 | 1,179 | 3.828125 | 4 | [] | no_license | //Ejemplo 3.5.2 de la página 82 - Programa que calcula el valor de pi con una precisión establecida.
#include <iostream> //Incluimos librería iostream que permite la entrada por teclado y la salida por pantalla.
#include <cmath> //Incluimos librería cmath para poder usar la raíz cúbica (cbrt) y la potencia (pow).
#incl... | true |
27994073e5c5624203ad5bc8eac2bb5a940b32a3 | C++ | Innand/ProjetInfo2 | /Complet_sauf_k-connexe/Version22/accueil.cpp | ISO-8859-1 | 2,342 | 2.828125 | 3 | [] | no_license | #include "accueil.h"
/***************************************************
THING (test)
Cette classe correspond au cadre en bas gauche
avec diffrents bidules interactifs assembls dessus
VOIR LE CONSTRUCTEUR ET LA METHODE UPDATE EN DETAIL
( dans test.cpp ) pour dcrypter l'utilisatio... | true |
cfbee69c702829e27e3e07e5f0f13b8673f5113a | C++ | BoHauHuang/Leetcode | /easy/110. Balanced Binary Tree/Balanced Binary Tree.cpp | UTF-8 | 689 | 3.375 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | true |
6bca3912108f1bc514f98d8c0b5a0cff5bae4ee6 | C++ | wojtek5739g/Programy | /main (14).cpp | UTF-8 | 380 | 3.203125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int funkcja (int k)
{
int w;
for (int i=1; i<=k; i++)
{
if (i*i*i==k)
{
w=i;
}
}
if (w*w*w==k) return 1;
else return 0;
}
int main()
{
for (int i=1; i<=1000; i++)
{
if (funkcja(i)==1)
... | true |
48bea8d9356df141edd00bc67788ed9950fcc314 | C++ | hliuliu/USACO | /milk/milk.cpp | UTF-8 | 813 | 2.84375 | 3 | [] | no_license |
/*
ID: heng_li1
TASK: milk
LANG: C++11
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> PII;
int main() {
ofstream fout... | true |