hello for some reason i dont really get a random resoult
i mean i run the program and i get the same result every time .
here is the code i wrote i dont get what is wrong
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
int main ()
{
constint size = 4;
int i,indx;
char usr_ask;
string card_type[size] = {"heart","diamond","cross","black"};
vector<string> card_t(card_type,card_type+size);
cout << "do you want to draw a card ? y/n";
cin >> usr_ask;
while (usr_ask == 'y'){
srand(size);
indx = rand() % size;
cout << card_t[indx];
cout << "do you want to drow another ?";
cin >> usr_ask;
}
}
i have only 4 options and i onley get black which is the 3 in the array
i tried couple of ways and all of them get me the same result every time i run the program.
so what i shold not use seeding becouse i belive its wrong and i dont need it to reffer to time as you can see im reffering the rand to a vector which store heart, diamond, cross and black.
how can i make a random out put from this vector . im sorry but what you gave is not an answer
i called srand only once . as you can see in the code.