![]() |
|
#1
|
|||
|
|||
Adding ArraysI am having trouble with a current C++ homework problem. I have to fill up 2 partially filled arrays with 2 numbers that are of 20 digits or less. I have to read the numbers as a character and put each individual array block with each digit. Once both arrays are filled as chars i have to convert the digits from chars to ints and then add the 2 arrays. If the sum of the 2 has more than 20 digits, then i have to state an error msg that it is overwhleming. Any help here would be great.
Here is what i have so far: CPP / C++ / C Code:
Last edited by LuciWiz : 05-Nov-2008 at 00:53.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Adding ArraysOk, so you want to store the numbers as char arrays and add them. So why are you storing the numbers in an integer array in your program?
|
|
#3
|
|||
|
|||
Re: Adding ArraysYes as noop said, it sounds like your supposed to convert a char string ot 'digits' to a numeric value.
Good excercise. So you will want to work with arrays of type char. Does this make sense to you?: CPP / C++ / C Code:
|
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help with input files. | Efferus | C++ Forum | 2 | 24-Nov-2007 17:19 |
| Arrays as function arguments - return arrays from functions | pisuke | C Programming Language | 2 | 25-Jul-2007 12:03 |
| Dynamic vs Static Arrays | WaltP | Miscellaneous Programming Forum | 5 | 16-Feb-2006 16:54 |
| I am reviewing Arrays and need help converting some strings to arrays | jenmaz | C Programming Language | 22 | 23-Nov-2004 00:26 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The