Thread: include c++ in c

  1. #16
    Registered User
    Join Date
    May 2011
    Quote Originally Posted by ZuK View Post
    Yes. The c compiler propably never even got that far to see that call.

    Now your problem seems to be that MS standard library doesn't have any drand48().
    I changed it to cstdlib.
    How can I fix this problem?

  2. #17
    Registered User
    Join Date
    Oct 2001
    Quote Originally Posted by quo View Post
    I changed it to cstdlib.
    How can I fix this problem?
    Quick and dirty:

    double drand48() // random number between [0.0, 1.0]
      return rand() / (double)RAND_MAX;
    srand(time(0)); // somewhere in main()
    However, if the random numbers will be as random (uniformly distributed) as the results you would get from the original drand48() function, I don't know.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Does #include indirectly include the source file too?
    By Lord Asriel in forum C Programming
    Replies: 10
    Last Post: 11-30-2011, 08:20 AM
  2. Replies: 1
    Last Post: 11-06-2011, 06:20 PM
  3. basic difference between #include<> and #include""
    By gunjansethi in forum C Programming
    Replies: 1
    Last Post: 03-26-2010, 12:53 AM
  4. #include <windows.h> and #include <wininet.h>
    By steve1_rm in forum C++ Programming
    Replies: 4
    Last Post: 03-30-2009, 11:14 AM
  5. Which came first? #include <stdio.h> or #include <stdlib.h> ?
    By Brian in forum A Brief History of
    Replies: 6
    Last Post: 01-14-2002, 10:58 PM