Click here to Skip to main content
16,013,207 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionShellExecute??? Pin
28-Jan-01 10:45
suss28-Jan-01 10:45 
AnswerRe: ShellExecute??? Pin
Christian Graus28-Jan-01 10:54
protectorChristian Graus28-Jan-01 10:54 
AnswerRe: ShellExecute??? Pin
29-Jan-01 3:38
suss29-Jan-01 3:38 
Generalip address Pin
loki rasputin28-Jan-01 6:45
loki rasputin28-Jan-01 6:45 
GeneralRe: ip address Pin
28-Jan-01 15:21
suss28-Jan-01 15:21 
GeneralRe: ip address Pin
loki rasputin28-Jan-01 17:26
loki rasputin28-Jan-01 17:26 
GeneralRandom number Pin
28-Jan-01 2:50
suss28-Jan-01 2:50 
GeneralRe: Random number Pin
DanYELL28-Jan-01 4:02
DanYELL28-Jan-01 4:02 
Hi,

The code for generating random numbers is posted below.

The second question involved static versus shared libraries.
You only get the shared dll option for the professional
version. The difference between the two is noticable when
you want to distribute your software.

When you compile the program with shared dll, you incorporate
all the dll files that you were using for that program
into your executable. You can put that executable on other
computers and everything will work fine.

When you compile the program with static dll's, you get
a rather small exectuable. If you put that executable on
another computer, it won't work unless you find and send
the dll files as well and put them next to the executable.

Finding which dll files your using can be a pain, but if you
don't have the professional version (which I don't), then
you have to hunt them down and include them. In fact, that's
the only real difference between the professional and
standard version.




main()
{
double a_number;

/*
* The simplest way to get a random number is just to call the
* function 'random()'. It returns a random number between
* 1 and 2**31 - 1. For example:
*/

a_number = (float) random();
printf("A big random number is %lf.\n", a_number);

/*
* To get a random number between 0 and 1, you would use this:
*
* double number;
* number = (float) random() / (float) 0x7fffffff;
*
* Note that the constant 0x7fffffff is equal to (2**31)-1, which is
the
* maximum value of the random number generator.
*/

a_number = (float) random() / (float) 0x7fffffff;
printf("A random number between 0 and 1 is %lf,\n", a_number);

/*
* However, when used as above, the program will get
* the same random numbers every time it is run. Sometimes
* this is good, sometimes not. For example, in Monte Carlo
* simulations a set of identical "random" numbers is useful
* for debugging, but bad for getting real data.
*
* To change the set of numbers generated, use 'srandom' to
* set an initial state. The number that you use to set this
* state is called a "seed". Note that identical seeds will
* generate identical sequences of random numbers. A possible
* seed is the number of seconds since Jan 1, 1970, GMT, the
* value given by time or the process id (from 'getpid').
* Both are used here. This 'srandom' call only needs
* to be done once per program.
*/

srandom(time(0) * getpid());

/*
* Now get and print a "real" random number.
*/

a_number = (float) random() / (float) 0x7fffffff;
printf("But a more random number between 0 and 1 is %lf\n", a_number);

/*
* So, if you wanted a random number between 0 and 10, you would take
the
* number you got above and multiply it by 10, and round to the
nearest
* integer (or whatever).
*/

a_number = 10.0 * (float) random() / (float) 0x7fffffff;
printf("But a more random number between 0 and 10 is %lf\n",
a_number);
}

GeneralRe: Random number Pin
28-Jan-01 5:56
suss28-Jan-01 5:56 
GeneralRe: Random number Pin
28-Jan-01 5:56
suss28-Jan-01 5:56 
GeneralAh i just figured it out my self :) Pin
28-Jan-01 6:07
suss28-Jan-01 6:07 
GeneralRe: Random number Pin
Julien28-Jan-01 16:54
Julien28-Jan-01 16:54 
GeneralHidden window is not getting messages Pin
Christian Skovdal Andersen28-Jan-01 2:20
Christian Skovdal Andersen28-Jan-01 2:20 
GeneralRe: Hidden window is not getting messages Pin
29-Jan-01 2:35
suss29-Jan-01 2:35 
QuestionHas anyone worked with CPLEX? linear programming? Pin
DanYELL27-Jan-01 10:28
DanYELL27-Jan-01 10:28 
GeneralHiding a Dialog Pin
27-Jan-01 9:47
suss27-Jan-01 9:47 
GeneralRe: Hiding a Dialog Pin
Michael Dunn27-Jan-01 10:39
sitebuilderMichael Dunn27-Jan-01 10:39 
GeneralRe: Hiding a Dialog Pin
27-Jan-01 10:56
suss27-Jan-01 10:56 
GeneralRe: Hiding a Dialog Pin
27-Jan-01 10:56
suss27-Jan-01 10:56 
GeneralRe: Hiding a Dialog Pin
Colin J Davies27-Jan-01 13:36
Colin J Davies27-Jan-01 13:36 
GeneralRe: Hiding a Dialog Pin
27-Jan-01 22:33
suss27-Jan-01 22:33 
GeneralRe: Hiding a Dialog Pin
28-Jan-01 0:08
suss28-Jan-01 0:08 
GeneralRe: Hiding a Dialog Pin
28-Jan-01 0:19
suss28-Jan-01 0:19 
GeneralOH NOOOOOO Pin
28-Jan-01 0:48
suss28-Jan-01 0:48 
GeneralRe: OH NOOOOOO Pin
28-Jan-01 2:22
suss28-Jan-01 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.