string or char to int

Discussion in 'C++' started by germinal, Sep 29, 2010.

  1. germinal

    germinal New Member

    Joined:
    Sep 29, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi!

    How can I convert selected numbers in a string to ints?

    string a[2];

    a[0] = "qs";
    a[1] = "bg1365";
    a[2] = "16";

    int b;

    a[1][3] ---?????---> b

    b should be than 3

    Thanks in advance :)
     
  2. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    19
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    http://www.techgeek.in
    use atoi function dear...try google for more help...
     
  3. go4expert

    go4expert Moderator

    Joined:
    Aug 3, 2004
    Messages:
    306
    Likes Received:
    9
    Trophy Points:
    0
    Here you go - atoi
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice