Hello people, I've got a 2-d array, the first row has a string in each position, the second has a number in each position returned by a function that run on the strings.I run the mutatedstring function, run the matchmutated and put the values into the array, offspring times. Then I need to find the minimum number, and return the corresponding string. Could I use the min function for one row? How do I do this?

``````string mutated_chooser(string origmutated,string orisentance int offspringnumber)

int array [offspringnumber]
for (int t=0; t=offspringnumber-1;t++){
string newmutated = mutatedstring(origmutated);
newmutated = array [t];
int matchmutated = match(orisentance,newmutated);
matchmutated = [t];
}
// I need to find the minimum matchmutated in the array and return it's corresponding string``````

Thanks for the help!

Could you not scan the numbers in a loop find the minimum and store the position in a variable then output the string in that position?

How would I scan only one row of the array, while still keeping the strings that it corresponds to usable?
This is what I've done so far:

``````string mutated_chooser(string origmutated,string orisentance int offspringnumber){
int array [offspringnumber];
int min;
for (int t=0; t=offspringnumber-1;t++){

string newmutated=mutatedstring(origmutated);
newmutated= array [t];
int matchmutated= match(orisentance,newmutated);
matchmutated=[t];
}

int min = array[j];
for (j=0; j=offspingnumber; j++)
{
if (array[j] < min)
{min = a[j];} // set the smallest value of the arra
}
//now i'm usure how to get the string back from the minimum matchnumber``````

if you create a variable say posvar
line 16

``{min = array[j];posvar=j;}``

then

``cout<<array[j];``

sorry meant

``cout<<array[varpos];``

There's an error coming up saying that "c++ does not support variable size arrays", is there an easy way out of this? Or do I have to use something like vectors (not too sure how to use them)?