C ++如何对顺序二进制文件中的记录进行排序并读出?

时间:2013-02-03 21:27:12

标签: templates sorting file-io stack binary-search-tree

以下是我给出的一个示例问题。

You are given files containing templates for a StackType, a QueueType, and a
BinarySearchTreeType.  There is also a file called Record.h that holds the
declarations and definitions for a Record class that contains information about a
student. All function bodies are given except for the overloading of the 
operators “<” and “>”. 

Write a main program, sort.cpp, that takes a squential binary file called 
Student.dat that contains records of the given class, then prints it out ordered 
by student ID. You may use all or none of the templates given to you.

我不完全确定这是在问什么。什么是最快最简单的方法呢?我认为最简单或最快的是有人应用quicksort或mergesort。你能发一些示例代码吗?

0 个答案:

没有答案