|
-
August 1st, 2009, 01:13 PM
#31
Re: a project for beginner
 Originally Posted by Alexz003
But the thing about it is i don't want it to repeat the same thing i want it to be random each time.
Then use a different seed each time, e.g., by seeding based on the current time, or from a random source like /dev/random.
-
August 1st, 2009, 03:27 PM
#32
Re: a project for beginner
what? xP i have no idea what you said.
-
August 1st, 2009, 04:24 PM
#33
Re: a project for beginner
Code:
std::srand(std::time(0));
-
August 1st, 2009, 04:44 PM
#34
Re: a project for beginner
 Originally Posted by Speedo
Code:
std::srand(std::time(0));
what would that do?
-
August 1st, 2009, 05:07 PM
#35
Re: a project for beginner
 Originally Posted by Alexz003
Is there a project for beginners that could take a little bit of time that would teach them alot about coding? Maybe give some ideas so i know what i can do and plan it out. Right now i have learned:
My advice is that you start writing programs. Just think of a program that does something interesting and then start writing it. This has the advantage that you're shifting focus from learning C++ features you don't don't know what they're for, to wanting to do something and is looking for a proper C++ feature to do that. It's a problem based approach. You're looking to solve problems rather than having solutions you don't know what they're for.
Good luck!
-
August 1st, 2009, 05:10 PM
#36
Re: a project for beginner
In addition to my post above:
Why don't you learn from Bjarne Stroustrup, the inventor of C++? He's very recently published a book called Programming, Principles and Practices Using C++. It contains lots of drills, reviews and exercises after each chapter.
-
August 1st, 2009, 05:33 PM
#37
Re: a project for beginner
But the thing about it is i don't want it to repeat the same thing i want it to be random each time.
Code:
std::srand(std::time(0));
what would that do?
If you search for examples related to the documentation on srand and on time, you'll see that srand initializes the random number generation system, and that if you use a different number on each call to srand, the random numbers generated by rand will be different on every execution of the application.
One minor flaw is that time is usually measured in seconds. You call srand at the initialization of a program. That sets the random generator to a unique output.
The next time the application runs, srand will receive a different time, and different number to initialize the random generator - no to runs of the application will obtain the same series of numbers from rand..
The only exception could be if two executions of the same program happen within 1 second of each other. Note, that's not two calls to rand, that's any two calls to TIME - it counts in seconds. As long as srand is called a little over 1 second later than the previous call, the random generator will be seeded such that a unique sequence comes out of rand - never the same twice.
Alexz003, please try harder to follow. Google for the C or C++ library and read some of the documentation for the suggestions we're posting - the only way any of us ever learned this stuff (myself included) was to research and dig.
Please don't misunderstand, this IS the place to ask questions - I'm just saying that in this case, after being handed the answer, it seems you haven't been interested enough to research that yourself or try it on your machine.
If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).
-
August 1st, 2009, 05:40 PM
#38
Re: a project for beginner
 Originally Posted by JVene
Note, that's not two calls to rand, that's any two calls to TIME - it counts in seconds. As long as srand is called a little over 1 second later than the previous call, the random generator will be seeded such that a unique sequence comes out of rand - never the same twice.
Use the boost random library instead. It's been adopted for the next version of standard C++.
-
August 1st, 2009, 06:10 PM
#39
Re: a project for beginner
 Originally Posted by JVene
Alexz003, please try harder to follow. Google for the C or C++ library and read some of the documentation for the suggestions we're posting - the only way any of us ever learned this stuff (myself included) was to research and dig.
Please don't misunderstand, this IS the place to ask questions - I'm just saying that in this case, after being handed the answer, it seems you haven't been interested enough to research that yourself or try it on your machine.
I wouldn't have asked if i wasn't getting what i was looking for. I have looked it up and tried what people have said worked and i always get the same result.
I think we are going off topic and i would like to redirect the question back to my first post if you don't mind.
I want to learn how to influece what the computer does not what my variables do.
-
August 1st, 2009, 07:12 PM
#40
Re: a project for beginner
I want to learn how to influece what the computer does not what my variables do.
I suppose I'm not exactly sure what this means, but I have some idea.
Much of develop is the creation of metaphors which represent real concepts, real objects and the like. Interaction seems to be what you're describing.
That could be the interaction of a server responding to connections, searching for and providing data upon request.
It could be the reaction of a character in a game.
I think we're still searching for something a little more concrete upon which to base the discussion.
If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).
-
August 1st, 2009, 07:20 PM
#41
Re: a project for beginner
I know im sorry i haven't been real specific on what i want. It isn't completely my fault because i haven't learned enough to actually know what i want to do. Thats why i am requesting people give me ideas on something that would teach me a little more than i already know. I have no idea what it may be as long as it isn't too complicated and i can understand what i am doing.
-
August 1st, 2009, 08:33 PM
#42
Re: a project for beginner
 Originally Posted by Alexz003
I know im sorry i haven't been real specific on what i want. It isn't completely my fault because i haven't learned enough to actually know what i want to do. Thats why i am requesting people give me ideas on something that would teach me a little more than i already know. I have no idea what it may be as long as it isn't too complicated and i can understand what i am doing.
You're passive, which is very common, even up to the university level of education.
To know how to break that, see my previous replies.
-
August 1st, 2009, 09:16 PM
#43
Re: a project for beginner
i may be passive but that doesn't mean i wont know what to do in the future. If i have a project in mind then i will do what i can do get it done.
-
August 1st, 2009, 09:28 PM
#44
Re: a project for beginner
 Originally Posted by Alexz003
i may be passive but that doesn't mean i wont know what to do in the future. If i have a project in mind then i will do what i can do get it done.
You're passive because you haven't already started. Insted you're asking questions here. ANY program will test your abilities in the areas you wanted tested.
STOP TALKING. GET STARTED. DO SOMETHING BY YOURSELF - NOW!
-
August 1st, 2009, 10:03 PM
#45
Re: a project for beginner
I have made 2 programs. 1 is a game and the other is something that lets me get to all important programs that i use on my computer with ease.
I think you might be a little stressed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|