0
Good morning, I’m having this mistake of request for Member in my float, someone could help?
struct Estoque {
char nome[60];
char quantidade[60];
char preco[60];
};
float caixaAtual = 0.00;
float venda();
void consultarSaldo();
float venda() {
Estoque b;
int qtd;
float lucro = 0;
char a;
do {
cout << "Informe o nome do produto:\n";
cin >> b.nome;
if (b.nome.quantidade < 0) {
cout << "Produto indisponivel\n";
} else {
cout << "Informe a quantidade:\n";
cin >> qtd;
cout << "Produto:\n" << b.nome.nome;
cout << "Quantidade:\n" << qtd;
cout << "Preço:\n" << b.nome.preco;
cout << "SubTotal:\n" << b.nome.preco * qtd;
lucro += b.nome.preco * qtd;
b.nome.quantidade -= qtd;
}
cout << "Deseja vender mais um item? (1) sim (2) não";
cin >> a; } while (a != '2');
cout << "\t\t\t Total: %1.2f" << lucro;
return lucro;
}
Errors are syntax see that you have not declared value of
b.nome
and doubledb.nome.nome
– Maury Developer
This code is extremely confusing and doesn’t make any sense, probably because it lacks parts (not that I think you didn’t put it all together, just that you put together almost random things and think it will produce something useful)So I don’t even know what to do if you don’t have a point mistake, I can only recommend the subject more, understand how to program something like this and start again. It is not a programming error indeed, it is an error of the problem not to be well defined before anything. And the code mixes C with C++, so there is a lot to fix. Yes, there is spot error too, but ñ is just,ñ solves
– Maniero
What is the sense of you declaring quantity and price as a string of characters?
– anonimo