rendered paste body// read_konton.cpp// Läser från en binärfil random access.#include <iostream>#include <iomanip>#include <fstream>#include <cstdlib>#include <vector>#include "diver.h"using namespace std;bool compare(const Diver& a, const Diver &b); int main(){ vector<Diver> theDivers; ifstream in( "divers.bin", ios::binary | ios::in ); if ( !in ) { cerr << "Filen kunde inte öppnas." << endl; exit( 1 ); } while ( !in.eof() ) { Diver temp; in.read( reinterpret_cast< char * >( &temp ), sizeof( Diver ) ); theDivers.push_back( temp ); } sort(theDivers.begin(), theDivers.end(), compare); for (vector<int>::size_type i = 0; i != theDivers.size()-1; i++ ) { cout << theDivers.at(i); } in.close(); return 0;}bool compare (const Diver& a, const Diver& b){ return a.getTotal() > b.getTotal(); }