MuffinMan
Juno 15/4/08 :)
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
int palindrome (int, int, char&);
int main()
{
char userInput [256]; // A very long string
char userInput2[256]; // A very long string
char temp;
char output;
cout <<"Please enter a phrase to check if it is a palindrome" << endl;
cin.getline (userInput, 256);
char tolower (char userInput);
char isspace (char userInput);
for (int a = 1; a <= 256; a++)
{
userInput[a] = temp;
temp = userInput2[256-a];
}
int palindrome (int userInput, int userInput2, char& output);
cout <<" Enter a phrase" << userInput << endl;
if (output == '1')
cout <<" It is a palindrome " << endl;
else
cout <<" This is not a palindrome " << endl;
return 0;
}
int palindrome (char userInput, char userInput2, char& output)
{
if (strcmp (userInput, userInput2) == 0) // Line 40
output = '1';
else
output = '2';
return output;
}
Compiler:
Error! Line 40. Invalid conversion from 'char' to 'const *char'
I have no idea what on earth this means
could anyone clarify this for me?
#include <cstring>
#include <cctype>
using namespace std;
int palindrome (int, int, char&);
int main()
{
char userInput [256]; // A very long string
char userInput2[256]; // A very long string
char temp;
char output;
cout <<"Please enter a phrase to check if it is a palindrome" << endl;
cin.getline (userInput, 256);
char tolower (char userInput);
char isspace (char userInput);
for (int a = 1; a <= 256; a++)
{
userInput[a] = temp;
temp = userInput2[256-a];
}
int palindrome (int userInput, int userInput2, char& output);
cout <<" Enter a phrase" << userInput << endl;
if (output == '1')
cout <<" It is a palindrome " << endl;
else
cout <<" This is not a palindrome " << endl;
return 0;
}
int palindrome (char userInput, char userInput2, char& output)
{
if (strcmp (userInput, userInput2) == 0) // Line 40
output = '1';
else
output = '2';
return output;
}
Compiler:
Error! Line 40. Invalid conversion from 'char' to 'const *char'
I have no idea what on earth this means
could anyone clarify this for me?
Last edited: