I dont quite get the reason why my program prints out weird numbers which I believe it's the address numbers....I'm trying to read the data from a file and then store them in class instances....the file has the id,x,y,z in a line....it has 10 lines, hence i gotta create 10 class instances..would be glad for your help...^^
class planet
{
public:
    int id_planet;
    float x,y,z;
};
void report_planet_properties(planet& P)
{
    cout<<"Planet's ID: "<<P.id_planet<<endl;
    cout<<"Planet's coordinates (x,y,z): ("<<P.x<<","<<P.y<<","<<P.z<<")"<<endl;
}
planet* generate_planet(ifstream& fin)
{
    planet* p = new planet;
    fin >> (*p).id_planet;
    fin >> (*p).x;
    fin >> (*p).y;
    fin >> (*p).z;
    return (p);
}
int main()
{
    planet* the_planets[10];
    int i=0;
    ifstream f_inn ("route.txt");
    if (f_inn.is_open())
    {
        f_inn >> i;
        for(int j=0;j<i;j++)
        {
            the_planets[j]=generate_planet(f_inn);
            report_planet_properties(*the_planets[i]);
            delete the_planets[j];
        }
        f_inn.close();
    }
    else cout << "Unable to open file";
}
 
     
    