int to string ?

This is a discussion on int to string ? within the C++ Programming forums, part of the General Programming Boards category; howdy i have a simple question here, that is how to convert an integer to a string ? i tried ...

  1. #1
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    int to string ?

    howdy i have a simple question here, that is how to convert an integer to a string ? i tried this but failed:
    Code:
    string s;
    char c;
    x = (char) 5;
    s =  "you got a " + x + " here~";
    any help ???
    Never end on learning~

  2. #2
    Registered User
    Join Date
    Aug 2001
    Location
    (>2studentindia programmingstudent >3_>4I am a mathematics studentLondon, England%Maths, football (soccer), music, filmStudent>5 Mass, USAStudent >66>7 I'm the best!UKAviatio
    Posts
    2
    Code:
    Syntax
    
    #include <stdlib.h>  
    
    char *itoa  (  
    
       int     value,    
    
       char   *buffer,    
    
       int     radix);
    
    Parameters
    value
    (IN) Specifies the integer value to be converted.
    
    buffer
    (OUT) Points to the character array.
    
    radix
    (IN) Specifies the base to be used in converting the integer. It must be in the range of 2 - 36.
    
    
    Return Values
    
    Returns the pointer to the result.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: int to string ?

    Originally posted by black
    howdy i have a simple question here, that is how to convert an integer to a string ? i tried this but failed:
    any help ???
    Yeah, read the FAQ. There are examples in there.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563
    thanx guys that FAQ really helps
    Never end on learning~

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 08:19 AM
  2. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 10:42 PM
  3. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM
  4. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM

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