Convert integer to string

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2004
Posts: 4,188
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 482
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Convert integer to string

 
0
  #1
Apr 10th, 2005
:o Hi there!!!!!!
May I ask for help? After holidays all my C++ knowledge gone.
What I need is to create string from integer number and another string as

STRING = INTEGER + SUFFIX
where INTEGER is 5
SUFFIX is than 'th'

so STRING is 5th
Last edited by peter_budo; Apr 10th, 2005 at 5:15 pm. Reason: spelling
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,342
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 237
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Convert integer to string

 
0
  #2
Apr 10th, 2005
First, convert the integer to a string, then concatenate the suffix.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,188
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 482
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Convert integer to string

 
0
  #3
Apr 10th, 2005
have to forget about classes not allowed
anything else???
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,342
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 237
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Convert integer to string

 
0
  #4
Apr 10th, 2005
Then what are your strings? What code do you have that makes an attempt?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,188
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 482
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Convert integer to string

 
0
  #5
Apr 10th, 2005
I think I got it.
It is gone be bite of cheat but will see if will pass (mean tutor will acceppt).
Simple print out first number followed by requered string with suffix.

Anyway thanks for respond
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,614
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Convert integer to string

 
0
  #6
Apr 10th, 2005
>mean tutor will acceppt
Unlikely. I posted an implementation of itoa just this morning that may help you, search the forum and you'll find it.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 9
Reputation: Talli is an unknown quantity at this point 
Solved Threads: 0
Talli Talli is offline Offline
Newbie Poster

Re: Convert integer to string

 
0
  #7
Oct 5th, 2008
Sorry posted by mistake ...
Last edited by Talli; Oct 5th, 2008 at 5:10 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC