Thread: random dice generator

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    17

    random dice generator

    this 1 is bugging me for weeks, i'm using Turbo C compiler and any code i have gotten for a random dice generator just wont work,
    that and TC doesn't give me the right error messages, any suggestions on a decent compiler aswell?, im running win7 32bit

    i have no code
    Last edited by larrydeloafer; 01-27-2011 at 01:38 PM. Reason: somebody doesn't like the things i write

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Your SMS speak made me throw up in my mouth. Please use proper English in the future.

    Post the code you have in code tags and list the specific error messages you're getting. While Turbo C is a dinosaur, it shouldn't break on a simple C program like the one you're writing. I suspect it's error messages are right, just that you aren't sure what they mean. Still, you should upgrade. A lot of people use MinGW or Pelles C, there's also a free version of Visual Studio that can compile C, and some people use Code::Blocks as an IDE.

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    17
    i am a noob to this, i have only been doing C for a few hours a week since last September,
    i have only gotten a manually entered dice program for 2 dice and a name, it works

  5. #5
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Loafer seems an appropriate name. To be frank, your post sounds like "I can't find a dice program that does exactly what I want and am unwilling to try my own, could you please write it for me." If that's not what you're asking, then be clear in exactly what it is you want. The only way you're going to get serious help is if you take a more serious approach to your problem (it is after all your problem, not ours). Make an effort. Try some sample code you found and try to debug it. Google error messages your compiler gives you and you will usually find a cause and/or solution. Try modifying the program and see how it's behavior and the output change. Ask specific questions. Have you read the link Salem posted yet?

    Also, you say you have no code, but:
    Quote Originally Posted by larrydeloafer View Post
    any code i have gotten for a random dice generator just wont work
    Can you point us to the code you've found that "just wont work". Tell us (as I asked in my previous post) what the specific error messages are. Perhaps the person making the example has a small mistake we can find, and you can be on your way.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by larrydeloafer View Post
    this 1 is bugging me for weeks, i'm using Turbo C compiler
    WOW... that compiler just won't die!

    It's not that it's not going to work, random number generators are painfully simple... It's more that it's so outdated that you won't have half the capacity of newer ones which means you won't get much past the itsey bitsey learning exercise kinds of things with it.

    Salem already gave you a link to Pelles C... download it, it's free ... but most importantly, it's up to date.

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by CommonTater View Post
    WOW... that compiler just won't die!
    Did someone say "die" and "dice"?

    Really good looking one's, done in Turbo C/C++, "rolling":

    swoopshare - Download drawdice.exe

  8. #8
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472

    no dice

    loafer is about right yes, having said that masses of quality code can be written with old turbo c,.. of course you actually have to write some code to discover that..and as for random number generators being simple..? you mean for simple implementations of course.. if go write something of mersenne twister quality, from scratch of course
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  9. #9
    Registered User
    Join Date
    Jan 2011
    Posts
    17
    I am really new to this and finding anything that is ansi c and not c++ is harder for me than you guys think, the code i found was in an ebook called (C Primer Plus 5th Edition) which wants three files put in the same folder to make the dice generator. I would have to type it and run it again to get the errors for you but its late and im going to bed, i will definitely do it for you for tomorrow. thanks for your time anyways.

  10. #10
    Registered User
    Join Date
    Jan 2011
    Posts
    17
    sorry again, Turbo C is the only compiler are class is allowed to use, its part of the curriculum

  11. #11
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by larrydeloafer View Post
    sorry again, Turbo C is the only compiler are class is allowed to use, its part of the curriculum
    It our class not are class.

    Post the code you haven't written.

  12. #12
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    Quote Originally Posted by larrydeloafer View Post
    sorry again, Turbo C is the only compiler are class is allowed to use, its part of the curriculum
    its != it's

  13. #13
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by \007 View Post
    its != it's

    I wondered who would be first to spot that!

  14. #14
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    I am an elementary school teacher. I see these mistakes often.

  15. #15
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by larrydeloafer View Post
    sorry again, Turbo C is the only compiler are class is allowed to use, its part of the curriculum
    Wow... where can one still go to school in 1985?

    (Oh, the things I would do differently if I had that chance!)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seeding a Random Number Generator
    By girly_engineer in forum C++ Programming
    Replies: 6
    Last Post: 07-19-2010, 07:40 AM
  2. Dice random generator problem
    By cgalvani in forum C++ Programming
    Replies: 3
    Last Post: 05-05-2010, 10:16 AM
  3. Random Poem Generator
    By ineedmunchies in forum C++ Programming
    Replies: 29
    Last Post: 03-26-2010, 09:31 AM
  4. NAQ: Everything you never wanted to know about CPP
    By evildave in forum C Programming
    Replies: 21
    Last Post: 12-12-2005, 10:56 AM
  5. Testing Random Number Generator
    By Roaring_Tiger in forum C Programming
    Replies: 7
    Last Post: 08-12-2005, 12:48 AM