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.13 seconds.

  1. Re: Specify how many times elements of array will be compared [Bubble sort]

    You're looking at a version of bubble sort that has a fixed number of iterations based on the number of elements. Therefore, even if the elements are nearly sorted, the same number of iterations will...
  2. Re: sort vector of objects on member variable

    Function names have external linkage unless declared otherwise (e.g., if you declare them static), hence the extern keyword is unnecessary.
  3. Replies
    14
    Views
    308

    Re: New Student Help

    Well, the rule is to post code in code bbcode tags. The well formatted part is not actually part of the rule, but is something taken for granted: to help you understand your own code, especially when...
  4. Re: sort vector of objects on member variable

    It should work, e.g.,

    namespace vec_obj {
    // compare result_holder objects:
    bool operator<(const result_holder& lhs, const result_holder& rhs);
    }
    In the source file:

    namespace...
  5. Replies
    14
    Views
    308

    Re: New Student Help

    But if he takes an arrow to the knee, he can still teach...
  6. Re: sort vector of objects on member variable

    I note that this would be effectively equivalent to monarch_dodra's suggestion of std::min_element.
  7. Replies
    14
    Views
    308

    Re: New Student Help

    For starters, you should post your well formatted code in
    bbcode tags, e.g.,

    #include <iostream>

    using std::cout;

    int a = 1, b = 1, i = 1, j = 1;

    void dont(int& a, int& b) {
  8. Re: sort vector of objects on member variable

    A simple approach would be along the lines of:

    bool operator<(const result_holder& lhs, const result_holder& rhs)
    {
    return lhs.row_value < rhs.row_value;
    }
    where this operator< is...
  9. Re: Help using .find_first_not_of to check true or false.

    You can get the compiler to help you detect this kind of thing but compiling at a higher warning level.
  10. Replies
    5
    Views
    241

    Re: some class exercise

    What exactly is the problem that you're facing?
  11. Re: How to determine size of an allocated buffer

    As far as I know, there is no way to do that given just p. Store the size separately (or bundled together in a container, e.g., std::vector).
  12. Re: Help using .find_first_not_of to check true or false.

    No, you have not fixed it. I explained why in my previous post. Try entering "======" as the password. You will find that your program accepts it even though the submitted password does not contain a...
  13. Re: Help using .find_first_not_of to check true or false.

    find_first_not_of would be appropriate when you have a whitelist of characters, i.e., you check for validity by checking the string for characters not on this whitelist, and if one is found, the...
  14. Re: Sequentially remove one element from a vector at a time with replacement

    Do you really need a vector? These operations (lots of deletions and insertions in the middle) sound more appropriate for a linked list.
  15. Replies
    5
    Views
    322

    Re: Fill Array with even numbers only

    Ah, look carefully:

    x = rand()%50 + 1;
    if ( x%2 != 0 )
    TA1[row][col] = x;
    You're saying: generate a number in the range [1, 50]. If the number is odd, assign it to TA1[row][col]. Otherwise,...
  16. Replies
    5
    Views
    322

    Re: Fill Array with even numbers only

    So... what exactly is the "little issue"?
  17. Re: Determination if sequance is increasing or non- decreasing

    Well, you don't actually need an array index (j in 2kaud's example). If you use a pointer to the start of the array (arr in 2kaud's example, though it is really a pointer to the start of the original...
  18. Re: Determination if sequance is increasing or non- decreasing

    What do you find unclear?
  19. Re: Determination if sequance is increasing or non- decreasing

    Your base case is incomplete, i.e., you should consider what happens if the array only has one element (or even zero, depending on your requirements). As such, you need to consider if you should have...
  20. Replies
    3
    Views
    262

    Re: infinite loop

    Perhaps you meant to cast the output, not the input? Besides. x is already an int, so the cast would be pointless either way.
  21. Re: Byte Array to double Conversion

    The dance that you're doing to fill a long long with the bytes of a double that has an approximation of pi does not give the long long an approximate value of pi. Rather, you get a long long whose...
  22. Replies
    3
    Views
    298

    Re: Help with Stack, please...

    Unless you have to access it over the Internet, it is just another file that you can read if you've ever worked with file streams or the standard input stream.
  23. Replies
    5
    Views
    332

    Re: question about matrix maniplation

    Not quite in that there's bcp, but since LMHmedchem "installed libboost-devel and that installs most of the other libraries" rather than having downloaded an extracted subset of Boost, that's not a...
  24. Re: What is the code I use to generate these patterns?

    This depends on your requirements. For example, the most straightforward yet inflexible method is to hard code them in string literals.
  25. Re: calculating paternity index of single inconsitency in mutation with python

    You should post your best attempt first.
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 survey question.


Featured


HTML5 Development Center