// Example of using the GeographicLib::MagneticModel class// This requires that the wmm2010 magnetic model be installed; see// https://geographiclib.sourceforge.io/html/magnetic.html#magneticinst#include <iostream>#include <exception>#include <GeographicLib/MagneticModel.hpp>usingnamespacestd;usingnamespaceGeographicLib;intmain(){try{MagneticModelmag("wmm2010");doublelat=27.99,lon=86.93,h=8820,t=2012;// Mt EverestdoubleBx,By,Bz;mag(t,lat,lon,h,Bx,By,Bz);doubleH,F,D,I;MagneticModel::FieldComponents(Bx,By,Bz,H,F,D,I);cout<<H<<" "<<F<<" "<<D<<" "<<I<<"\n";}catch(constexception&e){cerr<<"Caught exception: "<<e.what()<<"\n";return1;}}