C++ Tutorial - 7 - Arguments in Functions

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
73,304
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 2, 2008

Part 8 - http://www.youtube.com/watch?v=OVfUq2DPKKg

Make sure to Subscribe to my Channel for all my latest videos!!!

support my website too by registering at http://thenewboston.com

Category:

Howto & Style

Tags:

License:

Standard YouTube License

Link to this comment:

Share to:

Top Comments

  • bullshit i got 41 too. thumbs up if you too got 41

  • To generate the random number put:

    srand(time(0));

    before:

    num1 = rand();

    so it looks like this:

    double num1;

    srand(time(0));

    num1 = rand();

    cout << "A random number is " << num1 << endl;

see all

All Comments (438)

Sign In or Sign Up now to post a comment!
  • According to the documentation of srand, it takes an unsigned int seed. Which means if you don't enter a number, it defaults to 1 (and srand(1) = 41). If you input a variable seed like time, you get actual pseudo random numbers

  • @mole92db Thanks bro

  • always 41

  • I wish it was 42... so close, yet so far.

  • is an integer a whole number where as double could be any number and if it is can a double be a negative number as well

  • WTF i got 41 as well D:

    i got scared for a second, then seen that like 200 other people got 41 too

  • Is there a difference between an argument and a parameter?

  • @CloudDecim There is no point until you are aiming for a bigger project. Else the mind works perfectly, and I rather say it's a better idea to just name your cpp files after what it does.

  • @16yearoldwhiteboy seeding random number generator

  • @mole92db Where did you learn how to do that?  What does srand(time(0)) mean?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more