Sorting function repeating numbers?

MY SortArray function is sorting my numbers but repeating some of them twice, for example : 59 59, 60 60, etc. i cant seem to find the error

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  #include <iostream>
#include <fstream>
#include <iomanip>
#include <stdlib.h>
#include <cmath>

using namespace std;

void ZeroOutArray(int numbers[]);
  int GetSum(int numbers[]);
 /* GetData
 DisplayArray
  GetAverage

   GetStandardDeviation
   GetRandomElement
   GetHigh 
   GetLow */
   void SortArray (int numbers[]);
 

int main()
{
	//declare variables section
	
	
    
	string inputFile;
	ifstream inData;
	int sum,count=0,i=0;
	
	inData.open("ModerateTemps.dat");
/*
	cout << "Enter the input data file name: " << endl;
	cin >> inputFile;
	inData.open(inputFile.c_str());
	if (!inData)
	{
		cout<< "Can't open the input file. Program is stopping." << endl;
		return 1;
	}  
	*/
	const int MAX_TEMPS = 25;	//be sure to use a constant when declaring the array
	int numbers[MAX_TEMPS] = {0};  //declare and zero out the array
	
	inData >> numbers[0];  //prime the loop with an initial read from the file
	count++;
		i++;
	while (count < MAX_TEMPS && inData >> numbers[i])
	{
	
		count++;
		i++;
	}
	 

	
  
 SortArray(numbers);

  for (int i=0; i<25; i++)
	
	{
	cout << numbers[i] << endl;
	}
 
	 cout << GetSum(numbers);
	

	
	
return 0;
	
}

//FUNCTION DEFINTIONS 

int GetSum( int numbers[])
{

	int sum=0;
	for (int i=0; i<25; i++)
	
	{
	  
		sum+=numbers[i];
	}
	return sum;
}



 

void SortArray (int numbers[])
{
int n=25;
for(int x=0; x<n; x++)

	{

		int index_of_min = x;

		for(int y=x; y<n; y++)

		{

			if(numbers[index_of_min]>numbers[y])

			{

				index_of_min = y;

			}

		}

		int temp = numbers[x];

		numbers[x] = numbers[index_of_min];

		numbers[index_of_min] = temp;

	}
}
anyone? :(
Topic archived. No new replies allowed.