How would I write this for loop as a while loop or a do-while loop?

Hey, I'm really new to coding. This is my first semester taking C++ and I need help translating this for loop into a while loop or a do while loop.

for (int i=0; i<22581; i=i+1)
if (sunX[i]>sunX[i+1])
{
max[i/2] = sunX[i];
min[i/2] = sunX[i+1];
} //end of for loop

else
{
max[i/2] = sunX[i+1];
min[i/2] = sunX[i];
}
1
2
3
for (initialization; condition; increment){
    body;
}

1
2
3
4
5
6
7
8
9
{
    initialization;
    while (condition){
        {
            body;
        }
        increment;
    }
}
Topic archived. No new replies allowed.