Adblock breaks this site

Final Project

Discussion in 'Programming General' started by mopar-user, Mar 27, 2009.

  1. mopar-user

    mopar-user Guru
    Banned

    Joined:
    Jul 23, 2007
    Posts:
    1,188
    Referrals:
    1
    Sythe Gold:
    0
    Final Project

    My teacher has stated that we are to create a final project. It can be anything as long as he approves of it. I was wondering if anyone had really good ideas. I am using Dev 4.9.9.2. Please give me some great ideas.
     
  2. Esuom

    Esuom Guru
    Banned

    Joined:
    May 3, 2007
    Posts:
    1,731
    Referrals:
    2
    Sythe Gold:
    0
    Final Project

    How far along are you? Like, how much do you know about?
     
  3. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Final Project

    Esuom's right in that you should post a list of topics that you've covered to let people know what might be of suitable difficulty. It may even be helpful to say how much at ease you feel with each topic and whether or not you like it and feel it's useful.
     
  4. mopar-user

    mopar-user Guru
    Banned

    Joined:
    Jul 23, 2007
    Posts:
    1,188
    Referrals:
    1
    Sythe Gold:
    0
    Final Project

    ummmm vectors, strings, loops, some math operator stuff like isaplha and starting on pointers / structures.
     
  5. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Final Project

    Sorry I forgot to ask before what grade are you in and have you covered Object Oriented topics?
     
  6. mopar-user

    mopar-user Guru
    Banned

    Joined:
    Jul 23, 2007
    Posts:
    1,188
    Referrals:
    1
    Sythe Gold:
    0
    Final Project

    Well I got an idea on what I'm going to do. The issue now is that I need to get a completely random number to generate.....I tried rand() but I don't know enough about it to get it to generate randomly each time.

    For Example:

    gold = rand() * level / 2;

    Then it does the calculation and if your level was 1 for instance...it would always output the same number.
     
  7. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Final Project

    You have to seed the pseudo-random number generator first. rand() basically has a list of numbers from which one is picked each time (so it's kind of random and kind of not) and to make its selection different every time (which is considered random) it needs a seed to determine which slot will be picked from first. The time is probably the easiest thing to seed it with and quite effective since the time is always changing.
    Code:
    srand(time(NULL));
    
    You can read more about rand() and srand() at the links below. Feel free to post any other questions you can't find answers too.;)
    http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html
    http://www.cplusplus.com/reference/clibrary/cstdlib/srand.html
     
  8. mopar-user

    mopar-user Guru
    Banned

    Joined:
    Jul 23, 2007
    Posts:
    1,188
    Referrals:
    1
    Sythe Gold:
    0
    Final Project

    ok so i do this....

    Code:
    srand(time(NULL));
    
    gold = srand() * level / 2;
    
    or no?
     
  9. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Final Project

    It would be something like this. You can change the 6 to be whatever you want as its just increasing or decreasing the maximum that can be given to a player of a given level.
    Code:
    	srand(time(NULL));
    	int level = 10;
    	int gold = rand() % (level*6);
     
  10. mopar-user

    mopar-user Guru
    Banned

    Joined:
    Jul 23, 2007
    Posts:
    1,188
    Referrals:
    1
    Sythe Gold:
    0
    Final Project

    ok thanks
     
< What programming language should I start with? | .batch >


 
 
Adblock breaks this site