cs162/assignments/assignment1/magic.cpp
/*********************************************************************
 * ** Function: sort
 * ** Description: This function is the main function for sorting the spells/spellbooks
 * ** Parameters: wizard *wiz, int wiz_index, int num_wizards, string file2
 * ** Pre-Conditions: user has logged in
 * ** Post-Conditions: spellbooks/spells have been sorted
 * *********************************************************************/
sort
Description: This function is the main function for sorting the spells/spellbooks
Parameters: wizard *wiz, int wiz_index, int num_wizards, string file2
Pre-Conditions: user has logged in
Post-Conditions: spellbooks/spells have been sorted
sort Description : This function is the main function for sorting the spells / spellbooks Parameters : wizard * wiz int wiz_index int num_wizards string file2 Pre - Conditions : user has logged in Post - Conditions : spellbooks / spells have been sorted
void sort(wizard *wiz, int wiz_index, int num_wizards, string file2) {
	int num_books;
	bool x = true;
	string num_book;
	ifstream f2;
	do {
		f2.open(file2.c_str(), ios::in);
	} while(!f2.is_open());
	getline(f2, num_book);
	num_books = atoi(num_book.c_str());
	spellbook *spells = create_spellbooks(num_books);
	get_spellbook_data(spells, num_books, f2);
	f2.close();
	do {
		x = sort_again(wiz, wiz_index, num_wizards, spells, num_books);
	} while(x);
	delete_info(wiz, num_wizards, spells, num_books);
}
void sort ( wizard * wiz , int wiz_index , int num_wizards , string file2 ) { int num_books ; bool x = true ; string num_book ; ifstream f2 ; do { f2 . open ( file2 . c_str ( ) , ios :: in ) ; } while ( ! f2 . is_open ( ) ) ; getline ( f2 , num_book ) ; num_books = atoi ( num_book . c_str ( ) ) ; spellbook * spells = create_spellbooks ( num_books ) ; get_spellbook_data ( spells , num_books , f2 ) ; f2 . close ( ) ; do { x = sort_again ( wiz , wiz_index , num_wizards , spells , num_books ) ; } while ( x ) ; delete_info ( wiz , num_wizards , spells , num_books ) ; }
** Function: sort
 ** Description: This function is the main function for sorting the spells/spellbooks
 ** Parameters: wizard *wiz, int wiz_index, int num_wizards, string file2
 ** Pre-Conditions: user has logged in
 ** Post-Conditions: spellbooks/spells have been sorted
** Function : sort ** Description : This function is the main function for sorting the spells / spellbooks ** Parameters : wizard * wiz int wiz_index int num_wizards string file2 ** Pre - Conditions : user has logged in ** Post - Conditions : spellbooks / spells have been sorted