Search:
Type: Posts; User: Hermit
Search:
Search took 0.53 seconds.
-
January 22nd, 2009, 11:01 PM
Just think about it algebraically:
2^n = 2^(n-1) + 2^(n-1) = 2 * 2^(n-1)
x(n) = 2^n
x(n) = 2 * x(n-1)
Make sense? I haven't written any code and I still feel like I'm giving away the answer.
-
January 19th, 2009, 09:12 AM
I don't think it's meant to make the key "more secure" with regard to brute force methods, but to make the cyphertext less easily analyzed by mathematical or intuitive means. At the risk of revealing...
-
January 12th, 2009, 02:45 PM
A good point. Certainly one could limit the variable's scope with an extra pair of curly braces, but that would be a bit on the ugly side, and not something I can honestly say that I do. I had read...
-
January 12th, 2009, 02:25 PM
Agreed that it's odd. If I must write a loop that breaks form like that, I tend to prefer writing it as a while-loop. I don't think anyone should have to take a second look at a for-loop to see what...
-
January 12th, 2009, 02:13 PM
In other words, recall that member functions are implicitly passed a this-pointer when called. When you declare a member function as const, you are specifying the constness of that implicit...
-
January 10th, 2009, 11:30 AM
I don't think it's fair to assume that the OP is still in the beginning stages of his education, so the topic should have little to do with that. If this is a project for an introductory course, I'm...
-
January 7th, 2009, 01:14 PM
You may want to have a look at boost's ptr_vector class. It will, by default, automatically delete pointers when they are removed from the container.
Another option would be to use a vector of...
-
January 6th, 2009, 11:47 AM
None that I'm aware of.
Seems fine to me. It did seem a bit odd that you would create a second array of pointers to every element in another array, but then I saw the last part of your post. You...
-
January 5th, 2009, 10:15 AM
This still doesn't make any sense. In order for the policy class to resolve T::fooType, T needs to be a complete type, which it can't be because at this point in the instantiation we're still...
-
January 5th, 2009, 12:15 AM
I feel I need to point out that while you criticize _uj for his acerbic posting style, saying that it detracts from the informational content of the thread, you yourself have contributed nothing...
-
January 4th, 2009, 11:18 PM
I would subscribe to Lindley's definition if it lacked the word "objects", which causes it to disagree with the term "static method". To its credit, however, that definition does underscore an...
-
October 5th, 2008, 11:17 PM
You should be aware that the algorithm you're proposing is, in a word, slow. Consider the word "algorithm", of which there are 9! = 36,2880 permutations. Would you want to take each of those...
-
September 25th, 2008, 10:18 AM
Portaudio is a pretty good cross-platform sound library that you could use. If you're a novice programmer and don't want to muck about with a separate thread for audio, this library is particularly...
-
September 20th, 2008, 03:34 PM
In the code you posted, you do not divide by div1, you divide by div and store the result in div1. You then output the value of the uninitialized variable divided. Uninitialized variables may...
-
September 20th, 2008, 03:21 PM
Change
while (int j=0;j<counter;j++)
to
for (int j=0;j<counter;j++)
-
September 20th, 2008, 10:42 AM
This isn't a question.
Cyclic referencing is partially solved by using weak pointers where appropriate, which are convertible to and from shared pointers but do not by themselves increase the...
-
September 19th, 2008, 10:37 AM
I've seen a few licensing systems use the MAC address of the ethernet adaptor. A quick search brought up this article on getting MAC addresses (Windows-specific).
-
September 19th, 2008, 12:43 AM
What do you mean by "clear memory"? Free the memory reserved by a vector? One way that's often accomplished is what's called the swap trick:
std::vector<double> lots_of_data(5000);
...
-
September 19th, 2008, 12:31 AM
Cocoa is an Objective-C framework (could they have picked an uglier language?), although it is possible to incorporate C++ code into a Cocoa application (using "Objective-C++" as its called). Carbon...
-
September 16th, 2008, 10:36 AM
This is a bit of a math question, but I'll ask it here partly because I don't belong to any math forums, and partly because the computational complexity of the answer is important.
Given two...
-
September 9th, 2008, 11:44 PM
Yeah, it's doable. I can't seem to find the article but the technique involves virtually inheriting from a class whose constructor is private and which declares the "final" class as a friend. This...
-
September 7th, 2008, 09:21 AM
The problem here is simply that dbar_val is declared const but defined non-const. Change that line to:
const double bar::dbar_val = 3.1233;
Note you could also do:
class bar {
static...
-
September 7th, 2008, 09:10 AM
The conclusion is that C++ will not keep you from shooting yourself in the foot if you are hell-bent on doing so. Compiler rules exist to keep sane programmers from making mistakes, not to keep...
-
September 5th, 2008, 01:35 PM
Well, it's a debatable point, depending on what kind of guarantee you're looking for. The current standard does not require that strings be contiguous, but future standards will and most if not all...
-
September 5th, 2008, 10:19 AM
I do not think it is safe to assume that all random access iterators will iterate over contiguous memory, just that they provide constant-time access to any element in the collection. If a random...
|
Click Here to Expand Forum to Full Width
|