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

Search:

Type: Posts; User: wolle

Page 1 of 28 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    3
    Views
    320

    Re: Palindrome Problem in C++

    Are you sure? I could not spot a bug, so I ran your code with jverd's test set in #3 and the results are identical. It suggests your code is working. Still, it will not work with negative integers....
  2. Replies
    2
    Views
    3,620

    Re: Solving SameGame aka Clickomania

    Are you looking for an algorithm to develop or to play the game? It is an important distinction. I think the OP wanted an optimal playing strategy.
  3. Replies
    14
    Views
    6,117

    Re: Store all pixel from a circle in an array?

    Are you looking for a solution to the Gauss circle problem?

    https://en.wikipedia.org/wiki/Gauss_circle_problem

    https://mathworld.wolfram.com/GausssCircleProblem.html
  4. Replies
    5
    Views
    865

    Re: Which programming language can handle this

    I would consider Python,

    https://www.python.org/

    It is the preferred language among people with no idea :), and there are many, as you can see here,

    https://www.tiobe.com/tiobe-index/
    ...
  5. Replies
    2
    Views
    1,165

    Re: Is it ok to use null checks?

    The inventor of the null reference, Tony Hoare, has publicly apologized for it. He calls it his billion-dollar mistake. See this Wikipedia entry (the first paragraph in the Apologies and retractions...
  6. Replies
    2
    Views
    636

    Re: "Embedding a method" refactoring method

    Embedding usually means that something is made part of some larger structure. And since the term "method" is predominantly used in object orientation, the larger structures in question could be the...
  7. Thread: complex signal

    by wolle
    Replies
    1
    Views
    948

    Re: complex signal

    C++ has a standard library to handle complex numbers,

    https://en.cppreference.com/w/cpp/numeric/complex

    Say you have,

    f(t) = exp^(j*omega*t)

    Note that the imaginary unit j plays a role in...
  8. Replies
    3
    Views
    591

    Re: Set to coordinates to centre of grid

    My code is logically the same as yours. If your code is wrong, so is mine. Your problem description indicates you have a working solution and now want help making your code become "neater".
  9. Replies
    3
    Views
    591

    Re: Set to coordinates to centre of grid

    I do not know what you mean by neater, but this is another way of assigning values to devy and devx,



    if (_num <= 3) {
    devy = 1;
    devx = _num - 2;
    } else if (_num <= 6) {
    devy = 0;...
  10. Replies
    1
    Views
    396

    Re: I'm new in Golang

    What is wrong with VS Code? It is considered one of the best. Maybe you did not download the Go extension. Why not give it another Go :)

    https://code.visualstudio.com/docs/languages/go

    Anyway,...
  11. Replies
    1
    Views
    986

    Re: Tournament Round robin to bracket

    Could you please explain what is wrong with the order of the matches in the examples you have presented?

    I cannot see anything strange in particular. Or is it maybe, that those who play their...
  12. Replies
    6
    Views
    2,255

    Re: Sudden problem with std::vector

    But, it only works if the function itself is executable at compile-time. If not, you still need to use an std::vector.
  13. Replies
    6
    Views
    2,255

    Re: Sudden problem with std::vector

    It will work (in this case) if the function is declared constexpr.
  14. Replies
    4
    Views
    1,172

    Re: Float point number simple arithmetic.

    In addition to my post #4.

    Not all decimal numbers have a finite digital representation. This includes 0.1, which requires an infinite number of bits. So when you assign 0.1 to a single-precision...
  15. Replies
    4
    Views
    1,172

    Re: Float point number simple arithmetic.

    A single-precision FP has 6-7 significant decimal digits, and a double-precision FP has 15-18. A good rule is to consider the significant digits only. The range of significant digits in an FP starts...
  16. Re: Why is my single thread code is faster than my multhread code?

    That may speed things up on the CPU side, but you probably should do something to that effect on the GPU side too. Maybe by pooling the command buffers,
    ...
  17. Re: Is it safe to locally use arrays, vectors and calloc when multi-threading

    I understand there may be company restrictions. But if you are free to choose, I recommend you update to the latest Visual Studio version and the latest C++ standard. With a reasonable delay, of...
  18. Re: Is it safe to locally use arrays, vectors and calloc when multi-threading

    I agree with the previous posters, at least if you use C++ version 11 or later.

    C++ 11 was a game-changer. Especially concurrency got a much-needed overhaul. Why should you not be able to use...
  19. Thread: Finding Doubles

    by wolle
    Replies
    12
    Views
    1,333

    Re: Finding Doubles

    I posted a solution strategy to this problem quite some time ago now,

    https://forums.codeguru.com/showthread.php?562663-Birthday-is-no-problem&highlight=birthday+problem

    Today, I can just...
  20. Thread: Finding Doubles

    by wolle
    Replies
    12
    Views
    1,333

    Re: Finding Doubles

    Say you draw numbers at random from a range of equally likely numbers. At some point, all numbers have come up at least once. After that, all drawn numbers will be duplicates. With N numbers in the...
  21. Thread: Tutorials

    by wolle
    Replies
    8
    Views
    811

    Re: Tutorials

    The C++ guidelines may not fit the bill perfectly, but it does demonstrate modern C++ usage (according to Stroustrup and Sutter, two prominent figures in the evolution of C++),
    ...
  22. Thread: Finding Doubles

    by wolle
    Replies
    12
    Views
    1,333

    Re: Finding Doubles

    Duplicity is a relative property between two entities. To compare the current entitity in a sequence with previous entities, one must store them somewhere. Unless, of course, duplicity is an...
  23. Thread: Finding Doubles

    by wolle
    Replies
    12
    Views
    1,333

    Re: Finding Doubles

    Then I suggest you use an std::unordered_set,

    https://en.cppreference.com/w/cpp/container/unordered_set

    You insert each new random integer into the unordered_set using the insert function. You...
  24. Thread: Finding Doubles

    by wolle
    Replies
    12
    Views
    1,333

    Re: Finding Doubles

    Maybe you mean duplicates? Do you want to avoid them? One method is to add each new random number to an std::vector after making sure it is not already in there. Another method is to add the random...
  25. Replies
    10
    Views
    1,223

    Re: wait .. no blocking

    I often use a thread-safe producer-consumer queue for this kind of situation. The producer thread pushes information on the queue and the consumer thread pops it, either by active polling or waiting...
Results 1 to 25 of 698
Page 1 of 28 1 2 3 4





Click Here to Expand Forum to Full Width

Featured