Search:
Type: Posts; User: wolle
Search:
Search took 0.03 seconds.
-
January 14th, 2021, 11:30 AM
In this case, you have a total of 52 balls in the urn. The chance of picking a blue is 50/52, and a red is 2/52. The total probability is 50/52 + 2/52 = 52/52 = 1 (the ball will always be either blue...
-
January 14th, 2021, 03:08 AM
The link in my previous reply suddenly doesn't seem to work so I supply an example. It is based on the recipe: "Generating pseudo-random numbers" in Modern C++ Programming Cookbook, 2nd ed. by Marius...
-
January 14th, 2021, 01:37 AM
If you have the possibilities 0.8, 0.1, and 0.1 you think of them as three intervals,
1: 0.0 <= x < 0.8
2: 0.8 <= x < 0.9
3: 0.9 <= x < 1.0
Then you draw a random float x between 0 and 1, for...
-
January 13th, 2021, 01:19 AM
Well, according to the link in my previous post, according to the C++ standard, a reinterpret_cast should work,
"3) A value of any integral or enumeration type can be converted to a pointer type."...
-
January 11th, 2021, 12:43 PM
As a last resort, there's always the reinterpret_cast,
wpAddress = reinterpret_cast<WORD*>(nAddress);
https://en.cppreference.com/w/cpp/language/reinterpret_cast
-
January 3rd, 2021, 12:40 PM
This problem is quite common and there are several ways to solve it,
https://web.stanford.edu/class/cs9/sample_probs/TwoSum.pdf
The video uses the hashtable approach. A hashtable is a data...
-
December 31st, 2020, 12:02 PM
And you are not the only one :). I recognize the problem because I replied to this thread,
https://forums.codeguru.com/showthread.php?563893-Program-to-decompress-a-compressed-string
-
December 4th, 2020, 11:45 AM
You don't have to sort anything. Of course you can store all distances and then sort them to find the shortest. But you really just need to keep track of one distance, the shortest_so_far. Each time...
-
December 3rd, 2020, 01:44 PM
Do you want to find the shortest cell distance between two sites? Then you just calculate all possible cell distances one by one and keep the shortest so far. You don't need a data structure for that.
-
December 1st, 2020, 03:52 AM
Start with a minimal program that works. In this case just a main method that prints "Hello world". Then add code, little by little in incremental steps making sure it works after each step. So you...
-
November 23rd, 2020, 12:20 PM
Why not just take a screenshot,
https://www.howtogeek.com/226280/how-to-take-screenshots-in-windows-10/
-
November 21st, 2020, 04:30 AM
Here's a site trying to explain how things work to a general audience,
https://computer.howstuffworks.com/graphics-card.htm
-
November 16th, 2020, 01:34 PM
There are two kinds of inheritance, inheritance of implementation and inheritance of interface. Inheritance of implementation can lead to the so called fragile base class problem,
...
-
November 15th, 2020, 06:03 AM
It looks like your buddy has been right all the time, only it took a little while for the future to arrive :). Maybe Java got in between. It showed up in 1995 and enjoyed an almost religious...
-
November 14th, 2020, 12:30 PM
To me it seems Python is the new Basic. At least it is very popular (Tiobe Nov. 2020),
https://www.tiobe.com/tiobe-index/
But considering your VB6 background maybe VB (.NET) is a better choice,...
-
November 12th, 2020, 11:16 AM
Well, what I can see from the code in #1 you are copying already as part of the sorting process (swapping of records),
{
PiInfo tmp = pIIInfo[(size_t)i];
pIIInfo[(size_t)i] =...
-
November 12th, 2020, 01:27 AM
If the problem is that you want to co-sort the second array with the first, one way is to introduce a temporary std::vector of std:: pair.
In each std:: pair you combine a PiInfo object with its...
-
October 29th, 2020, 02:51 AM
Just because a section of code cannot be reached due to the program logic doesn't mean it's not present in the executable. It may still influence what else gets included that can cause problems.
I...
-
October 19th, 2020, 12:04 PM
Yet another cross-platform GUI is wxWidgets,
https://www.wxwidgets.org/
-
October 13th, 2020, 02:06 AM
Maybe it is a question of programming style. Traditionally in procedural programming, if you don't have all parameters immediately available to call a function you gather them by asking around for...
-
October 11th, 2020, 02:15 AM
I've never got into using bind because you regularly see articles like this,
https://abseil.io/tips/108
This article suggest using either lambdas or absl::bind_front instead, the latter...
-
September 29th, 2020, 01:47 PM
The complete text can be found here,
https://en.wikipedia.org/wiki/Rust_(programming_language)
-
September 28th, 2020, 11:33 AM
Well, I'm sure there is some ugly trick to do it but using the preprocessor is better I think because then you don't break the C++ language itself. The preprocessor allows you to select which parts...
-
September 27th, 2020, 11:54 AM
You could use the preprocessor to define a macro that looks like this while testing,
#define UNITTEST_FRIEND int AccessPrivateSruff(const MyClass& obj);
and otherwise like this,
#define...
-
September 22nd, 2020, 11:43 AM
You could replace the loop with 16 straight assignments like,
target[0] = A[0];
target[1] = B[0];
target[2] = C[0];
target[3] = D[0];
target[4] = A[1];
target[5] = B[1];
...
|
Click Here to Expand Forum to Full Width
On-Demand Webinars (sponsored)
|