Why the selection sort output not appear? Anybody knows how to correct it?
#include < iostream >
#include < string >
#include < cmath >
#include < iomanip >
#include < fstream >
using namespace std;
void SelectionSort ( int *y , int n )//selection sort function
{
int i , min , minat ;
{
for ( i = 0 ; i < 3 ; i++ )
{
minat = i ;
min = y [ i ];
if ( min < y [i ] )
{
minat = i;
min = y [ i ];
}
}
int temp = y [ i ] ;
y [ i ] = y [ minat ]; //swap
y [ minat ] = temp;
}
}
void printElements ( int *y , int x, int n ) //print array elements
{
int i = 0 ;
for ( i = 0 ; i < 3 ; i++ )
cout << " " << x << " " << y << endl;
}
void main()
{
int x, y;
ifstream inFile("jes.txt");
for (int i = 0; i < 3; i++)
{
if (inFile >> x >> y)
{ // Reading is successful
if (inFile.fail())
{
cout << "Error! Cannot open file! \n";
}
cout <<" "<< x <<" "<<y<< endl;
}
}
}