Search Results

Showing results 1 to 18 of 18
Search took 0.01 seconds.
Search: Posts Made By: grumpier
Forum: C++ Jan 14th, 2009
Replies: 8
Views: 542
Posted By grumpier
You're developing a realtime application, and don't know how to add values to elements of an array?????

Pull my other leg: it'll play a tune for you.

What is the criterion by which you would...
Forum: C++ Dec 31st, 2008
Replies: 5
Views: 806
Posted By grumpier
To give you a clue about what's happening, 100! is about 9.3 by 10^157. To represent that, a 525 bit integer is needed (and that increases 530 bits to represent 101!). 64 bit is nowhere near...
Forum: C++ Dec 30th, 2008
Replies: 6
Views: 358
Posted By grumpier
You need to be careful with executable compression. Compressed executables have some characteristics associated with self-modifying code (the decompression stub unpacks code and data into memory). ...
Forum: C Dec 29th, 2008
Replies: 3
Views: 420
Posted By grumpier
If by ``"c" programme'' you mean something that is compliant with one or both of the C standards, then there's only one answer: it's impossible. Your not wanting such an answer does not make it...
Forum: C++ Dec 27th, 2008
Replies: 8
Views: 491
Posted By grumpier
It doesn't matter where you do it, as long as you obey the one-definition rule (ODR). Typical projects link together object multiple object files to create an executable, and each object file is...
Forum: C++ Dec 17th, 2008
Replies: 6
Views: 1,286
Posted By grumpier
The only way in which a constructor can report an error is by throwing an exception.

The C++ standard has this to say (in Section 15.2 "Constructors and destructors" which is within Section 15...
Forum: C++ Dec 15th, 2008
Replies: 4
Views: 493
Posted By grumpier
That statement is inaccurate on so many levels that I'm speechless. Non-virtual functions can also be overridden, but the behaviour differs from overridden virtual functions due to "name hiding", as...
Forum: C++ Oct 31st, 2008
Replies: 9
Views: 966
Posted By grumpier
Dogma (n) : A firmly held belief based on faith, and often stated as fact.
Forum: C++ Oct 30th, 2008
Replies: 4
Views: 448
Posted By grumpier
If there are common things that all classes which handle triangles have to do, put those functions into their own class (eg TriangleModelFile derived from ModelFile). Derive the specific/multiple...
Forum: C++ Oct 25th, 2008
Replies: 8
Views: 1,260
Posted By grumpier
The array declaration int a[n]; is not valid C++. Your compiler doesn't complain because it supports this as an extension. (Your compiler might also support the 1999 C standard (where such things...
Forum: C Oct 3rd, 2008
Replies: 8
Solved: Null Char
Views: 2,115
Posted By grumpier
Because the %s format specifier tells printf() and related function that the corresponding argument is a pointer to char and to keep printing chars until it finds a zero.

When an array is passed...
Forum: C++ Sep 28th, 2008
Replies: 24
Views: 2,946
Posted By grumpier
Start with T(0) = 1.

In a loop use the fact that T(n+1) = x*T(n)/(n+1) to compute each term. Add the terms together.
Forum: C++ Sep 28th, 2008
Replies: 24
Views: 2,946
Posted By grumpier
Oh, please! Huge integer libraries or strings are needed for some things, but falling back on them for basic problems like this is crazy.

The program can go to much higher terms simply using the...
Forum: C++ Sep 15th, 2008
Replies: 14
Views: 1,139
Posted By grumpier
The above is common practice, but it is easily broken. Imagine, for example, a class that supports its own operator&() - it will not perform as you intend.

Generally, it is better to code in a...
Forum: C Sep 13th, 2008
Replies: 4
Views: 1,456
Posted By grumpier
1) First, represent a polynomial (of the form c_0 + c_1*x + c_2*x^2 + .... c_n*x^n) is represented by an array with elements (c_0, c_1, c_2, c_3, .... c_n).

2) Work out how to multiply two...
Forum: C++ Sep 12th, 2008
Replies: 6
Views: 810
Posted By grumpier
Not even close.

You have declared myclass's length() method as taking one argument, and yourlen() calls it with two arguments.

Similarly, yourlen() is declared with no arguments, but when you...
Forum: C Sep 11th, 2008
Replies: 4
Views: 473
Posted By grumpier
Firstly, your variables a, b, and c are uninitialised: their value before entering the loop could be anything.

As to your loop, it doesn't really make sense.

You only need two variables. An...
Forum: C++ Sep 5th, 2008
Replies: 5
Views: 982
Posted By grumpier
You're asking the wrong question. The compiler will attempt to invoke a copy constructor (assuming one exists) upon any attempt to create a copy of an object.

The real practical concern is...
Showing results 1 to 18 of 18

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC