Search:

Type: Posts; User: Freshjunior

Search: Search took 0.00 seconds.

  1. Thread: array size

    by Freshjunior
    Replies
    1
    Views
    1,096

    array size

    Hi all, this short paragraph of code is to get the user to enter q to quit. But why is the value of c = input_line[0] zero? What is the purpose of this line? Thanks!



    char input_line[81];

    ...
  2. Replies
    4
    Views
    1,236

    btw, how does return i work? What do you mean...

    btw, how does return i work? What do you mean when you "return" this number. Does it mean returning i to the beginning of the function, so i becomes 0 once again?
  3. Replies
    4
    Views
    1,236

    I understand that the part while (n-- >0) means...

    I understand that the part while (n-- >0) means do the following n times.
    But why does


    while (card_drawn[i])
    i++;


    means finding the first available card by skipping past all the...
  4. Replies
    4
    Views
    1,236

    While loops and arrays

    Hello, I was going through a beginner's guide book on C++ and could not understand exactly how this example works, even after pondering for hours.

    This program is a card-dealing program which...
  5. Thread: %(Modulus)

    by Freshjunior
    Replies
    19
    Views
    104,000

    So if I have three shapes (ball, cube, triangle),...

    So if I have three shapes (ball, cube, triangle), I have 3x4 possible combinations.
    But I would need to use n/4, because the counting is still done in fours. Right?

    What I also dont understand is...
  6. Thread: %(Modulus)

    by Freshjunior
    Replies
    19
    Views
    104,000

    Confused about uses of % and /

    #include <iostream>
    #include <stdlib.h>
    #include <time.h>
    #include <math.h>
    using namespace std;

    int rand_0toN1(int n);
    void draw_an_item();

    char *colors[4] = {"red", "blue", "orange",...
  7. Replies
    2
    Views
    1,104

    oops sorry. I also just discovered this careless...

    oops sorry. I also just discovered this careless mistake =x.
  8. Replies
    2
    Views
    1,104

    Infinite Loop?

    Hello, I'm a newbie at programming and this example is taken from the book <<C++ Without Fear>>.

    The problem is that the programs runs continuously, as though the "number of cards to draw" is...
Results 1 to 8 of 8