Thread: C++ problem
View Single Post
Old 03-09-2005, 04:03 AM   #1 (permalink)
Magnetic Life
 
Newb Techie

Join Date: Mar 2005

Posts: 3

Magnetic Life

Question C++ problem

I made a program to check weather an entered number is a palindrome or not ...

Code:
#include<iomanip>
#include<cctype>

using namespace std;
int main()
{
  int count=0,d=0;
  long int array[count];
  cout << "Enter a number";
  for(count=0;;count++)
  {
    cin >> array[count];
    if(!isdigit(array[count]))
    	break;
  }

  for(int check=0; check<=count; check++,count--)
  {
    if(array[check]==array[count])
      d++;
    if(d==count)
      cout << "the number is a palindrome";
  }

return 0;
}
There is some error, can any one help me ...
Magnetic Life is offline