473,804 Members | 3,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with code to reverse an number without using % and /

1 New Member
how to write a code to reverse an number without using % and /
Dec 13 '07 #1
4 1733
Ganon11
3,652 Recognized Expert Specialist
Think about what the % and / operators do to a number, then think how you can use that to (a) get the rightmost digit of a number, and (b) truncate the number so you don't get the same digit again.
Dec 13 '07 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
Are you allowed to use itoa() and read the string backwards?
Dec 13 '07 #3
Cucumber
90 New Member
why is this post sticky? just wondering
Dec 14 '07 #4
Ganon11
3,652 Recognized Expert Specialist
...it isn't?


......anymore.
Dec 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2070
by: Foxy Kav | last post by:
Hi everyone, Im currently doing first year UNI, taking a programming course in C++, for one project i have to create a simple array manipulator... that i have done, but i cant figure out how to make the ESC key quit the called function when ever the user inputs data. The description was : ESC drops back to the main menu in case the user gets locked up or wants to start over again, ESC should provide a fool proof way to exit back to the...
21
3989
by: google | last post by:
I'm trying to implement something that would speed up data entry. I'd like to be able to take a string, and increment ONLY the right-most numerical characters by one. The type structure of the data that is in this field can vary. It's a list of mechanical equipment, and how it is designated varies based on how the customer has them labeled. For example, a list of their equipment might look like: CH-1 CH-2 CH-3
15
5092
by: Fady Anwar | last post by:
Hi while browsing the net i noticed that there is sites publishing some software that claim that it can decompile .net applications i didn't bleave it in fact but after trying it i was surprised that i could retrieve my code from my applications after i compile it so i need to know to prevent this from happening to my applications Thanx in advance
11
1907
by: abico | last post by:
Write a program that reads in a sequence of words and prints them in reverse order.Using STACK.
36
3495
by: felixnielsen | last post by:
What i really wanna do, is defining my own types, it doesnt really matter why. Anyway, i have run into some problems 1) typedef unsigned short U16; U16 test = 0xffffffff; // There should be a limit on this, max value you should be able to asign should be 0xffff // std::cout << test; // result = 0xffff //
5
3795
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public List<RoleData> GetRoles() { return GetRoles(null, false); }
1
3636
by: goldenllama | last post by:
Hi, thanks in advance for the assistance. I need to make a program that will take a string using gets() (I know gets() is bad, but it's what I'm supposed to use), and then print the message in reverse. One problem I had was that when I used gets(message);, the program just continued without letting me enter anything. I'm using while(strlen(gets(message)) == 0); right now and it seems to work, but I'd prefer to use gets(message); if I can. ...
1
3616
by: yodadbl07 | last post by:
hey ive been messing around with this program to take a user inputed number, put it into an array and then reverse the number. I also want it to omit unecessary 0's at the begging. for example if the user inputs 100 the reverse shows 1, becuase with 001 the leading zeros are unecessary. I finally did it a complicated way and was wondering if there is an easier way to get the user inputed number into the array, and prefferably into an int...
2
1377
by: cJ500 | last post by:
I can't figure out the problem with this code. I'm using a Borland compiler. The problem is with the / operation overload. When I call isNeg it doesn't output true or false. Now I know this code isn't pretty but our teacher doesn't teach us syntax or anything so I'm doing the best I can. class Juggernaut { public: friend Juggernaut operator +(Juggernaut a, Juggernaut b); friend Juggernaut operator -(Juggernaut a, Juggernaut b);...
0
10593
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.