I have 2 question regarding 2d array. I am whether my program i working in the way I am want or not. I have to make a program to store values in one column and numbers in second column. (Table is just an example not actual values and numbers).
Then call the number stored at maximum value (which is number 3 stored at Max value 0.5).
I have stored values and numbers in array as mentioned below. Although it is not showing me any error. Just want to double confirm whether it is a right way to do so? Second thing how can I call this array to find out the number stored at maximum value?
Code:
double n[50][2];
int val=0;
int numb=0;
static double MyValue = 0.0;
static double number = 0.0;
static double lastValue = 0.0;
static double
CalculateMyValue(Node* node, int a){ // a is taken as argument
float b =0.3;
int bd = CalculateNumber(node); //calling another program
......
.....
{
MyValue = ((1-a)*LastValue); //MyValue = {0.1,-0.7..}
{
number = bd; //number = {1,2,..}
numb++;
}
n[val][numb] = number;
cout<<"Number = n[val][numb] = "<<n[val][numb]<<endl;
val++;
n[val][numb] = MyValue;
cout<<"MyValue = n[val][numb] = "<<n[val][numb]<<endl;
LastValue = MyValue;
}
return MyValue;
}
Here I want to call this array to find out the number stored at maximum value
void CalculateNumber(Node* node)
{
..............
..............
else {
Mymuber = ??? //number stored at maximum value in array
}
}