#include <fstream>
#include <cstring>
using namespace std;
#define MaxStr 128
#define MaxRecord 128
#include "Bubblesort.h"
#include "Book_1.h"
#include "Overload.h"
#include "WriteFile.h"
int main( int argc, char* argv[ ] ) {
fstream infile;
Book b;
int length, number;
char key[MaxRecord][MaxStr];
char rrn[MaxRecord];
char buffer[MaxStr];
infile.open( "books.txt", fstream::in );
infile >> number >> length;
for ( int i = 0; i < number; i++ ) {
infile >> b;
strcpy( key[i], b.GetValue( 2, buffer ) );
rrn[i] = i;
}
Bubblesort( key, rrn, number );
WriteFile ( infile, rrn, number, length );
infile.close( );
}
|
|
|
|