Questions tagged [c++]

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. This tag should be used for any question which requires knowledge or expertise with the C++ programming language. This is a general tag which is used for any of the C++ language standards (C++98, C++11, C++17, etc.). The question should identify the compiler being used, the operating system, and which of the C++ standards is being targeted.

Filter by
Sorted by
Tagged with
5 votes
3 answers
7k views

Max repeated word in a string

I was trying to do a very common interview problem "Finding the max repeated word in a string " and could not find much resources in net for c/c++ implementation. So I coded it myself here. I have ...
user avatar
4 votes
1 answer
434 views

Anything I'm missing on this delegate implementation?

Just as the question states and to be sure, am I missing anything on this? Something important/obvious that I overlooked? As is, I can save any functor, function pointer and member function pointer ...
Xeo's user avatar
  • 141
6 votes
2 answers
484 views

Optimising a custom tree data structure

I have the following 'custom' tree data structure. This concept was to be thought of as, if given ("abb", 20) and ("abc", 30), then Tree['a']['b']['b'] == 20 <...
hiddensunset4's user avatar
6 votes
2 answers
2k views

Optimizing WordWrap Algorithm

I have a word-wrap algorithm that basically generates lines of text that fit the width of the text. Unfortunately, it gets slow when I add too much text. I was wondering if I oversaw any major ...
jmasterx's user avatar
  • 213
9 votes
2 answers
5k views

OpenGL forward-compatible context creation on Windows

Is this the proper method for creating an OpenGL 3.3+ forward-compatible context? ...
Overv's user avatar
  • 1,972
5 votes
3 answers
960 views

Quicksort application

What do you think about this code? ...
user avatar
4 votes
3 answers
12k views

Reverse a word using string manipulation

...
user avatar
8 votes
1 answer
215 views

Simplifying a Resizing Method

I'm making a simple container class for fun and education, but my rebuilding/resizing method seems rather inefficient. Is there an easier way to do this? ...
Maxpm's user avatar
  • 395
15 votes
2 answers
17k views

C++ string_cast<> template function

In C++, to simplify string conversion between std::string and std::wstring, I created the following utility template functions: ...
Daniel K.'s user avatar
  • 333
6 votes
2 answers
323 views

Counting the total number of characters in an std::set<std::string>

I have a std::set<std::string> and I need to know the total number of characters (sum of all strings length): ...
bcsanches's user avatar
  • 370
9 votes
6 answers
5k views

Linked List program

This is a simple linked list program which creates a list by appending an object at the tail. It compiles and runs perfectly. Is the coding style, logic etc are fine? How can I improve this program? ...
user2305's user avatar
  • 283
14 votes
11 answers
1k views

Design dilemma: extensibility vs simplicity

Here is my problem abstracted to Bird classes. I know that number of Birds will increase on the future and new behaviors might ...
Nazgob's user avatar
  • 243
11 votes
2 answers
5k views

Improving HashMap in C++

I have created a HashMap<string,int> in C++. I would like help determining if it is good or bad. I have not handled the errors or successes with messages. I ...
bsoundra's user avatar
  • 263
14 votes
2 answers
512 views

Retrieving list of flight numbers from flight path

The below is \$O(n^3)\$. I'm sure there is a way to improve this.. ...
Sagar's user avatar
  • 265
14 votes
1 answer
3k views

Path finding function

Could this be made more efficient, and/or simpler? It's a path-finding function. It seems to work, but do you see any potential cases where it could fail? ...
Benjamin Lindley's user avatar
9 votes
1 answer
270 views

Interpolating given value and legacy value from serialization buffer

Here's a function that interpolates between a given value and a value fetched out of a legacy serialization buffer: ...
tenpn's user avatar
  • 387
16 votes
2 answers
2k views

Eratosthenes sieve and MPI

I wrote this sieve of Eratosthenes with MPI, but I'm not sure if it's good enough. Should I use MPI_Scatter and MPI_Gather ...
Ivansek's user avatar
  • 161
12 votes
6 answers
1k views

Class for holding person's information

I have written another program in C++. Excluding the point that the class definition should be in a separate header file, is there anything that needs to be improved? ...
user avatar
13 votes
8 answers
7k views

"Hello, world!" program using a class for printing

Please take a look at my program and let me know how I can improve it. ...
user avatar
15 votes
2 answers
669 views

Sudoku Grid special purpose Iterators

Please have a look at these iterators which I use for my Sudoku solver. They behave slightly different from STL iterators and don't implement all functionality that would be needed to use them in a ...
thorsten muller's user avatar
75 votes
8 answers
15k views

Open, write and close a file

I have a small 10-liner function that writes some data to a file using an std::ofstream. I did not explicitly call .close() at ...
dreamlax's user avatar
  • 1,128
28 votes
6 answers
60k views

Class for measuring distance as feet and inches

My homework question states: Develop a class to measure distance as feet (should be int), inches (should be float). ...
user avatar
41 votes
9 answers
127k views

Converting between std::wstring and std::string

While researching ways to convert back and forth between std::wstring and std::string, I found this conversation on the MSDN ...
Jere.Jones's user avatar
24 votes
7 answers
29k views

Function for removing forbidden characters

...
Karl's user avatar
  • 373
11 votes
5 answers
740 views

Resolving a link - follow-up

Similar piece of code to that I recently posted as: Resolving a link I have another piece of code which cannot be as easily extracted out into a method: ...
Billy ONeal's user avatar
  • 1,470
38 votes
6 answers
3k views

Resolving a link

How can I clean this up? ...
Billy ONeal's user avatar
  • 1,470
27 votes
6 answers
2k views

Formatter class

In our production code, we cannot use Boost or C++0x. Formatting strings using sprintf or stringstream is annoying in this case,...
John Dibling's user avatar
21 votes
4 answers
3k views

Custom checksum algorithm

A while back, I reverse-engineered a checksum algorithm from an MMO used to check the validity of an item that's linked to chat (similar to WoW). The idea is that if the checksum is invalid then the ...
greatwolf's user avatar
  • 1,874

1
186 187 188 189
190