how to get first value of ab array?

 

hello,

im using this code to print an array positif values, but i finding a difficulty to print a specific values,

  string text="";
   for(int i=0;i<count;i++)
     {
      if(ZigzagBuffer[i]!=PLOT_EMPTY_VALUE && ZigzagBuffer[i]!=0.0)
         //text=text+"\n"+IntegerToString(i)+": "+DoubleToString(ZigzagBuffer[i],Digits());
         Print(text+"\n"+IntegerToString(i)+": "+DoubleToString(ZigzagBuffer[i],Digits()));
     }

the returned values are like this    ......... candle: value

5: 0.95

8: 0.96

12: 0.955

22: 0.93

..

...

...

what i want is to print the first line alone or the second.

i tried serval attempt but nothing works with me.

regards

 
Belgacem Issam: i tried serval attempt but nothing works with me.
  1. “Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
         How To Ask Questions The Smart Way. (2004)
              When asking about code
              Be precise and informative about your problem

    Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the source file.

         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

    We can't see your broken code.

  2. Belgacem Issam: what i want is to print the first line alone or the second.
    Count your lines that you are about to print. Print only those you want.
 
int    Index1 = -1;
double Value1 = 0.0;
int    Index2 = -1;
double Value2 = 0.0;

for(int i=0; i<count; i++)
{
 if(ZigzagBuffer[i]!=PLOT_EMPTY_VALUE && ZigzagBuffer[i]!=0.0)
 {
  if(Index1==-1)
  {
   Index1 = i;
   Value1 = ZigzagBuffer[i];
   Print("Index 1 : ",IntegerToString(i)," Value 1 : ",DoubleToString(Value1,_Digits));
   continue;
  }
  
  if(index2==-1)
  {
   Index2 = i;
   Value2 = ZigzagBuffer[i];
   Print("Index 2 : ",IntegerToString(i)," Value 2 : ",DoubleToString(Value2,_Digits));
   break;   
  }
 }
}



 
Ehsan Razavi #:

after all there is a mind readers that can fix  car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tire.

thank you very much. work perfectly

Reason: