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

Search:

Type: Posts; User: laserlight

Page 1 of 80 1 2 3 4

Search: Search took 0.22 seconds.

  1. Replies
    1
    Views
    53

    Re: Is this method is bubble sorting?

    One of the characteristics of bubble sort is that only adjacent elements are compared. Your first code snippet compares elements that are not adjacent, so it is not bubble sort.

    Perhaps we could...
  2. Replies
    5
    Views
    158

    Re: Validating a Float

    You should avoid global variables. In this case, this means that you should move these declarations:

    string numstr;
    bool goodnum = true;//assume good
    from file scope into the local scope of the...
  3. Re: Using malloc and free instead of new and delete in C++

    Anyway, tomy12, maybe this will help:

    allocate should allocate memory for the elements of the vector without actually creating them, i.e., after it is called, you have memory, but technically you...
  4. Re: Using malloc and free instead of new and delete in C++

    The skeleton of My_allocator does follow the essential member functions of the pre-C++11 standard allocator though, so I think the problem probably lies in the wording, i.e., the instructions were...
  5. Replies
    5
    Views
    180

    Re: Input Validation

    I note that 2kaud's code example will allow input such as "1abc": the "1" would be read and validated, but as you do not attempt to read the "abc", there is no input failure, so it appears to...
  6. Re: concatenate int value from vector to long long int

    What exactly does that mean? Perhaps you should provide example input and expected output.
  7. Replies
    12
    Views
    256

    Re: Divide 1d vector into 2d vector

    So you managed to implement the code for your original problem using a for loop? I think that's fine in terms of how easy it is to understand and how fast it will be.
  8. Replies
    12
    Views
    256

    Re: Divide 1d vector into 2d vector

    Have you ever done that exercise where you are given a sequence of values, and you're supposed to display them in rows of say, 3 values per row? You can adapt that idea here.
  9. Replies
    4
    Views
    295

    Re: Learning MySQL by C++

    You don't even need to know a programming language like C++ to learn database design, SQL, and MySQL in particular. For example, you could use graphical tools for inspecting a MySQL database and...
  10. Re: How to create a function for storing object in map?

    Oh wait, I just realised that 2kaud's example from post #5 has two template parameters, so Richard.J's "template parameter for the object" comment refers to the second one. My bad. Yeah, it certainly...
  11. Re: How to create a function for storing object in map?

    It would, if the corresponding argument was a std::map<int, Account> object. However, in the example code from post #1, the corresponding arguments may be a std::map<int, Saving> object or a...
  12. Re: How to create a function for storing object in map?

    I don't think that will work though: std::map is a template, and possible arguments include a map<int, Saving> object and a map<int, Current> object.

    It also looks like Create should not be a...
  13. Re: C Question: I want to convert an int to string of size n and pad with 0's.

    I think part of the fun is trying this out yourself. I would expect something like this:

    int i = 1234;
    char result[11];
    char format[6];
    int width = 10;
    /* call sprintf to format format here
    ...
  14. Re: C Question: I want to convert an int to string of size n and pad with 0's.

    Yes, e.g., use sprintf to format a string that is then used as the format.
  15. Re: hierarchy of abstract interfaces implementation

    Instead of trying to cram many methods into a single interface, consider separating them according, as per the interface segregation principle. Maybe you could have something like this:

    #include...
  16. Re: Fast way to Multiply two string numeric value

    If you cannot understand a library with available code that was written for your scenario and that was optimised by people who have been researching and experimenting with this much longer than you,...
  17. Re: Fast way to Multiply two string numeric value

    Um, that looks like the beginning of an approach leading to the Karatsuba multiplication algorithm.

    I suggest that you go back to trying to get a third party library to work for you, and see if it...
  18. Re: [RESOLVED] C question: converting int to string and back

    Not quite: int has a minimum guaranteed value of -32767 which is only 6 chars, and could have a minimum value that cannot be represented with 11 chars, even though I don't think any implementation...
  19. Re: C question: converting int to string and back

    This array of char can only contain a string of a maximum length of 6:

    char str[7];
    If you want a string of a length of 8, then you need an array of 9 char to account for the null character.
    ...
  20. Re: Creating a shared_ptr in a method, and pass them out around.

    The caller will receive a copy of the shared_ptr, hence maintaining the reference count, no?

    Incidentally, I think it may be better to return a unique_ptr, hence allowing the caller to opt out of...
  21. Re: RAD Studio difference between i++ and ++i

    Have you tried increasing the warning level when compiling? Sikkirigi's examples definitely fall under the "trivial cases" mentioned by superbonzo in post #9, so while there might be debate over...
  22. Re: RAD Studio difference between i++ and ++i

    The behaviour is undefined in all the cases that you posted, whether or not you use prefix or postfix operator++. Refer to this FAQ on expressions in C that is applicable to C++. Consequently, there...
  23. Re: Standard C++98 Banking System example with OOPS

    What is your current code and how does it not work?
  24. Re: Standard C++98 Banking System example with OOPS

    Why not a C++11+ example?

    Anyway, I recommend that you attempt this yourself. I mean, I certainly don't have any "simple banking system example in C++ but with OOPS concept like Inheritance, and...
  25. Replies
    4
    Views
    329

    Re: List iterator is not incrementable

    I wonder if you have considered an approach like this instead, using facilities from <algorithm>:

    // Partition messages into those that are to be delivered now, and those that are not:
    auto...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!


HTML5 Development Center