well i have this project which i need to create a lot of user defined array say:
int num;
int array[num];
and it goes on and on like that. say:
string array1[num];
int array2[num];
int array3[num];
now I'm thinking of comparing array2 and array3 together and since it will hold the same value with array1 and array, i want to output the largest in array2 and array3 and output the corresponding value in array1. for example:
class Info {
public:
string name;
int value2,value3;
};
Info arr[num];
...
cout << "the winner is " << arr[winner].name << arr[winner].value2 << arr[winner].value3
This appears to be a simple case of parallel arrays. The length of the array(s) would not be significant while maintaining sync between arrays would be.
All that is necessary is to determine the index of the maximum value in the array and that index is used to select the corresponding elements with the same index from the other arrays.
As it turns out the OP's vagueness on which array(s) constitute the source(s) for the maximum doesn't matter. That is determined by the rules for scoring which OP doesn't know by the look of it.
So, that rule could be for all we know the number of letters in the name or the sum of elements in two arrays or whatever.
The assumption of synchronous parallel arrays is mine and might not have anything to do with this open-ended question. struct's certainly assist synchronous behaviour.