C :: Function Which Can Recognize Whether A Word Is Palindrome
Jun 24, 2013
I'm trying to write a function which can recognize whether a word is a palindrome. if it's the case , it must return 1 on screen, otherwise 0. This is the code which return 0 even in case of a palindrome...
Code:
int IsPalindrom(char String[]){
int i,l;
int counter=0;
for(i=0;;i++){ //counts the number of array elements
[Code] ....
View 9 Replies
Apr 6, 2013
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int x;
string favword;
[Code] ....
I want this program to be able to recognize if a user types in any word ex. (apple, tree, house etc..) and print "system error" if a word is recognized not to be a number. The bold section of code is my failed attempt to try this. Basically I need to know what to make
(x = ?(every word)) in order to finish my console program.
View 1 Replies
View Related
Feb 9, 2013
I have an assignment where i have to make a palindrome program. As you can see i have already done the basic palindrome prog, however i am now stuck since the program goes into a infinite loop whenever a word with whitespaces is added.
I have also tried searching for methods online however they do not seem to work for me...
void CPali::check() {
length = strlen(palin);
for (int i = 0, p = length-1; p>i; i++, p--) {
if (palin[i] == ' ')
[Code] ....
View 6 Replies
View Related
Feb 18, 2013
I am building a linked list and i need to display function i have. The display function displays all the letters of the word entered instead of the word itself. below is my struct, one of my functions and the display function.
Code:
//-----------struct ------------//
struct Node
{
char data;
struct Node *next;
}*Head;
[code]....
View 1 Replies
View Related
Apr 29, 2015
I have a text file that consists of:
1457887541
Madam
Able was I ere I saw Elba
Straw? No, too stupid a fad. I put soot on warts.
Class is cancelled today
And all of them are returning false as a palindrome and am not sure why that is so.
bool isPalindrome(const char *input){
int first = 0;
int last = strlen(input) - 1;
//begin loop to compare first position with last
while(last > first){
[Code] .....
View 3 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 != '