text: Type: Posts; User: laserlight
  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...
  Function names have external linkage unless declared otherwise (e.g., if you declare them static), hence the extern keyword is unnecessary.
  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...
  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...
  But if he takes an arrow to the knee, he can still teach...
  I note that this would be effectively equivalent to monarch_dodra's suggestion of std::min_element.
  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) {
  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...
  You can get the compiler to help you detect this kind of thing but compiling at a higher warning level.
  What exactly is the problem that you're facing?
  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).
  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...
  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...
  Do you really need a vector? These operations (lots of deletions and insertions in the middle) sound more appropriate for a linked list.
  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,...
  So... what exactly is the "little issue"?
  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...
  What do you find unclear?
  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...
  Perhaps you meant to cast the output, not the input? Besides. x is already an int, so the cast would be pointless either way.
  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...
  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.
  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...
  This depends on your requirements. For example, the most straightforward yet inflexible method is to hard code them in string literals.
  You should post your best attempt first.