cs162/assignments/assignment1/magic.cpp
/*********************************************************************
 * ** Function: create_temp_list
 * ** Description: This function creates a temprorary list of all spells used for sorting
 * ** Parameters: int numb_spells, spellbook *spells, int num_books
 * ** Pre-Conditions: user has logged in and begun sorting
 * ** Post-Conditions: list of all spells created
 * *********************************************************************/
create_temp_list
Description: This function creates a temprorary list of all spells used for sorting
Parameters: int numb_spells, spellbook *spells, int num_books
Pre-Conditions: user has logged in and begun sorting
Post-Conditions: list of all spells created
create_temp_list Description : This function creates a temprorary list of all spells used for sorting Parameters : int numb_spells spellbook * spells int num_books Pre - Conditions : user has logged in and begun sorting Post - Conditions : list of all spells created
spell * create_temp_list(int numb_spells, spellbook *spells, int num_books) {
	int index = 0;
	spell *spell_list_temp = new spell[numb_spells];
	for(int i = 0; i < num_books; i++) {
		for(int j = 0; j < spells[i].num_spells; j++) {
			spell_list_temp[index] = spells[i].s[j];
			index++;
		}
	}
	return spell_list_temp;
}
spell * create_temp_list ( int numb_spells , spellbook * spells , int num_books ) { int index = 0 ; spell * spell_list_temp = new spell [ numb_spells ] ; for ( int i = 0 ; i < num_books ; i ++ ) { for ( int j = 0 ; j < spells [ i ] . num_spells ; j ++ ) { spell_list_temp [ index ] = spells [ i ] . s [ j ] ; index ++ ; } } return spell_list_temp ; }
** Function: create_temp_list
 ** Description: This function creates a temprorary list of all spells used for sorting
 ** Parameters: int numb_spells, spellbook *spells, int num_books
 ** Pre-Conditions: user has logged in and begun sorting
 ** Post-Conditions: list of all spells created
** Function : create_temp_list ** Description : This function creates a temprorary list of all spells used for sorting ** Parameters : int numb_spells spellbook * spells int num_books ** Pre - Conditions : user has logged in and begun sorting ** Post - Conditions : list of all spells created