Thread: Lottery game Issue in Code...whats wrong?

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    8

    Lottery game Issue in Code...whats wrong?

    im trying to run this lotery game and it says decleration terminated incorrectly what changes to i have to make for program to run.. please and thank you..

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    10+rand()%90
    int main()
    {
    input-input%10)/10
       if(input==random number)
    {
            printf("You have won $10000\n");
             break;
    }
    else
    {
           if (input%10==random number || ((input-input%10)/10)==random number)
    {
           printf("You have won $1000\n");
             break;
    }
         printf("You have won nothing\n");
    }
    return 0;
    }

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    10+rand()%90
    int main()
    {
    input-input%10)/10
    and you do know you have to actually declare variables right?
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    8
    No I don't know.. Can u please explain a litle more I'm really new at this.. I would really appreciate your help thank you.

  4. #4
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by thebridge View Post
    No I don't know.. Can u please explain a litle more I'm really new at this.. I would really appreciate your help thank you.
    I suggest you either read a book about C, talk to your teacher (I'm assuming you have one, if you don't, ignore that), or find a tutorial about C online
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    I agree. You can't just throw random code on a page and expect it to make sense, any more than you can throw random words down on a page and expect it to make a coherent statement. In fact, it's WORSE for code, because a compiler is not smart enough to glean your intentions or meaning from the random code, where as an astute human listener may be able to grasp it.

    Learn the language, read the book(s).

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    8
    so what is the point of this site.. what are you doing here.. insnt this site so people could help other people.. yall a bunch of jerks...

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by thebridge View Post
    so what is the point of this site.. what are you doing here.. insnt this site so people could help other people.. yall a bunch of jerks...
    You just got help... the best kind, although I will agree a bit bluntly delivered (computer people are famous for that).

    The lesson? LEARN!

    You don't learn by being handed answers. That only satisfies your immediate need. You've been pushed toward the books... and that's a nudge in the right direction.

    Today you've learned a very valuable lesson... you now know at least one way that does not work.

    We spend time here. Every question you ask engages hundreds if not thousands of man hours, the least you can do is put in your fair share of effort.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code needed for 2d game
    By arcken07 in forum C# Programming
    Replies: 2
    Last Post: 02-10-2010, 05:43 PM
  2. Event driven game engine
    By abachler in forum Game Programming
    Replies: 9
    Last Post: 12-01-2009, 06:03 AM
  3. Lottery game
    By geetard in forum C++ Programming
    Replies: 2
    Last Post: 12-20-2005, 12:50 AM
  4. Engine <=> DX/OGL | c++ ?
    By darkcloud in forum Game Programming
    Replies: 6
    Last Post: 05-13-2005, 12:19 AM
  5. What's wrong with my Win32 Wrapper code?
    By miica in forum Windows Programming
    Replies: 9
    Last Post: 02-22-2005, 08:55 PM