this is what I have so far

#include <iostream>
#include <string>
#include "aStack.h"
#include "AQueue.h"

using namespace std;

bool match(char, char);
bool isValid(char);

int main(){
  char ch;
  char chL, chR;
  aStack S;
  AQueue A;
  int count = 0;
  bool err = false;

  while((ch=cin.get())!= EOF){
    cout << ch;  //Echo back data
    if(ch!= '\n')
    {
      if(!isValid(ch))
      {
        ch = "";
        S.push(ch);
        A.Enqueue(ch);
      }
      else
      {
        S.push(ch);
        A.Enqueue(ch);
        count++;
      }
    }

    while(count > 0)
    {
      S.pop(chL);
      A.Dequeue(chR);
      count--;
      if(!match(chL, chR))
        err = true;
    }
  if(err == true)
    cout << "Not a valid pack palindrome." << endl;
  else
    {
      cout << "Palindrome is valid" << endl;
      err = false;
    }
  }
  return 0;
}

bool match(char chL, char chR){
  if(chL == chR)
    return true;
  else
    return false;
}

bool isValid(char ch){
  if((ch>= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
    return true;
  else
    return false;
}

My problem comes when I try to get rid of the punctuation. I get this
error:
     project3.cpp:29: error: invalid conversion from 'const char*' to
'char'
If someone could help me I would greatly appreciate it.


--- In [email protected], Rajath N R <[EMAIL PROTECTED]> wrote:
>
> Hi,
>  check this pice of code 
> 
> 
> [EMAIL PROTECTED] ~]$ cat test.c
> 
> #include <stdio.h>
> 
> #define PALINDROME 0
> #define NOT_PALINDROME 1
> 
> main()
> {
>         char buff[512];
> 
>         printf("Enter a string: ");
>         scanf("%s", buff);
> 
>         if (palindrome(buff) == PALINDROME) {
>                 printf("String is palindrome\n");
>         }
>         else {
>                 printf("String is not a palindrome\n");
>         }
> 
> }
> int palindrome(char *ptr)
> {
>         int strbeg = 0, strend = 0;
> 
>         strend = strlen(ptr) - 1;
>         while ( strbeg == strend || strbeg < strend) {
>                 if (ptr[strbeg] != ptr[strend])
>                         return (NOT_PALINDROME);
> 
>                 strbeg++;
>                 strend--;
>         }
>         return (PALINDROME);
> }
> 
> 
> Thanks & Regards,
> 
> Rajath N R
> 
> --- On Wed, 10/22/08, elispop122003 <[EMAIL PROTECTED]> wrote:
> From: elispop122003 <[EMAIL PROTECTED]>
> Subject: [c-prog] Circular Queue
> To: [email protected]
> Date: Wednesday, October 22, 2008, 11:09 AM
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>     
>             I'm trying to write a program that can read in a string
of data and
> 
> determine if it is a pack palindrome.
> 
> 
> 
> 
>       
> 
>     
>     
>       
>        
>       
>       
> 
> 
> 
> 
> 
> 
> 
> 
>       
> 
> 
>       
>       
> 
> 
>       
> 
> [Non-text portions of this message have been removed]
>


Reply via email to