codice:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXRIGHE 100
#define MAXCOLONNE 100
int Matrice(int partite[MAXRIGHE][MAXCOLONNE],int d[],int n)
{
int i,j;
double max=0,max_indice=0;
double partite_vinte=0,partite_perse=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
//printf("%d\n",partite[i][j]);
if(partite[i][j]!=-1)
{
partite_vinte+=partite[i][j];
partite_perse+=partite[j][i];
}
}
printf("%lf\t%lf",partite_vinte,partite_perse);
if((partite_vinte/(partite_vinte + partite_perse)) > max)
{
max=(partite_vinte/(partite_vinte + partite_perse));
max_indice=i;
}
d[i]=partite_vinte - partite_perse;
partite_vinte=0;
partite_perse=0;
}
return max_indice;
}
int main()
{
int partite[MAXRIGHE][MAXCOLONNE]={{-1,3,4,5,2,1},{4,-1,2,1,2,3},{3,4,-1,4,5,4},{1,2,2,-1,3,3},{2,2,3,4,-1,1},{0,0,0,0,1,-1}};
int d[6]={0};
int n=6;
int i;
printf("\n%d",Matrice(partite,d,n));
for(i=0;i<6;i++)
printf("\n%d\n",d);
return 0;
}
l'unica cose che manca sono i dati nel vettore...con un semplice for nel main mi stampa solo il primo indice del vettore ripetuto(5 in questo caso)..qualche aiuto?