In this topic I would like to recieve some help from you guys with my arrays task. Namley I was asked to create two arrays, A and B with the same size of an array (100). Then I had to arrange these 100 values in the array, which I generated with rand() operate, in an ascending order for A[i] and descending order for B[i]. Unfortunetly my program doesn't work as although it returns the indexes (i=1,i=2,...,i=100 & i=100,i=99,...,i=1) it deosn't seem to put the generated random values in order. Could somebody please help?
On line 28 you declare a variable swaper (with nothing meaningful in) and then on line 29 you set your A[i] to that non-meaningful value. The next two lines are also setting wrong variables.
On lines 57 you set the same variable twice, but you never set B[i].
Swapping is a classic three-line sequence in c++. Work it out with any numbers you like on paper.