• Log in or sign up for an account here: https://www.sythe.org/login

Final Project

mopar-user

Guru

Banned
Joined
Jul 23, 2007
Sythe Gold
0
Messages
1,188
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.
 
Final Project
How far along are you? Like, how much do you know about?
 
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.
 
Final Project
ummmm vectors, strings, loops, some math operator stuff like isaplha and starting on pointers / structures.
 
Final Project
Sorry I forgot to ask before what grade are you in and have you covered Object Oriented topics?
 
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.
 
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
 
Final Project
ok so i do this....

Code:
srand(time(NULL));

gold = srand() * level / 2;

or no?
 
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);
 
Runescape Gamblingrunescape gambling
Back
Top