944,139 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 147482
  • C++ RSS
Apr 10th, 2005
0

Convert integer to string

Expand Post »
: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
Similar Threads
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004
Apr 10th, 2005
0

Re: Convert integer to string

First, convert the integer to a string, then concatenate the suffix.
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Apr 10th, 2005
0

Re: Convert integer to string

have to forget about classes not allowed
anything else???
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004
Apr 10th, 2005
0

Re: Convert integer to string

Then what are your strings? What code do you have that makes an attempt?
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Apr 10th, 2005
0

Re: Convert integer to string

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
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004
Apr 10th, 2005
0

Re: Convert integer to string

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Oct 5th, 2008
0

Re: Convert integer to string

Sorry posted by mistake ...
Last edited by Talli; Oct 5th, 2008 at 5:10 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Talli is offline Offline
12 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Singly Link List help
Next Thread in C++ Forum Timeline: Confused with algorithm





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC