0
It turns out that the gets functions do not return any kind of value. And getMedidasPC(); always returns values -858993460-858993460 regardless of what is written
Clientes.h
void getMedidasPC();
void setLargPC(int x);
int getLargPC();
void setAltPC(int y);
int getAltPC();
private:
int largPC;
int altPC;
cpp customers.
void Cliente::getMedidasPC()
{
cout << largPC << "mm x" << altPC << "mm" << endl;
cout << largPC;
cout << altPC;
}
void Cliente::setLargPC(int x)
{
largPC = x;
}
int Cliente::getLargPC()
{
return largPC;
}
void Cliente::setAltPC(int y)
{
altPC = y;
}
int Cliente::getAltPC()
{
return altPC;
}´
Main.cpp
int main(){
int xPC;
int yPC;
cout << "\n Largura:" << endl;
cin >> xPC;
clienteObj.setLargPC(xPC);
cout << "\n Altura:" << endl;
cin >> yPC;
clienteObj.setAltPC(yPC);
clienteObj.getLargPC(); //FUNCAO NAO ESTA A FUNCIONAR(não imprime nada)
clienteObj.getAltPC(); // "" "" "" "" ""
cout << xPC << "e" << yPC << endl; //aqui é impresso '400e700'
clienteObj.getMedidasPC();//aqui é impresso -858993460mm x-858993460mm
-858993460-858993460
return 0;
}
Where was declared the
clienteObj
? It does not appear anywhere in your code. Anyway I could not reproduce your problem. See your code running on Ideone– Isac