Sie sind auf Seite 1von 2

#include <iostream>

#include <math.h>
using namespace std;
class Combustivel {
private:
int o;
public:
void setOpcao(int o){
this -> o = o;
}
void Menu(int o){
int a = 0, g = 0, d = 0;
voltar:
do{
cout << "----------------------------------------------"
<< endl;
cout << "Digite uma opcao: " << endl;
cout << "1 - Alcool" << endl;
cout << "2 - Gasolina" << endl;
cout << "3 - Diesel" << endl;
cout << "4 - Fim" << endl;
cout << "Sua opcao eh: ";
cin >> o;
if (o == 1)
a++;
if (o == 2)
g++;
if (o == 3)
d++;
if (o == 4){
cout << "---------------------------------------------" << endl;
cout << "MUITO OBRIGADO!" << endl;
cout << " " << a << " cliente(s) abasteceu(ram)
com Alcool." << endl;
cout << " " << g << " cliente(s) abasteceu(ram)
com Gasolina." << endl;
cout << " " << d << " cliente(s) abasteceu(ram)
com Diesel." << endl;
break;
}
}while ((o == 1)||(o == 2)||(o == 3)||(o == 4));
if ((o != 1)||(o != 2)||(o != 3)||(o != 4)){
cout <<"\aOpcao invalida!\n\n";
goto voltar;
}
}
};
int main()
{
int o;
Combustivel c;

c.setOpcao(o);
c.Menu(o);
system("PAUSE");
}

Das könnte Ihnen auch gefallen