+ 2
How to check if an element exists in an array or not? (C++)
What i wanna do is>> Given n = 5 Given input --> 2 3 2 2 3 array [n] Cin > input Check(if element in array) If not, then store the value in array.. Else..continue For example: first input> 2..and the array is empty..so 2 not in array..then store it in array.. // Only store unique values.. I am having problem at the if statement..how can i check the value already exists or not?
2 ответов
0
it would be easier if you shared the code you already have.
may i suggest using a vector instead? if so here goes something i put together
https://code.sololearn.com/c95rHOTTniLs/?ref=app