In this, we are going to write a simple program to validate if a candidate is eligible to apply for a driving license or not in C++.
This program is kept simple so we have kept only one eligibility criteria that is AGE. If candidate's age is 18 or more then he/she is eligible to apply for driving license otherwise not
The code given below can be used for TURBO C++ Compiler:-
// to find driver eligibility using if statement
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a;
cout<<"Enter the age of candidate to check his/her eligibility to apply for driving license...\n";
cin>>a;
if(a >= 18) {
cout<<"You are ELIGIBLE to apply for driving license !";
}
else {
cout<<"You are NOT - ELIGIBLE to apply for driving license !";
}
getch();
}
The code given below can be used for g++/gcc Compiler:-
// to find driver eligibility using if statement
#include <iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter the age of candidate to check his/her eligibility to apply for driving license...\n";
cin>>a;
if(a >= 18) {
cout<<"You are ELIGIBLE to apply for driving license !";
}
else {
cout<<"You are NOT - ELIGIBLE to apply for driving license !";
}
return 0;
}
#ENJOYCODING
Â
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP