Jump to content

Am dat drumul la Black Week. Mai multe detalii aici

Coduri promoționale:

 

70% reducere - 30 utilizari - COD: FRIDAY70
60% reducere - 50 utilizari - COD: FRIDAY60
50% reducere - 70 utilizari - COD: FRIDAY50

40% reducere - 120 utilizari - COD: FRIDAY40
30% reducere - 400 utilizari - COD: FRIDAY30

 

Sign in to follow this  
shanker'

array cout [first<>last, second<>second last ...]

Recommended Posts

Metoda 1

 

for (int i=0; i<size; i++)
    if (i % 2 == 0)
        std::cout << Array[i/2] << " ";
    else std::cout << Array[size - (i/2+1)] << " ";

 

Metoda 2

 

if ((size+1) % 2 == 0)
    for (int i=0; i<=size/2; i++)
        if (i != size/2)
            Write << Array[i] << " " << Array[size-1-i] << " ";
        else Write << Array[i];
else
    for (int i=0; i<size/2; i++)
        Write << Array[i] << " " << Array[size-1-i] << " ";

 

size := numărul elementelor din vector != diferită de dimensiunea acestuia

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.