Batorder - / batorder.cpp / / Example of a...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// batorder.cpp // Example of a circularly-linked list. / // include files #include<iostream.h> #include<iomanip.h> #include"apstring.h" # // global structure, variables, and constants struct batter_node // node for linked list { apstring batter_name; batter_node *next; // link to next node }; batter_node *first; batter_node *current_batter; // pointer to current batter // function prototypes bool get_batter_name(apstring &name); void add_node(apstring &name); void do_rotation(); void delete_list(); v // beginning of main function int main() { apstring name; if(get_batter_name(name)) // prompt user for data for the node { first = new batter_node; // initialize list head first->batter_name = name; first->next = first; // initialize next node pointer to first current_batter = first; while(get_batter_name(name)) { add_node(name); } do_rotation(); // display the batters delete_list(); // free the memory used by the linked list } return 0; } // Function that gets data from user.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/20/2011 for the course COMPUTER 12 taught by Professor Aymanboghdady during the Spring '11 term at American College of Computer & Information Sciences.

Page1 / 2

Batorder - / batorder.cpp / / Example of a...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online