Jun 12, 2012 at 7:49pm
Write a program that reads ten integers and displays them in the reverse of the order in which they were read.Only use array.
Jun 12, 2012 at 7:53pm
How much have you written so far?
Jun 12, 2012 at 8:38pm
std::array is not an array. So the code can look the following way
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <iostream>
int main()
{
const size_t N = 10;
int a[N];
for ( size_t i = 0; i < N; i++ ) std::cin > a[i];
for ( size_t i = N; i != 0; ) std::cout << a[--i] << ' ';
std::cout << std::endl;
return ( 0 );
}
|
Last edited on Jun 12, 2012 at 8:40pm