Errors, bugs, questions - page 2152

 
Itum:

How can you compare two arrays?

are the elements unique?
 
Комбинатор:
are the elements unique?
yes
 
Itum:
yes
sort both arrays then look for the difference in one synchronous pass
 
Комбинатор:
sort both arrays then look for the difference in one synchronous pass
How do you do that... There are also different array sizes
 
Itum:

How can I compare two arrays?

Calculate which elements are missing in array2 compared to array1

The result should be: 6 и 7


This is what was brought up - there are language capabilities, but no "infrastructure" for solving elementary algorithmic problems.
That's how much effort it takes to solve a given task in Python:

set1 = set([1,2,3,4,5,6,7])
set2 = set([1,2,3,4,5])
result = set1-set2

print(result)
Out[1]: {6, 7}


How much effort does it take to solve it in MQL?
Can thestandard library help somehow, or not?

 

I've looked through everything I can think of. Different languages have functions for this everywhere and it's really simple there...

I'm doing it in MQL4 ... need to make things as simple as possible.

 
Itum:

I've looked through everything I can think of. Different languages have functions for it everywhere and it's really simple there...

I'm working in MQL4 ... need to make it as simple as possible.

Have a look at the standard library - look at CSortedSet and its ExceptWith method, it may help.

https://www.mql5.com/ru/docs/standardlibrary/generic/csortedset/csortedsetexceptwith

 
Sergey Dzyublik:

Have a look at the standard library - look at CSortedSet and its ExceptWith method, might help.

https://www.mql5.com/ru/docs/standardlibrary/generic/csortedset/csortedsetexceptwith

Thanks a lot !

It was solved in a much simpler way
   char array1[]={"1", "2", "3", "4", "5", "6", "7"};
   char array2[]={"1", "2", "3", "4", "5"};

   for(int a=0; a<ArraySize(array1); a++){
      string items = array1[a];
     
      int rez = ArrayBsearch(array2,items,WHOLE_ARRAY,0,MODE_ASCEND);  
      if(array2[rez]==items) {
         Print("ТАКОЕ ЗНАЧЕНИЕ ЕСТЬ в массиве: ", items);
      } else {
         Print("НЕТ ТАКОГО ЗНАЧЕНИЯ в массиве: ", items);
      }
   }
 

No error message

typedef void (*fn)( void * );
void f1 ( void * ) {}
class A {};
void OnStart()
{
        fn f2 = f1;
        const A *a;
//      f1( a ); //Error: 'a' - cannot convert from const pointer to nonconst pointer
        f2( a ); //нет сообщения об ошибке ???
}

while constancy is violated

 

Here's a question:

how do I know what time the forex symbol closes?

Reason: