+ 1

Non duplicate values using array

https://code.sololearn.com/c3A81A9A19A1 in this code, the non duplicate values are not printed..Done according to the solution.

16th May 2021, 8:17 AM
Ramisa Fariha
Ramisa Fariha - avatar
3 Antworten
+ 1
You are assigning values in loop into array by for(int j=0; j<subscript; j++) But j<subscript is false initially, and not changing subscript value. Because never enter into loop and not assigning array values so all a[I]=0 only....
16th May 2021, 8:49 AM
Jayakrishna 🇮🇳
+ 1
Thank you@jaya
16th May 2021, 10:20 AM
Ramisa Fariha
Ramisa Fariha - avatar
0
the question is from the book C++ how to program Harvey M Deitel 4.15 Use a single-subscripted array to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read. Provide for the “worst case” in which all 20 numbers are different. Use the smallest possible array to solve this problem.
16th May 2021, 8:17 AM
Ramisa Fariha
Ramisa Fariha - avatar