3
I am creating a Product registration code, but I can only store a single product. How to improve the code?
#include<iostream>
using namespace std;
void novoProduto(){
string nome="Patrick Oliveira de Souza";
float custo, venda;
system("cls");
cout<<"\tCadastro de Produto\n\n\n";
cout<<"\nNome do Produto: ";
cin>>nome;
cout<<"\nPreco de Custo: ";
cin>>custo;
cout<<"\nPreco de Venda: ";
cin>>venda;
}
int main()
{
int op;
cout<<"\tCadastro de Produto\n\n\n";
cout<<"\n<1>Novo Produto";
cout<<"\n<2>Listar Produtos";
cout<<"\n\tOpcao: ";
cin>>op;
switch (op){
case 1:
novoProduto();
break;
/*case 2:
break*/
}
return 0;
}
Did the answer solve your problem? Do you think you can accept it now? See [tour] to understand how it works. It would be helpful to indicate to everyone that the solution was useful and satisfactory for you. You can also vote on any question or answer you find useful on the entire site.
– Maniero