I am building a program tell score for a game of bowling. I have created a doubly linked list of ten frames. Each frame includes three integers - ball1, ball2, and ball3 for the 10th frame only.
For my scoring I need to look back one and possibly two frames to calculate the score, depending on strikes and spares previously thrown.
My question is how do I retrieve the values of those balls?
I'll strip it down to just one very basic example, because if I can figure out the syntax I can implement it throughout my program.
total=head->prev->ball1+head->prev->ball2;
head is a pointer
frame *head;
prev is a pointer in frame
frame *prev;
total is a local variable of type int
Any help using this example or a generic one would be great. I am still figuring out how to move within linked lists so any suggestions would be helpful. Thanks for the time