U E D R , A S I H C RSS

정렬/변준원

~cpp 

#include<iostream>
#include<fstream>  
using namespace std;  
  
int main()  
{  
        ifstream fin("UnsortedData.txt");  
        ofstream fout("SoretedData.txt");  
 
                int sorted[10000]; 
 
                int i,j,k,sort; 
 
                for(i=0; i<10000; i++) 
                        fin >> number[i]; 
                for(j=0; j<10000; j++) 
                {
		for(k=0; k<10000; k++) 
                    {
			if(number[j] < number[k]) 
                        {
			sort = sorted[j]; 
			sorted[j] = sorted[k]; 
                           sorted[k] = sort; 
                        } 
                    } 
                }                
  
        for(i=0; i<10000; i++) 
			fout << sorted[i] << endl;  
        				
		return 0;  
} 

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:45
Processing time 0.0126 sec