Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,984 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,389 people online right now. Registration is fast and FREE... Join Now!




Check If input is number or alpha numerical

 
Reply to this topicStart new topic

Check If input is number or alpha numerical

WsaENoTsoCK
28 Nov, 2006 - 05:03 PM
Post #1

New D.I.C Head
*

Joined: 6 Sep, 2006
Posts: 4


My Contributions
heyz dudes, i need a function which checks if input is a number or alphabets. I have created one myself but i believe that there is a function in C++ which does that. Can anyone help me out??

CODE

bool checknum(string s)
{
    istringstream iss(s);
    ostringstream oss;
    int x;
    iss >> x;
    oss << x;    
    
    if( s == oss.str())
        return true;
    
    return false;
}


Thanks in adv

This post has been edited by WsaENoTsoCK: 28 Nov, 2006 - 05:06 PM
User is offlineProfile CardPM
+Quote Post

Xing
RE: Check If Input Is Number Or Alpha Numerical
28 Nov, 2006 - 05:35 PM
Post #2

D.I.C Addict
Group Icon

Joined: 22 Jul, 2006
Posts: 723



Thanked: 4 times
Dream Kudos: 1575
My Contributions
Here's one code snippet
http://www.dreamincode.net/code/snippet591.htm
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 07:23PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month