Pointer Question

I have to make a program as a project for the college and they ask me to make it with pointers here's the code:

#include <string>
#include <iostream>
#include <math.h>
#include <fstream>
#include <stdio.h>

using namespace std;

struct Atleta {
string nombre_atleta;
int cedula;
int edad;
string escuela;
int Deportes_Practicados;

string deporte1;
int anos1;
string deporte2;
int anos2;
string deporte3;
int anos3;
string deporte4;
int anos4;
string deporte5;
int anos5;
Atleta *Siguiente , *Anterior;
};

struct Deporte {

Deporte *Siguiente, *Anterior;
string Nombre;
int Cant_Medallas;
int Cant_Atletas;
Atleta *Primero;
int Cant_Disciplinas;
};

int main ()
{
Deporte *Apunt_Global, *Aux, *D, *Aux2;
Aux = Apunt_Global;
char op;
bool salida=false;
int Cont_Disciplinas, Cant_A, Cant_M, Cont_Atletas;
string linea, linea1, linea2, linea3,nom;
ofstream Respaldo;
ifstream Cargar_Datos, Respaldo_1;

Cargar_Datos.open("entrada.dat");
while (!Cargar_Datos.eof())
{
getline(Cargar_Datos , linea);
Cont_Disciplinas=atoi(linea.c_str());
Apunt_Global->Cant_Disciplinas=Cont_Disciplinas;
for (int i=1;i<=Cont_Disciplinas;i++)
{
getline(Cargar_Datos , linea1); nom=linea1;
getline(Cargar_Datos , linea2); Cant_A=atoi(linea2.c_str());
getline(Cargar_Datos , linea3); Cant_M=atoi(linea3.c_str());


D->Nombre=nom; D->Cant_Atletas=Cant_A; D->Cant_Medallas=Cant_M; D->Siguiente = NULL; D->Anterior = NULL;


if (Aux->Siguiente==NULL)
{Aux=D;}
else
while(Aux!=NULL)
{
Aux2=Aux;
Aux=Aux->Siguiente;
}
Aux=D; D->Anterior=Aux2;

}
}
Cargar_Datos.close();
}
}

It gives me this error:
[main] C:\Users\Usuario\Documents\Mis archivos recibidos\proy.exe 1000 <0> handle_exceptions: Exception STATUS_ACCESS_VIOLATION
[main] proy 1000 <0> handle_exceptions: Dumping stack trace to proy.exe.core

I have no idea how to fix it and I wanted to know if someone can help me.
Last edited on
I can't read your code very well, can you edit your post and put the code between the code tags (see Format: on the right of the editbox)
I can't see where "*Apunt_Global, *Aux, *D," were assigned to some objects explicitly.
Topic archived. No new replies allowed.