C++ Program to Check User is Eligible for Vote or not

In this program, the user is ask to input his/her age, depending on that we will check his age. If age is greater than or equal to 18 then we will display he/she is eligible to vote otherwise not.



Source Code
#include <iostream>
using namespace std;

int main()
{
	int age ;

	// Input age
	cout<<"Enter the age of the person: ";
	cin>> age;

	// Check voting eligibility
	if (age>=18)
	{
		cout<<"You are eligible for voting.";
	}
	else
	{
		cout<<"You are not eligible for voting.";
	}

	return 0;
}
Output
Enter the age of the person: 15
You are not eligible for voting.

Enter the age of the person: 18
You are eligible for voting.