Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

need a little help with arrays

Garrett85Garrett85 Member Posts: 168
Iv been trying for a while now to learn C++, but it seems and inpossible task. I have a few questions about the following code.

What is going on with hits[10] suddenly having letters and crap inside it like r, and i?
And whats all the dividing about (n / 10)? Or the last line of code return rand() % n; correct me if IM wrong, but than n is the functions n and not the data entered my me with cin>> correct? Anyway I fill like shooting myself trying to learn this programming language. IM in the fifth chapter of C++ without fear. The code is below.

#include
#include
#include

Comments

  • MT2002MT2002 Member Posts: 1,444
    : Iv been trying for a while now to learn C++, but it seems and inpossible task. I have a few questions about the following code.
    :
    : What is going on with hits[10] suddenly having letters and crap inside it like r, and i?
    [blue]
    See the comment below.[/blue]

    : And whats all the dividing about (n / 10)? Or the last line of code return rand() % n; correct me if IM wrong, but than n is the functions n and not the data entered my me with cin>> correct?
    [blue]
    Yes. The 'n' in rand_0toN1() is local to that function.
    [/blue]
    Anyway I fill like shooting myself trying to learn this programming language. IM in the fifth chapter of C++ without fear. The code is below.
    [code]
    : #include
    : #include [blue]//C++ should be [/blue]
    : #include
  • sin26102003sin26102003 Member Posts: 5
    HELLO, I AM HAVING THE SAME PROBLEM WITH GENERATING COMBINATIONS, IF ANYONE HELPS U FIX THIS, PLEASE EMAIL ME AT [email protected]
    thanxs


    Iv been trying for a while now to learn C++, but it seems and inpossible task. I have a few questions about the following code.
    : :
    : : What is going on with hits[10] suddenly having letters and crap inside it like r, and i?
    : [blue]
    : See the comment below.[/blue]
    :
    : : And whats all the dividing about (n / 10)? Or the last line of code return rand() % n; correct me if IM wrong, but than n is the functions n and not the data entered my me with cin>> correct?
    : [blue]
    : Yes. The 'n' in rand_0toN1() is local to that function.
    : [/blue]
    : Anyway I fill like shooting myself trying to learn this programming language. IM in the fifth chapter of C++ without fear. The code is below.
    : [code]
    : : #include
    : : #include [blue]//C++ should be [/blue]
    : : #include
Sign In or Register to comment.