2 Replies - 323 Views - Last Post: 30 March 2013 - 08:19 AM Rate Topic: -----

#1 mil1234  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 109
  • Joined: 01-February 09

subtracting from 2 arrays of integers

Posted 30 March 2013 - 07:41 AM

Hi Guys,

i have a requirement where i have to minus (and then eventually also multiply and divide) numbers that are in an array:

pseodu type example:

int nos[] = {2,4,5,6,2,3} -
int nos2[] = {1,3,4,3,1,5}

therefore i have in some way make the subtraction like it is done on paper eg - start from 3 less 5 go and borrow from 2 etc etc..Can anyone provide me with some example on how i should go about developing this requirement. With this i will hopefully be then able to do also the other arithmetic requirements

Thanks....

This post has been edited by mil1234: 30 March 2013 - 07:46 AM


Is This A Good Question/Topic? 0
  • +

Replies To: subtracting from 2 arrays of integers

#2 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 355
  • View blog
  • Posts: 1,521
  • Joined: 08-April 09

Re: subtracting from 2 arrays of integers

Posted 30 March 2013 - 07:55 AM

You do know that arrays are accessed via indexes, get the value in the index and apply the desired operation.
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5481
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

Re: subtracting from 2 arrays of integers

Posted 30 March 2013 - 08:19 AM

Loop through the array.
There are so many tutorials out there that this question borders on 'gimme teh codez'. At best its just sheer laziness that you can't be bothered to read your text book.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1