U E D R , A S I H C RSS

정렬/방선희

~cpp 
#include <fstream> 
using namespace std; 
const int Max = 10000;
int main() 
{ 
    ifstream fin("UnsortedData.txt"); 
    ofstream fout("output.txt"); 
	
	int arr[Max];

	for(int i=0; i < Max; i++)
	{
		fin >> arr[i];
	}

	for(int j=0; j < Max; j++)
	{
		int temp;
		for(int k=0; k < Max; k++)
		{
			if(arr[j] < arr[k])
			{
				temp = arr[j];
				arr[j] = arr[k];
				arr[k] = temp;
			}
		}			
	}
	
	for(i=0; i < Max; i++)
		fout << arr[i] << endl; 

	return 0; 
} 
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:45
Processing time 0.0091 sec