#include <iostream>

using namespace std;

int main() 

{

    int age;

    cout << "enter age of citizen\n ";

    cin>> age;

    try 

{

  if (age >= 18)

{

    cout << "voter enroll  granted - you are old enough.";

  } else 

{

    throw (age);

  }

}

catch (int no)

 {

  cout << "voter enroll denied - You must be at least 18 years old.\n";

  cout << "Age is: " << no;

}

    return 0;

}

output 1:

enter age of citizen

 45

 voter enroll  granted - you are old enough.

output 2:

enter age of citizen

 15

 voter enroll denied - You must be at least 18 years old.

Age is: 15