Need help in this code

ejoi
280
ejoi  
double EUR=4;
double USD=1;
double GBP=6;
double CHF=3;
double JPY=9;
  
double num_array[5]={EUR,USD,GBP,CHF,JPY};//41639
ArraySort(num_array,WHOLE_ARRAY,0,MODE_DESCEND);

string Comm;
Comm=Comm+"\n\n = "+DoubleToStr(num_array[0],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[1],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[2],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[3],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[4],4)+"";

Comment(Comm);

I need help in this code where I cant seem to go about it. The code just arrange it from biggest to smallest currency in comment.
Anybody can help me pinpoint the error?
Alexander
2441
Alexander  
int init()
{
start();
return(0);
}
int start()
{
double EUR=4;
double USD=1;
double GBP=6;
double CHF=3;
double JPY=9;
  
double num_array[5]={4,1,6,3,9};//41639
ArraySort(num_array,WHOLE_ARRAY,0,MODE_DESCEND);

string Comm;
Comm=Comm+"\n\n = "+DoubleToStr(num_array[0],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[1],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[2],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[3],4)+"";
Comm=Comm+"\n = "+DoubleToStr(num_array[4],4)+"";

Print("Comm - ",Comm);
return(0);
2010.10.24 00:13:52 test AUDUSD,H1: initialized
2010.10.24 00:13:52 test AUDUSD,H1: Comm -

= 9.0000
= 6.0000
= 4.0000
= 3.0000
= 1.0000
2010.10.24 00:13:52 test AUDUSD,H1: loaded successfully
bernd
989
bernd  

This thread is lacking the actual question. All I can see is some code and the complaint(?) that the code indeed does *exactly* what it is supposed to do.


Are you searching for the DoWhatIMeanNotWhatISay() function? Unfortunately neither MT4 nor most of the people here in this forum can read your mind.

William Roeder
23446
William Roeder  
ejoi:
Anybody can help me pinpoint the error?
double EUR=4;
double USD=1;
double GBP=6;
double CHF=3;
double JPY=9;
  
double num_array[5]={EUR,USD,GBP,CHF,JPY};//4163

You can only initialize an array with constants. So either
  1. #define EUR 4
    #define USD 1
    #define GBP 6
    #define CHF 3
    #define JPY 9
    double num_array[5]={EUR,USD,GBP,CHF,JPY};//4163
  2. or
    double EUR=4;
    double USD=1;
    double GBP=6;
    double CHF=3;
    double JPY=9;
    double num_array[5];
    Num_array[0]=EUR;
    Num_array[1]=USD;
    Num_array[2]=GBP;
    Num_array[3]=CHF;
    Num_array[4]=JPY;