message of closing the program

Hi everyone,

I dont know where does the error come from. Anyone can help me to correct my program with code following. Thank you so much.


#include <iostream>
#include<string.h>

using namespace std;

struct PlayerInfo
{
int level;
string name;
};
int updatelevel ( PlayerInfo playerinfo [] );
PlayerInfo modifyplayer ( PlayerInfo modify [] );

const int SIZE = 5;

int main()
{
PlayerInfo Players [SIZE], *p_Players = new PlayerInfo [SIZE] ;

for ( int i = 0; i < SIZE; i++ )
{
cout << "Enter player name " << i << " :" ;
cin >> Players [i].name ;
cout << "Enter player skill level for " << Players [ i ].name << " :" ;
cin >> Players [ i ].level ;
}
for ( int i = 0; i < SIZE; i++)
{
cout << "Player " << Players [ i ].name << " is at level: " << Players [ i ].level << '\n';
}
cout << "Players update info: " << '\n' ;
updatelevel ( Players );
modifyplayer ( Players ) ;

return 0;

}



int updatelevel ( PlayerInfo playerinfo [] )

{
for ( int i = 0; i < SIZE; i++)
{
playerinfo [i].level += 2;
cout << playerinfo [i].name << " now is at " << playerinfo [i].level << '\n' ;
}
}


PlayerInfo modifyplayer ( PlayerInfo modify [] )
{

PlayerInfo *p_Array = new PlayerInfo[SIZE];
p_Array = modify;
int number ;
int nlevel ;
cout << "Player you want to change? " ;
cin >> number ;
cout << "Enter the current Skill level of player number " << number << ": " ;
cin >> modify [ number ].level ;

cout << "Name of new player: " ;
cin >> modify [ number ].name ;

for ( int i = 0; i < SIZE; i++)
{
cout << "Player" << modify [i].name << " now is at " << modify [i].level << '\n' ;
}
delete [] p_Array;
}
what is the error?
Topic archived. No new replies allowed.