Good evening I have a mess with a C ++ code use the Vector class template to enter the number of data dao by the user, what happens is that you use one function to enter the data and another to show data, the error or the exception I get when calling the function showData () the following error
This is the exception that comes out
and this is part of the code
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;
void ingresoDatos(vector <string> nombreEquipo,
vector <string> nombreJugador,
vector <string> cedula,
vector <string> telefono,
vector <string> direccion,
vector <int> edad,
vector <double> estatura,
vector <double> costoJugador, int numDatos)//argumentos
{
string nEquipo;
string nJugador;
string ci;
string tlf;
string direcc;
int ed;
double altura, costo;
for (int i = 0; i < numDatos; i++)
{
cout << setw(20) << " JUGADOR NUMERO" << i + 1 << " : "<<endl;
cout << endl;
cin.get();
cout << "\tNOMBRE DEL EQUIPO : ";
getline(cin, nEquipo);
nombreEquipo.push_back(nEquipo);
cout << endl;
cout << "\tNOMBRE DEL JUGADOR : ";
getline(cin, nJugador);
nombreJugador.push_back(nJugador);
cout << endl;
cout << "\tEDAD : ";
cin >> ed;
edad.push_back(ed);
cout << endl;
cout << "\tESTATURA : ";
cin >> altura;
estatura.push_back(altura);
cout << endl;
cin.get();
cout << "\tNUMERO DE IDENTIFICACION : ";
getline(cin, ci);
cedula.push_back(ci);
cout << endl;
cout << "\tNUMERO DE TELEFONO MOVIL: ";
getline(cin, tlf);
telefono.push_back(tlf);
cout << endl;
cout << "\tDIRECCION : ";
getline(cin, direcc);
direccion.push_back(direcc);
cout << endl;
cout << "\tCOSTO DEL JUGADOR (dolares) : ";
cin >> costo;
costoJugador.push_back(costo);
cout << endl;
}
}
void mostrarDatos(vector <string> nombreEquipo,
vector <string> nombreJugador,
vector <string> cedula,
vector <string> telefono,
vector <string> direccion,
vector <int> edad,
vector <double> estatura,
vector <double> costoJugador, int numDatos)
{
cout << numDatos;
cin.get();
for (int i = 0; i < numDatos; i++)
{
cout << setw(20) << " JUGADOR NUMERO" << i + 1 << " : " << endl;
cout << "NOMBRE DEL EQUIPO : " << nombreEquipo.at(i) << endl;
cout << "NOMBRE DEL JUGADOR : " << nombreJugador.at(i) << endl;
cout << "EDAD : " << edad.at(i) << endl;
cout << "ESTATURA : " << estatura.at(i) << endl;
cout << "IDENTIFICACION : " << cedula.at(i) << endl;
cout << "TELEFONO : " << telefono.at(i) << endl;
cout << "DIRECCION : " << direccion.at(i) << endl;
cout << "VALOR EN EL MERCADO : " << costoJugador.at(i) << endl;
cout << endl;
}
}
int main()
{
vector <string> nombreEquipo;
vector <string> nombreJugador;
vector <string> cedula;
vector <string> telefono;
vector <string> direccion;
vector <int> edad;
vector <double> estatura;
vector <double> costoJugador;
int numDatos;
cout << "Cuantos datos va a ingresar" << endl;
cin >> numDatos;
cout << endl;
ingresoDatos(nombreEquipo, nombreJugador, cedula, telefono,
direccion, edad, estatura, costoJugador, numDatos);
cout << endl;
mostrarDatos(nombreEquipo, nombreJugador, cedula, telefono,
direccion, edad, estatura, costoJugador, numDatos);
_getch();
return 0;
}