comparing elements in 2 different vectors for a higher value.

thanks!
Last edited on
If you have a vector, you can use .at(#) to access the element at that location. Then just compare it like normal.
thanks :)
Last edited on
card1 is a random number within the vector size and thats the element that gets displayed.
this random number is basically the random card thats played by player1.

now player2 must find a higher card so:
card2 has to check element 1 if its higher then card1, if its not then go to element 2, and so on until it finds an element that is higher.

when it finds this higher value in the vector
cout << this value
erase element from vector

otherwise if it goes through all the cards and nothing was found higher then card1, it will cout PASS.

any tips on how ican to this ive been playing with the loops for over a hour and a half now and still going, cant seem to find anything.


Edit: sorry guys i just posted my idea of a loop here. thanks for bearing with me :)
finally finished my card game :)
Last edited on
Topic archived. No new replies allowed.