I am doing simple recursion, I have written the following program:
when defining my palindrome function it says too few arguments, also in my first if statement whe I call the function again it gives me a very nondescript error that just says error at this point of the file. Any help would be much appreciated.
Code:
// csc2111lab5part2.cpp : Defines the entry point for the console application.
#include <string>
#include <iostream>
using namespace std;
int counter = 0;
bool palindrome(string pal)
{
int length;
length = pal.length();
if ( pal[length-counter] == pal[counter])
{
counter++;
palindrome();
}
if ( counter == length)
{
return true;
}
return false;
}
int main()
{
string pal;
cout << "input what you think is a palindrome\n";
cin >> pal;
cout << palindrome(pal);
return 0;
}
when defining my palindrome function it says too few arguments, also in my first if statement whe I call the function again it gives me a very nondescript error that just says error at this point of the file. Any help would be much appreciated.