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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
06fa651a7d864477732d7b4d003e609696499e6c | C++ | exgs/42 | /wip/CPP Modules/03/ex02/FragTrap.cpp | UTF-8 | 2,825 | 3.03125 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* FragTrap.cpp :+: :+: :+: ... | true |
4a83322caf09d04e5efc24d304cbc4739af621a3 | C++ | AVZhelyazkov18/avzhelyazkov18-20210202 | /avzhelyazkov18-20210202/avzhelyazkov18.cpp | UTF-8 | 1,952 | 3.125 | 3 | [] | no_license | #include "avzhelyazkov18.h"
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void initLaptops(vector<LAPTOP> &laptops)
{
LAPTOP laptop1;
laptop1.mf = "Asus";
laptop1.dateOfRelease = 2017;
laptop1.CPU = "Intel I7";
laptop1.GPU = "Geforce 960M";
laptops.push_back(laptop1);
laptops.pus... | true |
f05bef8c35021a9a98654ca3a07816a16fa5f53e | C++ | SCVision/Utilities | /includes/URG04Kit.hpp | GB18030 | 5,823 | 2.75 | 3 | [] | no_license | // URG04Kit.HPP
//
// Tool kit for URG04 laser range finder, C++ version.
// by Lin, Jingyu, linjy02@hotmail.com, 2019.9
//
// ʹ÷
// 1. URG04Device
// 2. StartScan()ѡ豸ڴڲǡڿֱָSearchURG04Device()ѯ
// Close()رļǡURG04DeviceʱԶرļǡ
// 3. ReadScanAngle()ȡݶӦɨ顣鲻
// 4. ʱ100msReadRange()ȡݼʱδȥ
// 5. вݴֵ̫С<20mm˵ΧԾ档
//... | true |
0c45a430cc128907178a3cc93b91eb0fa851be0d | C++ | tufei/Halide-elements | /src/sgm/sgm_test.cc | UTF-8 | 1,151 | 2.5625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "HalideRuntime.h"
#include "HalideBuffer.h"
#include "test_common.h"
#include "run_common.h"
#include "sgm.h"
using namespace Halide::Runtime;
int main(int argc, char **argv) {
try {
Buffer<uint8_t> in_l = load_pgm("data/left.pgm");
Buffer<uint8_t> in_r = load_pgm("... | true |
7a42f77eaefbb7001b9d793bfc869d49c7b40fb9 | C++ | bdomitil/CPP-module-08 | /ex00/easyfind.hpp | UTF-8 | 349 | 2.9375 | 3 | [] | no_license | #ifndef EASYFIND_HPP
#define EASYFIND_HPP
#include <iostream>
#include <array>
#include <set>
template <typename T>
typename T::iterator easy_find(T &container, int x)
{
if ((std::find(container.begin(), container.end() , x)) == container.end())
throw std::exception();
return ( std::find(container.begin(), cont... | true |
25ab3ab08ba5023563d88017b429de38b8e98a1a | C++ | HiteshBhragu/100-days-of-code | /C++/sum_of_diagonal.cpp | UTF-8 | 667 | 3.796875 | 4 | [] | no_license | #include<iostream>
#define ROWS 3
#define COLS 3
using namespace std;
int sum_of_diagonal(int[][COLS], int);
int main()
{
int matrix[ROWS][ROWS]={ {1,2,3}, {2,3,4}, {3,4,5} };
int row,col,sum;
for(row=0;row<ROWS;row++)
{
for(col=0;col<COLS;col++)
{
cout<<"Enter the number = ... | true |
9911bf47c75231638dab4408101ab460b32416e7 | C++ | janfredrikaasmundtveit/compfys | /project_2/jacobi.cpp | UTF-8 | 1,687 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <time.h>
#include "linalg.h"
#include "jacobi.h"
#include "catch.hpp"
void Jacobi_rotate ( double **A, double **R, int k, int l, int n ){
double s, c;
if ( A[k][l] != 0.0 ) {
double t, tau;
tau = (A[l][l]... | true |
2adc19a31290ad9d75949a34967c1090450b9e57 | C++ | jmbrito01/PointBlank-Reverser | /PointBlank Reverser/Helpers/ProcessHelper.h | UTF-8 | 1,211 | 2.828125 | 3 | [] | no_license | #pragma once
#include "..\Includes.h"
class ProcessHelper
{
public:
ProcessHelper(HANDLE hProc);
DWORD GetImageBase();
char* GetProcessName();
void* Read(DWORD Address, DWORD size);
template<typename t> t* Read(DWORD Address);
template<typename t> void Write(DWORD Address, t value);
int GetExternalStrLen(DWOR... | true |
9f49bcf1397b03c8d9993d87a9fce1886e0402a4 | C++ | muellesi/PSE_2018 | /PSE_2018_Gruppe1/src/FollowMarkerModule.hpp | UTF-8 | 1,503 | 2.984375 | 3 | [] | no_license | ///////////////////////////////////////////////////////////
// FollowMarkerModule.h
// Implementation of the Class FollowMarkerModule
// Created on: 05-Jun-2018 14:42:04
// Original author: student
///////////////////////////////////////////////////////////
#pragma once
#include "DriveCommandPublisher.hpp"
#... | true |
cde49b3d29d13e91b3094e0bcb8e73c4a7706195 | C++ | szmanda/ZSK | /klasa4/CPP/skopul/samochody.cpp | UTF-8 | 507 | 2.90625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int ile;
cin>>ile;
bool * samochody = new bool[ile];
for (int i = 0; i < ile; i++) {
cin>>samochody[i];
}
int suma = 0, wschod = 0, zachod = 0;
for (int i = 0, j = ile-1 ; i < ile; i++, j--) {
if (samochody[i]==0){
wschod++;
}
... | true |
68bbd61b22dff0ad43fd64faf19702f6a2fde0c3 | C++ | YeonWon123/My_Problem_Solving | /Atcoder/Panasonic Programming Contest 2020/A/A/A.cpp | UTF-8 | 370 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int a[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
... | true |
b03ceade190db19d318105004e065f0a23bcb395 | C++ | zhuangqf-sysu/PAT | /src/pat/Advance1101.cpp | UTF-8 | 879 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int myList[100001];
int isPivot[100001];
vector<int>answer;
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>myList[i];
isPivot[i] = true;
}
int leftMaxValue = myList[0];
for(int i=0;i<n;i++)... | true |
457758b83145f95a681a1b231b3283cfd27fb88c | C++ | Nickqiaoo/cppim | /common/util.hpp | UTF-8 | 540 | 2.875 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
namespace common {
typedef std::vector<std::string> Tokens;
inline void split(const std::string & src, const std::string & sep, std::vector<std::string> & tokens) {
tokens.clear();
std::string s;
for(auto ch : src) {
if (sep.find(ch) != std::string... | true |
ff5dbe0e5cb705225748a8793e79a9ccfd52381f | C++ | ankitsumitg/mrnd-c | /Step_13/spec/MergeBSTsSpec.cpp | UTF-8 | 6,307 | 3.09375 | 3 | [] | no_license | #include "stdafx.h"
#include <stdlib.h>
#include "../src/MergeBSTs.cpp"
using namespace System;
using namespace System::Text;
using namespace System::Collections::Generic;
using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
namespace spec
{
[TestClass]
public ref class MergeBSTsSpec
{
private:
Tes... | true |
efa56cab7dd8322c9398588f41abe7e7af08924a | C++ | skyformat99/ring_buffer | /include/ring_buffer_boost.hpp | UTF-8 | 1,082 | 3.5625 | 4 | [
"MIT"
] | permissive | #include <boost/atomic.hpp>
template<typename T, size_t Size>
class ringbuffer {
public:
ringbuffer() : head_(0), tail_(0) {}
bool push(const T & value)
{
size_t head = head_.load(boost::memory_order_relaxed);
size_t next_head = next(head);
if (next_head == tail_.load(boost::memory_order_acquire))
... | true |
de37c2b945871ef6d27fb9737503cf727c66575f | C++ | aldavidramos/RamosAllan_CSC5_45549 | /Assignments/Assignment 3/Gaddis_7thEd_Ch4_Prob20_Freezing&BoilingPoint/main.cpp | UTF-8 | 1,313 | 3.875 | 4 | [] | no_license | /*
* File: main.cpp
* Author: Allan Ramos
* Created on July 1, 2017, 6:51 PM
* Purpose: To determine which elements freeze or boil
*/
//System Libraries
#include <iostream> //Input/Output Library
using namespace std; //Namespace of the System Libraries
//User Libraries
//Global Constants
//Function Protot... | true |
cbf8822f628f5556d04cb70cfca31e568dfee662 | C++ | oivanyts/CPP_Day00 | /Day04/ex03/AMateria.h | UTF-8 | 623 | 2.890625 | 3 | [] | no_license | //
// Created by Oleh IVANYTSKYI on 2019-10-04.
//
#ifndef CPP_DAY00_AMATERIA_H
#define CPP_DAY00_AMATERIA_H
#include <string>
#include "ICharacter.h"
class AMateria
{
public:
virtual ~AMateria();
AMateria();
AMateria(AMateria const &src);
AMateria(std::string const & type);
virtual std::string const & get... | true |
417300f1a1a044cc4cd0d8a70f0838b8e02f6006 | C++ | sachinkj/interview-Prep | /two_missing_nums.cpp | UTF-8 | 945 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <array>
#include <vector>
#include <unordered_set>
#include <algorithm>
using namespace std;
vector <int> two_missing_num_sol1(array<int, 8> a);
int main()
{
array<int, 8> a = {2, 4, 6, 3, 5, 8, 7, 10};
int array_size = sizeof(a)/(sizeof(a[0]));
vector <int>... | true |
a18a387d58e9bdad6e8ca49c80094872914145f1 | C++ | aposos/Cataclysm | /computer.cpp | UTF-8 | 22,940 | 2.78125 | 3 | [] | no_license | #include "computer.h"
#include "game.h"
#include "monster.h"
#include "overmap.h"
#include "output.h"
#include <fstream>
#include <string>
#include <sstream>
computer::computer()
{
security = 0;
name = DEFAULT_COMPUTER_NAME;
w_terminal = NULL;
}
computer::computer(std::string Name, int Security)
{
security = Secu... | true |
ffb5c64497b75af132caacaf099e54ef26b4bc0d | C++ | lkeegan/CTCI | /src/arrays_and_strings.cpp | UTF-8 | 7,054 | 3.375 | 3 | [
"MIT"
] | permissive | #include "arrays_and_strings.hpp"
namespace ctci {
namespace arrays_and_strings {
bool is_unique_a(const std::string &str) {
// best case: O(1)
// worst case: O(N) where N is number of unique chars, i.e. max 2^7
// use look-up table to check if char has already been seen.
// NOTE: assuming 7-bit ASCII chars
... | true |
4a35a2cfb38865b7900d5c9d9c8525ba38e9277c | C++ | InsightSoftwareConsortium/ITK | /Modules/ThirdParty/VNL/src/vxl/vcl/tests/test_cctype.cxx | UTF-8 | 1,302 | 2.59375 | 3 | [
"IJG",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"SMLNJ",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"LicenseRef-scancode-free-unknown",
"Spencer-86",
"LicenseRef-scancode-llnl",
"FSFUL",
"Libpng",
"libtiff",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
... | permissive | #include <iostream>
#include <cctype>
#ifdef _MSC_VER
# include "vcl_msvc_warnings.h"
#endif
// Test the functionality, and also cause a link to make sure the
// function exists.
int test_cctype_main(int /*argc*/,char* /*argv*/[])
{
return ! ( std::isspace(' ') && std::isspace('\n') && !std::isspace('a') &&
... | true |
c2dba5f7cc61d617437f6e1af73e1287e31cfaca | C++ | AdityaShekharTiwary/competitve_programming | /time_for_medicine.cpp | UTF-8 | 508 | 2.65625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int y,m,d,t;
char ch;
cin>>t;
while(t--)
{
cin >> y >> ch >> m >> ch >> d;
if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
{
cout<<(31-d)/2+1<<endl;
}
else if(m==4 || m==6 || m==9 || m==11)
{
cout<<(30-d+31)/2+1... | true |
6192f70c45163b1fbe1ac48065618633b38fe7fe | C++ | lbguilherme/duvidovc-app | /java/include/org.apache.commons.logging.Log.hpp | UTF-8 | 2,243 | 2.59375 | 3 | [] | no_license | #pragma once
#include "../src/java-core.hpp"
#include <jni.h>
#include <cstdint>
#include <memory>
#include <vector>
#include "java.lang.Object.hpp"
namespace java { namespace lang { class Object; } }
namespace java { namespace lang { class Throwable; } }
namespace org {
namespace apache {
namespace commons {
names... | true |
f69056aabdef39cc650004c980f0e7c56d267e6d | C++ | yannick-cn/book_caode | /算法竞赛宝典/第二部资源包/第七章 贪心算法/删数问题/src/标程/DeleteNum.cpp | WINDOWS-1252 | 591 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
using namespace std;
void Delete_Num(char str[],int n,int k)
{
while(k--)
{
int m=0,i=0;
while(i<n && str[i]<=str[i+1])//λ
i++;
for(int j=i+1;j<n;j++)
str[j-1]=str[j];
}
}
int main()
{
freopen("DeleteNum.in","r",stdin);
f... | true |
3435b08dd8b6e0c366468c1e2e566110d9f8697e | C++ | udaysankarm/stack-and-queue | /queue.cpp | UTF-8 | 1,019 | 3.59375 | 4 | [] | no_license | #include<iostream>
#include"linkedlist-mod.cpp"
using namespace std;
class queue//implementing queue
{
public:
Node *end;//variable to point to the top
Node *start;
LinkedList ll;
queue()//default constructor
{
end=ll.head;;//assinging head to top
start=ll.last;
}
void Enqueue(int value)// add element in t... | true |
2315f0fdfa52c63d6b0fbd0dbacfe31dc8766460 | C++ | demonsheart/C- | /practice7/3.cpp | GB18030 | 1,861 | 3.890625 | 4 | [] | no_license | #include <iostream>
using namespace std;
class CLuckNumber
{
private:
int n;
int *p;
public:
CLuckNumber(int n);
CLuckNumber(CLuckNumber &s);
~CLuckNumber();
void getLuck();
void print();
};
CLuckNumber::CLuckNumber(int n)
{
this->n = n;
p = new int[n];
for (int i = 0; i < n; i... | true |
6d12a76303859b9006f4909c081b3d9ddcf0a25b | C++ | baklazan/trts | /src/io/message_reader.cpp | UTF-8 | 2,056 | 3.0625 | 3 | [] | no_license | #include <message_reader.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <utils.h>
#include <vector>
#include <iostream>
MessageReader::MessageReader(int fd, std::function<void(std::string)> callback) : fd_(fd), callback_(callback) {
Reset();
};
void MessageReader::Reset() {
buffer_.clear();
state_ = RE... | true |
a06e85ee25815f175eaad83e11b4524f33715702 | C++ | kkkd1211/model_with_learning | /V0_bak/cpp.cpp | UTF-8 | 603 | 2.53125 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include"head.h"
using namespace std;
gene::gene()
{
int i;
for(i=0;i<Nx;i++)
{
c0[i]=0.1;
c1[i]=0.0;
}
}
gene::gene(double ini_c[Nx])
{
int i;
for(i=0;i<Nx;i++)
{
c0[i]=ini_c[i];
c1[i]=0.0;
}
}
void gene::next()
... | true |
c2e5836d020765fb4bf0985e784c919f6710e02c | C++ | KIIIKIII/hello-world | /Cheese.cpp | UTF-8 | 1,252 | 2.828125 | 3 | [] | no_license | #include<iostream>
#include<queue>
using namespace std;
typedef struct {
int x;
int y;
}P;
char graph[1000][1000];
P aim[10];
P s, g;
int N, W, H;
int vis[1000][1000];
int dx[] = { 1, 0, -1 ,0 }, dy[] = { 0, 1, 0, -1 };
int bfs(P s, P g) {
queue<P> que;
P n;
for (int i = 0; i<H; i++)
for (int j = 0; j<W; j++)... | true |
3dfb7b7235a0432c7c6efd80112fb67289e5380f | C++ | Shokk357/Infotecs2020 | /Common/BigNum.cpp | UTF-8 | 1,637 | 3.125 | 3 | [] | no_license | #include "BigNum.h"
const long long numOrder = 10E8;
BigNum::BigNum(const std::string& expression) {
for (int i = expression.length(); i > 0; i -= 9)
if (i < 9)
val.push_back(atoi(expression.substr(0, i).c_str()));
else
val.push_back(atoi(expression.substr(i - 9, 9).c_str()... | true |
70e2fc8c1c739d3b478aac566aa61d43bd83bd81 | C++ | BenMarshall98/Real-Time-Graphics-ACW | /Real Time Graphics ACW/Real Time Graphics ACW/ShapeNode.cpp | UTF-8 | 1,169 | 2.828125 | 3 | [] | no_license | #include "ShapeNode.h"
#include "ObjectManager.h"
#include <string>
#include "Sphere.h"
#include "Cuboid.h"
#include "Plane.h"
#include "RenderManager.h"
ShapeNode::ShapeNode(const std::shared_ptr<Shape> & pShape, const ObjectType pType) : mShape(pShape)
{
if (pType == ObjectType::STATIC)
{
RenderManager::instance... | true |
c262bd3cd09bcfcf29fcb089cdf918b1df80f7fb | C++ | zhaimobile/iosGraphicEngine | /iOS3DEngine/ShadersManager.cpp | UTF-8 | 2,340 | 2.578125 | 3 | [] | no_license | //
// ShadersManager.cpp
// MoEngine
//
// Created by Mo on 10/11/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include "ShadersManager.hpp"
//include the Shaders
#define STRINGIFY(A) #A
#include "../Shaders/SimpleVBO.vert"
#include "../Shaders/SimpleVBO.frag... | true |
330cddbcb131922b38d530bb4d45b251eadce185 | C++ | BrushkouMatvey/LZW_compression_algorithm | /LZW.cpp | UTF-8 | 2,916 | 2.71875 | 3 | [] | no_license | #include <iostream>
#include <Windows.h>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
using namespace std;
void readAllBytes(string fileName, vector<char> &result);
void writeToFile(string fileName, vector<int> &compressCode);
void compress(vector<char> &uncompressInfo, vector... | true |
f9a5fba0b8effdba98462d639d8e2bc03e415702 | C++ | hhyvs111/BrushCode | /Company/xiaohongshu/3.cpp | UTF-8 | 3,387 | 3.40625 | 3 | [] | no_license |
#include<bits/stdc++.h>
using namespace std;
int dp[1000][2];
int main() {
//首先这个题尼玛是不能相邻的,那么排序肯定就不能用了。这里只能弄一个排列组合了。不过好像也不能简单的用这个单双来操作。
//这个有点像之前那个什么二分法?
//这些题肯定尼玛都是改编的,但是自己可能做不出来,十分的尴尬啊弟弟。
int n;
cin >> n;
vector<int> num(n);
for(int i = 1;i <= n;i++)
cin >> num[i];
//一开始只能选第一个或者第二个
dp[1][0] = num[1]... | true |
0cb977d1c5f7280b8c9375f296a992a56dc1e42e | C++ | lbarnabas88/3DBattleships | /src/tools/utils/ResourceStore.tpp | UTF-8 | 1,424 | 2.828125 | 3 | [] | no_license | /*
* ResourceStore.tpp
*
* Created on: 2013.01.24.
* Author: Baarnus
*/
#include "ResourceStore.hpp"
template<typename R>
ResourceStore<R>::ResourceStore()
{
}
template<typename R>
ResourceStore<R>::~ResourceStore()
{
clear();
}
template<typename R>
std::string ResourceStore<R>::getDirectory() const
{
... | true |
ebe2672ea05b8e267fe058da6b7c97f3cd253a67 | C++ | JiangSir857/C-Plus-Plus-1 | /Object Oriented Programming(C++)/例题及训项目代码/chapter6/ex2.cpp | GB18030 | 509 | 3.53125 | 4 | [] | no_license | //6.2 6.1룬ʵֳԱڶ塣
class Rect
{
private: //˽ݳԱlength,width
float length,width; //Ϳ
public: //кset(),peri(),area()
void set(float x,float y)//Աset()
{
length= x;
width = y;
}
float peri() //Աperi()
{
return (length+width)*2;
}
float area() //Աarea()
... | true |
318a050af99ce5875ae6830d19fe834e67ea173b | C++ | CarsonRoscoe/BlizzardBallBattle | /BlizzardBallBattle/Engine/Component/GameObject.h | UTF-8 | 2,419 | 2.78125 | 3 | [] | no_license | #pragma once
#include "Component.h"
#include <string>
#include <typeinfo>
#include <vector>
#include <map>
#include "Updateable.h"
#include "Transform.h"
#include <iostream>
class GameObject : public Updateable {
private:
std::map<std::string, std::vector<Component*>> components;
int id;
bool isGlobal;
Tr... | true |
04318b228e79f80dfb9884909c80397a7ac2e21a | C++ | RoyTrenneman/Horaire-bus-RATP-LCD- | /tranmetter.ino | UTF-8 | 1,349 | 2.8125 | 3 | [] | no_license | /* TRANSMITTER CODE */
// LIB
#include <VirtualWire.h>
#include <Wire.h>
//Virtual REGISTER
#define BUSTIME 0xAA
#define RER 0XAB
//GLOBALES
volatile unsigned int x;
char msg[7];
void setup()
{
//I2C communication
Wire.begin(8); // join i2c bus with address #8
Wire.onReceive(receiveEvent); // regis... | true |
ac9b40a6998ae9b6829599f718ef35d294620959 | C++ | sail308/fRobot | /comm.cpp | UTF-8 | 880 | 2.5625 | 3 | [] | no_license | #include "comm.h"
int init_server_socket() {
int sockfd = 0;
struct sockaddr_in my_addr;
struct sockaddr_in remote_addr;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
std::cout<< "socket create failed!\n";
exit(1);
}
my_addr.sin_family = AF_INET;
my_add... | true |
fd764eac3fa875e738b71da88de41853c73dbe7f | C++ | HashJProgramming/C-- | /Basics/operators.cpp | UTF-8 | 424 | 3.109375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int num1 = 2 + 1;
int num2 = 2 - 1;
int num3 = 3 * 2;
int num4 = 2 / 1;
int num5 = 5 % 2;
int num6 = 1;
int num7 = 1;
num6++;
num7--;
cout << num1 << endl;
cout << num2 << endl;
cout << num3 << endl;
cout << num4... | true |
f98efcb90c7f8bc434e0fd18f6f5f15f2d4dbd0a | C++ | hiennv92/litleeardoctor | /DoctorEar/Classes/fakeBug.cpp | UTF-8 | 3,579 | 2.53125 | 3 | [] | no_license | //
// fakeBug.cpp
// DoctorEar
//
// Created by Trinh Van Duong on 11/7/14.
//
//
#include "fakeBug.h"
#include "Define.h"
fakeBug::fakeBug(){}
fakeBug::~fakeBug(){}
fakeBug* fakeBug::createBug(std::string imageBug){
fakeBug *bug = new fakeBug();
if(bug->initWithFile(imageBug)){
bug->autorelease(... | true |
463536f0602ec2dbaa5dc5e27940873da13c474b | C++ | SJTUStevenDu/Algorithm-Contest | /BZOJ/3155 Preprefix sum.cpp | UTF-8 | 1,075 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <algorithm>
using namespace std;
const int MAXN = 100000 + 10;
int n, m, x;
long long c1[MAXN], c2[MAXN], a[MAXN], y;
inline int lowbit(int x) {return x & (-x);}
inline void Add(long long c[], i... | true |
c07c0db15451eeb8bc28d50084236155edcc3c02 | C++ | duchevich/c-plus-plus-VS2017-course | /queue1/Проект15/Source.cpp | WINDOWS-1251 | 613 | 3 | 3 | [] | no_license | /*
1. . , .
*/
#include <iostream>
using namespace std;
typedef struct queue {
int value;
}*queuePointer;
void init(queuePointer queue)
{
}
void insertQueue(queuePointer queue)
{
}
void deleteQueue(queuePointer &queue)
{
}
void printQueue(queuePointer queue)
{
}
void main()
{
setlocale(0... | true |
3d40a6324fc419404d87bff18a30875eb4a9b62c | C++ | mukoedo1993/cpp_primer_solutions | /C++_chap13/sec13_6_3_RvalueReferencesAndMemberFunctions/sec13_6_3_RvalueReferencesAndMemberFunctions.cpp | UTF-8 | 4,255 | 3.984375 | 4 | [] | no_license | //Member functions other than constructors and assignment can benefit from providing both
//copy and move versions.
//Such move-enabled members typically use the same parameter pattern as the copy and the assignment operators---
//one version takes an lvalue reference to const, and the second takes an rvalue referen... | true |
57a38134769097b1f5f3965ba260cbcf659dd853 | C++ | sdail007/TheMountain | /TheMountain/Vertex.h | UTF-8 | 298 | 2.828125 | 3 | [] | no_license | #pragma once
class Vertex
{
private:
float x, y, z;
public:
Vertex()=default;
Vertex(float, float, float);
float GetX() const;
float GetY() const;
float GetZ() const;
friend std::ostream& operator<<(std::ostream& out, Vertex& obj);
friend Vector operator-(const Vertex&, const Vertex&);
}; | true |
f8e396d8a2cd4ec3403b6df6565d75e7d0c8233c | C++ | tectronics/raupe | /modules/arduino/libraries/SerialCommand/SerialCommand.h | UTF-8 | 3,213 | 2.640625 | 3 | [] | no_license | /*******************************************************************************
SerialCommand - An Arduino library to tokenize and parse commands received over
a serial port.
Copyright (C) 2011 Steven Cogswell <steven.cogswell@gmail.com>
http://husks.wordpress.com
Version 20110523B.
Version History:
... | true |
f405dde2e40cf4f391d4f69dee84010a44b5ade2 | C++ | treasureb/Projects | /ZMQ/req_res/rrbroker.cc | UTF-8 | 1,627 | 2.59375 | 3 | [] | no_license | #include "zhelpers.hpp"
int main(){
//准备上下文和套接字
void *context = zmq_init(1);
void *frontend = zmq_socket(context,ZMQ_ROUTER);
void *backend = zmq_socket(context,ZMQ_DEALER);
zmq_bind(frontend,"tcp://*:5559");
zmq_bind(backend,"tcp://*:5560");
//初始化轮询集合
zmq_pollitem_t items[] = {
... | true |
b760e56dbcd622ae6f5ca9775ea5a08a46e319b6 | C++ | YKolokoltsev/DistPipelineFWK2 | /src/executables/demo/ngspice/ngspice_src.h | UTF-8 | 5,831 | 2.515625 | 3 | [] | no_license | //
// Created by morrigan on 4/5/19.
//
#ifndef DISTPIPELINEFWK_NGSPICE_SRC_H
#define DISTPIPELINEFWK_NGSPICE_SRC_H
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <complex>
#include <atomic>
#include <mutex>
#include <ngspice/sharedspice.h>
#include "base_source.hpp"
// TODO: Check... | true |
8c9efa07abb702278f03749f1c666839bcb97016 | C++ | noobnoob-ctrl/hackhacktober-2 | /reverse.cpp | UTF-8 | 269 | 2.78125 | 3 | [
"MIT"
] | permissive | #include<stdio.h>
int main()
{
//fill the code;
int n;
scanf(“%d”,&n);
int arr[n];
int i;
for(i = 0; i < n; i++)
{
scanf(“%d”,&arr[i]);
}
printf(“Reversed array is:\n”);
for(i = n-1; i >= 0; i–)
{
printf(“%d\n”,arr[i]);
}
return 0;
} | true |
e189b2355ef6c584c5e697b352c4b83d4b5b3f5e | C++ | claudiosousa/hard-pass | /firmware/project/src/settings/settings.cpp | UTF-8 | 918 | 2.84375 | 3 | [] | no_license |
#include "settings.h"
#include <EEPROM.h>
int address = 400;
uint8_t config;
void settings_setup() {
config = EEPROM.read(address);
}
void settings_save() {
EEPROM.write(address, config);
}
bool settings_getbit(char bitpos) {
return config & 1 << bitpos;
}
void settings_setbit(char bitpos, bool setbit... | true |
23f83648605d803b42bf673cfe1a7af1ba7314e0 | C++ | astell601/teamprojects | /EVERLAND/Ride.cpp | UTF-8 | 8,112 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include "Windows.h" //Sleep()을 가지고 있는 헤더파일
#include "Ride.h"
using namespace std;
Viking::Viking() :people(0), answer(0) {} //생성자 + 멤버이니셜라이징
Viking::Viking(int n) :people(n) { //생성자 + 멤버이니셜라이징
for (int i = 0; i < people; i++) {
total++;
}
}
int Viking::getSeat() {
return seat;
}
i... | true |
b99db87cb80ccf631eda97504b38ea98dc171b75 | C++ | pranay2063/CS17 | /OOPS/Friend/4FriendClass.cpp | UTF-8 | 427 | 3.90625 | 4 | [] | no_license | #include <iostream>
using namespace std;
class A{
int x;
public:
void set(){
x = 69;
}
friend class B;
};
class B{
//class B can access private members also as it is a friend of A
public:
void display(A a){
//private member of class A can now be accessed through object as B is friend
cout<<"x is : "<<... | true |
61ffddc9f07453728328a793055b380f497ca3ab | C++ | thecodingwizard/competitive-programming | /alphastar/alphastar-cs501ab-usaco-platinum-summer-2018-s2/14-advanced-dynamic-programming-1/06 - Moovie Mooving.cpp | UTF-8 | 3,493 | 2.578125 | 3 | [] | no_license | /*
Moovie Mooving
==============
Bessie is out at the movies. Being mischievous as always, she has
decided to hide from Farmer John for L (1 <= L <= 100,000,000)
minutes, during which time she wants to watch movies continuously.
She has N (1 <= N <= 20) movies to choose from, each of which has a
certain duration and ... | true |
21a2f1ddc5c79d4510cc16d4c8c6aefaf629626f | C++ | timmyzeng/newcode | /2.2-XiaoYiFavoriteWords.cc | UTF-8 | 2,141 | 3.59375 | 4 | [] | no_license | /*
小易喜欢的单词具有以下特性:
1.单词每个字母都是大写字母
2.单词没有连续相等的字母
3.单词没有形如“xyxy”(这里的x,y指的都是字母,并且可以相同)这样的子序列,子序列可能不连续。
例如:
小易不喜欢"ABBA",因为这里有两个连续的'B'
小易不喜欢"THETXH",因为这里包含子序列"THTH"
小易不喜欢"ABACADA",因为这里包含子序列"AAAA"
小易喜欢"A","ABA"和"ABCBA"这些单词
给你一个单词,你要回答小易是否会喜欢这个单词(只要不是不喜欢,就是喜欢)。
输入描述:
输入为一个字符串,都由大写字母组成,长度小于100
输出描述:
如果小易喜欢输出"Likes",不喜欢输出"Disl... | true |
48ed69ba594606378d4ef4237e1683bbf4847915 | C++ | TelloViz/DD_BD | /Character_Movement/Actor.hpp | UTF-8 | 512 | 2.765625 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
class Actor :
public sf::Drawable
{
public:
Actor(sf::Vector2f size, sf::Vector2f pos, sf::Color color);
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
enum DIRECTION
{
NONE,
UP,
DOWN,
LEFT,
RIGHT
} currentDir;
void move(... | true |
a95272ae5f33fb9131e812cbc5651243744e81cc | C++ | dmitrytyurev/HomeProjects | /LearnWordsV2/LearnWords/FileOperate.h | UTF-8 | 472 | 2.546875 | 3 | [] | no_license | #pragma once
#include <vector>
#include "WordsManager.h"
struct FileOperate
{
static void LoadFromFile(const char* fullFileName, std::vector<WordsManager::WordInfo>& wordsInfo);
static void SaveToFile(const char* fullFileName, const std::vector<WordsManager::WordInfo>& wordsInfo);
private:
static std::string LoadS... | true |
323cfd0b9dc2e84d64a7460fdb69ede0b67e01b4 | C++ | amitnileka/competitive-Programme | /map.cpp | UTF-8 | 651 | 2.6875 | 3 | [] | no_license |
#include<iostream>
#include<map>
using namespace std;
int main()
{
map<string,int> m;
map<string,int>::iterator it;
int q,i=0;
int a;
string x;
int y;
cin>>q;
while(i<q)
{
cin>>a;
switch(a)
{
case 1:
cin>>x>>y;
... | true |
b13290e5d8268fd9e5c5fa932d1e16e8b31cafc5 | C++ | KurodaKanbei/ACM | /Template of other teams/Grimoire/Template/source/string/SuffixAutomaton_array.cpp | UTF-8 | 947 | 2.625 | 3 | [] | no_license | /*
* Suffix Automaton - array version
* SAMSAMSAM? SAMSAMSAM!
*/
namespace SAM {
int to[100005 << 1][26], parent[100005 << 1], step[100005 << 1], tot;
int root, np;
int sam_len;
int newnode(int STEP = 0) {
++tot;
memset(to[tot], 0, sizeof to[tot]);
parent[tot] = 0;
step[tot] = STEP;
... | true |
6a2de1b933686e4e4a7b4e8c4602c75e8f0d81c2 | C++ | paulolemus/ee205 | /Lab10/tests/test-Sales.cpp | UTF-8 | 4,584 | 3.203125 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <string>
#include <sstream>
#include "../Sales.h"
TEST(Sales, salary_constructor) {
Sales ad(65000);
ASSERT_TRUE(true);
}
TEST(Sales, salary_commission_constructor) {
double salary = 65000;
double commission = 4000;
Sales ad(salary, commission);
ASSERT_EQ( ad.... | true |
d47cf98a1ef6ef60573693fdb27cce7dcafdf844 | C++ | wusongnie/LeetCodeOJ_Solutions | /777_Swap Adjacent in LR String.cpp | UTF-8 | 695 | 2.828125 | 3 | [
"MIT"
] | permissive | class Solution {
public:
bool canTransform(string start, string end) {
string s, e;
for (int i = 0; i < start.size(); i++)
if (start[i] != 'X')
s = s + start[i];
for (int i = 0; i < end.size(); i++)
if (end[i] != 'X')
e = e + end[i];
... | true |
6b504729e2a1deec2a38ba43b72dcd99a6798cb2 | C++ | asokolov1104/vs2019repo | /ProjectSandBox/winThreading/main.cpp | WINDOWS-1251 | 1,559 | 3.140625 | 3 | [] | no_license | //
#include <windows.h>
#include <iostream>
//
const int _NUM_THREADS = 10;
//
struct TThreadParam
{
int iCounter;
};
//
DWORD WINAPI ThreadFunc(PVOID pvParam)
{
DWORD dwResult = 0;
//// !- - ..
//TThreadParam mParam = *((TThreadParam*)pvParam);
// ..
TThreadParam *pParam = (TThreadPa... | true |
357b9c3a1535ea858518917b576f59499c7d6787 | C++ | Algostu/boradori | /ONLINE_CONTEST/UCPC/tryout_round/hankyul/E.cpp | UTF-8 | 1,406 | 2.734375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct node{
node * parent;
vector<node *> childs;
};
void solve(){
int N, from, to, root_index=0;
long double dig=0, jit=0;
vector<node*> tree;
vector<node*> cur_stack;
node * n, * root;
cin >> N;
for(int i=0; i<1000; i++){
tree.push_back(new node);
tree... | true |
135aacc27825a9fbfe7eb6a04864b8309fb6124e | C++ | NUKEDO/practice_coding | /aizu_online_judge/ALDS1_11_B_stack.cpp | UTF-8 | 1,886 | 3 | 3 | [] | no_license | // https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_B&lang=ja
// 螺旋本を参考に作成(ほぼそのまま)
// 螺旋本と異なりi = 1; i <= n で設計されてるので注意
// stackを使用した解答
#include <bits/stdc++.h>
using namespace std;
#define WHITE -1
#define GRAY -2
#define BLACK -3
int n, count_time;
vector<int> color(100 + 1, WHITE), nt(100 + 1, 1),... | true |
8d2e158564413778eed21712382300199adc3e8c | C++ | bishoyAtif/problemSolving | /codeForces/A.carrotCakes.cpp | UTF-8 | 927 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char const *argv[])
{
double n, t, k, d, timeOne, timeTwo = 0;
cin >> n >> t >> k >> d;
if ((t <= d && n <= k) || n <= k)
{
cout << "NO" << endl;
return 0;
}
timeOne = ceil(n / k) * t;
... | true |
7291f7d4bdd0f32c524ec203209f8b3519876a04 | C++ | YoshiroAraya/Yoshidagakuen_ArayaYoshiro | /吉田学園情報ビジネス専門学校 荒谷由朗/04_OverKillSoulHell/00_制作環境/lasteenemy.h | SHIFT_JIS | 2,388 | 2.703125 | 3 | [] | no_license | //=============================================================================
//
// ŏIGl~[ [lasteenemy.h]
// Author : rJ RN
//
//=============================================================================
#ifndef _LASTEENEMY_H_
#define _LASTEENEMY_H_
#include "main.h"
#include "scene2D.h"
#include "bullet.h"
#def... | true |
10ebf84490f9a20f2e84de9ec63a1004cac73efa | C++ | Vito-bo/C-code | /9-9/9-9/test.cpp | GB18030 | 1,596 | 3.25 | 3 | [] | no_license |
//Ϊ-C
#include <stdio.h>
#include <string.h>
/*
#define CHAR char
#define ULONG unsigned long
#define VOID void
CHAR *VOS_strncpy(CHAR *pcDest, const CHAR *szSrc, ULONG ulLength)
{
CHAR *pcPoint = pcDest;
if ((NULL == szSrc) || (NULL == pcDest))
{
return NULL;
}
while (ulLength && (*pcPoint = *szSrc))
{
pc... | true |
cc7019ba4a15875fd51bb90488537d591f64364b | C++ | missingXiong/leetcode | /Amazon/957. Prison Cells After N Days.cpp | UTF-8 | 1,247 | 3.109375 | 3 | [] | no_license |
// time complexity
vector<int> prisonAfterNDays(vector<int>& cells, int N)
{
int size = cells.size();
vector<vector<int>> rolling(2, vector<int>(size, 0));
for(int i = 0; i < size; i++)
rolling[0][i] = cells[i];
int old = 0, now = 0;
for(int k = 1; k <= N; k++)
{
old = now; now = 1 - now;
rolling[now][0] =... | true |
415d713a7bde23f182c3090f84b352def7301321 | C++ | manzali/bdx | /include/ru/ru_args.hpp | UTF-8 | 1,510 | 2.734375 | 3 | [] | no_license | #ifndef RU_RU_ARGS_HPP
#define RU_RU_ARGS_HPP
#include <chrono>
#include <cstdlib> // exit
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
namespace ru {
namespace po = boost::program_options;
struct ru_args {
std::string id;
boost::filesystem::path config_file;
std::... | true |
029b6b012e64c5304d2defd91d0985873ace86d6 | C++ | vlc/ml4r | /ext/ml4r/LinearRegression/LinearRegression.cpp | UTF-8 | 9,011 | 2.515625 | 3 | [] | no_license | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/lu.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/foreach.hpp>
#include <iostream>
using std... | true |
b86a9796a535d3675ffef56a299c8b7885d2fb77 | C++ | zachwreed/CS-325 | /week 1/merge sort/mergesort.cpp | UTF-8 | 1,893 | 3.796875 | 4 | [] | no_license | /**************************************************
** Author: Zach Reed
** Date: 1/13/2019
***************************************************/
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
/************************
** Author: Sanfoundry
** Title: C++ Program to Implement ... | true |
f324d39804530778aa42036cd17965ac5b7a10b9 | C++ | chasingegg/Online_Judge | /leetcode/404_Sum-of-Left-Leaves/SumofLeftLeaves.cpp | UTF-8 | 545 | 3.140625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
int sumOfLeftLeaves(TreeNode* root) {
if (root == nullptr) return 0;
int res = 0;
... | true |
e158c3f80462463fb858eaedbb52158bf584a9e8 | C++ | uJason/CSCI222_Assignment_1 | /Warehouse_System/src/Employee.cpp | UTF-8 | 374 | 3.078125 | 3 | [] | no_license | #include "Employee.h"
Employee::Employee()
{
eName = "Admin";
ePass = "1234";
//ctor
}
Employee::~Employee()
{
//dtor
}
string Employee::getName() {
return eName;
}
string Employee::getPass() {
return ePass;
}
void Employee::setName(string name) {
this->eName = name;
}
void Employee::s... | true |
f06a5bff207edc92ed3348f805a94f7c5d6e57fa | C++ | hunghoang3011/contro | /phan 2/b2/main.cpp | UTF-8 | 370 | 2.796875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(int argc, char** argv) {
double sum=0;
double tich=0;
cout<<"nhap so phan tu: ";
int n;
cin>>n;
double *p=new double[n];
for (int i=0; i<n; i++){
cin>>*(p+i);
}
for( int i=0; i<n; i++){
if(p[i]<1){
cout<<p[i]<<" ";
}
sum+=p[i];
tich*=p[i];
}
cout... | true |
95655a09c1ea41fb0664c92b74ddb928d855e685 | C++ | qcxygo/LeetCode | /LeetCode-142.cpp | UTF-8 | 683 | 3.15625 | 3 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode *detectCycle(struct ListNode *head) {
struct ListNode *p,*q;
p=q=head;
if(p==NULL)
return NULL;
while(1){
p=p->next;
q=q->next;
if(p==NULL||q==N... | true |
cfa4d78d11e62a631d78e77b1b20a502c05b8468 | C++ | rramsden/re | /src/re/cursor.cpp | UTF-8 | 512 | 2.984375 | 3 | [] | no_license | #include "re/cursor.h"
Cursor::Cursor(int c_x, int c_y, int clamp_x, int clamp_y) {
cx = c_x;
cy = c_y;
clampx = clamp_x;
clampy = clamp_y;
}
void Cursor::up() {
if (cy != 0)
cy--;
}
void Cursor::down() {
if (cy < clampy)
cy++;
}
void Cursor::left() {
if (cx != 0)
cx--;
}
void Cursor::rig... | true |
279ee3ef9605634ff305f4ee65d401261676f2d4 | C++ | bruceoutdoors/CG-Assignment | /OpenGL-Utilities/MyFerrisWheel.cpp | UTF-8 | 2,528 | 2.90625 | 3 | [
"MIT"
] | permissive | /********************************************
Course : TGD2151 Computer Graphics Fundamentals /
TCS2111 Computer Graphics
Session: Trimester 2, 2015/16
ID and Name #1 : 1141125087 Hii Yong Lian
Contacts #1 : 016-4111005 yonglian146@gmail.com
ID and Name #2 : 112272848 Lee Zhen Yong
Contacts #2 : 016-3188... | true |
39774f53f84731519dc3077150ad5c029e79da1f | C++ | R-ovo-stack/VS_CODE-DOCUMENT_C-- | /SNAKE_GAME_PROFECT/SNAKE_MAIN.cpp | UTF-8 | 1,186 | 2.875 | 3 | [] | no_license | #include"SNAKE_RUN.h"
#include<windows.h>
#include<time.h>
int main()
{
int testNum = 0; //食物和蛇身重叠次数检测
char c = 'd'; //方向键初始化为d
srand((unsigned)time(NULL)); //随机种子
Food food = {5, 8, 'A'}; //初始化食物
Snakepoint snake; // 定义结构体
Snakepoint *head, *rear; //定义结构体指针
initSnake(&s... | true |
e910bdfa5dd2223250e99157e3cef3322a7d6372 | C++ | SimonBerggren/Asteroid_3.0 | /Asteroid 3.0/Utilities.h | UTF-8 | 2,508 | 3.28125 | 3 | [] | no_license | #pragma once
#include "SFML/System.hpp"
#include <iostream>
#include <sstream>
#include <stdarg.h>
#include <random>
#include <ctime>
typedef unsigned int uint;
// some useful utilities
namespace utils
{
template<class Owner>
static std::string ToString(Owner i)
{
std::ostringstream stream;
stream << i;
retu... | true |
50de710571d8d728a858fd8159f08b78c44784e3 | C++ | JJTurrubiates/Graphic-EQ-Template | /Source/GraphLayout.hpp | UTF-8 | 2,764 | 2.515625 | 3 | [] | no_license | //
// GraphLayout.hpp
// grapher
//
// Created by Jesus Turrubiates on 2020-08-22.
//
#ifndef GraphLayout_hpp
#define GraphLayout_hpp
#include <stdio.h>
#include <JuceHeader.h>
#include <array>
// axis
class BackgroundAndAxis : public juce::Component
{
public:
BackgroundAndAxis(){}
~BackgroundAndAxis(){... | true |
91e2a5a923b48531439c69c8ce483549a3e7e0f7 | C++ | sfitzpatrickchapman/SFitzpatrick_298-01_Assignment1 | /ProblemCereal.cpp | UTF-8 | 472 | 3.546875 | 4 | [] | no_license | // Scott Fitzpatrick, 2328196
#include <iostream>
using namespace std;
int main() {
float cerealWeightOunces;
float cerealWeightTons;
/* Prompt and user input */
cout << endl << "Enter the weight of breakfast cereal in ounces: ";
cin >> cerealWeightOunces;
/* Calculates ounces to tons convers... | true |
669d3bcb27915f182145e6c130af611478db9306 | C++ | TJUSsr/leetcodesolution | /151-reverse-words-in-a-string/reverse-words-in-a-string.cpp | UTF-8 | 1,390 | 3.359375 | 3 | [
"MIT"
] | permissive | // Given an input string, reverse the string word by word.
//
// Example:
//
//
// Input: "the sky is blue",
// Output: "blue is sky the".
//
//
// Note:
//
//
// A word is defined as a sequence of non-space characters.
// Input string may contain leading or trailing spaces. However, your reversed string should not... | true |
1b38c577a7d84d1896cf91f7520999cae5cf525f | C++ | kangli-bionic/algorithm | /lintcode/498.cpp | UTF-8 | 4,852 | 3.59375 | 4 | [
"MIT"
] | permissive | /*
498. Parking Lot
https://www.lintcode.com/problem/parking-lot/description?_from=ladder&&fromId=98
*/
#include <utility>
#include <vector>
#include <map>
enum class VehicleSize { Motorcycle, Compact, Large };
class Vehicle {
// Write your code here
protected:
VehicleSize size_;
int number_of_spot_needed_;
p... | true |
90fedaf68856af9ec5829d75f0e82cf394168d81 | C++ | codechef34/Software-Engineering | /Course Work/CG/rubiksss/RubiksCubeSolution/RubiksCube/3DMath.cpp | UTF-8 | 2,453 | 3.015625 | 3 | [] | no_license | #include "stdafx.h"
#include "3DMath.h"
Point3f operator+(const Point3f &lhs, const Vector3f &rhs)
{
float newX, newY, newZ;
newX = lhs.X() + rhs.X();
newY = lhs.Y() + rhs.Y();
newZ = lhs.Z() + rhs.Z();
return Point3f(newX, newY, newZ);
}
Vector3f operator-(const Point3f &lhs, const Point3f &rhs)
{
float newX ... | true |
b425edbb08a6c209f81e50be30cd85cbced488f0 | C++ | luiscabus/learnNodeMCU | /simple_led_blink/simple_led_blink.ino | UTF-8 | 426 | 2.765625 | 3 | [] | no_license | #define ledPin LED_BUILTIN
// #define ledPin 16
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(ledPin,OUTPUT);
delay(1000);
Serial.println("");
Serial.println("Boot iniciado.");
delay(1000);
Serial.println("Vou iniciar o Loop para piscar os leds.");
delay(1000);
Serial.println("Lá vai!");
... | true |
36f30580e3c9273f0b7f250de11a9d4bb01c053d | C++ | miaomao1989/program_test | /c++/mm-temp/11/11-15.cpp | UTF-8 | 495 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <list>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int ia[] = {1, 2, 3, 4, 100, 5, 100};
list< int > ilst(ia, ia+7);
vector< int > ivec;
vector< int >::iterator end_unique = unique_copy(ilst.begin(), ilst.end(), back_inserter(ivec));
// 输出vector容器
... | true |
1bcd5230726ff009adf378b00e7ed5708a8e47d9 | C++ | githaoyang/countSteelLayer | /countMaxInModel.cpp | GB18030 | 5,440 | 2.859375 | 3 | [] | no_license | #include "countOnModel.h"
void getModelHight(int photoHight, int upEdge, int downEdge, int& modelHight, vector<int> list)
{
int flag = false;
//жΪְб
vector<int> candidateList(photoHight, 0);
for (int i = upEdge; i < downEdge; i++)
{
int max = list[i];
int maxPosition = i;
flag = false;
for (in... | true |
be742b4a8325b7411ebef37f89b209fd9e799b63 | C++ | icgw/practice | /LeetCode/C++/0121._Best_Time_to_Buy_and_Sell_Stock/solution.h | UTF-8 | 547 | 3.078125 | 3 | [
"MIT"
] | permissive | /*
* solution.h
* Copyright (C) 2021 Guowei Chen <icgw@outlook.com>
*
* Distributed under terms of the Apache license.
*/
#ifndef _SOLUTION_H_
#define _SOLUTION_H_
#include <vector>
using std::vector;
#include <algorithm>
using std::max;
using std::min;
class Solution {
public:
int maxProfit(vector<int>& pric... | true |
370ef9890bc69452dc9d5c4a6cf5bf079c7efc54 | C++ | GabeOchieng/ggnn.tensorflow | /program_data/PKU_raw/93/1218.c | UTF-8 | 530 | 3.0625 | 3 | [] | no_license | int main()
{
int x, front_number_exist;
front_number_exist = false;
cin >> x;
if (x % 3 == 0)
{
front_number_exist = 1;
cout << 3;
}
if (x % 5 == 0)
{
if (front_number_exist)
{
cout << " 5";
}
else
{
front_number_exist = 1;
cout << "5";
}
}
if (x % 7 == 0)
{
... | true |
98f43085d3aaf7b8748d66158699d381b7d322ae | C++ | anducnguyen/image_processing | /geo_projectile.cpp | UTF-8 | 2,113 | 3.234375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "myImageIO.h"
int linear_interpolation(myImageData *in, double xx, double yy)
{
int W = in->getWidth();
int H = in->getHeight();
int x, y;
int v1, v2, v3, v4;
x = int(xx);
y = int(yy);
v1 = v2 = v3 = v4 = 0;
if(x>=0 && x<W-1 && y>=0 &&... | true |
225aebd74796027bef74fd0d878c5a02ef41072a | C++ | timmyew/SpaceGame | /TextureManager.cpp | UTF-8 | 1,526 | 3.171875 | 3 | [
"MIT"
] | permissive | #include "TextureManager.h"
Texture::Texture(SDL_Texture* texture){
tex = texture;
}
Texture::~Texture(){
SDL_DestroyTexture(tex);
tex = NULL;
}
SDL_Texture* Texture::getTexture(){
return tex;
}
TextureManager::TextureManager(){
textureVec = new std::vector<Texture*>();
spritesVec = new std::vector<Sprites*>(... | true |
8a2ce5de832790102b51ac638e3ca16c18b1fba1 | C++ | kaulszhang/base | /src/tools/util_test/smart_ptr/RefenceFromThis.cpp | UTF-8 | 771 | 2.625 | 3 | [] | no_license | // RefenceFromThis.cpp
#include "tools/util_test/Common.h"
using namespace framework::configure;
#include <util/smart_ptr/RefenceFromThis.h>
using namespace util::smart_ptr;
#include <iostream>
struct Base
: RefenceFromThis<Base>
{
virtual ~Base()
{
std::cout << "~Base" << std::... | true |
0d8e80ab1a4ff0ccf74daad00eaf2142af85126f | C++ | antmicro/prjxray | /tools/bits2rbt/ecc.cc | UTF-8 | 2,622 | 2.796875 | 3 | [
"LicenseRef-scancode-dco-1.1",
"ISC"
] | permissive | #include "ecc.h"
#include <cassert>
#include <iostream>
const std::unordered_map<std::string, size_t> ECC::ecc_word_per_architecture = {
{"Series7", 50},
{"UltraScale", 60},
{"UltraScalePlus", 45}};
uint32_t ECC::GetSeries7WordEcc(uint32_t idx,
uint32_t data,
... | true |
10dee63bd7e1bf26b04db755dd2a85603ada7094 | C++ | G-Reg26/TetrisCPP | /TetrisCPP/tetromino.h | UTF-8 | 1,053 | 2.734375 | 3 | [] | no_license | #pragma once
#include <list>
#include <iterator>
#include "SFML\Graphics.hpp"
class Tetromino {
public:
Tetromino();
Tetromino(std::list<sf::RectangleShape> * blocks);
void setTetromino(std::list<sf::RectangleShape> * blocks);
void update();
void rotate();
int ** getTetromino() { return tetromino; }
private:
sf... | true |
4288153e48006fb8abdad8207b1e56843c63be81 | C++ | Hychiro/Trabalho-Grafos-2021-1 | /main.cpp | UTF-8 | 7,392 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <utility>
#include <tuple>
#include <iomanip>
#include <stdlib.h>
#include <chrono>
#include "Graph.h"
#include "Node.h"
#include "Edge.h"
#include "Graph.cpp"
#include "Node.cpp"
#include "Edge.cpp"
using namespace std;
Graph *leitur... | true |
a884ae4ebdbd6f6a68b0f0a9561c1947d6937934 | C++ | uofuseismo/rtseis | /src/modules/detrend.cpp | UTF-8 | 8,958 | 2.75 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <ipps.h>
#include "private/throw.hpp"
#include "rtseis/postProcessing/singleChannel/detrend.hpp"
using namespace RTSeis::PostProcessing::SingleChannel;
class DetrendParameters::DetrendParmsImpl
{
public:
void clear()
{
... | true |
41538b6703372dcd968577a8c9d0aa1918b77ad1 | C++ | Awesomebirds/ProblemSolving | /cpp/스도쿠보드.cpp | UTF-8 | 2,041 | 3.96875 | 4 | [] | no_license | #include <iostream>
#include <cstdio>
using namespace std;
const int MAX_ROW = 9;
const int MAX_COL = 9;
class SudokuBoard {
public:
//칸의 번호로 행의 번호를 계산하는 메소드
int getRowByIndex(int index) {
// 칸의 번호에 대해 마디를 가지고 증가하므로 몫으로 계산할 수 있다.
return (index - 1) / 9 + 1;
}
//칸의 번호로 열의 번호를 계산하는 메소드
... | true |
3d802760cd31f3a59e6b1373b118492f288f24ba | C++ | tgckpg/libeburc | /eburc/Search/Match.cpp | UTF-8 | 7,434 | 2.75 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | #include "pch.h"
#include "eburc/Search/Match.h"
using namespace libeburc;
int Match::Word( const char *word, const char *pattern, size_t length )
{
int i = 0;
unsigned char *word_p = ( unsigned char * ) word;
unsigned char *pattern_p = ( unsigned char * ) pattern;
int result;
for ( ;;)
{
if ( length <= i )
... | true |
59d8770a813b51b5bbdccd2d2df13a9c3546f575 | C++ | DanIsraelMalta/Useful-Functions-and-Classes | /LazyStringSplit.h | UTF-8 | 5,757 | 3.75 | 4 | [] | no_license | /**
* Lazy string splitting and iteration.
*
* example usage:
*
* std::string sentence{"Expressive C++ rocks"},
* delimiter{" "};
* std::size_t i{};
* for (auto& word : split(sentence, delimiter)) {
* std::cout << "word #" << std::to_string(i) << " = " <<word << "\n";
* ++i;
* }
*
* Da... | true |
03a068d6ce3f26a0578456f22a2b748e74ada71f | C++ | hyozkim/drone-project | /projects/RASPBERRY_PI/drone-master/remote_drone/remote_drone/sensors/filters.h | UTF-8 | 2,124 | 2.515625 | 3 | [] | no_license | #ifndef FILTERS_H
#define FILTERS_H
//START SIMPLE KALMAN FILTER
/*
simeple kalman 1
reference site : http://www.magesblog.com/2014/12/measuring-temperature-with-my-arduino.html
simeple kalman 2
reference site : http://interactive-matter.eu/blog/2009/12/18/filtering-sensor-data-with-a-kalman-filter/
*/
#defin... | true |
b68a7b5513e99163b6b5fd6468cc8ef8243625b2 | C++ | organicmaps/organicmaps | /base/observer_list.hpp | UTF-8 | 1,705 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include "base/logging.hpp"
#include <algorithm>
#include <mutex>
#include <utility>
#include <vector>
namespace base
{
class DummyLockable
{
public:
void lock() {}
void unlock() {}
};
template <typename Observer, typename Mutex>
class ObserverList;
/// This alias represents a thread-safe observer... | true |