Bonjour.
Si c'est en C (ne fonctionnera pas en C++), tu peux faire ceci:
#include <stdio.h>
static const char B = 'B';
static const char N = 'N';
static const char V = 'X';
typedef struct
{
int i;
char cases[8][8];
double d;
} Plateau;
int main()
{
Plateau p1 =
{
0, /* i */
{ /* cases */
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,B,N,V,V,V},
{V,V,V,N,B,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V}
},
12.5 /* d */
};
printf("%c\n", p1.cases[3][3]);
return 0;
}
Pour du C++, il faut faire ceci:
#include <iostream>
namespace
{
const char B = 'B';
const char N = 'N';
const char V = 'X';
} // namespace
struct Plateau
{
Plateau()
: i(0),
cases({
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,B,N,V,V,V},
{V,V,V,N,B,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V},
{V,V,V,V,V,V,V,V}
}),
d(12.5)
{
}
int i;
char cases[8][8];
double d;
};
int main()
{
Plateau p1;
std::cout << p1.cases[3][3] << std::endl;
return 0;
}