nurulshidanoni -1 Posting Whiz in Training

why the output do not produce the output after sorting....anybody knows how to do a selection sort code?

#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; 
	  
		}
	}

int 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";
			return -1;
			}
			cout <<" "<< x <<"  "<<y<< endl;
		}
		  // Print out sorted list. 
       
	 } 
		
			cout<<"After Descending Order"<<"\n";
			
			cout << x <<" "<< y <<" " ; 
			cout << endl; 
	
	return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.