Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "pch.h"
#include<iostream>
using namespace std;
class Mymenu{};
{
private:
int formula;
int choice;
int quantity;
int gun = 3;
int energy = 2;
int life = 5;
int ok = 1;
char answer;
//Mymenu{};();
//~Mymenu{};();
public:
void gun()
{
cout << "the price of the gun is " << gun << endl;
cout << "how many u want?? \n";
cin >> quantity;
formula = gun * quantity;
cout << "the price is " << formula;
}
void energy()
{
cout << "the price of energy is " << energy << endl;
cout << "how many u want?? \n";
cin >> quantity;
formula = energy * quantity;
cout << "the price is " << formula;
}
void life()
{
cout << "the price of life is " << life << endl;
cout << "how many u want?? \n";
cin >> quantity;
formula = life * quantity;
cout << "the price is " << formula;
}
void buyAgain()
{
cout << "\n" << endl << "do you want to buy anything else? y/n" << endl;
cin >> answer;
if (answer == 'y')
print_menu();
}
void print_menu() {
//while (ok)
//{
cout << "please insert the option " << "\n" << endl;
cout << "1)gun""\n";
cout << "2)energy ""\n";
cout << "3)life" << endl;
cout << "###############################""\n";
cin >> choice;
if (choice == 1)
{
gun()
}
else if (choice == 2)
{
energy()
}
else if (choice == 3)
{
life()
}
else
{
cout << "invalid info" << endl;
}
buyAgain();
}
int getLife()
{
return life;
}
};
int main(){
Mymenu menu;
menu.print_menu();
}