Arrays in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Arrays in c++

I am trying to write a c++ code that stores 5 numbers from user in an array and outputs, the numbers are supposed to be unique, any number repeated the program prompts user to input another unique number. I have a problem with where the program ensures elements outputed are unique, help...

29th Sep 2021, 4:39 AM
Philip Ochieng
Philip Ochieng - avatar
4 Answers
+ 1
Then write it down and post it. One -- very inefficient -- way to do it is to loop through all numbers and compare them.
29th Sep 2021, 4:45 AM
Simon Sauter
Simon Sauter - avatar
+ 1
Ok, lemme give it a go
29th Sep 2021, 4:46 AM
Philip Ochieng
Philip Ochieng - avatar
0
Post your code in the code playground and link it here.
29th Sep 2021, 4:41 AM
Simon Sauter
Simon Sauter - avatar
0
I haven't written the code yet, brain storming
29th Sep 2021, 4:42 AM
Philip Ochieng
Philip Ochieng - avatar