// Code derived from Stroustrup's PPP2 book// § 9.4.1 struct and functions// -and beginning on p 308#include<iostream>usingnamespacestd;// simple Date (too simple?):structDate{inty;// yearintm;// month in yearintd;// day of month};//------------------------------------------------------------------------------// helper functions:voidinit_day(Date&dd,inty,intm,intd){// check that (y,m,d) is a valid date// if it is, use it to initialize ddcout<<dd.y<<y<<m<<d<<'\n';// rm's 'unused variable' error}voidadd_day(Date&dd,intn){// increase dd by n dayscout<<dd.y<<n<<'\n';// rm's 'unused variable' error}voidf(){Datetoday;init_day(today,12,24,2005);// oops! (no day 2005 in year 12)add_day(today,1);}//------------------------------------------------------------------------------intmain(){// this C++ attribute prevents an 'unused variable' error by compiler[[maybe_unused]]//Datetoday;// a Date variable (a named object)// set today to December 24, 2005today.y=2005;today.m=24;today.d=12;// this C++ attribute prevents an 'unused variable' error by compiler[[maybe_unused]]//Datex;//x.y=-3;x.m=13;x.d=32;// Was year 2000 a leap year? Are you sure?Datey;y.y=2000;y.m=2;y.d=29;init_day(y,2000,1,1);add_day(y,28);}