thanks for ur answer.Initially u have taken a array in determining the elements in that are numbers or not...the code that u have provided fails for inputs like..123xsd34..
how ever i have written code in cpp which will determine whether the given number is integer or not.... this worked on my com...i heard that there is a function isnumber()..do u know that?..how ever code i have written below will not fail for any of ur input....how long it may be and how mixed it may be....
code:
Code:
#include<iostream>
using namespace std;
#include<cstring>
int check(string s)
{
    int x;
    char y;
    int count=0;
    for(int i=0;i<s.length();i++)
    {
        //cout<<s.at(i)<<"   ";
        x=int(s.at(i));
        //cout<<x<<"  ";
        if(x>47 &&  x< 58) count++;
        //cout<<"count"<<count<<" ";
    }
    if(count==s.length())
        return 0;
    else return 1;
}
main()
{
    string s;
    cout<<"enter int"<<endl;
    cin>>s;
    if(!check(s))
        cout<<"int"<<endl;
    else cout<<"not an int"<<endl;
}

Last edited by shabbir; 23Oct2008 at 18:38.. Reason: Code block