// Code derived from Stroustrup's PPP2 book// § 10.7 Reading a single value// -and beginning on p 358#include<iostream>usingnamespacestd;intmain(){cout<<"Please enter an integer in the range 1 to 10 (inclusive):\n";intn=0;while(cin>>n&&!(1<=n&&n<=10))// combine the read and range checkcout<<"Sorry "<<n<<" is not in the [1:10] range; please try again\n";// what could possibly go wrong here?// … use n here …}