No older revisions available
No older revisions available
데블스캠프2003첫째날 정렬하기
~cpp #include <fstream> using namespace std; const int size = 10000; int main() { ifstream fin("unsorteddata.txt"); ofstream fout("output.txt"); int *data = new int[size]; int i, j, temp; for (i = 0; i < size; i++) fin >> data[i]; for (i = 0; i < size; i++) for (j = i; j < size; j++) if (data[i] > data[j]) { temp = data[i]; data[i] = data[j]; data[j] = temp; } for (i = 0; i < size; i++) fout << data[i] << endl; return 0; }