Friday, September 11, 2020

String Palindrome in C++

 This program will ask the user to give a string and then the program will check if the given string is a Palindrome or Not using a C++ programming language.

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 in the following email address for further details.  If you want to advertise on 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.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

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

Program Listing

// string_palindrome.cpp
// This program will ask the user to give a string 
// and then the program will check if the given 
// string is a Palindrome or Not using  a
// C++ programming language.
// Author   : Jake Rodriguez Pomperada,MAED-IT,MIT
// Website  : http://www.jakerpomperada.com
// Email    : jakerpomperada@gmail.com
// Location : Bacolod City, Negros Occidental Philippines.

#include <iostream>

using namespace std;

int a=0,len=0,j=0,flag=1;
char given_str[100];

int main()
{
cout <<"\n\n";
cout <<"\tString Palindrome in C++\n\n";
cout<<"\tGive a string: ";
cin>>given_str;
    
for(len=0;given_str[len]!='\0';len++);
   
for(a=0,j=len-1;a<len/2;a++,j--)
{
if(given_str[j]!=given_str[a])
flag=0;
}

cout <<"\n\n";

if(flag==1)
{
cout<<"\tThe given string " <<given_str <<  
      " is Palindrome";
}
else
{
cout<<"\tThe given string " << given_str <<  
      " is Not Palindrome";
}
cout <<"\n\n";
cout << "\tEnd of Program";
}

No comments:

Post a Comment