Download MetaTrader 5

What my easy code 's error,two value compare

To add comments, please log in or register
All articles are available from MetaTrader 5. Contribute your own one!
47803124
157
47803124 2014.11.06 12:19 
Look last Code ,why the run ruzult is  ok2    not  ok3?
  double a=4.0;
      double    b=4.5;
      if(a>b)  Alert("ok1");
      if(a<b)  Alert("ok2");
      if(a==b) Alert("ok3");



 double a=4.0;
      int b=4;
      if(a>b)  Alert("ok1");
      if(a<b)  Alert("ok2");
      if(a==b) Alert("ok3");






           int MAINX= FileOpen("MAIN2222.TXT", FILE_COMMON|FILE_CSV|FILE_READ|FILE_WRITE);
           FileWrite(MAINX,4);  
           FileSeek(MAINX, 0, SEEK_SET);
           FileClose(MAINX);
//That's mean is write  a text  and write integer 4

   
           int MAINX= FileOpen("MAIN2222.TXT", FILE_COMMON|FILE_CSV|FILE_READ|FILE_WRITE);
           FileSeek(MAINX,0,SEEK_SET);
           double a=FileReadNumber(MAINX);  //这里的方向只代表了美元的多头方向
           FileClose(MAINX);
      //Read the double  a=4
           int b=4;
        
      
          if(a>b)  Alert("ok1");
          if(a<b) Alert("ok2");
         if(a==b) Alert("ok3"); 
Look last Code ,why the run result sometimes is  ok2    not  ok3? WHY
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.11.06 12:27  
Print() the result and see what is the value for a.
whroeder1
14508
whroeder1 2014.11.06 13:43  
zdj231: ,why the run ruzult is  ok2    not  ok3?
The == operand. - MQL4 forum
To add comments, please log in or register