CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: wolle

Page 1 of 26 1 2 3 4

Search: Search took 0.05 seconds.

  1. Re: is it safe to use the bitwise XOR for boolean types (in c++)

    It is best to use the logical XOR operator != whereby



    bool c = !(a^b);


    becomes
  2. Re: Not sure what the best way to handle this task is.

    I would use one of these, probably the first,


    void checkTheState() {
    const bool hasChanged =
    (boolOne != boolOneCurrentState()) ||
    (boolTwo != boolTwoCurrentState()) ||
    ......
  3. Replies
    19
    Views
    4,685

    Re: header files online database

    Instead of excavating the past, you could go for something current,

    https://www.sqlite.org/index.html
  4. Re: How to generate a condition (true or false) based on possibilities?

    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...
  5. Re: How to generate a condition (true or false) based on possibilities?

    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...
  6. Re: How to generate a condition (true or false) based on possibilities?

    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...
  7. Replies
    6
    Views
    842

    Re: Need to convert an INT to WORD*

    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."...
  8. Replies
    6
    Views
    842

    Re: Need to convert an INT to WORD*

    As a last resort, there's always the reinterpret_cast,


    wpAddress = reinterpret_cast<WORD*>(nAddress);


    https://en.cppreference.com/w/cpp/language/reinterpret_cast
  9. Re: challenged problem C++ implementation - homework help (preparing for an interview

    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...
  10. Replies
    6
    Views
    424

    Re: string replace related

    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
  11. Re: coming up with data structure for the algorithm

    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...
  12. Re: coming up with data structure for the algorithm

    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.
  13. Thread: JAVA errors

    by wolle
    Replies
    3
    Views
    728

    Re: JAVA errors

    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...
  14. Re: I want to learn how monitors and graphics hardware create and display images.

    Why not just take a screenshot,

    https://www.howtogeek.com/226280/how-to-take-screenshots-in-windows-10/
  15. Re: I want to learn how monitors and graphics hardware create and display images.

    Here's a site trying to explain how things work to a general audience,

    https://computer.howstuffworks.com/graphics-card.htm
  16. Re: What does an interface not allowed to have any implementation?

    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,
    ...
  17. Replies
    5
    Views
    897

    Re: Best web dev language 2020

    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...
  18. Replies
    5
    Views
    897

    Re: Best web dev language 2020

    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,...
  19. Replies
    21
    Views
    2,272

    Re: replace with sort algorithm

    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] =...
  20. Replies
    21
    Views
    2,272

    Re: replace with sort algorithm

    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...
  21. Re: Programm crashes due to the presence of code even if it is not executed

    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...
  22. Replies
    3
    Views
    981

    Re: c/c++ ide for win/linux GUI programming

    Yet another cross-platform GUI is wxWidgets,

    https://www.wxwidgets.org/
  23. Thread: boost::bind

    by wolle
    Replies
    9
    Views
    1,166

    Re: boost::bind

    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...
  24. Thread: boost::bind

    by wolle
    Replies
    9
    Views
    1,166

    Re: boost::bind

    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...
  25. Replies
    2
    Views
    2,421

    Re: Rust Language Rocket Framework

    The complete text can be found here,

    https://en.wikipedia.org/wiki/Rust_(programming_language)
Results 1 to 25 of 643
Page 1 of 26 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)