#include <fstream>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
#include "Book_1.h"
#include "Overload.h"
|
|
|
int main( int argc, char* argv[ ] ) {
fstream file;
Book b;
int number, length, count = 1;
char title[129], buffer[129]; |
|
|
strcpy( title, argv[1] );
file.open( "books.txt", fstream::in );
file >> number >> length;
while ( true ) {
file >> b;
if ( strlen( b.GetValue( 1, buffer ) ) == 0 ) {
printf( "<br /><h3>No such book: <em>%s</em></h3>", title );
break;
}
else {
cout << count++ << " comparisons; checking title: ";
cout << b.GetValue( 1, buffer ) << "<br />";
if ( strcmp( title, buffer ) == 0 ) {
b.PutResults( );
break;
}
}
}
file.close( );
}
|
|
|
|