I am building up a program where I create a vector of objects, the input variables that create the object are read from a .txt file. I want to check if the "ID" of the object introduced by the user exists in order to continue.
vector<Producto> vectorProductos;
while(file >> sID >> sDesc >> sUMed >> sFam >> sClass >> dVolumen >> dLongitud >> sPrecio){
    vectorProductos.push_back(Producto(sID, sDesc, sUMed,sFam, sClass, dVolumen, dLongitud, stringToDouble(sPrecio)));
    iNumProductos++;
}
file.close();
int iNumPartidas;
cout << "iNumPartidas? " << endl;
cin >> iNumPartidas;
for(unsigned int iP = 1; iP <= iNumPartidas; iP++){
    cout << endl << "Partida " << iP << ":" << endl;
    cout << "Clave de partida:\t";
    cin >> sPartida;
    for(unsigned int iPrd = 0; iPrd < iNumProductos; iPrd++){
        cout << endl << "Clave de producto " << iPrd+1 << ":\t";
        cin >> sClave;
        if(sClave == vectorProductos[iPrd].getClave()){
            cout << endl << "Cantidad:\t";
            cin >> iCantProdxP;
        }else{
            cout << "Producto no existe" << endl;
        }
    }
}
Producto class
#ifndef Producto_h
#define Producto_h
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
class Producto{
protected:
    string _sClave, _sDescripcion, _sUMed, _sClass, _sFam;
    double _dVolumen, _dPrecio, _dLongitud;
public:
    Producto();
    Producto(string, string, string, string, string, double, double, double);
    inline string getClave(){return _sClave;}
    inline string getDescripcion(){return _sDescripcion;}
    inline string getUMed(){return _sUMed;}
    inline string getFam(){return _sFam;}
    inline string getClass(){return _sClass;}
    inline double getVol(){return _dVolumen;}
    inline double getPrecio(){return _dPrecio;}
    inline double getLongitud(){return _dLongitud;}
    inline void setClave(string sClave){_sClave = sClave;}
    inline void setDescripcion(string sDescripcion){_sDescripcion = sDescripcion;}
    inline void setUMed(string sUMed){_sUMed = sUMed;}
    inline void setFam(string sFam){_sFam = sFam;}
    inline void setClass(string sClass){_sClass = sClass;}
    inline void setVol(double dVolumen){_dVolumen = dVolumen;}
    inline void setPrecio(double dPrecio){_dPrecio = dPrecio;}
    inline void setLongitud(double dLongitud){_dLongitud = dLongitud;}
    void toString();
};
Producto::Producto(){
    _sClave = "";
    _sDescripcion = "Falta descripcion";
    _sUMed = "N/A";
    _sFam = "Sin Familia";
    _sClass = "Sin clase";
    _dVolumen = 0.0;
    _dPrecio = 0.0;
    _dLongitud = 0.0;
}
Producto::Producto(string sClave, string sDescripcion, string sUMed, string sFam, string sClass, double dVolumen, double dLongitud, double dPrecio){
    _sClave = sClave;
    _sDescripcion = sDescripcion;
    _sUMed = sUMed;
    _sFam = sFam;
    _sClass = sClass;
    _dVolumen = dVolumen;
    _dPrecio = dPrecio;
    _dLongitud = dLongitud;
}
void Producto::toString(){
    cout << "\nProducto: " << _sClave;
    cout << "\nDescripcion: " << _sDescripcion;
    cout << "\nUnidad de Medida: " << _sUMed;
    cout << "\nFamilia: " << _sFam;
    cout << "\nClase: " << _sClass;
    cout << "\nVolumen: " << _dVolumen;
    cout << "\nLongitud: " << _dLongitud;
    cout << "\nPrecio: " << _dPrecio;
    cout << endl;
}
What I need is to see if that "ID" that the user is going to input actually exists and if not mark error. When I run my program I have to type in the ID of the first product to match it with the index number of the loop, and that is the only way it works but I need the program to match it with any "Producto" regardless of the position or index.
 
    