-
Notifications
You must be signed in to change notification settings - Fork 0
/
asad2.cpp
25 lines (24 loc) · 979 Bytes
/
asad2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream> //header file
#include <string>//string header file
using namespace std; //using namespace standard
int main () { //main function
string name,city,nationality; //declaring string variables
int age,calc; //declaring variables
cout<<"Please Enter Your Name: ";//prints
getline (cin,name); //gets inputed name
cout<<"Are you Pakistani? Enter Yes or No: "; //prints
cin>>nationality; //takes input
cout<<"Please Enter Your Age: ";//prints
cin>>age;//takes input
cout<<"Are you resident of Sukkur? \n Enter Yes or No ";//prints
cin>>city;//takes input
cout<<"What is 5+7= "; //asks a question
cin>>calc; //takes input
if ( nationality=="Yes" && age>=18 && city=="Yes" && calc==12 ) //condition check
{
cout<<name<<" you are eligible to vote. \n Please Caste your vote.\n Thank You."; //prints
}
else //for not eligible
cout <<"Sorry "<<name<<" you are not eligible to vote."; //prints
return 0;//program terminates
}