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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
95e7d37e7afcbaa292d706049bec34c92e2c5d9c | C++ | ErickHernandez/Evaluaciones_Compi_1 | /Prueba2_P2_2020/parser.h | UTF-8 | 633 | 2.65625 | 3 | [] | no_license | #ifndef _EXPR_PARSER_H
#define _EXPR_PARSER_H
#include <iosfwd>
#include "lexer.h"
class Parser {
public:
Parser(Lexer &lexer): lexer (lexer) { }
void parse() {
currToken = lexer.getNextToken();
input();
if(currToken != Token::Eof){
throw "Syntax Error not EoF Reached";
} else {
std::cout... | true |
ce3b88f8835e93faa7c3b5d35dc96fe6ca9cb426 | C++ | ElNatcho/SenseHat_TicTacToe | /RPi_TicTacToe/CGridRenderer.cpp | ISO-8859-1 | 2,176 | 2.984375 | 3 | [] | no_license | #include"CGridRenderer.hpp"
// -- Konstruktor --
CGridRenderer::CGridRenderer() {
// Alloc Memory
_timeMgr = new ST::CTimeMgr();
_ledMatrix = new CLEDMatrix(GD::fb);
_curSelected = new _selected{};
_elapsedTime = new sf::Time();
_curSelected->x = new int;
_curSelected->y = new int;
_curSelected->display = new ... | true |
26420da9c6dd96b0f4431cfc368417276981d9e7 | C++ | haus-bus/HausBusControls-ESP8266 | /lib/ArduinoHAL/ResetSystem.h | UTF-8 | 2,067 | 2.859375 | 3 | [] | no_license | /*
* ResetSystem.h
*
* Created on: 17.07.2017
* Author: Viktor Pankraz
*/
#ifndef ResetSystem_H
#define ResetSystem_H
#include <Arduino.h>
class ResetSystem
{
//// Operations ////
public:
///*! \brief This function lock the entire clock system configuration.
// *
// * This... | true |
04b73e527cc5b6757e86df1daa7235d492774eac | C++ | mehulthakral/logic_detector | /backend/CDataset/hasCycle/hasCycle_6.cpp | UTF-8 | 668 | 3.46875 | 3 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
class ListNode{
public:
ListNode* next;
int val;
};
bool hasCycle(ListNode *head) {
if(head=... | true |
68ab30a52107a45a231d622a24984fc6e1a63125 | C++ | yoongoing/Algorithm | /~2019/1546.cpp | UTF-8 | 320 | 2.59375 | 3 | [] | no_license | #include <stdio.h>
int main(int argc, char const *argv[])
{
int n,i;
float data[1001],max=0,total=0;
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%f",&data[i]);
if(data[i] > max) max = data[i];
}
for(i=0; i<n; i++){
data[i] = (data[i] / max )*100;
total += data[i];
}
printf("%f\n",total/n);
return 0;
} | true |
da7b2bcab1b640b935e70c9776df56696c98913e | C++ | Guyntax/INF1010 | /TP3/src/Consultation.cpp | UTF-8 | 2,576 | 3.328125 | 3 | [] | no_license | //! Implémentation de la classe abstraite Consultation qui permet de gérer les consultations de l’hôpital.
//! \Authors: Didier Blach-Laflèche & Maude Tremblay
//! \date 07 Juin 2020
#include "Consultation.h"
#include <iostream>
#include <string>
//! Constructeur par paramètres de la classe abstraite Consultation
//!... | true |
5aa793181c71237f5e47e57d98993ff79e6a6dea | C++ | ShinW0330/ps_study | /06_Tree/Level2/9934.cpp | UTF-8 | 1,342 | 3.484375 | 3 | [] | no_license | // 완전 이진 트리
// https://www.acmicpc.net/problem/9934
// 힌트
// 1. Input으로 들어오는 값들을 하나의 배열에 입력 받았을때, 가운데 값을 중심으로 왼쪽 오른쪽 트리가 만들어짐
// 2. 1의 방식이 재귀함수 방식으로 왼쪽 트리, 오른족 트리에서 동일하게 적용됨
// 3. 트리의 깊이에 따른 vector를 선언하여 입력을 받아놓으면, 나중에 깊이에 따라 출력할 수 있음.
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vec... | true |
9a39f84d542dc833195218a369987089c89cafc3 | C++ | kcat/XLEngine | /thirdparty/AngelCode/sdk/tests/test_feature/source/test_object.cpp | UTF-8 | 6,957 | 2.5625 | 3 | [
"Zlib",
"MIT"
] | permissive | #include "utils.h"
namespace TestObject
{
#define TESTNAME "TestObject"
static const char *script1 =
"void TestObject() \n"
"{ \n"
" Object a = TestReturn(); \n"
" a.Set(1); \n"
" TestArgVal(a); \n"
" Assert(a.Get() =... | true |
485990f327a91b156e8562ea1ac7fec405dc1628 | C++ | jinnaiyuu/Parallel-Best-First-Searches | /src/multi_a_star.cc | UTF-8 | 1,535 | 2.578125 | 3 | [
"MIT"
] | permissive | // © 2014 the PBNF Authors under the MIT license. See AUTHORS for the list of authors.
/**
* \file multi_a_star.cc
*
*
*
* \author Ethan Burns
* \date 2008-11-07
*/
#include "util/thread.h"
#include "util/timer.h"
#include "state.h"
#include "astar.h"
#include "multi_a_star.h"
MultiAStar::MultiAStar(unsigned... | true |
7561c712e83f374ab74e2c44b84742d7ef8b95d4 | C++ | iamard/Online-Judgement | /LeetCode/811. Subdomain Visit Count.cpp | UTF-8 | 1,121 | 2.953125 | 3 | [] | no_license | class Solution {
public:
vector<string> subdomainVisits(vector<string>& cpdomains) {
unordered_map<string, int> table;
for (int i = 0; i < cpdomains.size(); i++) {
string domain = cpdomains[i];
int pos = 0;
while(pos < domain.length() && d... | true |
ef2e226232fbd60806f85ae12e99884efa051635 | C++ | eeeeeeeelias/cpp_hw_quarter2 | /contest_11/7_cut.cpp | UTF-8 | 1,080 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
std::string getRow(std::string& currentLine, int rowNumber) {
if (rowNumber < 1) {
return "";
}
for (int i = 1; i != rowNumber; ++i) {
if (currentLine.find('\t') != std::string::npos) {
currentLine = currentLine.substr(curr... | true |
8f652bd1d5ee71330e53bdef0398c02a1bd5a449 | C++ | mayanksingh1998/C-Network-Programming | /sheet-2/GoBackN.cpp | UTF-8 | 3,914 | 3.03125 | 3 | [] | no_license | //Author: P. Bharat
//Roll No: 08114022
//Branch: CSE, 4th year
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
//Global time
int globalTime = 0;
//the area till which the receiver has acknowedged
int receiverAck;
// To determine the efficiency of the network
float... | true |
6db7877052c6446d66cbae0afe72f44f3db3eb19 | C++ | EggyJames/Leetcode | /46.cpp | UTF-8 | 453 | 2.65625 | 3 | [] | no_license | class Solution {
public:
int jump(vector<int>& nums) {
if(nums.size() == 0)
return 0;
int cnt = 0;
int start = 0,reach = 0;
while(reach<nums.size() - 1){
int farest = 0;
for(int i = start;i<=reach;i++){
farest = max(farest,i+nums[i]... | true |
57fd11c7fcd0cf26ccd8abe91f3ad77448ab3eb7 | C++ | ManhND27/C-Cplus | /final-example-NguyenDucManh/chap13/PRG2/main.cpp | UTF-8 | 1,678 | 3.828125 | 4 | [] | no_license | #include <iostream>
using namespace std;
class Complex
{
private:
float real;
float ima;
public:
Complex(): real(0), ima(0){ }
void input()
{
cout << "Enter real: ";
cin >> real;
cout << "Enter imaginary: ";
cin >> ima;
}
//overload
Complex operator + (Complex c2)
{... | true |
987c8df8651bc46d49f973d3d24186a03a38e998 | C++ | chrisdepas/6Shots-Game | /6Shots-V2/CAnimatedSprite.h | UTF-8 | 2,641 | 2.71875 | 3 | [
"CC0-1.0"
] | permissive | #ifndef __CANIMATEDSPRITE_H__
#define __CANIMATEDSPRITE_H__
/* Handler for Darkfunction exported sprites
http://darkfunction.com/editor/documentation
*/
#include "CGame.h"
class CAnimatedSprite {
/* Time for each frame in an animation */
const float ANIMATION_FRAME_TIME = 0.02f;
class CSpriteImg {
... | true |
04c5b8191ff0238ccc5f5292351be3f74a4d324f | C++ | Anushkakesharwani/Cpp-program | /class.cpp | UTF-8 | 431 | 3.703125 | 4 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
class employee{
public:
int id;
string name;
float salary;
void insert(int i,string n,float s)
{
id=i;
name=n;
salary=s;
}
void display()
{
cout<<id<<" "<<name<<" "<<salary<<endl;
}
};
int main()
{
employee e1... | true |
5c57dee7eed8bd920d4cecf47e89f80794ff548f | C++ | socc-io/algostudy | /SCPC/smilu/2018/4.cpp | UTF-8 | 4,075 | 3.265625 | 3 | [] | no_license | /*
You should use the statndard input/output
in order to receive a score properly.
Do not use file input and output
Please be very careful.
*/
#include <iostream>
#include <vector>
#include <list>
#include <map>
using namespace std;
int gcd(int a, int b)
{
if(b == 0) return a;
int tmp = a % b;
return gcd(b, t... | true |
8df723bc8fbde46d438029e4dad90f1afd98d2f0 | C++ | murfreesboro/cppints | /util/constants/constant.cpp | UTF-8 | 1,755 | 3.15625 | 3 | [
"MIT"
] | permissive | //
// This simple program is used to generate the constants
// for the cppints program
// all of constants are defined as macro
// fenglai liu
//
#include<cstdlib>
#include<cstdio>
#include<string>
#include<cmath>
#include "boost/lexical_cast.hpp"
using boost::lexical_cast;
using namespace std;
int main()
{
cout <<... | true |
b48ec1104dd3348c0a5025c84af28f7bf343c22b | C++ | siskinc/util-cpp | /src/sockets/SocketException.hpp | UTF-8 | 516 | 2.640625 | 3 | [] | no_license | //
// Created by siskinc on 18-3-28.
//
#ifndef NET_SOCKETEXCEPTION_HPP
#define NET_SOCKETEXCEPTION_HPP
#include <exception>
#include <string>
#include <cstring>
#include <cerrno>
class SocketException : public std::exception
{
public:
SocketException(int error)
: exception()
{
error_str_... | true |
d27d14ee5320a4f8f238e8d26b288639b188a5a3 | C++ | NotMichaelChen/index_update | /block_matching/src/Structures/translationtable.cpp | UTF-8 | 2,500 | 2.65625 | 3 | [] | no_license | #include "translationtable.h"
#include <sstream>
#include <sys/socket.h>
#include <sys/time.h>
#ifdef _WIN32
#include <Winsock2.h>
#endif /* _WIN32 */
using namespace std;
string transToString(Translation& t);
Translation stringToTrans(const string& s);
TranslationTable::TranslationTable() {
#ifdef _WIN32
... | true |
3e25f391fbf9e4d8dde5d3ae1c0fc6f199e4ab3e | C++ | mrdrivingduck/leet-code | /1423.MaximumPointsYouCanObtainFromCards.cpp | UTF-8 | 3,446 | 3.71875 | 4 | [
"MIT"
] | permissive | /**
* @author Mr Dk.
* @version 2021/02/06
*/
/*
There are several cards arranged in a row, and each card has an
associated number of points The points are given in the integer
array cardPoints.
In one step, you can take one card from the beginning or from the
end of the row. You have to take e... | true |
fb9ec312ced56c1827c1ed608f8eced99cadc5b8 | C++ | rys1689434805/example | /slaver_container.cpp | UTF-8 | 2,215 | 2.71875 | 3 | [] | no_license | #include <cstdio>
#include <stdlib.h>
#include <hiredis/hiredis.h>
#include <hiredis/async.h>
#include <hiredis/adapters/libevent.h> //这个libevent中没有定义stdlib会用到stdlib中的东西,所以要放到后面
#include <event.h>
#include <string>
using namespace std;
void my_callback(struct redisAsyncContext *pc, void *reply, void *private_data)
{... | true |
cbfef5adea005694ca2c71fc1ae6d93c16a49e3b | C++ | codeStack82/Cpp | /week 6/hunt_W6_HW_Zabrina.cpp | UTF-8 | 7,330 | 3.140625 | 3 | [
"MIT"
] | permissive | /*
* Tyler Hunt
* Advanved C++
* OCCC Fall 2017
* Due: 10/15/17
* Details: Simple Sorts Homework
* Reference Material https://solarianprogrammer.com/2012/10/14/cpp-11-timing-code-performance/
* Reference Material: http://www.geeksforgeeks.org/quick-qSort/
* Reference Material: http://homepage.divms.uio... | true |
330a0a3732bf8690c586e7fd306451a062c483b3 | C++ | Anubha-Singh/Competetive-coding | /Project Euler/euler12.cpp | UTF-8 | 629 | 2.515625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std ;
long long tau(long long num) {
long long n = num;
long long i = 2;
long long p = 1;
if (num == 1) return 1;
while (i * i <= n) {
long long c = 1;
while (n % i == 0) {
n/= i;
c++;
}
... | true |
089f966b1dd76b77a051d41c4a01669e465cb55e | C++ | 5fe6eb50c7aa19f9/OJ | /uva/382.cpp | UTF-8 | 601 | 2.578125 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
long long n,i,j,ans;
printf("PERFECTION OUTPUT\n");
while(scanf("%lld",&n)&&n){
ans=n>1?1:0;
for(i=2;i*i<=n;i++){
if(n%i==0){
ans+=i;
if... | true |
b5976bd6c7380cfd94b09a3922d1143228e27c9f | C++ | Yessengerey/Game-Dev | /NomNomSweets Game Engine/NomNomSweets Game Engine/TextureManager.h | UTF-8 | 966 | 3.0625 | 3 | [] | no_license | #pragma once
#include <SFML\Graphics.hpp>
#include <map>
#include <string>
#include <iostream>
#include "Singleton.h"
//Pre define the texture path to all texture files
#define TEX_PATH "Resources\\Textures\\"
using std::map;
using std::string;
using std::cout;
/*
A class that is responsible for managing the text... | true |
aba831a9f545e66e927e3e98b1ffb272bf4541b8 | C++ | dddddtest/CPP_TECHNOLOGY | /D.HW4/H/H.cpp | UTF-8 | 2,075 | 3.015625 | 3 | [] | no_license | //Fadeev Sergey. 2019
//Задача H. СУ-ДО-КУ
//http://neerc.ifmo.ru/teaching/cpp/year2018/sem2/hw/hw4.pdf
#include <iostream>
long arr4Ch[9];
long arr[9][9];
using namespace std;
bool in()
{
for (int i = 0 ; i < 9; ++i)
{
for (int k = 0; k < 9; ++k)
{
cin >> arr[i][k];
i... | true |
b86d7a32523484af6c8ef4b5b49c9de869ffcc44 | C++ | vgasparyan1995/InstantChat | /src/Generic/ChatMessage.h | UTF-8 | 725 | 2.6875 | 3 | [] | no_license | #pragma once
#include <cstdlib>
#include <string>
#include "Serializers.h"
namespace Generic {
class ChatMessage
{
public:
static const int s_headerSize = sizeof(size_t);
public:
ChatMessage();
size_t getLength() const;
std::string getSender() const;
std::string getText() co... | true |
ea387f360845eb5f84574fd49ef2d92eaa7f2bb5 | C++ | PikoAll/ASD-Strutture | /Linked List/src/Rating.cpp | UTF-8 | 654 | 3 | 3 | [] | no_license | /*
* Rating.cpp
*
* Created on: 16 ott 2020
* Author: peppi
*/
#include "Rating.h"
#include <string>
#include <iostream>
using namespace std;
Rating::Rating(string nome,string prodotto, int v) {
// TODO Auto-generated constructor stub
setNome(nome);
setProdotto(prodotto);
setRating(v);
}
void Rating... | true |
830159213c21b0e554621cf39a7218d6d83fc1bc | C++ | yaroslav-tarasov/3dcgtutorials | /04_PopBuffer/osgPop/LevelOfDetailGeometry.h | UTF-8 | 2,078 | 2.546875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vector>
#include <string>
#include <osg/Geode>
#include <osg/Geometry>
namespace osg
{
struct PopCullCallback;
class OSG_EXPORT LevelOfDetailGeometry : public osg::Geometry
{
public:
friend struct PopCullCallback;
LevelOfDetailGeometry();
LevelOfDetailGeometry(const LevelOfDetailGeome... | true |
5628d5292e2424e5fabf1e42b5da671561d5144f | C++ | blizmax/AntiradianceCuts | /Framework/OGLResources/COGLUniformBuffer.cpp | UTF-8 | 2,090 | 2.75 | 3 | [] | no_license | #include "COGLUniformBuffer.h"
#include <assert.h>
uint COGLUniformBuffer::static_GlobalBindingPoint = 0;
COGLUniformBuffer::COGLUniformBuffer(uint size, void* data, GLenum usage, std::string const& debugName)
: COGLResource(COGL_UNIFORMBUFFER, debugName), m_Size(0)
{
m_Size = size;
m_GlobalBindingPoint = GetUniq... | true |
7aa2fa93fb1c6cf25d573ee54e0cbdfe49d2b60a | C++ | tlouwers/STM32F4-DISCOVERY | /drivers/drivers/Watchdog/Watchdog.hpp | UTF-8 | 2,558 | 2.71875 | 3 | [] | no_license | /**
* \file Watchdog.hpp
*
* \licence "THE BEER-WARE LICENSE" (Revision 42):
* <terry.louwers@fourtress.nl> wrote this file. As long as you retain
* this notice you can do whatever you want with this stuff. If we
* meet some day, and you think this stuff is worth it, you can buy me
... | true |
a5182593e45c4f577824057b3a0d973efbc828d8 | C++ | roznet/autoalign | /src/align_ast.h | UTF-8 | 939 | 3.21875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <memory>
#include "align_value.hpp"
using namespace std;
class AST {
public:
AST() {};
~AST() {};
virtual int value()=0;
};
class AST_op : public AST {
public:
typedef enum {
tPlus, tMinus, tMultiply, tDivide
} OperationType;
private:
OperationType m_type;
shared_ptr<AST> ... | true |
68e83bfa695d23287a351d4105af2673931f7647 | C++ | conlen/CPP | /src/vektor/test.cpp | UTF-8 | 4,027 | 3.46875 | 3 | [
"BSD-2-Clause"
] | permissive | #include <iostream>
#include <new>
#include "vektor.hpp"
using namespace std;
void test1()
{
vektor<float> x;
std::vector<float> v = {1.0, 2.0, 3.0};
cout << "test1" << endl;
x = v;
cout << "x = " << x << endl;
cout << "end test1" << endl;
return;
}
void test2()
{
std::vector<double> v = {1.0, 2.0, 3.0};... | true |
ceea4c2d848d29a5c95ff2586bc22ecb80191c66 | C++ | trishnakalita660/Interview | /InterviewQtns/Graphs/Birpartite/B_DFS.cpp | UTF-8 | 813 | 3.1875 | 3 | [] | no_license | // Expected Time Complexity: O(V)
// Expected Space Complexity: O(V)
class Solution {
public:
bool bipartite(int color[],vector<vector<int>> graph,int node){
if(color[node]==-1) color[node]=1;
for(auto x: graph[node]){
if(color[x]==-1){
color[x] = 1-color[node];
... | true |
424e1da65f30e316809f69616930e4a3ac571188 | C++ | Siwencjusz/SI | /kuba.cpp | WINDOWS-1250 | 3,670 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <math.h>
using namespace std;
double **G;
int xcel = 20;
int ycel = 20;
class kwadrat;
std::vector < kwadrat > otwarta;
std::vector < kwadrat > zamknieta;
class kwadrat {
public :int x;
public :int y;
public :int pozycjaRodzica;
... | true |
3a66f0713330daa7f84d07efe68cf199cbe8135e | C++ | EthanWelsh/Network-Routing-Simulator | /routelab-f12/table.h | UTF-8 | 1,178 | 2.921875 | 3 | [] | no_license | #ifndef _table
#define _table
#include <iostream>
#include <map>
#include <deque>
#include "link.h"
using namespace std;
struct TopoLink
{
TopoLink() : cost(-1), age(0)
{
}
TopoLink(const TopoLink &rhs)
{
*this = rhs;
}
TopoLink &operator=(const TopoLink &rhs)
{
this... | true |
1ada79799cbb5584fd14a5865ad089447003ad9b | C++ | Knabin/TBCppStudy | /Chapter6/Chapter6_05/main_chapter65.cpp | UTF-8 | 1,103 | 3.578125 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
const int num_rows = 3;
const int num_columns = 5;
for (int row = 0; row < num_rows; row++)
{
for (int col = 0; col < num_columns; col++)
{
cout << '[' << row << ']' << '[' << col << ']' << '\t';
}
cout << endl;
}
cout << endl;
int array[num_... | true |
2a924520ca2483f519a4f8c0b806ba6adeb4e5f3 | C++ | karitra/cpp-playground | /src/pair.cc | UTF-8 | 410 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <map>
using namespace std;
struct Boo {
enum Selector { Key, Value };
};
int
main()
{
map<int,string> m = { {1, "hello"}, {2, "bye-bye"} };
enum Selector { Key, Value };
for(const auto &kv : m) {
int k;
std::string v;
tie(k,v) = kv;
cerr
<< " k: " << std::get<Selecto... | true |
b70287fa3513b22ea2c4dbfb17f18bd6ed4bea06 | C++ | MaxHsuProgram/CPP | /GreenJudge/a/a035.cpp | UTF-8 | 202 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include<math.h>
using namespace std;
int main()
{
double a=0 , b = 0 , x = 0 , y = 0;
cin>>a>>b;
x = log10(a);
y = b * x;
cout << (int)floor(y) + 1;
} | true |
dd9f7494482d297c7275541b30dedeeda46fa48b | C++ | sorelmitra/learn | /c++/threads-sockets/src/av-client/main-client.cpp | UTF-8 | 1,242 | 2.609375 | 3 | [] | no_license | //
// main.cpp
// av-client
//
// Created by Sorel Mitra on 15/11/17.
// Copyright © 2017 Sorel Mitra. All rights reserved.
//
#include <iostream>
#include <unistd.h>
#include <cstdlib>
#include <string>
#include <iostream>
#include <cstdio>
#include "../common/net/defs.h"
#include "AvClient.h"
int main(int arg... | true |
dbe337ed92adceb4dfb7be9e88f80b222ec9cc10 | C++ | runzhesheng/li_yurun | /ex06_29/main.cpp | UTF-8 | 909 | 3.921875 | 4 | [] | no_license | #include <iostream>
#include <iomanip>
using namespace std;
bool Prime( int ); //声明函数为布尔类型,返回的变量为逻辑变量
int main()
{
int count=1;
cout<< "The prime numbers from 1 to 10000 are:" <<endl;
cout<< 2;
for (int i=3; i<10000; i=i+2 ) // 只需要判断奇数,偶数没有可能成为素数
{
if (Prime(i))
{
... | true |
f89e702d22c5a9b954008491c83254ea5722e7f5 | C++ | cvassago/priority_queue | /test_queue.cxx | UTF-8 | 461 | 3.03125 | 3 | [] | no_license | #include "priority_queue.hxx"
int main(int argc, char **argv)
{
priority_queue<int> queue;
int i;
i = 1;
std::cout << "ADD:" << std::endl;
while(i < argc)
{
queue.add(atoi(argv[i]));
i++;
}
queue.print();
std::cout << "\nDEL:" << std::endl;
while(!queue.empty())
{
std::cout << queue.max() << st... | true |
f07beb4785a46b16f901b35aff09839dbc0ada3e | C++ | gewaltig/sli3 | /sli_allocator.h | UTF-8 | 4,255 | 3.03125 | 3 | [] | no_license | /*
* allocator.h
*
* This file is part of NEST
*
* Copyright (C) 2004 by
* The NEST Initiative
*
* See the file AUTHORS for details.
*
* Permission is granted to compile and modify
* this file for non-commercial use.
* See the file LICENSE for details.
*
*/
#ifndef SLI_ALLOCATOR_H
#define SLI_ALL... | true |
7726ffbc982452703f08cb1619b4607936d65e09 | C++ | jaredpetersen/ghostlab42reboot | /examples/ex4_scrollingtextadvanced/ex4_scrollingtextadvanced.ino | UTF-8 | 2,215 | 3.421875 | 3 | [
"MIT"
] | permissive | #include <GhostLab42Reboot.h>
#include <Wire.h>
GhostLab42Reboot reboot;
void setup()
{
reboot.begin();
reboot.write(1, "126.2");
reboot.write(2, "-46.9");
}
void loop()
{
// String to be scrolled across the six digit display
// Need the extra spaces to make the scrolling smooth
String displayText = " ... | true |
e6dbc38243c0576fd031fdf9d0e9ec80ff327dff | C++ | paulRoux/dataStruct | /previous_datastruct/Hanoi/Hanoi.cpp | UTF-8 | 617 | 3.90625 | 4 | [] | no_license | #include <iostream>
using namespace std;
void move(int n, char x, char y)
{
cout<<"No."<<n<<": "<<x<<" -> "<<y<<endl;
}
void hanoi(int n, char a, char b, char c)
{
if(n == 1)
move(1,a,c);
else
{
hanoi(n-1,a,c,b); //可以理解为通过借助c,在b处已经放好n-1个盘
move(n,a,c); //第n号盘从a处移到c
... | true |
7381dc9aa1a5b565908361e9434960fd5adb627d | C++ | zhuyoujun/cpp | /ch3/exercises/ex3_2_1.cpp | UTF-8 | 438 | 3.109375 | 3 | [] | no_license | /*Date :2015/06/25
*Author :zhuyoujun
*Email :zhuyoujun0513@163.com
*Function:reading the standard input a word at a time.
*Link :C++ Primer 5th(english version)
@page90, ex3_2.
*/
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int ... | true |
c3c2eac342b79d4c7cbc9e26c444adb833e72138 | C++ | semmelknoedel/example | /include/MusicTape.h | UTF-8 | 1,121 | 2.796875 | 3 | [] | no_license | /*
* File: MusicTape.h
* Author: barbara
*
* Created on August 31, 2016, 11:25 AM
*/
#ifndef MUSICTAPE_H
#define MUSICTAPE_H
/*===========================================================================*
* INCLUDES C/C++ standard library (and other external libraries)
*======================================... | true |
cc1b606da35ebdc771f866a47036146b185992cf | C++ | harshp30/PCLEDLights | /WhiteLightCode/White_light.ino | UTF-8 | 350 | 2.515625 | 3 | [] | no_license | #define red 11
#define blue 10 //DigitalPin values for RGB and on-off and mode switch
#define green 9
#define on_off_swt 2
#define mode_switch 4
int red_pin = A3;
int blue_pin = A4;
int green_pin = A5;
void setup() {
}
void loop() {
analogWrite(red, 255);
analogWrite(blue, 255);
a... | true |
8355e760a1cb9c18f88442da84ff0539e836d9dd | C++ | Anubhav2907/DSA | /sortingQues/aashish.cpp | UTF-8 | 529 | 3.09375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void colors(int arr[], int n){
int low = 0;
int mid = 0;
int high = n-1;
while(mid<=high){
if(arr[mid]==0){
swap(arr[low],arr[mid]);
low++;
mid++;
}
else if(arr[mid]==1){
mid++;
... | true |
1c186dbca9044154103371e57138df450ef9a4e4 | C++ | rollingshow/test | /task3.cpp | UTF-8 | 408 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
int main()
{
string word, longest;
size_t maxlong=0;
ifstream words("words.txt");
while (!words.eof())
{
words>>word;
if (word.length() > maxlong)
{
maxlong= word.length();
... | true |
b84c52549a77b4db82b6a8663fde91ee8adcab33 | C++ | Zylann/SnowfeetEngine | /modules/render/GLContextSettings.h | UTF-8 | 1,480 | 2.71875 | 3 | [] | no_license | #ifndef __HEADER_SNR_GLCONTEXTSETTINGS__
#define __HEADER_SNR_GLCONTEXTSETTINGS__
#include <core/types.h>
#include <cmath>
#include <sstream>
namespace sn
{
struct GLContextSettings
{
u32 majorVersion;
u32 minorVersion;
u32 multiSampleLevel;
u32 stencilBits;
u32 depthBits;
GLContextSettings() :
... | true |
0dfd881b31ddaa9141163c67a94485d5d654b6a3 | C++ | ke-kontur/eps | /Services/Monitoring/EPSMonitoringService/monitoringsystem/local/services/src/main/native/wmi/wmi/monitoring_utils.h | UTF-8 | 632 | 2.78125 | 3 | [] | no_license | /**
* Utility classes
*/
class StringFromJavaReleaser {
private:
const wchar_t * gotten;
jstring initial;
JNIEnv *env;
public:
StringFromJavaReleaser(JNIEnv *env, jstring initial, const wchar_t * gotten) {
this->env = env;
this->initial = initial;
this->gotten = gotten;
}
~StringFromJavaReleaser() {
if (... | true |
0f1f36ddd13fed0d038b342a0976a4b154f1f8da | C++ | vinodkotiya/First-Website-Ever | /source/mycpp/V5NMCPP.CPP | UTF-8 | 4,186 | 2.765625 | 3 | [] | no_license | #include<iostream.h>
#include<conio.h>
#include<string.h>
int option();
void title(void);
char j;
class dir
{
long int fone,std;
double mobile;
char nm[10],snm[10],place[20],ct[10];
public:
void set(long int , long int ,double,char[],char[],char[],char[]);
void show();
void nmchoice();
void snmchoice();
vo... | true |
1bd9eeca7b9b26d2408afe11b44393934d21ab14 | C++ | ranxx/Reading | /jianzhioffer/chapter2/7.cpp | UTF-8 | 3,351 | 4.03125 | 4 | [] | no_license | #include <iostream>
#include <exception>
#include <string>
/*
输入某二叉树的前序遍历和中序遍历的结果, 请重建该二叉树.
假设输入的前序遍历和中序遍历的结果中都不包含重复的数字. 例如, 输入
前序遍历{1,2,4,7,3,5,6,8}和中序遍历{4,7,2,1,5,3,8,6}, 则
重建如图 2.6 所示的二叉树并输出它的头结点. 二叉树节点的定义如下:
struct BinaryTreeNode {
int m_nValue;
BinaryTreeNode* m_pLeft, m_pRigh... | true |
87009dde8ce0776eb077b7f4bc8d5e9eef441ea6 | C++ | KyungminYu/Algorithm | /BOJ/4355 서로소.cpp | UTF-8 | 561 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
#include <math.h>
int main(){
while(1){
int n; scanf("%d", &n);
if(n == 0) break;
int pi = 1;
int tmp = n;
for(int i = 2; i * i <= tmp; i++){
int cnt = 0;
if(tmp % i == 0){
while(!(tmp % i)) {
tmp ... | true |
0e7e39450d838d2cb2f3827df0e0b8ed311b4d65 | C++ | budsan/climbers | /logic/tilemap.cpp | UTF-8 | 751 | 2.890625 | 3 | [] | no_license | #include "tilemap.h"
#include <math.h>
Tilemap::Tilemap(float unitsPerTile) : m_unitsPerTile(unitsPerTile)
{
}
math::vec2i Tilemap::tilePos(math::vec2f pos)
{
return tilePos(pos.x, pos.y);
}
math::vec2i Tilemap::tilePos(float x, float y)
{
return math::vec2i(
(int) floor(x/m_unitsPerTile),
(int) floor(y/m_unit... | true |
9aaa9283968a0c68152b1b57ab906482f054927e | C++ | teng88/i2a | /poj1365.cpp | UTF-8 | 2,482 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include "number.h"
using namespace std;
using namespace i2a;
//typedef signed int int32_t;
//typedef unsigned int uint32_t;
//typedef signed long long int int64_t;
//typedef unsigned long long int ui... | true |
f6810d822a7157117ee7d2be3eb2b8bf1290c1f8 | C++ | blacksph3re/voidrunner | /src/Spaceship.cpp | UTF-8 | 1,502 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <SFML/Graphics.hpp>
#include "../h/Spaceship.hpp"
#include "../h/ResourceManager.hpp"
#include "../h/ConstantManager.hpp"
#include "../h/VectorCalculator.hpp"
int Spaceship::init() {
setTexture( ResourceManager::get().getTexture( "Spaceship" ) );
setPosition(sf::Vector2f(0, 0) );
... | true |
b1be96ad4c277ebe73f9cffd7fda41100bbf3137 | C++ | zavla/DeleteOldBackupFiles | /DeleteOldFilesCxx11/initFile.cpp | UTF-8 | 2,445 | 2.890625 | 3 | [] | no_license | #pragma once
//#pragma warning (disable 4996)
#include <vector>
#include "row2.h"
#include <fstream>
#include <iostream>
#include "InitFile.h"
namespace my {
/*! deletes quotes from string*/
bool readInitFile(std::vector<row> & v, std::wstring& Initfilename)
{
//!
//file format is:
//"j:\b\" 4days (ubcd... | true |
604eb93523ea62cac1148010b96ffa5e5f0fea40 | C++ | alexsr/vup | /src/libraries/vup/Geometry/Mesh.cpp | UTF-8 | 820 | 2.65625 | 3 | [] | no_license | //
// Alexander Scheid-Rehder
// alexanderb@scheid-rehder.de
// https://www.alexsr.de
// https://github.com/alexsr
//
#include "Mesh.h"
vup::Mesh::Mesh(const Mesh_data& m) {
m_count = m.count;
m_faces_count = m.faces_count;
m_vbos.push_back(std::make_shared<VBO>(m.vertices, 4));
m_vbos.push_back(std::... | true |
d7e79507bf96c83dd96c8adb600984f448651268 | C++ | jlj147/Data-Structures-and-Algorithms-Programs | /assign3_jlj147/StudentStack.h | UTF-8 | 904 | 3.453125 | 3 | [] | no_license | // File Name: StudentStack.h
//
// Author: Jayce Jones
// Date: 09/29/16
// Assignment Number: 3
// CS 3358: Fall 2016
// Instructor: CJ Hwang
//
// Represents a student record list
// Includes a students ID, name, avearge test score, and address
// Takes the student list and creates a stack, pops from stack
// and dis... | true |
1fba772f7e56051b903da7c615bf2b5a085a0879 | C++ | jmanna6/1440_HW04 | /Bingo/Card.h | UTF-8 | 518 | 2.609375 | 3 | [] | no_license | //
// Created by Jake on 3/2/2017.
//
#ifndef BINGO_CARD_H
#define BINGO_CARD_H
#include <ostream>
#include <algorithm>
#include "Cell.h"
class Card {
public:
Card(int size, int maxNum);
~Card();
void print(std::ostream& out) const;
void setPotentialValues(int maxNum);
private:
// Testing
... | true |
0186ff682b9a6753ad3c1a17d2bab0914aa082aa | C++ | atiabjobayer/Codes | /OJ/UVa/uva_10018.cpp | UTF-8 | 786 | 2.609375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main ()
{
//freopen("test/in.txt", "r", stdin);
//freopen("test/out.txt", "w", stdout);
long long int t;
cin >> t;
while(t--){
string num;
long long int sum = 0;
cin >> num;
string num_rev(num.rbegin(), num.ren... | true |
caa8831e6fd5b734a0b02572706d825e1b660479 | C++ | leewoongi/Algorithm | /BackJoon/17406/dong/배열돌리기.cc | UTF-8 | 2,609 | 2.71875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n, m, k;
int arr[51][51];
int tmp_arr[51][51];
int first_xy[2];
int end_xy[2];
int tmp;
int tmp_result[51];
int result = 210000000;
typedef struct NODE {
int r;
int c;
int s;
}node;
vector<node> v;
vector<int> v2;
void reset_... | true |
23a7d156d05927b07b6c9c33b5f02b89ecc0ed04 | C++ | Hackables44/TareaProgramadaII | /Texto.cpp | UTF-8 | 4,959 | 3.53125 | 4 | [] | no_license | //Texto.cpp Implementación de la clase Texto
#include "Texto.h" // Clase Texto
#include "Diccionario.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
// constructor por omisión
Texto::Texto(){
// inicialización de las variables de instancia (atributos)
diccionarioPtr ... | true |
db4a41a0a29c5e3985261903d72636368d4c7af1 | C++ | sfofgalaxy/Summary-of-Software-Engineering-Coursework-in-Zhejiang-University | /2大二/面向对象程序设计/课件/unit three courseware and code/unit three courseware and code/unit three code/Private Inheritance/intstack.h | GB18030 | 327 | 2.625 | 3 | [] | no_license | class intstack: private intlist{
public:
void push(int a)
{
insert(a); //ͷ
}
int pop()
{
return get(); //ȡͷ
}
void print() //
{
intlist::print();
}
};
/*
intstackûκο˽м̳intlistĴ
intstack c;
c.push(1);
c.pop();
*/
| true |
b378a6575217deec09999f3d78c9ce1d02b0c529 | C++ | idelgado2/DataStructures | /idelgado2Lab8/idelgado2Lab8 2/ArrayListType.h | UTF-8 | 8,989 | 3.609375 | 4 | [] | no_license | /********************************************************************
* Name: Isaac Delgado
* Course #: COSC2437
* Semester: Spring 2015
*** Code is taken from "Data Structures Using C++", by D.S. Malik***
********************************************************************/
#ifndef idelgado2Lab8_ArrayListType_h
#... | true |
4573a76240224d48ab316734bbb1e4a7adea6c7f | C++ | haojjang/jjang | /p3_60/main.cpp | UTF-8 | 2,080 | 2.78125 | 3 | [] | no_license | // Author: Justin Fung
#include "huffman.hpp"
int main (int argc, char *argv[])
{
Heap min_heap;
string input_buffer;
char decompress_mode[3] = "-d";
unsigned char c;
unsigned int freq_table[256] = {0};
unsigned int total_freq = 0, symbol_cnt = 0;
if (argc == 2)
{
if ( !strcmp(argv[1], decompress_mode) )... | true |
a8fca0040d9132962a01a8fe31b0b18136fc26d9 | C++ | t-kuha/sdsoc | /algorithm_sort/hw.cpp | UTF-8 | 1,919 | 2.65625 | 3 | [] | no_license | //
// Based on:
// I. Skliarova, V. Sklyarov, A. Sudnitson, M. Kruus,
// "Integration of High-Level Synthesis to the Courses on Reconfigurable Digital Systems",
// Proceedings of the 38th International Conference on Information and Communication Technology, Electronics and Microelectronics
// - MIPRO, Opatija, Croatia,... | true |
9ed43dd28f2a7d559e6d81f26e32640d67f6ebae | C++ | luohongliang-o/sysmonitor | /SysMonitor/link_manager.cpp | GB18030 | 5,416 | 2.546875 | 3 | [] | no_license | #include "load_config.h"
#include "link_manager.h"
#ifdef WIN32
CLinkManager::CLinkManager()
{
memset(m_aLinkInfo, 0, sizeof(OPLINK)*MAX_LINK_NUM);
m_nFailCount = 0;
// ::CoInitialize(NULL);
}
CLinkManager::~CLinkManager()
{
// ::CoUninitialize();
Exit();
}
BOOL CLinkManager::_Init(LPOPLINK pLinkInfo)
{
if (!pLin... | true |
374a2ca252f38523abcb599fcd4bf86faa7b4fea | C++ | panjunbing/DataStructure | /Test3-1/Test3-1/BinTree.cpp | GB18030 | 4,768 | 3.5 | 4 | [] | no_license | #include "StdAfx.h"
#include "BinTree.h"
#include <iostream>
#include <string>
using namespace std;
#include <queue>
const char RefValue = '#';
template <class T>
BinTree<T>::BinTree(void){
root = NULL;
}
template <class T>
BinTree<T>::~BinTree(void){
deleteTree(root);
}
template <class T>
void BinTree<T>::delet... | true |
32da55c68a6eec78d22c92c8f860e3f5fe617611 | C++ | josefnaslund/microcontrollers | /02_hid_pad/Observers.cpp | UTF-8 | 1,243 | 3.09375 | 3 | [] | no_license | #include "Arduino.h"
#include "Observers.h"
MyLed::MyLed(int pin, unsigned long interval, unsigned long len, int state) : pin(pin), interval(interval), len(len), state(state) {
last = millis();
on = false;
}
void MyLed::update(int val){
SerialUSB.print("Hey MyLed object (");
SerialUSB.print("pin ");
... | true |
4883b7af3f042cc37c11fda7f83dcf4b159a79af | C++ | BekzhanKassenov/olymp | /NSUTS/2013/Test tour/A/A.cpp | UTF-8 | 952 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n;
cin >> n;
int ans = 0;
int res = 0;
if (n >= 1) {
for (int i = 1; i <= 100; i++) {
if (i <= n)
ans += i;
for ... | true |
5bb94eac240793451a1c6171de01e3a6dd52936b | C++ | benbraide/cscript | /cscript/cscript/lexer/token.cpp | UTF-8 | 3,275 | 2.625 | 3 | [] | no_license | #include "token.h"
cscript::lexer::token::token(){}
cscript::lexer::token::token(const index &index, const std::string &value, int match_index, const adjustment &adjustment)
: index_(index), value_(value), match_index_(match_index), adjustment_(adjustment){}
cscript::lexer::token::token(const index &index, std::str... | true |
38353c4606ca7c18f93d2f7776f3d381fa402aab | C++ | LeyNe050309/Lista-Doblemente-Enlazada | /Lista doblemente enlazada/Doble lista.cpp | UTF-8 | 1,668 | 3.5625 | 4 | [] | no_license | #include <iostream>
#include <conio.h>
using namespace std;
struct Nodo{
int valor;
Nodo *Anterior;
Nodo *Siguiente;
};
void agregar(int);
void mostrar();
void mostrar_an();
struct Nodo *lista=NULL;
int main(int argc, char** argv) {
int option,agreg,num;
while(option!=3){
cout<<":-:-:LISTA DOBLEMEMNTE ENLAZADA:-:-:"<... | true |
22c9d0dc847130155abe38f14e69a6fbb5945462 | C++ | binaryDiv/bdEngine | /src/Texture2D.h | UTF-8 | 1,363 | 2.953125 | 3 | [] | no_license | #ifndef _BDENGINE_TEXTURE2D_H
#define _BDENGINE_TEXTURE2D_H
#include <GL/glew.h>
#include "Image.h"
namespace bdEngine {
class Texture2D {
public:
/*******************************************************************
* Construction and destruction
****************************************************************... | true |
6e7e870e3681aced5d92e53f2ec108bbb770f1f5 | C++ | sg0/Elemental | /examples/lapack_like/HermitianEigFromSequential.cpp | UTF-8 | 1,911 | 2.625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | /*
Copyright (c) 2009-2015, Jack Poulson
All rights reserved.
This file is part of Elemental and is under the BSD 2-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensource.org/licenses/BSD-2-Clause
*/
#include "El.hpp"
using namespace El;
using namespace s... | true |
8e7a787097d83690c4c1d1da650672d91d96c642 | C++ | CoolRuss/TcpUdpEx | /src/protocols.cpp | UTF-8 | 15,274 | 2.921875 | 3 | [] | no_license | #include "../includes/protocols.hpp"
///
/// TcpServer
///
TcpServer::~TcpServer()
{
this->close();
}
void TcpServer::init_server(int port_init, const string& address_init)
{
port = port_init;
message = string(message_size_max + 1, 0);
if ((socket = ::socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
per... | true |
0c14d4665e9e6a145d391441b2d7415d6fb5c1d4 | C++ | alexbajzat/C-Cpp-projects | /Laborator6-7/src/Header/controller.h | UTF-8 | 2,152 | 3.125 | 3 | [] | no_license | /*
* controller.h
*
* Created on: Mar 28, 2016
* Author: alex-bajzat
*/
#ifndef CONTROLLER_H_
#define CONTROLLER_H_
#include "../Header/disciplineRepo.h"
#include <string>
class DisciplineController {
private:
DiscRepository repository;
/*
* return the current repository
*/
DiscRepository* getRe... | true |
802d571512900871667137d584a75a10c462cc09 | C++ | RayCS2023/MST | /DisjointSet.cpp | UTF-8 | 4,031 | 3.546875 | 4 | [] | no_license | //
// DisjointSet.cpp
// MST
//
// Created by Raymond Chen on 2020-03-27.
// Copyright © 2020 Raymond Chen. All rights reserved.
//
#include "DisjointSet.hpp"
//constructors/destructors of Node class
Node::Node() {
next = nullptr;
list = nullptr;
}
Node::Node(const int &u) {
this->u = u;
next = n... | true |
60b87e13640bdf3f0aff27b2c581374c07a8d84e | C++ | dylanrichardson/factor | /factorRichardson.cpp | UTF-8 | 17,563 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <windows.h>
#include <math.h>
#include "dric.h"
using namespace std;
const int STR_LEN = 200;
const int ARR_LEN = 30;
void factor(float, float, float, char * * );
void quadratic(float, float, float, char * * );
void equation(void);
void writeHtml(float, float, float, ch... | true |
a8ae79387be19f0b935e3c5f6b8f1aaf7fbef6fe | C++ | nponcian/LibroDeConocimiento | /References/HexagonalString/RecursiveAlgorithm.cpp | UTF-8 | 2,682 | 3.015625 | 3 | [] | no_license | #include <RecursiveAlgorithm.hpp>
#include <string>
#include <unordered_set>
#include <utility>
#include <Grid.hpp>
namespace algo
{
namespace
{
std::pair<int, int> getColumnTopAndBotNeighbors(
const int row,
const int col)
{
return row % 2 ?
std::make_pair(col - 1, col) :
std::m... | true |
e44f7c9d30790043df2a4d2d1e9169f7e3ae1644 | C++ | BenniKunz/SFML-Game | /Game Engine/RocketParticle.cpp | UTF-8 | 1,848 | 2.78125 | 3 | [] | no_license | #include "RocketParticle.h"
Engine::RocketParticle::~RocketParticle()
{
std::cout << "RocketParticle Destructor" << std::endl;
}
void Engine::RocketParticle::InputHandler()
{
}
void Engine::RocketParticle::Update(float dt, std::vector<std::shared_ptr<IGamePart>>& _gameParts)
{
ParticleMovement(dt);
CollisionDete... | true |
e84c82011d43b649925d6e4bc6cd88b39feb5349 | C++ | halfopen/data_struct | /work2.1/expr/2013301500100.2.1.cpp | UTF-8 | 2,776 | 3.46875 | 3 | [] | no_license | #include "expr.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
/* -BLOCK----------- 如果需要, 你可以调用以下函数 ----------------- */
// 将由数字字符组成的 arr 转为数字, n 为 arr 的长度
static int NumFromArray(const char * const arr, int n);
// 根据运算符 op 进行运算, 获得运算结果
static int Calc(int a, int b, char op);
/* -END OF B... | true |
12c9117f3ca89248ad9e465c5d25f0bf26892010 | C++ | dillonanderson2023/CSCI-261 | /main.cpp | UTF-8 | 747 | 3.640625 | 4 | [] | no_license | /* CSCI 261 Lab 1C l: Geometric Calculations
*
* Dillon Anderson*/
#include <iostream>
using namespace std;
int main() {
int length = 17;
int width = 17;
int height = 2;
cout << "Enter length of box here: ";
cin >> length;
cout << "Enter width of box here: ";
cin >> width;
cout << "Ent... | true |
392c9d2e73126fec07690fc319e810b59916244a | C++ | tngo0508/Cplusplus-OCC- | /quiz3_practice/Project3/Function.cpp | UTF-8 | 7,774 | 3.484375 | 3 | [] | no_license | #include "DoublyList.h"
void DoublyList::insertBack(int newData)
{
Node *newNode = new Node(newData, NULL, last);
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->setNext(newNode);
last = last->getNext();
}
++count;
}
void DoublyList::reservePrint() const
{
Nod... | true |
1d5a5c208fcd33509735301ef713e478121e0cce | C++ | blacksea3/leetcode | /cpp/leetcode/748. shortest-completing-word.cpp | GB18030 | 970 | 3.1875 | 3 | [] | no_license | #include "public.h"
//24ms, 80.48%
//תvectorͳƴƵ, ȻÿwordҲ
class Solution {
public:
string shortestCompletingWord(string licensePlate, vector<string>& words) {
vector<int> l(26, 0);
for (auto& iil : licensePlate)
{
if (iil <= 'z' && iil >= 'a') l[iil - 'a']++;
else if (iil <= 'Z' && iil >= 'A') l[iil - 'A... | true |
75991222d7ce8dfc26d5b459b948e41b835da668 | C++ | xueyeduling/CPP-Primer-note | /05section/05section/05section/5.22.cpp | GB18030 | 688 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <cctype>//iostream
#include <cstddef>//±size_tָptrdiff_t
#include <iterator>//⺯beginend
#include <cstring>
#include <ctime>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::vector;
using std::begin;
using std::end;
int get_... | true |
3706ed9c51e97378c857318574f195f429585412 | C++ | wrz155/Algorithms | /other/1003 之字型打印矩阵.cpp | UTF-8 | 297 | 3.515625 | 4 | [] | no_license | “之”字形打印矩阵
【题目】 给定一个矩阵matrix,按照“之”字形的方式打印这个矩阵,例如: 1 2 3 4 5 6 7 8 9 10 11 12 “之”字形打印的结果为:1,2,5,9,6,3,4,7,10,11,8,12
【要求】 额外空间复杂度为O(1) | true |
afdce69c56b7627976302e94b891e48b4211777e | C++ | chakradarraju/varindexer | /exp/grpc.cc | UTF-8 | 1,400 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include "exp/test.pb.h"
#include "exp/test.grpc.pb.h"
#include "include/grpc++/grpc++.h"
using grpc::Status;
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using std::cout;
using std::endl;
Test GetTest() {
Test a;
a.set_field1("chakra");
a.set_field2(2);
return... | true |
7946d399c079077458d8e3a690920b322fb87bbf | C++ | m-statkiewicz/EvolutionaryAlgorithmsInCudaOLD | /openMP_cpu/src/mipluslambdastrategy.h | UTF-8 | 379 | 2.53125 | 3 | [] | no_license | /*
* strategy.h
*/
#ifndef MIPLUSLAMBDASTRATEGY
#define MIPLUSLAMBDASTRATEGY
#include<cstdlib>
#include<vector>
#include"method.h"
class MiPlusLambdaStrategy : public Method
{
private:
int mi;
int lambda;
int iterations;
public:
MiPlusLambdaStrategy (int mi, int lambda, int iterations);
Point operator () (c... | true |
8dc267e323b4fe0d90ed268710a36dbdd4d6aaae | C++ | DariuszOstolski/cppassert | /include/cppassert/AssertionFailure.hpp | UTF-8 | 5,276 | 3.203125 | 3 | [
"BSD-3-Clause"
] | permissive | #pragma once
#ifndef CPP_ASSERT_ASSERTIONFAILURE_HPP
#define CPP_ASSERT_ASSERTIONFAILURE_HPP
#include "details/AssertionMessage.hpp"
#include <cstdint>
namespace cppassert
{
/**
* @class AssertionFailure
*
* A class for indicating an assertion failure. The AssertionFailure object
* remembers a non-empty message t... | true |
3f198dd075fdbfdc2b44803b20d89066849240bb | C++ | cgddrd/Endurance-Race-Tracker | /Event-Creator/Course.cpp | UTF-8 | 1,554 | 3.421875 | 3 | [] | no_license | /*
* File: Course.cpp
* Description: Provides a data model for an event course.
* Author: Connor Luke Goddard (clg11)
* Date: March 2013
* Copyright: Aberystwyth University, Aberystwyth
*/
#include "Course.h"
using namespace std;
/**
* Constructor that allows the constant 'courseID' variable
* to be specifi... | true |
8a0e97e2d60ed16423789c6294ced9099276957d | C++ | hardiktechnoplanet/C-plus-plus-STL | /C_C++_Codes/47. Permutations II.cpp | UTF-8 | 1,477 | 3.8125 | 4 | [] | no_license | //Given a collection of numbers that might contain duplicates, return all
//possible unique permutations.
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
void indent(int n)
{
for(int i=0;i<n;i++)
cout<<"....";
}
void permutationHelper(string s, string choosen, set<string>& alreadyPrinted)
... | true |
9a818f7d6ef6334d207b0b2ddefc93e314504985 | C++ | YKitty/CurrentmentMemory | /memPool/ThreadCache.hpp | GB18030 | 1,063 | 2.734375 | 3 | [] | no_license | /*
Ϊ˽̻߳ȡڴʱľ˲µ
*/
#pragma once
#include "Common.hpp"
#include "CentralCache.hpp"
#include <iostream>
#include <stdlib.h>
class ThreadCache
{
public:
//̷߳ڴ
void* Allocate(size_t size);
//ͷڴ
void Deallocate(void* ptr, size_t size);
//Ļȡڴ棬index±꣬sizeҪȡڴֽڴС
void* FetchFromCentralCache(size_t i... | true |
7e93f1c7b4a9268a4500bea0620f2e6b659a1f41 | C++ | Vaphen/Stegano | /include/Stegano.h | UTF-8 | 2,344 | 3.09375 | 3 | [] | no_license | #ifndef STEGANO_H
#define STEGANO_H
#include <string>
#include <Magick++.h>
#include <iostream>
#include <random>
#include <fstream>
#include <set>
#include "SteganoExceptions.h"
#include "SteganoStructs.h"
class Stegano
{
public:
virtual ~Stegano();
void loadPicture(const std::string &);
protected:
Steg... | true |
a6f3b940dfd4cde3978cb2d5aa25f61b01bb13c0 | C++ | msymkany/ft_retro | /UserShip.cpp | UTF-8 | 3,218 | 2.65625 | 3 | [] | no_license | //
// Created by Illia Lukianov on 11/4/17.
//
#include "UserShip.hpp"
UserShip::UserShip() : FlyingEssence::FlyingEssence(7), _cout_missile(0) {
newGamePos();
}
UserShip::UserShip(const UserShip & u) {
*this = u;
}
UserShip &UserShip::operator=(const UserShip & u) {
_cout_missile = u._cout_missile;
... | true |
f152fb7c02e53ca9a2b305c82d5682e37cbbfe09 | C++ | shdwp/openrunner | /app/view/widgets/StackWidget.cpp | UTF-8 | 2,530 | 2.546875 | 3 | [] | no_license | //
// Created by shdwp on 5/21/2020.
//
#include "StackWidget.h"
void StackWidget::update() {
auto scaled_bbox = glm::vec4(
bounding_box.x,
bounding_box.y,
bounding_box.z,
bounding_box.w
);
auto amount = children_->size();
if (amount == 0) {
... | true |
23852264b6434a83f0e4654bfc5c8336a334d186 | C++ | WHALEEYE/CS203-Lab-Assignments | /Lab07/C.cpp | UTF-8 | 1,498 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct Node {
int value;
Node *next;
Node *pre;
};
Node *none = new Node{-1, NULL, NULL};
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t, n, val, rear, k;
Node *head, *tmp, *cur, **qu = new Node *[100010];
cin >> t;
for (int i = 0... | true |