To start i apologize for my english but its a little hard for me.
My problem is that i have to do a program that manages items in a supermarket.
What I dont not sure about is after you make a structure outside of main, how can i properly do a menu to call that structure.
I did the structures and the strings for the structures fairly easy what am not sure about is how do start the main since i have to do a menu and am not sure how to call a structure.
Code:#include<iostream.h> #include<string.h> #include<stdlib.h> struct supermercado { char Articulo [50]; char Tipo [50]; int Cantidad; int Ventas; float Precio; int Suplidor; }; supermercado bistec; supermercado pollo; supermercado leche; supermercado huevos; supermercado pan; supermercado carnes; supermercado lacteos; supermercado escolar; supermercado general; struct suplidor { char Nombre [50]; char Direccion [50]; int Precio; }; void main () { int opcion; do{ cout<<"Supermercado:"<<endl; cout<<"Menu del Supermercado: "<<endl; cout<<"1. Crear Supermercado: "<<endl; cout<<"2. Comprar articulo a suplidor o vender articulo a cliente: "<<endl; cout<<"3. Buscar Suplidor: "<<endl; cout<<"4. Buscar Articulo: "<<endl; cout<<"5. Reportes: "<<endl; cout<<"6. Salir: "<<endl; cin>>opcion; switch(opcion) { case 1: int x, y=0; cout<<"Entre la cantidad de articulos en el supermercado: "; cin>>x; cout<<"Entre los articulos del supermercado: "; do{ cin.getline (bistec.Articulo,50); cin.getline (pollo.Articulo,50); cin.getline (leche.Articulo,50); cin.getline (huevos.Articulo,50); cin.getline (pan.Articulo,50); y++ }while(x != y); break; }// end switch }while(opcion >= 1 && opcion <= 5); }//end main
If you can show me an example of how to call a structure inside a menu i would appreciated it. thank you. The elements are in spanish cuase thats the language that i use but its the same thing. Thank you in advanced.
edit: edited code with what i have so far. I still have no idea on how to call the structures and make them do what i want but am trying. Again the elements are in spanish if you need me to translate it let me know.