Answer to Question #180737 in C++ for fiey

Question #180737

A certain organization needs to elect its new president. So, they started looking for potential candidates. A candidate must be 30 to 40 years old and must be male in pursuance to its by-laws. Create a program that will ask the gender and age of the candidate applicant and will print if the applicant is accepted or rejected to be an official candidate. Use IF statements.


1
Expert's answer
2021-04-12T15:22:49-0400
#include <iostream>
using namespace std;

int main() {
    //ask fro gender and age from user
    char gender;
    int age;
    cout<<"Enter Gender (M/F) : ";
    cin>>gender;
    cout<<"Enter Age : ";
    cin>>age;

    //validate gender and age
    if(age>=30 && age<=40 && gender=='M'){
        cout<<"Applicant is accepted";
    }else{
        cout<<"Applicant is rejected";
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS