Type: Posts; User: monarch_dodra
Search took 0.10 seconds.
December 18th, 2014, 04:49 AM
My first comment is: "I know it's easier using std::list but we were asked to implement the projet using our own home-made List class, so we learn how to do it." I don't see a home made list class...
December 17th, 2014, 10:00 AM
Should your nodes hold the number information in some place? Or is the idea that the node's index in its container makes that implicit?
In any case, to insert a word, I'd decompose it into its...
December 17th, 2014, 08:37 AM
Ideally, I think you should store your names in an (unordered_)set. A set is a data structure that manages its own ordering, and is itself capable of retrieving items for you, and knowing if they are...
December 17th, 2014, 06:42 AM
You need to read what you just wrote. Which variable are you using to iterate?
December 17th, 2014, 06:14 AM
Please properly format your code. I don't see any "search name" function. What exactly isn't working for you?
This declares a variable length array and is not standard C++. Use an std::vector...
December 16th, 2014, 04:06 AM
I remember this question with the actual "design requirements" which would have better helped answer. As is, we can only guess from the names what the functions should do. My guess is:
December 14th, 2014, 05:23 AM
There is a version of find called "find_if" that can take a predicate, and will return an iterator to the first element for which pred(e) returns true.
If you do a functor approach (with state!),...
December 12th, 2014, 10:13 AM
BTW, month names in English are capitalized.
December 12th, 2014, 09:51 AM
First thing: If you want some real help, please take the time to format your code into something easy to read. We are giving you free help. If you can't make the effort, then you we might not feel...
December 11th, 2014, 04:19 AM
It means that *IF* your object is declared in a name space *THEN* your "operator<" *SHOULD* be in the same namespace. This is for Koenig lookup, but you shouldn't have to worry (or even know...
December 10th, 2014, 04:30 AM
As laserlight said, you can either define operator< in result_holder for a "default" sort. If you want to customize the sort, you can do it either via a function pointer or functor.
if you want to...
December 9th, 2014, 03:25 AM
I'm a bit rusty on my linear algebra, but it seems you are basically just trying to find the basis of your matrix? Aren't there known algorithms that do that already?
December 8th, 2014, 10:46 AM
I think he wants to process sequence of partial permutations?
December 8th, 2014, 04:04 AM
Well, depending on how you look at it, he's only *swapping* items in and out, but never actually doing insertions or deletions. Given OP (seems) to be working with trivial ints, then sticking with...
December 8th, 2014, 03:58 AM
Yes, I hesitated to mention this. But to be frank, I think that's a bit over OP's level...
December 6th, 2014, 04:38 PM
For what it's worth, if this is a class assignment (and it looks like it is) that requires a recursive solution, then a simple "check first, recurse the rest" might not be what is being asked of you....
December 5th, 2014, 11:32 AM
It's just shorthand: a reference is (mostly) just a "dereferenced pointer" managed by the compiler. You are reinterpreting the reference, which is equivqlent to extracting a reference (pointer),...
December 5th, 2014, 09:31 AM
You are "C casting" your long long back to a double "(double)piAsLong". This is a standard value-style static_cast: You are literally reading the numeric value of your long (f1d4c853fb210940), and...
December 2nd, 2014, 06:12 AM
November 29th, 2014, 11:09 AM
I call BS on that statement. All random number generators generate randomness with varying "quality", but *none* will emulate something such as "skewedness" or "loadedness". They will all generate...
November 26th, 2014, 04:47 PM
srand "(re)initialises" your global rand sequence using the seed you give it. If you are using clock, then chances are the clock did not actually change, so you are effectively "resetting" your rand...
November 26th, 2014, 03:54 PM
I didn't read the code.
If you are getting the same result every *run*, then your forgot to srand.
If you are experiencing duplicate sequences in a single run, then you are probably...
November 21st, 2014, 03:44 AM
Stating you "have" to use an if than proceeding to basically put a switch inside your for loop to special case the iteration is an anti-pattern.
All I can understand is that you want to read your...
November 20th, 2014, 04:47 PM
Your "buff" is an array of characters, therefore your "cstr" is just *a* string. "cstr" is the first character, and "cstr" is the second character.
It would appear that you think that "cstr"...
November 19th, 2014, 04:05 AM
!!!! That's some seriously old style C.
Back to the subject at hand, you seem to want to have either an integral fraction (5/4) or a floating point fraction (2.3/5.2) depending on what the user...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.