// Code derived from Stroustrup's PPP2 book// § 5.6.1 Bad arguments// -and beginning on p 147#include<iostream>usingstd::cout;// a type specifically for reporting errors from area()classBad_area{};// calculate area of a rectangle;// throw a Bad_area exception in case of a bad argumentintarea(intlength,intwidth){if(length<=0||width<=0)throwBad_area{};returnlength*width;}// calculate area within frameintframed_area(intx,inty){constexprintframe_width=2;returnarea(x-frame_width,y-frame_width);}intmain()try{intx=-1;inty=2;intz=4;// . . .intarea1=area(x,y);intarea2=framed_area(1,z);intarea3=framed_area(y,z);doubleratio=area1/area3;cout<<area1<<'\n'//<<area2<<'\n'//<<area3<<'\n'//<<ratio<<'\n';}catch(Bad_area){cout<<"Oops! bad arguments to area()\n";}