hey all, i have an array of pointers of which i just want to change the order. i've done this before, but somethings not right here and i can't find it (where i'm unsure with if i have the pointers all pointing in the right direction). it does the secondary copy fine, but there's something wrong with copying in to/out from p_temp.
thanks in advance.
Code:
// . .
// stack declaration
Player lineup[15]={*p_h1, *p_h2, *p_h3, *p_h4, *p_h5, *p_h6, *p_h7, *p_h8, *p_h9, *p_h10,
*p_h11, *p_h12, *p_h13, *p_h14, *p_h15};
clrscr();
cout<<endl<<endl<<"In order to play, you must submit your batting order to the umpires."
<<endl<<endl<<setw(20)<<"Please wait, while you lineup is loading . . . ";
f_wait(4);
clrscr();
f_Lineup_display(lineup);
cout<<endl<<endl<<endl<<"This is your present batting order."<<endl
<<"Would you like to change it, y/n?"<<endl<<"? ";
cin>>lineup_choice;
while(lineup_choice=='y')
{
int whoMove=0,
whereMove = 0;
Player *p_temp;
clrscr();
f_Lineup_display(lineup);
cout<<endl<<endl<<endl<<"Enter the number of the player you would like to move:"<<endl;
cin>>whoMove;
cout<<endl<<"Good, now in what spot should the player be place? (1, 2, 3 . . .)"<<endl;
cin>>whereMove;
for (int i=0; i<15; i++)
{
if (whoMove == lineup[i].mf_playerStats_getNum())
{ p_temp=&lineup[i];
lineup[i]=lineup[whereMove-1];
lineup[whereMove-1]=*p_temp;//this line isn't doing what
//i want :(
}
}
// . .