how could i write this function in the main function

hi every one >>>
i want to write a function called AddOne it will increment every element in a list

object (called IntList) by 1 the code must be written in the main function

the teacher gave us a hint to use to function retrive & replace the problem is

how i could put my code in the main and how could i use the two function (retrieve

& replace) in my work ?!

it is not clear from your message how the list is defined.
I think that your teacher meant that function retrieve should be used to find the element in the list that you want to increment. And function replace will replace old value of an element with the incremented value.
Last edited on
thank you vary mach :) :)
i agree with you >>>
the question ask to increment every element in the list but i think that replace & retrieve function will not work in this question so how i could writ this function in the main function
You may not include the defininition of one function inside the definition of other function. All functions shall be defined outside other functions.
Last edited on
Can't you just loop through the list then increment each item? Try the ++ operator.
Topic archived. No new replies allowed.