First  |  Prev | 
Pages: 51 52 53 54 55 56 57 58 59 60 61
random number [0, 99]
Hi, I am using the int version of rand() with MS Visual Studio. I would like to generate random number in the range of [0, 99]. Right now I am using rand() * 100 / (RAN_MAX + 1) I found that I got too much 0. 0 appears more than any other numbers. How can I fix it? Thanks, qq [ See http://www.... 19 Feb 2006 06:49
Atexit() and C++
Hello, when I try to use atexit() from a C++ class, my compiler is giving me an error. error C2664: 'atexit' : cannot convert parameter 1 from 'void (void)' to 'void (__cdecl *)(void)' Is it possible to use atexit() with a C++ class member or only with global functions? Thank you in advance, Marco ////... 6 Feb 2006 05:42
C++ template base class' nested typedefs not visible in derived template class
Below is a file I'm getting compile errors on (CASEs 1 and 2). I think both 1 and 2 should be legal C++. Visual C++ Expres 2005 agrees with me. Compiling using Cygwin's GNU 3.4.4 has the shown error messages. Which compiler is right and what C++ standard clause would cover this situation? Thanks, Mike tem... 30 Jan 2006 17:01
Tree container library
Hello, Feeling a need for a generic tree container to supplement the available containers in the STL, I've created a generic tree container library (TCL). The library usage is very much like the containers in the STL, including iterator usage. Info on the library can be found here.. http://www.visuallandlord... 4 Jan 2006 08:48
generate double persision random value
After searching to no evail for an answer to generate double presision random values I come here for assistance. I am still very new to C++ and have a situation where I need to generate a radom number that contains a fractional part. I have the following statement: currentValue = minValue + (rand() % maxValue);... 27 Dec 2005 14:03
Portable way to write binary data
Hi all, I was shocked when I read to thread "For binary files use only read() and write()??" above, in which was stated that using read()/write() for binary data is unportable and may lead to undefined behaviour (!!). I always thought myself to be on the safe side by doing things the following way: - Use s... 28 Nov 2005 16:39
SHA1
I am trying to implement SHA1 based on the pseudo-code on Wikipedia. The pseudo-code is on: http://en.wikipedia.org/wiki/SHA-1 My code is working, but is not giving me the correct hashes. This is being tested (initially) on a big-endian machine, and only after I have it working on big-endian was I planning on m... 24 Nov 2005 12:47
C++ Concepts
I came across a comment on Slashdot that gives me an excuse to write about the "A concept design" paper before the standards committee: "It was certainly interesting in the 'bad old days' when no two compilers implemented things like templates the same way. Of course, I'm no fan of templates, since they are essen... 16 Oct 2005 05:53
C++/CLI limitations?
Hi, I am currently sinking my teeth into the C++/CLI stuff since I just want to know a bit more about it. Now, during some playing around I found out that using pointer-to-member types together with reference classes are not possible, e.g. I tried: public ref class Foo { public: void bla( int blubb ); ... 21 Sep 2005 06:17
Exceptions
Hi, I have a lot of questions about exceptions. In the sample below: struct E( . . . ~E(){} ); int main() { try { throw E(); } catch(const E &e) { e.some(); } } When ~E will be called? Which is the E scope? Where E will be created? In the Stack? Exceptions are slow if are... 19 Sep 2005 16:37
First  |  Prev | 
Pages: 51 52 53 54 55 56 57 58 59 60 61