I have 2 arrays that are the following:
int[] used = {300,525,110}
int[] total = {350,600,115}
(By the way, the language is C # in case someone asks.)
What I try to achieve is to go through each of the arrays and compare the values between them and assign them other values, so that it becomes clearer is the transfer of memory between hard disks, that is why used
and total
I put the following example:
A used[2]
(I mean 110) I want to subtract 50 to add it to used[0]
remaining like this
at 350 and then subtract the remaining 60 from used[2]
to add them to used[1]
.
The indexes (or the values stored in them) come into play because the values of used[i]
can not be greater than those contained in total[i]
.
Even what I have arrived was very little:
public int moveData(int[] xUsed, int[] xTotal)
{
foreach(int totalData in xTotal)
{
foreach(int usedData in xUsed)
{
int auxData = 0;
while(usedData <= totalData)
{
auxData = usedData - totalData;
//usedData. = auxData;
}
}
}
}
As you can see there, I went through the 2 array but I can not assign the data, in this case auxData
.
I hope someone can help me with this, of course, thanks in advance, if you need more part of the code or more details just comment.