TieneEl programa tiene que preguntar si quieres agregar otro articuloartículo, pero no se que ocurre que aunque ponga que no, no me regresa al menu inicial y en lugar de eso me vuelvervuelve a pedir ingresar otro articulo, no se porqueartículo. No sé porqué el do whiledo while
no jala pero ahi si. Si alguien me puede echar la mano muchas gracias.
Tengo que hacerlo con este compilador https://www.onlinegdb.com/online_c++_compiler AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int j;
int opcion;
int res;
char articulo[j][30];
float precio[j];
do {
cout<<"\n\nGAMES STORE";
cout<<"\n\n1. Alta de Articulos";
cout<<"\n2. Lista de articulos";
cout<<"\n3. Salir";
cout<<"\n\nIngrese una opcion: ";
cin>>opcion;
switch(opcion)
{
case 1:
for (int i = 0; i < j; i++)
{
cout <<"\n---------------------------------------------";
cout<<"\n\nIngrese articulo: ";
cin>>articulo[i];
cout<<"\nIngrese precio: ";
cin>>precio[i];
cout <<"\n---------------------------------------------";
cout<<"\n\nDesea agregar otro articulo?";
cout<<"\n\n1. Si";
cout<<"\n2. No";
cout<<"\n\nIngrese una opcion: ";
cin>>res;
if (res==1)
{
j=j+1;
}
}
break;
case 2:
cout<<"LISTA DE ARTICULOS VIGENTES "<<endl;
for (int i = 0; i < j; i++)
{
cout<<articulo[i]<<endl;
cout<<precio[i]<<endl;
}
break;
case 3:
cout << "\nGracias por su preferencia, que tenga un lindo dia :D" << endl;
break;
default:
cout<<"Opcion incorrecta";
break;
}
cout << "\n\n--------------------------------------------- ";
cout << "\n\nQuieres volver al menu inicial?";
cout << "\n\n1. Si ";
cout << "\n2. No ";
cout << "\n\nIngrese una opcion: ";
cin >> opcion;
} while (opcion == 1);
}
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int j;
int opcion;
int res;
char articulo[j][30];
float precio[j];
do {
cout<<"\n\nGAMES STORE";
cout<<"\n\n1. Alta de Articulos";
cout<<"\n2. Lista de articulos";
cout<<"\n3. Salir";
cout<<"\n\nIngrese una opcion: ";
cin>>opcion;
switch(opcion)
{
case 1:
for (int i = 0; i < j; i++)
{
cout <<"\n---------------------------------------------";
cout<<"\n\nIngrese articulo: ";
cin>>articulo[i];
cout<<"\nIngrese precio: ";
cin>>precio[i];
cout <<"\n---------------------------------------------";
cout<<"\n\nDesea agregar otro articulo?";
cout<<"\n\n1. Si";
cout<<"\n2. No";
cout<<"\n\nIngrese una opcion: ";
cin>>res;
if (res==1)
{
j=j+1;
}
}
break;
case 2:
cout<<"LISTA DE ARTICULOS VIGENTES "<<endl;
for (int i = 0; i < j; i++)
{
cout<<articulo[i]<<endl;
cout<<precio[i]<<endl;
}
break;
case 3:
cout << "\nGracias por su preferencia, que tenga un lindo dia :D" << endl;
break;
default:
cout<<"Opcion incorrecta";
break;
}
cout << "\n\n--------------------------------------------- ";
cout << "\n\nQuieres volver al menu inicial?";
cout << "\n\n1. Si ";
cout << "\n2. No ";
cout << "\n\nIngrese una opcion: ";
cin >> opcion;
} while (opcion == 1);
}