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

Search:

Type: Posts; User: wolle

Page 1 of 22 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: simple rendering

    by wolle
    Replies
    3
    Views
    181

    Re: simple rendering

    When I started Windows programming in C++ I used a GUI (Graphical User Interface) package called Win32++. There are several sample applications included. I picked the one I thought looked most like...
  2. Replies
    1
    Views
    211

    Re: Please help me solve this problem

    The brute force solution is to generate all possible triplets (corners of a triangle) and select those that form a right triangle.

    This solution can be improved. By geometric reasoning it is...
  3. Replies
    3
    Views
    296

    Re: How do I write a recursive golden ratio?

    It looks like you're trying to use the fact that you get the golden ratio if you divide two consecutive numbers in the Fibonacci sequence?

    Since I don't know any Python I have to cheat and search...
  4. Replies
    6
    Views
    479

    Re: virtual function in derived class

    When you have virtual functions in a base class you must put in a virtual destructor too. It's enough to have it in the top base class if there is an inheritance chain (like you have). If it's not...
  5. Replies
    7
    Views
    755

    Re: implicit conversion in derived classes

    The first case is fine. It's called an upcast. The base class pointer will point to the derived object and access it as if it were a base object. The other way around is called a downcast and it has...
  6. Replies
    32
    Views
    1,644

    Re: Set of Unique pairs

    Well, it turns out I was on the right track after all so I restore the solution and continue.

    I had the idea that a pair (i,j) can be viewed as a square on a 6 by 6 chess board. We place 6 rocks...
  7. Replies
    32
    Views
    1,644

    Re: Set of Unique pairs

    Yes I've realized that so I removed my failed solution.
  8. Replies
    4
    Views
    393

    Re: Please help me with the error.

    cin >> n >> q;
    int ar[n];


    I think this is the error. You cannot declare a C array to be of a certain size n by reading n at runtime. Instead n must be available at compile-time already. It...
  9. Replies
    32
    Views
    1,644

    Re: Set of Unique pairs

    The purpose of the hash table was to store pairs (i,j) you have encountered so you can check later whether you have encountered them before.

    The purpose of the 2-dimensional 6 by 6 int array is to...
  10. Replies
    32
    Views
    1,644

    Re: Set of Unique pairs

    I've shared a lot already.

    I think it's your turn now.
  11. Replies
    32
    Views
    1,644

    Re: Set of Unique pairs

    In C I would be less general and replace the hash table with a 6x6 2-dimensional int array.

    Instead of the numbers 1 to 6 I would use 0 to 5.

    The array is initially set to all 0. To indicate...
  12. Replies
    32
    Views
    1,644

    Re: Set of Unique pairs

    Sure, the C++ standard library (STL) offers both a function to generate permutations and a suitable hash table.

    https://en.cppreference.com/w/cpp/algorithm/next_permutation...
  13. Replies
    32
    Views
    1,644

    Re: Set of Unique pairs

    I seems like all numbers 1 to 6 must always be present in each set. If means if you start with this set,

    (1,2)(3,4)(5,6)

    you can generate all possible variations of that set simply by...
  14. Replies
    12
    Views
    824

    Re: cin isn't blocking

    Do all user input/output from the main thread.

    Then set up a message system, that is some way to pass information between threads.

    If you do this you're on solid traditional ground and don't...
  15. Replies
    12
    Views
    824

    Re: cin isn't blocking

    Yes I bet this is the problem. The OP is not reading the standard input from inside the main thread.
  16. Replies
    21
    Views
    1,359

    Re: unexpected behavior of integer variable

    You don't have to skip C++ altogether. You can still use elements of C++ to your advantage without taking on the full modern C++. As I mentioned in #11, one example is the standard STL data...
  17. Replies
    21
    Views
    1,359

    Re: unexpected behavior of integer variable

    I googled for Arduino UNO,

    https://store.arduino.cc/arduino-uno-rev3

    and when writing code for devices like this I would say C++ may be overkill.

    I would concentrate on the C part of C++. It...
  18. Replies
    21
    Views
    1,359

    Re: unexpected behavior of integer variable

    That line is wrong in two ways. It should be,


    if (i == 0) numstr.append("0");


    = is an assignment, == checks for equality.

    There is a standard function to_string you can use,
  19. Replies
    5
    Views
    523

    Re: Should I go for QT?

    If you want C++ then I suggest you go for Qt. It's not just a GUI but also an application framework. You'll have to check out the contents of the framework to find out whether it has what you need....
  20. Thread: std::string trim

    by wolle
    Replies
    6
    Views
    3,233

    Re: std::string trim

    What about Boost? It's well tested and has the status as almost STL.

    https://www.boost.org/doc/libs/1_72_0/doc/html/string_algo.html

    I'm not a lawyer but my impression is that the Boost licence...
  21. Replies
    9
    Views
    559

    Re: vb6 will and VC98 C++ won't

    Sure, rounding!
  22. Re: bizare compiler error assigning a value to a string (expected constructor, etc)

    I do this a lot. I post a section from my production code as an example. It's a conversion function called toElement that turns atom names in the form of strings into internal counterparts.

    Since...
  23. Replies
    7
    Views
    599

    Re: sort vector of struct

    I don't think the call to fill is strictly necessary since when the vapp vector is constructed it will be filled with N default constructed app structs whose members will be initialized to the...
  24. Re: bizare compiler error assigning a value to a string (expected constructor, etc)

    There are restrictions as to what kinds of code you can put at different places.

    If you put the assignments inside a function the code should compile. This function then obviously must be called...
  25. Replies
    7
    Views
    599

    Re: sort vector of struct

    Yes you're right, and I suppose the OP would've got a compiler error if they weren't allowed.
Results 1 to 25 of 548
Page 1 of 22 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)