Ok, I am making a BlackJack game in console (there's a way, believe me), and would like to know how to display the card values randomly. I have an array like this:
Code:
int card_values[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
And my card choosing code goes like this:
Code:
srand(time(NULL));
for(card_p_1 < )
{
while(card_p_1 < 5)
{
cout << card_values[13];
}
}
I have card_p_1 defined already before the code, but this is what happens:
Code:
--------------------Configuration: black jack - Win32 Debug--------------------
Compiling...
main.cpp
C:\Program Files\MVC\MyProjects\black jack\main.cpp(26) : error C2374: 'card_values' : redefinition; multiple initialization
c:\program files\mvc\myprojects\black jack\arrays.h(6) : see declaration of 'card_values'
C:\Program Files\MVC\MyProjects\black jack\main.cpp(26) : error C2440: 'initializing' : cannot convert from 'int' to 'int []'
There are no conversions to array types, although there are conversions to references or pointers to arrays
C:\Program Files\MVC\MyProjects\black jack\main.cpp(172) : error C2059: syntax error : ')'
C:\Program Files\MVC\MyProjects\black jack\main.cpp(173) : error C2143: syntax error : missing ';' before '{'
C:\Program Files\MVC\MyProjects\black jack\main.cpp(176) : error C2059: syntax error : ';'
Error executing cl.exe.
black jack.exe - 5 error(s), 0 warning(s)
I've tried numerous things (about 6 things approximently). Any help would be greatly appreciated.
EDIT: Here's the declarations:
Code:
int card_d_1, card_d_2, card_p_1, card_p_2;
int card_values[] = card_values[13];