oh I just wish I could be more helpful.
for one thing, since you are using std namespace:
using namespace std;
I don't think you need to put "std::" before cout..
it knows whats you means
@ lynx:
what exactly does this bit return? Never run across this before:
sizeof(arrayS[0])
@sniperfz
if the problem is with the loops, post the code that contains them!
hint: you'll want to start the outer loop with an int with a value of 1, and end when
that int > (sizeof(array) - 2)
then you can use the int as delimiter to access elements in the array (skipping, of course, the first and last terms, since a palindrome 1 number long doesn't do you any good)
example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
int check_for_palindrome(int s);
int main()
{
int a_nums[13] = {blah blah values here};
int length=0;
int longest=0;
int long_pos=0;
for (int x=1; x<(sizeof(array) -1); x++)
{
length = check_for_palindrome(x) // will access a_nums[x]
if (length > longest)
{
longest = length;
long_pos = x;
}
}
}
|
there's a little bit of what you need
EDIT this code won't work lol need to change the for loop
I thought sizeof() was like vector.size()
maybe like lynx says
( sizeof( arrayS ) / sizeof( arrayS[ 0 ] )
should be included in conditional statement in for()