Hi guys! I got a simple problem but I dont know whats wrong in my code.
The situation is:
I have an array of integers:
int rptds[] { 12, 32, 40, 12, 35, 95, 32, 12}; (any else)
Then I want to overwrite the repeated numbers with the next:
12, 32, 40, 12, 35, 95, 32, 12
12, 32, 40, 35, 95
look the code:
thanks for any helpCode:int a, b, c, d; a = b = c = d = 0; while (rptds[a++]); a--; for (b=0; b<=a; b++) { for (c=b+1; c<=a; c++) { if (rptds[b]==rptds[c]) { for (d=c; d<a; d++) rptds[d]=rptds[d+1]; } } }



LinkBack URL
About LinkBacks



