Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Showing results 1 to 20 of 20
Search took 0.01 seconds.
Search: Posts Made By: Bench
Forum: C++ Aug 4th, 2007, 11:56 AM
Replies: 18
Views: 585
Posted By Bench
Look at this (contrived) program ... do you...

Look at this (contrived) program ... do you understand how this works?
#include <iostream>

int factorial_one( int n )
{
return n;
}

int factorial_two( int n )
{
Forum: C++ Jul 26th, 2007, 9:21 PM
Replies: 18
Views: 585
Posted By Bench
In the context of the reply, I believe the OP was...

In the context of the reply, I believe the OP was under the train of thought that 'return 1' was a direct return to the original call in main, rather than back to itself. Perhaps I should have used...
Forum: C++ Jul 26th, 2007, 8:38 PM
Replies: 18
Views: 585
Posted By Bench
No, the function doesn't terminate, it returns a...

No, the function doesn't terminate, it returns a value to itself. What you have is essentially a function call within a function call within a function call within a function call...

If you were...
Forum: C++ Jan 10th, 2007, 7:57 PM
Replies: 10
Views: 328
Posted By Bench
I'd say that this is far more 'C++' .. ...

I'd say that this is far more 'C++' .. std::string my_string("The quick brown fox jumped over the lazy dog");
std::replace( my_string.begin(), my_string.end(), 'o', '*' ); :)
Forum: C++ Jan 7th, 2007, 11:54 AM
Replies: 5
Views: 169
Posted By Bench
Have a look here -...

Have a look here -
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9
Forum: C++ Dec 22nd, 2006, 9:00 AM
Replies: 9
Views: 227
Posted By Bench
The difference between the 3 styles is the...

The difference between the 3 styles is the difference between whether or not you fill up your program's namespace scope with identifiers from the standard library.

The main idea of namespaces is to...
Forum: C++ May 7th, 2006, 11:31 AM
Replies: 6
Views: 458
Posted By Bench
How about "Get something made this millenium"...

How about "Get something made this millenium" instead? ;)
Forum: C++ Apr 12th, 2006, 5:18 PM
Replies: 16
Views: 432
Posted By Bench
int divby; for (divby == 2; divby < decksize;...

int divby;
for (divby == 2; divby < decksize; divby++)
look carefully at that line..
Forum: C++ Mar 29th, 2006, 5:59 PM
Replies: 75
Views: 1,633
Posted By Bench
ok... but you still haven't fixed the problems...

ok... but you still haven't fixed the problems which Cache identified for you in the heapNode class.. //get right
heapNode getRight()
{
return right;
}

//get left
heapNode getLeft()
...
Forum: C++ Mar 28th, 2006, 9:15 PM
Replies: 75
Views: 1,633
Posted By Bench
Before dereferencing any pointer, check that it...

Before dereferencing any pointer, check that it is not NULL.

You most probably don't want to return heapNode by value, because this uses copying. Cache's suggestion of returning the pointer is...
Forum: C++ Mar 28th, 2006, 8:44 PM
Replies: 7
Views: 247
Posted By Bench
Change your #include files to C++ standard ones,...

Change your #include files to C++ standard ones, Also change void main() to int main(). Finally, You can remove the stdafx.h if you like. You don't need that header since you can turn precompiled...
Forum: C++ Mar 19th, 2006, 4:50 PM
Replies: 19
Views: 596
Posted By Bench
Why not use the standard library algorithm...

Why not use the standard library algorithm provided for this purpose? :)
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
string s("tnorf-ot-kcab");
...
Forum: C++ Mar 14th, 2006, 10:38 AM
Replies: 21
Views: 536
Posted By Bench
I believe there is currently some discussion...

I believe there is currently some discussion among members of the ISO C++ Standards Committee about precisely how the value of a null pointer should be written. In a recent usenet post, Bjarne...
Forum: C++ Mar 14th, 2006, 9:55 AM
Replies: 9
Views: 388
Posted By Bench
Nothing to do with C++ - blame your old compiler...

Nothing to do with C++ - blame your old compiler for misleading you. it has been secretly adding an extra line to the end of your main() function, letting your program pause before it ends.
Forum: C++ Mar 14th, 2006, 9:05 AM
Replies: 21
Views: 536
Posted By Bench
And I think this sort of confusion among tutors...

And I think this sort of confusion among tutors is the main source of confusion among learners. I'm sure it would help if the word "pointer" itself was not applied to the value aswell as the...
Forum: C++ Mar 12th, 2006, 9:11 AM
Replies: 13
Views: 493
Posted By Bench
When using non-standard/non-portable code, you...

When using non-standard/non-portable code, you might want to localise it to one small part of your program (eg, a function wrapper) - Then all calls to the non-standard code will be through that...
Forum: C++ Mar 9th, 2006, 5:02 AM
Replies: 17
Views: 463
Posted By Bench
I believe he's referring to the fact that your...

I believe he's referring to the fact that your examples encouraged sprintf() over streams, not necessarily a claim that you said "X is better than Y".
On the other hand, he may have a point - The...
Forum: C++ Mar 3rd, 2006, 7:40 PM
Replies: 14
Views: 488
Posted By Bench
My guess is that you are a Windows user, and...

My guess is that you are a Windows user, and problem has nothing to do with C++ ... windows automatically closes console windows when a console program is finished... The easy solution - don't let...
Forum: C++ Mar 1st, 2006, 7:01 PM
Replies: 3
Views: 222
Posted By Bench
look at exp() for e^x

look at exp() for e^x
Forum: C++ Feb 19th, 2006, 4:36 PM
Replies: 10
Views: 654
Posted By Bench
a dumbed-down explanation

You may feel comfort in the fact that the majority of people also found themselves banging their head against a wall at one stage or another when they first tried to grasp OOP (I know I did).

You...
Showing results 1 to 20 of 20

 
Forum Jump



DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:59 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC