![]() |
|
#1
|
|||
|
|||
Using for_each in ListI need a simple code that operates one list, and uses the for_each() function, like i got one list of elements 1,2,3,4,5,6,7,8,9 and the other one should be the list that consist of every element from the first + his left element like:
1 2 3 4 5 6 7 8 9 - original 10 3 5 7 9 ... - modified ( note that first and last are summed) the code i have for something like beginning or just an example is i think is like... CPP / C++ / C Code:
The AddValue<> c1*** defines function objects that add a value to each element that is passed to the constructor. Using the function object has the advantage that you can process the added value at runtime. The program has the following output: 11 12 13 14 15 16 17 18 19 22 23 24 25 26 27 28 29 30 Last edited by admin : 12-Aug-2008 at 19:33.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|||
|
#3
|
|||
|
|||
Re: using for_each in Listthank you fakepoo i really apreciate yor help. But here is used function, so can you help me how to made that function so the new list schould be like the examples given to my first post. I don't know how can I add each predecessor element value to the new, like this:
1 2 3 4 5 6 original list 7 3 5 7 11 new list (the first and last element are summed) that schould be a function but i still don't know how to program it I REALLY THANK ALL HELP |
|
#4
|
|||
|
|||
Re: using for_each in ListQuote:
please read my quick reply :S |
|
#5
|
|||
|
|||
Re: Using for_each in ListSorry, I'm not really sure how to access other elements of the data structure from within a function that only looks at one element.
|
|
#6
|
|||
|
|||
Re: Using for_each in Listohhhhhhhhh where to find some examples of accesing this elements and oprating with them
|
|
#7
|
||||
|
||||
Re: Using for_each in ListLook at the for, while, and do-while statements, as well as arrays and indexing into the arrays.
__________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Str_Misaligned in Double Link List | Peter_APIIT | C Programming Language | 1 | 29-Feb-2008 21:50 |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 08:44 |
| need 'pointers' on deaing with segmentation faults | aijazbaig1 | C Programming Language | 7 | 17-Aug-2007 08:43 |
| C++ class -- Please help | vnca_1 | C++ Forum | 3 | 14-Jun-2006 13:31 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The