109 Posted Topics

Member Avatar for sTorM

I would create more of a deck than you have right now, and treat it as a stack. You would have 52 cards, each card would have a suit, a face, and a value, and you can shuffle and deal from it easily. [code] #include <algorithm> #include <iostream> #include <string> …

Member Avatar for Ravalon
0
111
Member Avatar for unclepauly

You're adding a constant number of items onto a variable number of lines. When you have a constant number of items, the big O is almost always going to be O(1) and when you have a variable number of items but you do a constant operation on every item, the …

Member Avatar for unclepauly
0
126
Member Avatar for sTorM

[QUOTE]"Debug Assertion Failed!"and with "Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)"[/QUOTE] When you get that it means that somehow you corrupted your memory and the allocator isn't getting what it expects to free it. The bug is almost never near the delete operator, and it could be anywhere. In the case of memory bugs, post all …

Member Avatar for John A
0
224
Member Avatar for JRM

[QUOTE=JRM;295149]I'm just trying to get a handle on the when and why of overloaded operators.[/QUOTE] Cool. :) [QUOTE=JRM;295149]the line: T& operator[] ... is there for use in the copy constructor?[/QUOTE] Nah, the copy constructor doesn't invoke the overloaded operator at all, it uses the [] operator for pointers. [QUOTE=JRM;295149]the line …

Member Avatar for Ravalon
0
84
Member Avatar for unclepauly

Big O takes the biggest part of the time expression because it has the biggest effect. :) As n gets bigger and bigger, the log n part will get less and less significant as the n^2 part starts to dominate. Since you can toss anything smaller than n^2 in the …

Member Avatar for unclepauly
0
65
Member Avatar for sTorM

It's implementation defined what happens when you use an unrecognised character literal. You use '10', and that has too many expected characters, and C++ is seeing it as '0'. [code] #include <cstdio> int main() { using namespace std; char x = '10'; printf( "%d\t%c\n", x, x ); } [/code]

Member Avatar for sTorM
0
104
Member Avatar for sTorM

I don't understand the question. Can you explain it a different way please?

Member Avatar for sTorM
0
128
Member Avatar for Boldgamer

[quote]I know that you cannot judge a book by it's size but I am a little worried that Accelerated C++ will not go as far in depth as the other two.[/quote] That's because with Accelerated C++ you get all the meat and none of the empty calories. :) It basically …

Member Avatar for may4life
0
169
Member Avatar for l2u

[QUOTE]How do I get smart pointer from pointer address?[/QUOTE] You can't. Smart pointers are smart, but regular pointers are very dumb. They don't know which objects they belong to, or even if they belong to an object at all. The only way to figure it out is by coming up …

Member Avatar for Ancient Dragon
0
96

The End.