2016-07-31 23 views
-2
void phage :: evaluate(bacteria ba[]) { 

    for (int i = 0; i<popsize; i++) 
     for (int j = 0; j<gensize; j++) 
      fitness += m[i] == ba[i].m[j]; 
} 

here is an evaluate function, declared in struct. when I try to call it, there is an error "expected an expression"Fehler: "erwartet einen Ausdruck" Ich versuche, Array zu verwenden, in Funktion

for (int i = 0; i < popsize; i++) 
    population[i].evaluate(population[]); 
+1

entfernen '[]' von ' population [i] .evaluate (population []); ' – DimChtz

+0

der Fehler erscheint in der Population [] –

+0

vielen Dank! –

Antwort

2

statt

for (int i = 0; i < popsize; i++) 
    population[i].evaluate(population[]); 

Verwendung

for (int i = 0; i < popsize; i++) 
    population[i].evaluate(population);