C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

learn more… | top users | synonyms

0
votes
0answers
4 views

C++ Console based password generator [on hold]

I am currently developing a password generator and just finished my first version. I know there is a lot to do but before I proceed with the next version I would like to have a feedback on my current ...
-1
votes
0answers
11 views

How do I implement per-pixel shading in GLSL 4.3? [on hold]

I've created a functional level in C++ and OpenGL. I am able to render it properly using a basic shader, but I need to add my own per-pixel shader for lighting. I have added per-pixel shading in GLSL ...
1
vote
0answers
24 views

Extremely simple code that adds two integers with wxWidgets

This code using wxWidgets for GUI adds two numbers when the add button is clicked. Please review my code design because I would like to know a few things on managing wxCtrls before writing more ...
-2
votes
0answers
18 views

i am getting SIGABRT error when submitting my code on spoj judge [on hold]

he code below works fine both on my PC and ideone, but when I submit it to SPOJ, it returns runtime error(SIGABRT). What could be the possible reason for this?here is link to problem- ...
1
vote
1answer
61 views

Bot clean written on C++

First string includes 4 integers: N, M, A, B (1 ≤ N, M ≤ 300, A, B ≤ 1000). Each next line include M-symbols. Symbol . is a clean cell, ...
4
votes
0answers
34 views

Compile-time printf-style format checking

Compile time checking of printf-like format strings Inspired by this open ticket on boost, this seeks to complete the work there Given a printf-style format string and associated arguments, a ...
1
vote
2answers
38 views

Strongly-typed angle measures in radians and degrees

I often work with angles when writing code for 3D rendering and such. Personally, I prefer to measure angles in degrees, but many APIs (including the Standard Library) measure angles in radians. So ...
5
votes
0answers
73 views

union based approach to implement variant

This implementation of discriminated union based on C++ inherent unions and inspired by this article. ...
2
votes
0answers
49 views

Disruptor pattern in a lock-free producer-consumer queue

I'm implementing a quick-and-dirty lock-free MPMC queue in C++, based on the v3 Disruptor algorithm. The implementation is pretty simple: Data to be shared between threads is stored in a ring ...
4
votes
3answers
898 views

Array Sorting in C++

I have this simple implementation for array sorting: ...
4
votes
2answers
50 views

Iterating over the lines of a stream

This structure is supposed to iterate over the lines of an input stream, using std::getline. Any remark is welcome! ...
3
votes
1answer
57 views

Check is_permutation on a pair of same sized arrays

After considering the suggestions of my previous question Check whether given a pair of arrays are permutation of each other, I changed the code. Resolved the bug reported earlier In place of ...
1
vote
0answers
42 views

Dynamic Programming with large arrays

Last week we have finished our program which applies a local search. At this moment the program needs more than three hours for the largest instances. The three hours are too long and we try to ...
0
votes
0answers
28 views

Beginners C++ file stream homework [on hold]

The assignment is to make a program that allows would prompt the user to locate a .txt file, convert it to an encrypted mess, create an output file of said mess named "encrypt.txt", then have the ...
3
votes
3answers
209 views

Check whether given a pair of arrays are permutation of each other

Check whether two given arrays are permutation of each others. Does this implementation guarantee execution of \$O(n)\$ time? What is the additional space utilization for this implementation by ...
1
vote
0answers
24 views

fftshift implementation for OpenCV

I'm trying to implement fftshift from matlab for OpenCV. Can you please review the correctness of my algorithm? Have I missed something? Also, is there a better and faster way to do it? ...
3
votes
0answers
37 views

A Trivia game with SFML

So I've been making a trivia game with SFML and C++ for quite a while now for my school project and I would like to get some constructive criticism, anything helps from best practices to overall ...
0
votes
0answers
22 views

Real time head segmentation using OpenCV

I am using OpenCV 2.410 to implement a project. My project allows to segment head from video sequence which get from camera. First, I detect the head region and then apply segmentation method for that ...
2
votes
1answer
60 views

Object pool with linked list of available objects implementation

I was reading some gameprogrammingpatterns (awesome book, by the way, would recommend) and was very excited when I learned that unions are a thing that exists, so I decided to implement an object pool ...
-1
votes
0answers
10 views

Wrong answer spoj SCUBADIV - Scuba diver [on hold]

This problems link is http://www.spoj.com/problems/SCUBADIV/. It is basically a 0-1 knapsack problem only. The logic I have implemented is Bottom up :) and so far I have found it perfectly correct. ...
4
votes
1answer
82 views

Compile-time printf format checking

Compile time checking of printf-like format strings Inspired by this open ticket on boost, this seeks to complete the work there Given a printf-style format string and associated arguments, a ...
3
votes
0answers
31 views

Arena memory allocator

I'm not exactly sure if this is technically an "arena allocator" but it serves a similar purpose: providing a fast way to allocate a lot of objects that can all be freed at once. ...
1
vote
0answers
61 views

Create pairs from a set of numbers

Problem here is to list all pairs from a set of integers. We need 2 versions. In the first program, the order matters — pairs (a,b) and (b,a) are considered distinct. In the second program, (a,b) and ...
3
votes
0answers
47 views

Lock-free ringbuffer with multiple readers in C++11

Basic Info I needed a lock-free ringbuffer with multiple readers (but one writer). However, I did not want the writer to check all readers every time in order to prevent an overrun. Thus, I decided ...
2
votes
1answer
55 views

Array implementation of unbalanced binary search tree

I'm preparing for an interview. I tried implementing binary search tree in C++. I used array but it seems to be complicated to restructure the array while deleting nodes. Is linked list a better data ...
3
votes
0answers
51 views

Timeout watchdog using a standby thread

The simple but generic timeout class to be used watching for network connections, user input, filesystem events, and is intended to have a very simple interface specific to only our use cases (i.e. no ...
4
votes
2answers
105 views

Minimal webserver in C++, second revision

First revision: Minimal webserver in C++ Here's my test question for C++ programmer job: Servers only static content, no cgi Single process, multithreaded 1000 concurrent request at least Valid ...
3
votes
1answer
36 views

Templated renderer class

A class that matches the rendered objects shader and render function(sets shader resources) based on its typeid hash. ...
1
vote
2answers
59 views

Backtrack algorithm

I coded this algorithm in order to have a generic backtracking algorithm. I expect the user to pass a POD for ELEMENT, hopefully as small as possible. Any idea how ...
4
votes
0answers
78 views

Merge Sort Bottom Up

I am looking for suggestions on how to improve my mergesort. My teacher explained the recursive mergesort and left the bottomUp one as as an assignment. I have implemented it but find it too messy. I ...
3
votes
1answer
44 views

Graph Adjacency List

Spent some time implementing a graph as an adjacency list. Looking for suggestions on how to improve this implementation. ...
0
votes
0answers
25 views

BOOST graph cc1plus: out of memory allocating [closed]

I'm using BOOST to work with graph mining problem. So, after reading graphs from a file: t # 0 v 0 5 v 1 9 v 2 8 v 3 7 v 4 2 e 0 1 4 e 1 2 68 e 1 4 12 e 3 2 18 ...
3
votes
1answer
51 views

Qt Custom Scatterplot

I have created a custom scatterplot in Qt and am wondering if there is a more efficient way to do it. Here is a sketch of the problem: The layout of the plotting area consists of a rectangular ...
3
votes
1answer
50 views

Searching for a substring in a ring queue

I am implementing a function which searches through a ring queue for a given substring. The function returns true if the substring is found, otherwise false. There is a cell containing null between ...
5
votes
2answers
179 views

BrainFuck Interpreter in C++

Generic Headers #include <vector> #include <string> #include <iostream> #include <fstream> typedef std::string const BFProgram; ...
9
votes
1answer
277 views

Quadtree implementation

I've implemented a quadtree in c++. Ignore any apparent similarity to the pseudocode on wikipedia, it's all in your head, I swear. How can I improve? Algorithm speed/space improvements, any extra ...
15
votes
3answers
2k views

Brainfuck on-the-fly interpreter in C++

I was bored yesterday morning, so I wrote a brainfuck interpreter. I know there are a lot, but this one is different. Why? Because it evaluates brainfuck code on the fly, reading from the input file, ...
2
votes
0answers
41 views

Simple C++ Hopfield Network pattern recall

Here is a simple hopfield network in C++ that I wrote with the help of a book that I am reading at the moment. I would like you to review it and give me your suggestions, especially the node updating ...
2
votes
1answer
59 views

C++ program that recognizes a context-free language

This program (C++) was for a class project. A program that recognizes a given context-free language by implementing a pushdown-automaton (PDA). The PDA recognizes the following language: S → $T$ ...
5
votes
1answer
41 views

Tree list recursion from Stanford tutorial

I have found this appearing-to-be famous problem in Stanford tutorial about trees and decided to solve it. My solution appears to work great: ...
1
vote
2answers
60 views

Passing text through a network of transformation modules (task #4)

About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of ...
1
vote
0answers
44 views

Beat count-to-time converter (task #2)

About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of ...
2
votes
1answer
47 views

Rhythm notation converter (task #1)

About a year ago, I was given a C++ assignment as a preliminary job-interview test. The assignment included 4 different tasks, from which I had to choose one. I actually chose and completed 3 out of ...
5
votes
1answer
80 views

STL-like palindrome checking

I just read this article on how to write a standard-like algorithm and wanted to try it myself by writing (as suggested in the article) an algorithm to test if a sequence given by two bidirectional ...
3
votes
1answer
39 views

Proper use of type_info in relation to mapping components to a type

I'm trying to map a components type to the component value itself in a map. The following code all works properly. My main ...
7
votes
2answers
121 views

Spinlock for C++ kernel (with x86 ASM)

This is some prototype code for a spin-lock for my toy operating system. Bear in mind this means there are no standard library routines to fall back on. It's also for C++11 compilation and will only ...
5
votes
2answers
434 views

A multi-threaded Producer Consumer with C++11

I am trying to learn concurrent programming in C++11. I tried to write code for a classic producer consumer concurrency problem. Would you please review and make any comments about it? ...
7
votes
3answers
443 views

Checking if a number is prime

Is there a better way to check if a number is a prime? ...