Emergency

Thread Starter

Parker06

Joined Oct 26, 2006
4
need help with a program.
The task: Randomly pick one unique card out of the 52 cards.
*If it is a diamond OR a heart put it in a stack (call it "rstack")
*If it is a club or spade put it in a different stack (call it "bstack")
*Each stack can only hold 10 cards.
*The first time one of the stacks has 10 cards, then stop dealing the cards and put the 2 stacks into 2 different files.
*Call them rfile.txt and bfile.txt respectively.
*Open those 2 files to verify the contents (use notepad). One of the files must have 10 cards, the other file should have less than 10.
 

Dave

Joined Nov 17, 2003
6,969
Have you attempted anything? Or do you want spoon-feeding an answer - if so you are mistaken as to what the forums here are for. Read this and look at providing the appropriate information, otherwise this thread will go nowhere.

Dave
 

Thread Starter

Parker06

Joined Oct 26, 2006
4
Okay, well i understand how to input, the only thing that i'm having trouble with is trying to randomly select the card and put it in a stack
 

Papabravo

Joined Feb 24, 2006
21,158
In most programming language libraries there is a function that will return a sequence of pseudo random numbers. The basic routine returns uniformly distributed results. A uniform distribution describes a situation where each of the possible choices is equally likely. These functions are called pseudo random because they repeat after a suitably long sequence of results. It is this repetition that prevents the sequence from being truly random.

The function might be called rand() or srand() or something like that.
 
Top