Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,394 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,148 people online right now. Registration is fast and FREE... Join Now!




Integer reversing

 
Reply to this topicStart new topic

Integer reversing

MasterWafu
19 Sep, 2006 - 03:56 PM
Post #1

New D.I.C Head
*

Joined: 18 Sep, 2006
Posts: 30


My Contributions
i'am having a problem with my program reversing a integer by a functions.... i wanted to save the input integer and output it is a string blink.gif
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Integer Reversing
19 Sep, 2006 - 04:00 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 4,013



Thanked: 18 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
we are going to need to see some code, and to know the nature of the issue, are you having trouble casting the int to a string? saving the int? printing the string? or just the reversal part?
User is offlineProfile CardPM
+Quote Post

MasterWafu
RE: Integer Reversing
19 Sep, 2006 - 04:07 PM
Post #3

New D.I.C Head
*

Joined: 18 Sep, 2006
Posts: 30


My Contributions
I use do while loop for it......i figure how can i print it reverse but if i input four digits i always come up with each digits...... i use the

I illustrate one part of the program below

int rem;
char array[4]="";
char storage[2];

rem=digits%10;
std::cout << "Reverse Value";
do
{
itoa(rem,storage,10);
strcat(array,storage);
digits=digits/10;
rem=digits%10;
}while(rem!=0);

digits=atoi(array);
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 02:42AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month