Hi to all.
I need help. Quick and easy question. Is it possible to randomize and than delate stream of character pairs(one by one) from the input file? How can I do that?
The input is a stream of character pairs that represent playing cards. For example: 2C, 3H, JH...
What I would like to do is randomize the deck then pick first card in the file and put into new array, and then delate that card from the deck. Then randomize again the deck,take the another first card from the deck, place in the new array, and delating from deck ,and so on untill there will be no more cards in the deck.
Is it possible? If yes how could I do that?
Thank you
mauro21pl
10
Junior Poster in Training
Recommended Answers
Jump to Postthere are 26 cards in a deck, so generate a list of 26 unique but random numbers. Then if you have a list of cards, just pick them out in the order of the random numbers previously generated. It would be a lot easier to use an vector or list …
Jump to PostYou first need to decide what tools you have to solve the problem. I'd use C++ with classes to represent a Card and a Hand and I'd sort the Cards in a Hand as they are dealt rather than sort the hand after the deal, but it could be done …
Jump to PostLet suits and face values as defined as enumerated user defined types.
Declare and implement classes to represent cards and hands. Overload the >> operator to allow routine syntax to display value of any given card in the format of 2H, AS, 10D, etc, and to display any given …
All 9 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
mauro21pl
10
Junior Poster in Training
Lerner
582
Nearly a Posting Maven
mauro21pl
10
Junior Poster in Training
Lerner
582
Nearly a Posting Maven
mauro21pl
10
Junior Poster in Training
Lerner
582
Nearly a Posting Maven
DesiShaddy
0
Newbie Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.