#include #include using namespace std; class Adaptee{ //Existing way requests are implemented provide full precision public: double SpecificRequest(double a, double b){ return a / b; } }; class Adapter{//Required standard for requests. Rough estimate required public: virtual double Request(int i)=0; }; class ConcreteAdapter:public Adapter{ //Implementing the required standard via the Adaptee Adaptee *adaptee; public: ConcreteAdapter(Adaptee *adaptee):adaptee(adaptee){} double Request(int i){ double val=adaptee->SpecificRequest(i, 3); //double val = 37.777779; double rounded_down = floorf(val * 100) / 100; /* Result: 37.77 */ double nearest = roundf(val * 100) / 100; /* Result: 37.78 */ double rounded_up = ceilf(val * 100) / 100; /* Result: 37.78 */ return nearest; } }; int main(){//The Client Code // Showing the Adapteee in stand-alone mode Adaptee adaptee; cout<<"Before the new standard\nPrecise reading: "<Request(5)<