Hi, could someone help me with my program. I have my program that is from a restaurant where you have to enter what you will eat for lunch, drink and dessert. The program gives you the invoice-like quantities and prices, all right there, the problem is that I need that when you enter any character that is not a number the program allows you to re-select the correct option for each option. If anyone could help me with this I would greatly appreciate it.
#include <iostream>
using namespace std;
const float torta=20000;
const float helado=15000;
const float oferta_postre=8000;
const float sopa=15000;
const float arroz_pollo=25000;
const float pasta_bolona=35000;
const float oferta_almuerzo=15000;
const float jarra_jugo=15000;
const float vaso_jugo=5000;
const float jarra_agua=10000;
const float vaso_agua=3000;
float total = 0;
int continuar = 0;
int acum_op1 = 0;
int acum_op2 = 0;
int acum_op3 = 0;
int acum_op4 = 0;
int acum_op5 = 0;
int acum_op6 = 0;
int acum_op7 = 0;
int acum_op8 = 0;
int acum_op9 = 0;
int acum_op10 = 0;
int acum_op11 = 0;
int opcion=0;
void pedido(int op){
int cantidad = 0;
cout<<"Ingrese la cantidad a pedir: "<<endl;
cin>>cantidad;
switch(op)
{
case 1:
total = total + (sopa * cantidad);
acum_op1 = acum_op1 + cantidad;
break;
case 2:
total = total + (arroz_pollo * cantidad);
acum_op2 = acum_op2 + cantidad;
break;
case 3:
total = total + (pasta_bolona * cantidad);
acum_op3 = acum_op3 + cantidad;
break;
case 4:
total = total + (oferta_almuerzo * cantidad);
acum_op4 = acum_op4 + cantidad;
break;
case 5:
total = total + (jarra_jugo * cantidad);
acum_op5 = acum_op5 + cantidad;
break;
case 6:
total = total + (vaso_jugo * cantidad);
acum_op6 = acum_op6 + cantidad;
break;
case 7:
total = total + (jarra_agua * cantidad);
acum_op7 = acum_op7 + cantidad;
break;
case 8:
total = total + (vaso_agua * cantidad);
acum_op8 = acum_op8 + cantidad;
break;
case 9:
total = total + (torta * cantidad);
acum_op9 = acum_op9 + cantidad;
break;
case 10:
total = total + (helado * cantidad);
acum_op10 = acum_op10 + cantidad;
break;
case 11:
total = total + (oferta_postre * cantidad);
acum_op11 = acum_op11 + cantidad;
break;
default:
cout<<"Ingreso una opción invalida"<<endl;
break;
}
}