Hello, I need to know how to use an if statement to check if 2 string elements are in an array that contains 7 string elements for names. Also after that if they are in that array I have to swap those values. I'm not sure how to check, thanks for your help! :)
If it has to be a simplistic array like this then you would iterate through it with a for loop. Take the numberical constant that you have designating the size of your array and make it into a constunsigned Array_Size = 7; somewhere above Line 16. Use this to set the array size and also to designate the limit in your for loop. That way if you need to change it, you are only changing the constant in one place. You also need to save the position that the names were found at, so that's two more variables.
I just want to say that if you can get away with using any of the standard containers, this becomes much nicer looking in the end.