Computer Science Canada number adding |
Author: | Hackster [ Sat Mar 06, 2004 2:39 pm ] |
Post subject: | number adding |
hello , im new, i need help with a program i have to do, no one can help me at school. ok, i need to make three three digit numbers and add the three numbers of each number to the numbers of the other numbers. Mod Edit: Post in the right section next time. Moved. |
Author: | Hackster [ Sat Mar 06, 2004 2:50 pm ] |
Post subject: | |
i just thought i would get more replies and faster help, sorry! |
Author: | zylum [ Sat Mar 06, 2004 2:53 pm ] |
Post subject: | |
can you be a little bit more descriptive? you mean add all the digits in each number and the add all the sums of the digits? |
Author: | Mazer [ Sat Mar 06, 2004 2:56 pm ] |
Post subject: | |
That doesn't make alot of sense, but here's what I got from it: you need to add the digits from each number to the digits of the other numbers? Do you mean like number 1: digits a,b,c number 2: digits d,e,f number 3: digits g,h,i number 4: digits a+d+g,b+e+h,c+f+i Like that? It'd also help if you posted the code you have so far, so as to clarify your problem. |
Author: | Hackster [ Sat Mar 06, 2004 2:58 pm ] |
Post subject: | |
that i what i need , but i didn't start it yet, i thought i would get some ideas on how to do it , then starrt the code part, cuz im not too good with turing right now |
Author: | zylum [ Sat Mar 06, 2004 3:00 pm ] |
Post subject: | |
does it matter if each new digit is greater than 9? |
Author: | Mazer [ Sat Mar 06, 2004 3:03 pm ] | ||
Post subject: | |||
I try not to write entire programs for people, because when I do I tend to get sarcastic and angry and make mini virus-like programs. Ah... Anyways, as I said, use intstr and strint. Suppose you have your numbers
And let's assume that you've already set them all to some 3 digit numbers. You can convert the number to a string and look at each 'character' of the string individually. For example, if you have an integer, 654, you can convert it to a string and get "654", or to look at the first digit, "6". In code, it would be something like put intstr(number1)(1). |
Author: | Hackster [ Sat Mar 06, 2004 3:08 pm ] |
Post subject: | |
ok i think i understand , ill post the code for you to check over later, just so i don't screw it up too bad |
Author: | zylum [ Sat Mar 06, 2004 3:16 pm ] | ||
Post subject: | |||
so the first digit of the new number will be something like:
-zylum |
Author: | apomb [ Sat Mar 06, 2004 3:45 pm ] | ||
Post subject: | |||
I had a similar program, here's some of the code, the basis of the strint intstr thing
just remember to change the variables. |
Author: | zylum [ Sat Mar 06, 2004 4:08 pm ] | ||
Post subject: | |||
or you could do this:
-zylum |