Search:

Type: Posts; User: dnj23

Search: Search took 0.01 seconds.

  1. Replies
    20
    Views
    2,453

    I see what you're saying, rcgldr. Thanks for the...

    I see what you're saying, rcgldr. Thanks for the links.
  2. The books I've read don't define it well, but I...

    The books I've read don't define it well, but I understand what you mean.
  3. I see. I thought the comma operator guaranteed...

    I see. I thought the comma operator guaranteed left to right evaluation, but I guess it behaves differently as an argument list.



    I simplify my examples to facilitate the point. I forgot to...
  4. why does printf behave differently in the following example

    The following program prints this, which is what I want it to do:




    #include <stdio.h>
    #define MAX_TERMS 5

    int ret_one(int);
  5. Replies
    20
    Views
    2,453

    I'm doing combinatorial analysis on certain card...

    I'm doing combinatorial analysis on certain card games, where generating certain outcomes can lead into very large iterations.




    well, that's something that didn't seem so obvious with me. I...
  6. Replies
    20
    Views
    2,453

    Wow, thanks for the great replies. I'll just have...

    Wow, thanks for the great replies. I'll just have to experiment around.



    I did. It varied somewhat but no more than .1 of a second. I guess with multitasking and all, the OS comes into play...
  7. Replies
    20
    Views
    2,453

    execution speed of seemingly eqivalent loops

    Consider the following 2 looping statements:

    a) while(counter <=MAX_COUNT) counter++;

    b) while(counter++ <= MAX_COUNT);

    When I set counter to 1 and MAX_COUNT to 4 billion (counter and...
  8. Replies
    6
    Views
    2,630

    check that your text file has correct input. It...

    check that your text file has correct input. It should print out 45 1's.

    It's good practice to also close the file pointer at the end:

    fclose(fp);
  9. Thread: Modulus Operator

    by dnj23
    Replies
    6
    Views
    14,141

    It's also commonly used in formatting output with...

    It's also commonly used in formatting output with a lot of data when printed with iterations.

    If you needed to display, say 10,000 numbers, % c could mean to place a newline every c numbers,...
  10. also make sure if n should = 0,to handle it...

    also make sure if n should = 0,to handle it appropriately.

    I've crashed many of my programs with unforseen division by zero.
  11. also, depending on the precision of your...

    also, depending on the precision of your data,you should really use type double if you get incorrect answers
  12. You are performing integer division here: f_A...

    You are performing integer division here:

    f_A = ((2*genotype[1])+(genotype[2]))/(n*2);

    You have to instruct the compiler that it's floating point division, by putting a cast operator
    to one of...
  13. Replies
    7
    Views
    10,105

    I get it now. Thanks guys.

    I get it now. Thanks guys.
  14. Replies
    7
    Views
    10,105

    conditional operator :? with function calls

    consider the statement :


    i >= 0 ? positive_case() : negative_case();

    Does :? need to call and evaluate both functions to execute, or does it just
    call and evaluate one or the other function...
  15. Replies
    6
    Views
    5,028

    I tried it, and so far it works again. Haven't...

    I tried it, and so far it works again. Haven't been using it though for the past few days. I'll keep my fingers crossed.
  16. Replies
    6
    Views
    5,028

    The window can't be closed no matter what you...

    The window can't be closed no matter what you try. The OS can't even close it during shutdown.
    MS is aware of the bug:

    You cannot close a console window of an application after you stop debugging...
  17. Replies
    6
    Views
    5,028

    Visual C++ 2010 express problems

    I tried the compiler out and have problems with it.

    First, the program window wouldn't close when in debug mode, only when the program terminated normally. The window would stay open even through...
  18. Replies
    12
    Views
    3,091

    Understood, what I mean is the probability of...

    Understood, what I mean is the probability of occurrence for each of the six values should be accurate up to a certain decimal place, given a sufficient number of rolls.





    I will experiment...
  19. Replies
    12
    Views
    3,091

    Now I understand what you guys are talking about....

    Now I understand what you guys are talking about.

    rand() % 6 produces 1 too many 0 and 1 outcomes, with the totals being:

    0 : 5462
    1 : 5462
    2 : 5461
    3 : 5461
    4 : 5461
    5 : 5461
  20. Replies
    12
    Views
    3,091

    Correct, I meant unbiased. do { ...

    Correct, I meant unbiased.



    do {
    die1 = rand();
    } while (die1 < (RAND_MAX / 6) * 6);
    die %= 6; // safe to do this now
  21. Replies
    12
    Views
    3,091

    cool page, thanks.

    cool page, thanks.
  22. Replies
    12
    Views
    3,091

    need random number generator

    hello,

    I need a good RNG. I have tried rand() with srand(time(NULL)) and it does not work accurately. I tested it with simulating a craps pass line bet 1 billion times and some of the figures...
Results 1 to 22 of 23