C++ if statement determine whether the age is greater than 10 and less than 100

Description

C++ if statement determine whether the age is greater than 10 and less than 100

#include <iostream>
using namespace std;
int main()/*from w  w  w.  j a  va2s .  co m*/
{
   int age;
   cout << "What is your age? ";
   cin >> age;
   if ((age < 10) || (age > 100))
   {
      cout << " \x07 \x07 \n";   // Beep twice
      cout << "*** The age must be between 10 and 100 ***\n"; }
      else
      {
         cout << "You entered a valid age.";
      }
      return 0;
}



PreviousNext

Related