C++ :: Program That Checks Whether A String Is Palindrome
Apr 27, 2014
Write a program that checks whether a string is a palindrome. A palindrome is a word, phrase, orsequence that can be read the same backward and forward.
Code:
#include<iostream>
#include<string>
using namespace std;
int main(){
[Code] .....
View 2 Replies
May 20, 2013
So I've been tasked with creating a program that checks to see whether or not a string is a palindrome. It has to remove whitespace, punctuation, and capitalization for obvious reasons. Getting some errors which I'm not sure how to correct.
On an unrelated note, while programming in the console, my cursor has turned into a gray box and replaces characters when typing, instead of pushing them forward, etc. How do I return it to normal?
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
bool isPalin(string& palin);
string cleanUp(string& palin);
[Code] .....
View 7 Replies
View Related
Nov 4, 2013
Everything seems to be correct from my perspective. heres the program: Code: /*c program to check whether a string is palindrome or not*/
#include<stdio.h>
#include<string.h>
int main(void) {
char str[30];
int i,j,flag=0;
[Code] .....
View 1 Replies
View Related
Feb 9, 2013
here is my code, the issue is its not determine if the value is a palindrome or not.
// unit 5b.cpp : Defines the entry point for the console application.
//
// How to read a file
// identify the string if its a palindrome or not
//
#include "stdafx.h"
#include <iostream>
#include <cctype>
#include <fstream>
[Code] .....
View 1 Replies
View Related
Apr 23, 2014
I am trying to check a string to be a palindrome. I have tried using for loop but I am looking for most efficient way.
View 5 Replies
View Related
Jun 5, 2014
I want to make a program that opens a text file and checks the usernames listed in the text files to see if the names are registered on a site such as twitter. How easy would this be to make, what things would I need to know?
View 4 Replies
View Related
Jun 13, 2014
I am trying to create a simple palindrome program. I get the error string subscript out of range. I believe the error is either in the while or for loops.
#include <cctype>
#include <string>
#include <iostream>
using namespace std;
//cleans string, converts to lower
bool cleanTolower(const string& s);
[Code] ....
View 2 Replies
View Related
Mar 28, 2015
I am supposed to take the three string lines from a text file and then individually reverse them and state whether or not they are a palindrome. I have the three lines from the text file into string variables already but I am not sure on how to reverse them and then see if they are the same reversed(palindrome)
Here is my code so far -->
#include <iostream>
#include <string>
#include <cctype>
[Code].....
EDIT: Ignore line 123 and down in the code. That was merely test code and will not be used.
View 7 Replies
View Related
Sep 25, 2014
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
void findPalind(char *arr) {
int i,j,n,odd,flag=0,count[26]={0};
[Code] ....
This question was asked in Hackerrank. [URL] ....
I am able to get correct output upto a input of 50000 character string, but not for 100000 character string.
View 12 Replies
View Related
Feb 12, 2014
I could not find the mistake in this program....
Code:
//cpp program to check whether a number is palindrome or not
#include<iostream.h>
#include<conio.h>
//the class
class palindrome
[Code] ....
View 4 Replies
View Related
Nov 8, 2013
I get this error..In function 'main':
p6.c.text+0x6a): undefined reference to 'palindromeness'
collect2: 1d returned 1 exit status
This is program is suppose to check if a phrase is a palindrome or not.I need to write a function definition for _Bool palindromeness(char str[])but I am having a tough time figuring that part out. I am brand new to programming..this is my first class and I am just learning arrays and pointers.
View 4 Replies
View Related
Jan 16, 2014
Here is the code which I wrote in Turbo C++...its giving errors..
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
voidmain() {
clrscr();
[code]....
View 8 Replies
View Related
Feb 19, 2015
I'm trying to determine the number of times I have to change each specific character in a string to make it a palindrome. You can only change a character one at a time from the end.
Example: "abc" -> "abb" -> "aba" should print 2. "aba" will print 0 because it's already a palindrome. "abcd" -> "abcc" -> "abcb" -> "abca" -> "abba" will print 4 because it took 4 changes to make a palindrome.
I'm not too sure how to approach this - I figured out the case where if it's a palindrome (if reversed string is the same) then it'll print out a 0.
int main() {
int number;
cin >> number; //expecting a number for first line user input
for (int i = 0; i < number; i++) {
string str;
[Code] ....
View 1 Replies
View Related
Feb 28, 2014
I had an assignment to do a palindrome program but im stuck in this part.
"This c-string will be sent to a function that will remove all spaces and punctuation marks from its c-string as well as change any uppercase letters to lowercase. Use string tokens to eliminate the spaces & punctuation marks. Make sure you include the NULL as you concatenate the tokens into a c-string. Then copy back into the original c-string for the pass by reference."
void tokenptr(char drome[]) {
char *token;
size_t i;
token = strtok(drome, " ,.!:;?");
while (token != '