Hi guys.I need to make a small program with a function with this prototype: void f(char *a,char *b) that adds two numbers represented as strings without using conversion operators or other tricks.Thanks
Hi guys.I need to make a small program with a function with this prototype: void f(char *a,char *b) that adds two numbers represented as strings without using conversion operators or other tricks.Thanks
Fine. Do you have a question doing this program ?
Kurt
do you want to pay somebody to do it for you? Or do you have some code you need help with.
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"
Let's say you have two strings, of the form "123454232" and "23475239994" (I just made them up with a few random keystrokes on my keyboard).
Write down the steps, on paper, that you would use to "add them together". That is an essential first step to prepare for writing code. If you provide enough detail, the steps you write down on paper will represent the design of the code.
From there, all that is needed is some understanding of how C++ does particular things. If you don't have that, you will need to apply effort to learn ..... because the PURPOSE of your homework (yes, people here know enough to realise your problem is a homework exercise) is to help you "learn by doing".
If you expect people to just do your homework for you, have a look at this site's homework policy, here, for enlightenment.
You misunderstood me.Im not a c++ beginner and i dont want the whole code just some advices ..Anyway this problem is easy for me but i must solve this without using conversions like atoi etc..
Advice on what? How to make this program? Grumpy already gave you that.
If you're looking for advice on something else, you should just tell us. We're not psychics!
How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.
Once you have described the requirement, as I suggested in my previous post, then the solution is simple.
There are two bits of knowledge specific to C and C++, which should be trivial for someone who is "not a c++ beginner" to work out. The first is the relationship between each of the digits (characters in the range ['0', '9']) and each of the numeric values that are represented as single decimal digits (i.e. in the range [0,9]). The second bit of knowledge needed concerns the method of obtaining values, or changing the values, of elements of an array using a loop.
No need to use atoi() or any other conversion.
So, demonstrate your basic C++ knowledge, and solve this problem on your own. So far you have provided no evidence to substantiate your claim that you are not a beginner, and have not demonstrated any effort to solve your own problem.
Start off with something simple, how could you "add" two single digit ascii characters to produce a one or two digit ascii character result?
If you were an experienced programmer of any language at all then you would certainly be capable of writing a more concise post question than you staretd withIm not a c++ beginner
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"