jeudi 2 décembre 2021

How can i draw multiple random variables from multiple arrays?

I am very new to c++ and really, programming in general. To learn how to use the language, I am trying to create a very simple game of blackjack.

I currently have the code below, that defines what a card is and adds the variables needed for one before introducing some arrays that define the possibilities for those variables.

#include <iostream>
#include <ctime>
#include <stdio.h>
#include <string>

using std::string;
using std::cout;
using std::cin;
using std::endl;


struct DefineCard {

    char cardSuit;
    int cardFace;
    int cardValue;
    int cardStatus;

} Deck[53];

int main()
{   
    
    string cardSuits[4] = { "clubs", "spades", "hearts", "diamonds" };
    string cardFaces[13] = { "ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king" };
    string cardStatus[3] = { "in play", "in deck", "discarded" };
    int cardValue[13] = { 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 };

}

From this code, assuming I have it correct, how would I draw a random card containing all these variables randomly and then ensure that the same card is not drawn twice?

Thanks for all the help, and sorry for any blatant misunderstandings on my part, I'm very new to this :)




Aucun commentaire:

Enregistrer un commentaire