0
I would like to relate the class pointer corresponding to the user input and present on the screen the attributes related to that object.
#include <iostream>
#include "classes.h"
using namespace std;
int main()
{
    string sLeitor,sLivro,*pLivro;
    int iLivro;
    cout << "Digite o numero do livro que deseja ler: ";
    cin >> iLivro;
    sLivro = "livro" + to_string(iLivro);  // tentei converter int para string para ponteiro
    pLivro << sLivro; 
    cin.ignore();
    cout << "Digite seu nome: ";
    getline(cin,sLeitor);
    cout << endl;
    Livros *livro1 = new Livros("Pesquisa Operacional","Wagner",851,sLeitor);
    Livros *livro2 = new Livros("Probabilidade e Estatistica","Spiegel",517,sLeitor);
    Livros *livro3 = new Livros("Um Curso de Calculo - Volume 1","Guidorizzi",580,sLeitor);
    pLivro->consultar();
    return 0;
}
// A classe está assim, tem alguns recursos a mais:
#ifndef CLASSES_H_INCLUDED
#define CLASSES_H_INCLUDED
using namespace std;
class Livros{
public:
    Livros (string sNome, string sAutor, int iQdtPaginas, string sLeitor);
    ~Livros();
    void setNome(string sNome);
    string getLeitor();
    string getNome();
    void consultar();
private:
    string sNome;
    string sAutor;
    int iQtdPaginas=0;
    string sLeitor;
};
Livros::Livros(string sNome, string sAutor, int iQtdPaginas, string sLeitor){
    this->sNome=sNome;
    this->sAutor=sAutor;
    this->iQtdPaginas=iQtdPaginas;
    this->sLeitor=sLeitor;
}
void Livros::setNome(string sNome){
    this->sNome=sNome;
}
string Livros::getLeitor(){
    return this->sLeitor;
}
string Livros::getNome(){
    return this->sNome;
}
Livros::~Livros(){
    cout << "Objeto destruido!" << endl;
}
void Livros::consultar(){
    cout << "Nome do livro: " << this->sNome << endl;
    cout << "Nome do autor: " << this->sAutor << endl;
    cout << "Quantidade de paginas: " << this->iQtdPaginas << endl;
    cout << "Leitor(a): " << this->sLeitor << endl;
    cout << endl;
}
#endif // CLASSES_H_INCLUDED