Hi,
I have two arrays like this: A={ 1, 3, 7} B={ 4, 5, 2, 3, 8,7,1}
In C++, I want to check whether all elements of the array A exist in the array B or not?
Could you please help me to do this?
Thanks in advance
Try using some for loops to check array B and see if it has any of the values in array A. If you run in to a specific problem post your code and I would be more than happy to help.
while running in Linux, the following errors are seen.
Error: Invalid type ';return0;}}cout<<"\All' in declaration of 'elements are in array B\n\n"' main.cxx:26:
Error: Symbol ;return0;}}cout<<"\All elements are in array B\n\n" is not defined in current scope main.cxx:26:
Error: improper lvalue main.cxx:26:
*** Interpreter error recovered ***
I am new comer.
I am compiling your code in ROOT (software framework) with Cling (an interactive C++ interpreter) in it.
Even when I comment out the lines 21 and 26 , I encountered with the following error.
Error: Symbol ;return0;}}system is not defined in current scope main.cxx:27:
Error: improper lvalue main.cxx:27:
*** Interpreter error recovered ***
probably, My interpreter has problem with "system ("pause");".
Remove the system("pause"); altogether. There is no sane reason to have it in any program. It is a sorry excuse of a workaround for not knowing how to keep terminal open after a program exists.