CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 51
  1. #31
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: a project for beginner

    Quote 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.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  2. #32
    Join Date
    Jul 2009
    Posts
    105

    Re: a project for beginner

    what? xP i have no idea what you said.

  3. #33
    Join Date
    Aug 2007
    Posts
    858

    Re: a project for beginner

    Code:
    std::srand(std::time(0));

  4. #34
    Join Date
    Jul 2009
    Posts
    105

    Re: a project for beginner

    Quote Originally Posted by Speedo View Post
    Code:
    std::srand(std::time(0));
    what would that do?

  5. #35
    Join Date
    May 2009
    Posts
    2,413

    Re: a project for beginner

    Quote Originally Posted by Alexz003 View Post
    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!

  6. #36
    Join Date
    May 2009
    Posts
    2,413

    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.

  7. #37
    Join Date
    Nov 2006
    Posts
    1,611

    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).

  8. #38
    Join Date
    May 2009
    Posts
    2,413

    Re: a project for beginner

    Quote Originally Posted by JVene View Post
    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++.

  9. #39
    Join Date
    Jul 2009
    Posts
    105

    Re: a project for beginner

    Quote Originally Posted by JVene View Post
    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.

  10. #40
    Join Date
    Nov 2006
    Posts
    1,611

    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).

  11. #41
    Join Date
    Jul 2009
    Posts
    105

    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.

  12. #42
    Join Date
    May 2009
    Posts
    2,413

    Re: a project for beginner

    Quote Originally Posted by Alexz003 View Post
    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.

  13. #43
    Join Date
    Jul 2009
    Posts
    105

    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.

  14. #44
    Join Date
    May 2009
    Posts
    2,413

    Re: a project for beginner

    Quote Originally Posted by Alexz003 View Post
    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!

  15. #45
    Join Date
    Jul 2009
    Posts
    105

    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.

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured