0
How Do I call the menu function by passing more than one struct per reference according to the validation in the validation function ?
sorry I’m starting now and decided to do this little exercise to practice functions, classes, and structs and I came across this problem that I can’t solve. Can someone please help me ?
class Conta {
 private:
struct cliente_1 {
    string nome = "Odair";
    int conta = 739146;
    double senha = 759247;
    float saldo = 00.00;
    double cpf = 48730701875;
};
struct cliente_2 {
    string nome = "Leo";
    int conta = 135478;
    double senha = 789878;
    float saldo = 00.00;
    double cpf = 48730701875;
};
struct cliente_3 {
    string nome = "Caio";
    int conta = 789757;
    double senha = 24860165;
    float saldo = 00.00;
    double cpf = 48730701875;
};
struct clientes {
    cliente_1 c1;
    cliente_2 c2;
    cliente_3 c3;
};
 public:
void menu( cliente_1 cont) {
    cout << cont.nome << endl;
    system("pause");
}
void validacao(int x, double  y) {
    cliente_1 c1;
    cliente_1 c2;
    cliente_1 c3;
    if (x == 739396 || y == 759247) {
        menu(c1);
    }
    else if (x == 135478 || y == 789878) {
        menu(c2);
    }
    else if (x == 789757 || y == 24860165) {
        menu(c3);
    }
}
						
Thank you I’ll try ...
– Odair Lue
can give me a little help, I did the way you taught me but, something on Cout does not display anything on the screen, it’s like skipping Cout and went straight to system pause.
– Odair Lue
if you add anything else into
coutalong withcliente->nomedisplay?– Christian Beregula
No, but when I put it to display another double or float data instead of the name it appears a number half nothing to see type - 946856x84
– Odair Lue
you initialized the
structwith theIniciarClientes()– Christian Beregula
Yes and called her both in the main int and in the valifacao function
– Odair Lue
I did a quick test here, apparently the problem is
stringwithin thestruct, mute tochar*– Christian Beregula