Thursday, September 20, 2018

Civil Status Checker in C++

In this article, I would like to share with you a simple program that is being requested of me by a student who visited my website. It is a civil status checker that I wrote using C++ as our programming language.

What the program does is to ask the user to give his or her name and then it will ask again for the civil status of the person and the program will display the result on the screen. The code is very simple and easy to understand.

I am currently accepting programming work, it projects, school 

programming projects, thesis and capstone projects, IT consulting 

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing

// civil_status.cpp
// Written By Mr. Jake Rodriguez Pomperada, MAED-IT
// Date : September 20, 2018
// Tool : Dev C++ 5.11
// www.jakerpomperada.com
// jakerpomperada@aol.com and jakerpomperada@gmail.com

#include <iostream>
#include <cctype>
#include <cstring>
#include <cstdio>

using namespace std;

int main()
{
string status;
char civil_status;
char option,reply;
char name[200];

do {
system("cls");
cout <<"\n\n";
cout <<"\tCivil Status Checker in C++";
cout <<"\n\n";
cout << "\tWhat is your name : ";
gets(name);
cout <<"\n\n";
cout <<"\t1-Single,2-Married,3-Annulled,4-Separated and 5-Widow";
cout <<"\n\n";
cout <<"\tWhat is your Civil Status? : ";
    cin >> civil_status;
    
    if (civil_status == '1') {
    status ="SINGLE";
}
else if (civil_status == '2') {
    status ="MARRIED";
}
else if (civil_status == '3') {
    status ="ANNULLED";
}
else if (civil_status == '4') {
    status ="SEPARATED";
}
else if (civil_status == '5') {
    status ="WIDOW";
}
else {
status ="Invalid Civil Status Try Again.";
}
for (int i=0; i<strlen(name); i++) {
       name[i] = toupper(name[i]);
    }
cout <<"\n\n";
cout <<"\t===== DISPLAY RESULT =====";
cout <<"\n\n";
cout <<"\tHi " <<name <<".";
cout <<"\n\n";
cout <<"\tYour Civil Status is " << status <<".";
cout <<"\n\n";
cout <<"\tDo you want to continue Y/N? : ";
cin >> reply;
option = toupper(reply);
      } while(option=='Y');
    cout <<"\n\n";
    cout <<"\tThank you for using this software";
cout <<"\n\n";  
}



No comments:

Post a Comment