Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

정렬/문원명

From ZeroWiki

두번째,.


#include <iostream>
#include <fstream>
using namespace std;


void main()
{
	ifstream fin("UnsortedData.txt");
	ofstream fout("output.txt");
	int arr[10000];
	unsigned long i=0,m=0,n,k=0;
	int temp;
	for(i; i<10000;i++)
	{
		fin>>arr[i];
	}
	
	for(;m<10000;m++)
	{
		for(n=m;n<10000;n++)
		{
			if (arr[m]>arr[n])
			{
				temp=arr[m];
				arr[m]=arr[n];
				arr[n]=temp;
			}
		}
	}

	for(k;k<10000;k++)
	{
		fout<<arr[k]<< endl;
	}

}

문원명