hmmm char string to variable double or int

This is a discussion on hmmm char string to variable double or int within the C++ Programming forums, part of the General Programming Boards category; Code: // this 3 are user input char szNum1[]; char szNum2[]; char szNum3[]; after the user input for example 3, ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    9

    Question hmmm char string to variable double or int

    Code:
    // this 3 are user input
    char szNum1[];
    char szNum2[];
    char szNum3[];
    after the user input for example 3, 21 and 25

    i need to make this strings into int or double variables, so i can use them to make some math operations after.

    I have tryed this because this is what they though me, but looks like with strings wont work :P

    Code:
    szNum1 = static_cast<double>(szNum1);
    szNum2 = static_cast<double>(szNum2);
    szNum3 = static_cast<double>(szNum3);
    any idea of how I can make this work guys?

    Thank you for your time.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    You need to perform a conversion. Casting will only cause you grief.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    9
    any idea of how? i am just starting C++, and have 0 knoledge about C

  4. #4
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    By clicking the link Prelude wrote

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    9
    lol thanks so many hours reading made my head go weird that i didnt see the link :P, i better go take some fresh air then continue hehe

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 09:36 PM
  2. C problem with legacy code
    By andy_baptiste in forum C Programming
    Replies: 4
    Last Post: 05-19-2008, 07:14 AM
  3. Need some help...
    By darkconvoy in forum C Programming
    Replies: 32
    Last Post: 04-29-2008, 04:33 PM
  4. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 04:24 PM
  5. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21