Re: Concatenating int values
From: Francis Glassborow (francis_at_robinton.demon.co.uk)
Date: 04/21/04
- Next message: karendavis_at_optonline.net: "My new nipple and vagina piercings"
- Previous message: Francis Glassborow: "Re: Newbie static class member question [C++]"
- In reply to: Toros Caglar: "Re: Concatenating int values"
- Next in thread: Karl Heinz Buchegger: "Re: Concatenating int values"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Apr 2004 08:57:36 +0100
In message <c64vuc$jnn$1@solaris.cc.vt.edu>, Toros Caglar
<tcaglar@vt.edu> writes
>Well I just realized that I am making some assumptions that you might not
>like.. Such as: values are in non-increasing number of digits.. e.g. val1 =
>3 and val2 = 23 would give 53 whereas it should actually give 323..
I think you are confusing value with representation. What you are
describing is an operation on the decimal representation of some integer
values. As both C and C++ (along with most other computer languages)
explicitly do not represent integer values in a decimal form whatever
you do will have to consider changing the representation to the one that
is relevant to the manipulation you wish to do.
The obvious way in C++ is to create a stringstream, feed the values into
it without whitespace and then read an int value out of it. That process
will automate all the conversions for you even if it is not particularly
efficient.
However there is a major question; why do you want to do this? Perhaps
the they should all be strings all the time.
-- Francis Glassborow ACCU Author of 'You Can Do It!' see http://www.spellen.org/youcandoit For project ideas and contributions: http://www.spellen.org/youcandoit/projects
- Next message: karendavis_at_optonline.net: "My new nipple and vagina piercings"
- Previous message: Francis Glassborow: "Re: Newbie static class member question [C++]"
- In reply to: Toros Caglar: "Re: Concatenating int values"
- Next in thread: Karl Heinz Buchegger: "Re: Concatenating int values"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|