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

learn more… | top users | synonyms

2
votes
0answers
11 views

Modern C++ compliant selection sort

I am writing, as review, Modern C++ compliant versions of sorting algorithms I previously have seen. This post is about selection sort, and selection sort only. Whilst selection sort is rather ...
1
vote
1answer
22 views

C++11 Thread Pool

I've been using a thread pool that I wrote using Windows threads for a while and I've decided to update it to use std::threads. I'm looking for some feedback on ...
2
votes
1answer
29 views

Improving texture managing with smart pointers

Ok, so I have an SDL_Wrapper which is working perfectly (it is not broken)! If anyone could suggest how I could improve performance, and how I could make my unique_ptr(s) dispose automatically, It ...
0
votes
0answers
7 views

Why do we need extra arrays while finding longest increasing subsequence? [on hold]

Here is an algorithm which finds longest increasing up sequence. However, I can't figure out what the tailIndices and prevIndices are doing in the following C++ code. This is taken from this link ...
3
votes
1answer
25 views

C++ regex golf solver program much slower than original Python

I am rewriting Peter Norvig's Python regex golf solver in C++. I had originally planned to post the whole thing here at once when I was finished, but: This program takes double the time of the ...
0
votes
0answers
18 views

Opengl 3.3 model loading with assimp [on hold]

I'm getting two messages from SFML: opengl stack underflow and stack overflow. I would be very gratefull if someone found the error: To mods: model loads and displays but sfml console says there is ...
3
votes
2answers
46 views

Performance of Median routine using min performs abysmally

I am writing a routine to calculate median using the minimum of the numbers and then changing the value of the minimum to a large value outside the range of numbers (assuming you know the nature of ...
4
votes
2answers
65 views

Portable C++98 thread class akin to std::thread

I want a homegrown version of C++11's std::thread. My motivation is to avoid manual memory management of the arguments passed to the thread function. I'm restricted ...
2
votes
2answers
40 views

Implementing Directed and Undirected Graph in C++

I am learning C++ and I decided to implement a Directed and UnDirected graph. (I haven't learned how to do inheritance yet, so they are distinct classes.) I have not handled any error cases (i.e. ...
2
votes
1answer
49 views

Console random password generator

This program is a random password generator. It asks the user how many chars they want their password to be and how many passwords it should generate. I used the ...
1
vote
0answers
21 views

Select type stringification for ostream output using C++11 template mess

The objective is to select which function is used to represent a type as a string for output on ostreams. The code here allows to explicitly choose a function, or to fallback on a java style ...
1
vote
2answers
33 views

A* versus Bidirectional Dijkstra's algorithm

I have added bidirectional Dijkstra's algorithm into my pathfinding "framework", and I would like to make good use of C++ programming idioms, eliminate all possible memory leaks, otherwise improve ...
2
votes
2answers
57 views

Creating an optimized, fully functional TextureManager in SDL

After I've discussed pointer semantics with Loki Astari previously, I finally managed to code the TextureManager class using auto_pointers. But the problem is that ...
6
votes
2answers
65 views

Templated queue implementation

I wrote an implementation for a simple queue in C++ (for practice, since there's an stl queue). I've been trying to focus on memory management and the rule of three. Any suggestions/improvements? ...
1
vote
2answers
84 views

Using std::vectors to store textures

I need to write a TextureManager class which stores Texture objects; the problem is I'm using an ...
2
votes
0answers
26 views

Storing collections of objects of any type

I've put together a class whose goal is to store objects of arbitrary type, with each type having its own vector for contiguity. I'd like to gather advice on what I have so far before I carry on. Let ...
1
vote
1answer
46 views

C++ class template for notification management

Recently, I found myself frequently writing notification managing facilities. That is, one can register as a receiver by providing a callback, and another can send a notification to all registrants by ...
4
votes
3answers
88 views

Student Classroom class

I'd like to know if the following class design is good or bad: ...
1
vote
0answers
24 views

IUnitTest, INonCopyable, and IMapKey mixins

I am creating a boiler-plate namespace that will allow me to ensure proper coding practices are followed and avoid gotchas. Looking over my code below; can you see any "no-no's" or gotchas? Can you ...
-3
votes
0answers
13 views

Printing arrays causing program to crash (C++) [on hold]

Here's the full block of code: http://pastebin.com/GTx6pSr5 and here's the section that is making it crash: http://pastebin.com/vb8PKSAv It prints the first array after the user selects item 3 from ...
5
votes
0answers
54 views

C++ concurrency library

I started a C++11 library of concurrency primitives in order to study and compare their performance; provide high-quality implementation of those to use in my projects. Its main target platform is ...
-3
votes
0answers
22 views

Create a program that reads five numbers, finds their sum, and then prints the numbers in reverse order. [on hold]

im VERY new to c++ and decided to take an online class for my degree which gives me very little help outside of the book. this code is from a prior assignment and now i have to tweak this 1 to take 5 ...
2
votes
1answer
55 views

Generic pathfinding framework in C++

I have this generic framework for finding (weighted) shortest paths. Also, the program demonstrates the performance of A* and Dijkstra's algorithms on a directed weighted graph. Both run in ...
-4
votes
0answers
23 views

Finding the least 3 values of an array? [on hold]

You are required to manage the sales data of a car showroom. There are 8 salesman. At the end of the month you have to make a report. You are required to make the following calculations.Input the ...
3
votes
2answers
127 views

Implementing a Yearmonth class

Recently I wrote a program that was required to handle year and month data and so I wrote this class to encapsulate that handling. What I needed was a way to initialize the ...
1
vote
1answer
39 views

Handling console application commands/input

I am new to c++ and as a project to learn the language I have been working on a console application that would be able to handle and execute commands from the user. I have gotten it to work the way I ...
0
votes
0answers
35 views

C++ singleton — not full C++ 11 standard [closed]

I'm struggling to design a thread-safe singleton implementation in C++, but it will be targeted primarily on the Visual Studio 2012 environment. I know that the C++ 11 standard guarantees that this ...
2
votes
1answer
51 views

XML parsing program in C++

This is my code which works and compiles but I feel it may be non-optimal, especially the tag mapping and use of the if command. It reads two .xml files and finds ...
5
votes
1answer
77 views

Enter values, generate a list, and search

My assignment in school: Read in names to sort until the user types the “enter” key After sorting and displaying the array of strings Do a binary search to find if the string is in the array If the ...
4
votes
2answers
71 views

Create a structure to store data about a movie

Below are the instructions for my program and the source code. My program runs and works but I would like second opinions on how to make my program more efficient or if there are any loose ends in my ...
4
votes
1answer
49 views

Bills and coin denomination program

I am currently in an intro C++ programming class. We have an assignment where we have to convert a dollar and cents amount, say $192.89, to bills and coins using the least amount of both. Below is the ...
3
votes
1answer
43 views

C++ port of my Ruby narcotic solitaire simulator

Having undergone a little "rediscovery" of C++, I decided to port my Ruby narcotic solitaire simulator program to it. My goal here is efficiency. This program is already about 5 times faster than the ...
1
vote
1answer
52 views

C++ Disposing Textures

Recently, I've asked in a code review if my code was causing any pointer related issues. They mentioned that I had problems with my dispose method. Basically, I'm disposing textures from a texture ...
9
votes
3answers
708 views

Printing a pyramid

Can you please review this code to determine if it's good or can be improved? ...
2
votes
1answer
27 views

C++ class for capturing broadcast window messages

In the Windows operating system, some system events are notified via broadcast window messages. DBT_DEVICEARRIVAL and ...
0
votes
1answer
64 views

Unit test failing on case sensitive string comparison [closed]

I'm currently writing some unit tests for my own BinarySearchTree class with Microsoft's unit testing framework in VS2013. The VS solution contains the project for ...
2
votes
0answers
38 views

Neural Network Simulator with OpenMP

I wrote a simple neural network simulator (the biophysical kind) from scratch, and was hoping to get some feedback on how I can speed things up, or any C++ / compilation best practices that I can ...
5
votes
4answers
270 views

Texture managing

I'm new to C++ and SDL, and I've written a Texture manager class whose purpose is to help me manage sprites and other textures. I have a ...
5
votes
1answer
45 views

Prefix- and z-functions in C++ (string algorithms)

Let us define prefix-function(string)[i] as the length of the largest prefix of string, which is also a suffix of ...
8
votes
4answers
1k views

Brute Force N Body Implementation in C++

I have wrote the following code in C++ for the n-body problem. This code is sequential as later on I am planning to parallelize it using OpenMP. I want to know whether I have wrote the correct ...
2
votes
1answer
30 views

Different return types with same function

I'm implementing my own time unit class. This class provides a function for fetching a specific time value (milliseconds, seconds etc.). In order to prevent defining several get() functions for each ...
3
votes
1answer
46 views

Resistor Program Using Functional Decomposition

The purpose of this program is to write a code that will give a user a list or menu of choices that show colors and their values according to some data and prompt them to enter input to determine the ...
0
votes
1answer
22 views

Word Counting from Array onto Output File [closed]

For this problem, I have to have two text files: one for list of words that need to be found and other containing the document that needs to be search. The results would placed in a output "results" ...
0
votes
0answers
27 views

OpenCV 2.4.10 /C++ displaying image

Please comment about speed and memory optimization for my code. It is about converting a 10 bit raw image (bayer pattern) from int** and displaying some lines. ...
-1
votes
0answers
26 views

How to list all strings of length 12 in C++? [closed]

I tried to make a program that lists all strings of length 12 such as its characters are from a-z. However, there seems to be a bug I could find. Could anyone spot it? Is there some easier way to do ...
8
votes
4answers
776 views

Simple comparison of sorting algorithms in C++

I know this has been done a million times before, but this is my implementation of bubble-sort, insertion-sort, merge-sort, heap-sort, and quicksort. Any feedback on how to make it better would be ...
1
vote
3answers
75 views

First full Tic-Tac-Toe program [closed]

This is a Tic-Tac-Toe game that I recently began working on. Note: I am new to C++ and programming in general; I have only been coding in C++ for a few days now. I decided to make this program to see ...
1
vote
1answer
46 views

Track execution time using std::chrono facilities and print the execution time in a comprehensible way

The class below will be used to track the execution time of various operations. There is no need to dip into C libraries to get formatted output then. Output would be something like this: 10 ...
3
votes
1answer
34 views

Find change in XML and print node

This code has been developed with help on Stack Overflow. It is designed to compare two XML files and print the node for any differences (i.e if a entry appears in A.xml and not B.xml and vice versa). ...
0
votes
0answers
22 views

How to best handle unused pointer when calling C++ from C#? [migrated]

I have code in C++, which I will call from C# via interop mechanism. In my C++ code, this is my class structure ...