Reverse order of an array

I'm getting information from a file and putting it into an array. My problem is after I get this information I have to reverse the original order of the numbers. The input file reads

9
23 19
-3 7892 12
7 4000 0 44

The first number tells how many numbers there are gonna be and is not part of the set. Right now my program outputs : 23 19 -3 etc.., but I need it to go from 44 0 4000 etc.. Any ideas? Help? Thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <fstream>
#include <cstdlib>

using namespace std;

int main()
{
	const int ARRAY_SIZE = 25;
	int numbers[ARRAY_SIZE];
	char fname[100];
	ifstream inputFile;
	int header;
	int count = 0;



	cout << "Please enter the name of the input file: ";
		cin >> fname;

		inputFile.open(fname);
		if(!inputFile)
		{
			cout << "Input file not found" << endl;
			exit(0);
		}

		inputFile >> header;
		cout << "The amount of numbers in the file is " << header << endl;

		while (count < ARRAY_SIZE && inputFile >> numbers[count])
			count++;

		inputFile.close();
		cout << "The numbers are: ";
		for (int index = 0; index < count; index++)
			cout << numbers[index] << " ";
		cout << endl;
		return 0;
	}
Hi, if you're only concerned with the output, then simply change your for loop to this
for (int index = count; index > -1; index--)
cout << numbers[index] << " ";
Thanks! Don't know what I was thinking.
Topic archived. No new replies allowed.