Hi, I'm a thai student ... now i have a premiership project but i can't pass this problem that is , How to random matching football team ?
example I have 4 team in vector<string>
name
[0]=a
[1]=b
[2]=c
[3]=d
I want to matching them such as
week 1 : a VS b
c VS d
week 2 : a VS c
b VS d
week 3 : a VS d
b VS c
so how i can design my code to random an element for this result
this is my original code
// Loop for matching name
for(int i=0;i<=vc_size-2;i++)
{
for(int j=i;j<=vc_size-2;j++)
{
cout<<nam<<" VS "<<nam[j+1]<<" : ";
}
}
but it result is:
a VS b
a VS c
a VS d
b VS c
b VS d
..... <-- I don't want it .
Please, help me .........