Posts
 
Reputation
Joined
Last Seen
Ranked #129
Strength to Increase Rep
+10
Strength to Decrease Rep
-2
93% Quality Score
Upvotes Received
211
Posts with Upvotes
151
Upvoting Members
73
Downvotes Received
10
Posts with Downvotes
9
Downvoting Members
9
47 Commented Posts
7 Endorsements
Ranked #260
Ranked #191
~177.58K People Reached
About Me

Mostly retired computer scientist after 26 years at Bell Labs and its offshoots. Founding member of C++ standards committee. Project editor for the 1998 and 2003 versions of the C++ standard. Author of "C Traps and Pitfalls" and coauthor of…

Interests
Most of my energy these days goes into music and photography.
PC Specs
Core 2 Extreme Q6850 (quad core), 3 GHz/3.25 GB RAM; Windows XP SP3.
Favorite Tags
Member Avatar for JoBe

[QUOTE=JoBe;188512]Ok, thanks for the additional info :!: I think I could do this by putting an if statement in it, for example when the while loop is at N°3 it should enter 0 into the vector, this way the amount of vectors is correct, but the total amount isn't.[/QUOTE] The …

Member Avatar for Alfonso_4
0
853
Member Avatar for montjoile
Member Avatar for kylcrow

[QUOTE=Ancient Dragon;1501019]Nice info, but 4 years too late.[/QUOTE] And wrong, too, for at least two reasons that come to mind immediately.

Member Avatar for zia shaikh
0
5K
Member Avatar for Dave Sinkula

Thank-you Andrew Koenig and Barbara Moo..I appreciated yours words of wisdom. You're welcome.

Member Avatar for shahidali6
11
10K
Member Avatar for nightcrew

If there's no upper bound on n, then you need a data structure that can grow without bound. If you can't use arrays or pointers, then you must find some other data structure that grows without bound. If you're not allowed to use any such data structure, then the only …

Member Avatar for omgerg
0
3K
Member Avatar for biljith

And now that it's in the C++ forum, I can point out that the title of this thread talks about printing the reverse of a number, but the program computes the sum of its (decimal) digits. Which is right?

Member Avatar for ReaseySo
0
267
Member Avatar for bob89

Is there a reason that you are insisting on an AVL tree rather than just a data structure that will use an order relation to store values in a way that will keep equals together? Because if you just need the latter, you should be able to get std::set (or …

Member Avatar for paladin.lone
0
336
Member Avatar for crazyboy
Member Avatar for Kirielson

[code]ofstream f(filename, ios_base::out | ios_base::app);[/code] iosbase::app means that you want to append to the file.

Member Avatar for ankit1990rana
0
8K
Member Avatar for blee93

Not every C++ implementation is capable of supporting an integer as large as 600851475143. So if you want to use a C++ implementation that doesn't support integers that large, you have a few choices: 1) Figure out how to represent such large integers for yourself. 2) Find an extended-precision integer …

Member Avatar for vCillusion
0
363
Member Avatar for rena0514

What do lines 20-22 do? They don't seem to correspond to any part of the problem specification. In particular, they seem to say that A(0,1) is equal to A(1,1). I see no justification for that claim.

Member Avatar for guly2010
0
4K
Member Avatar for predator78

[QUOTE=Ancient Dragon;1572886]The republicans had no say in passage of Obamacare. The Democrats controlled both houses of congress at that time. So I don't know how you can possibly blaim the republicans for anything.[/QUOTE] That's easy: the same way that the original poster can talk (apparently with a straight face) about …

Member Avatar for mike_2000_17
2
728
Member Avatar for Geli19

Also: Why are you writing `DataType *Ptr = new DataType();` instead of simply writing `DataType Obj;` ?

Member Avatar for Geli19
0
5K
Member Avatar for silvercats

To Silvercats: Everything in Accelerated C++ is as valid now as it was in 2000. It is true that it doesn't cover the C++11 stuff, but it is possible to learn that stuff later.

Member Avatar for arkoenig
0
350
Member Avatar for henry.sj.shin

I think that you probably have something like this in mind: def print_reverse(s): for i in range(len(s)-1, -1, -1): print(s[i])

Member Avatar for TrustyTony
0
392
Member Avatar for Microno

I doubt you're going to find anyone to help you with this code because your description of what it's supposed to do is so unclear. To begin, (x^2+x)/(x^2+x^3) isn't a polynomial; so your claim that your program finds the integral of a polynomial is not correct. Therefore, we don't actually …

Member Avatar for ravenous
0
171
Member Avatar for DonutsnCode

The paragraph you cite is an example of explaining how to avoid a bad programming technique by using a second bad programming technique. Here's why I say that. A reference is an alternative name for an object. For example, if I write [code]int i; int& j = i;[/code] then I …

Member Avatar for elmohler
0
925
Member Avatar for gerard4143

I would think that if you replace the type std::pair<std::string, unsigned long> in lines 7 and 23 by std::pair<const std::string, unsigned long>, it ought to work. At least I can't think immediately of any reason it shouldn't.

Member Avatar for gerard4143
0
356
Member Avatar for SoulMazer

This code doesn't work: [code] std::list<bullet> bullet_list; std::list<bullet>::iterator iter; bool alive = false; for (iter = bullet_list.begin(); iter != bullet_list.end(); ++iter) { bool isalive = iter->alive; if (isalive == true) { alive = iter->move(); // move is a function inside the struct "bullet" } if (alive == false) { int …

Member Avatar for saravmittar
0
195
Member Avatar for misalazeem

There are four conditions that must be met for checkmate to occur: 1) The king is in check. 2) There is no move that the king can make that takes it out of check. 3) It is not possible to capture the attacking piece. 4) It is not possible to …

Member Avatar for arkoenig
0
1K
Member Avatar for iamthesgt

I don't even need to ask how your program is supposed to work because it can't -- there is no way for recursivecandy to return that does not involve a recursive call, so there is no way for it ever to return a meaningful value.

Member Avatar for markshah2
0
613
Member Avatar for optimumph

[QUOTE=mzimmers;1691543]Everything you say makes sense. I just found it odd that an algorithm that needs to be told the start and the end of the data (like sort) would expect the end to be beyond the final valid element. But, your position is supported by the results of the program, …

Member Avatar for mzimmers
0
218
Member Avatar for eRayven38

I don't understand the assignment. Deleting an element from a doubly linked list is not inherently an iterative operation, which means that there is no obvious way to transform it into a recursive operation.

Member Avatar for deepu.sri24
0
1K
Member Avatar for sergent

What would you do with variable-length arrays that you can't do better with C++ vectors?

Member Avatar for mike_2000_17
0
211
Member Avatar for programing

I think this question would be better asked in the C forum, as the program you posted has no significant C++ content.

Member Avatar for trin12345
0
175
Member Avatar for hujiba

Remove the call to srand from the choose_number function. As a general rule, you should call srand only once in your entire program.

Member Avatar for doug65536
0
166
Member Avatar for Labdabeta

Xoring the bits of an integer is equivalent to computing its parity. There are ways of doing so that might be faster than your original example, but you'd have to measure to see whether it's really faster in practice. The way that comes to mind is this: Divide the integer …

Member Avatar for murnesty
0
95
Member Avatar for Pikachumanson
Member Avatar for Kyren5058

Here are some questions for you to answer? 1) Do you know how to print the first line of the required output? 2) Do you know how to print the second line? 3) If I give you a number n, do you know how to print the nth line?

Member Avatar for cherrymae.calma
0
275
Member Avatar for frogboy77

[QUOTE]Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is …

Member Avatar for pseudorandom21
0
422