Jump to content

Newish to C++

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
xGhost4000x

xGhost4000x

    Newbie

  • Members
  • Pip
  • 6 posts
Hello, I haven't done C++ in a while and I don't really remember any of it. Anyway I am trying to get a Windows Form Application to work like a Lottery. Ie I enter names and then the program pick one at random. Could anyone help me with this?

Ps the reason I am getting back into C++ is that I have a class for it next term and I figured I should try and get a head start.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Get a count of the number of names entered (stored in an array or list), then generate a random number and return the corresponding name.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
UserError

UserError

    Newbie

  • Members
  • Pip
  • 1 posts
For the random number generator part, you should get familiar with srand and rand. They are part of the C Standard Library (stdlib.h).