Cpp for loop

Hi all,

How to write the below if condition in cpp?

  Here the vector elements are x = 10,20,30,40
  y = 60,10,100,120
  Both x and y are vectors. How to check if x present in y.

  for x in y:  // How to write this in cpp

Thank you,
What's your end goal?

https://www.cplusplus.com/forum/beginner/273657/ Oct 26, 2020
https://www.cplusplus.com/forum/beginner/273556/ Oct 20, 2020

Because asking one question a week on how to turn some random bit of python into some random bit of C++ isn't going to help you learn C++ in any shape or form.

What does the python code mean? Do all the values of x exist in y - or does any value of x exist in y?
Or obtain all the values that are common?
Last edited on
I would suggest using std::find

Topic archived. No new replies allowed.