say we have array[6] .. i want to ask user to enter 6 values to the array and if there is any repeated value the program will cout them ..
which operation that i can use ? i thought about switch statement or if else condition and i have to use looping to cover all odds.. but i cant get it out

There are two really simple approaches you could take:

  1. Use two loops, inner and outer, which step through the array. Have a second array hold any duplicate values you find.

  2. Sort the array (or a copy of it if you need to preserve the original order), then walk through it and see if there are any runs of duplicates. Again, you may want to have a second array to hold the found values so you don't get redundant answers.

Neither of these approaches is very efficient, but for such a small data set, that's of minimal concern.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.