Friday, June 25, 2021

Gender Checker in Modern C++

 Machine Problem in C++

Write a program that will ask the user to input a character “m” or “f” and  then it will display “Hello Sir. You are a Male ”  if the input is “f” otherwise “Hello Madam. You are a Female”. Use if-else statement.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.








Program Listing

gender.cpp

// gender.cpp

// Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

// www.jakerpomperada.com  www.jakerpomperada.blogspot.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental

// June 24, 2021  Thursday  9:41 PM


#include <iostream>


int main(int argc, char **argv)

{

    char gender;

    std::cout <<"\tGender Checker in Modern C++";

    std::cout <<"\n\n";

    std::cout << "Enter the gender(m or f): ";

    std::cin >> gender;

    std::cout <<"\n\n";

    if (gender == 'm' || gender == 'M')

        std::cout << "Hello Sir. You are a Male.\n";

    else if (gender == 'f' || gender == 'F')

        std::cout << "Hello Madam. You are a Female.";

    else

        std::cout << "Invalid input.\n";

}


No comments:

Post a Comment