I tried to figure it out but I am still getting E0065 error codes, and E0020 error codes. I am having trouble defining showMenu, showPrice, ItemPrice, and quantity. Should I have them as int? Do I have the voided functions in the wrong spot. A little confused and bummed, because I wanted this to work. I am new at this so be gentle to my code, still learning the ropes.
/*
Corey Brooks
Magic Beans!
Date Created 06/19/18
*/
void showMenu();
void showPrice(double, int);
void showPrice(double ItemPrice, int quantity);
int sum(int, int);
int main()
{
int intmonsterHP = 100, intplayerHP = 50, intbooster = 30;
string strname;
cout << "Welcome To Magic Beans!\n\n"; // Introduction Text
cout << "Tell us you name Unknown Traveller:";
getline(cin, strname);
cout << "Hello," << strname << endl;
cin.ignore();
cout << "How many coins will you start with?" << endl;
srand((unsigned)time(0));
int random_integer;
int coins;
int lowest = 1000, highest = 10000;
int range = (highest - lowest) + 1;
{
random_integer = lowest + int(range*rand() / (RAND_MAX + 1.0));
cout << "Coins:" << endl << random_integer << endl;
const int Coins = 10000;
//the Grand Prize is 10000 coins
// If the Grand Prize is 10000 coins, congratulate the Player.
if (Coins == 10000)
cout << strname << endl << "You have won the Grand Prize!" << endl;
}
{
cout << "Player's Health:" << intplayerHP << endl;
intplayerHP = intplayerHP * intbooster;
cout << "You have recieved an upgrade! Your hp is now; " << intplayerHP;
getchar();
{
int a, b, c;
a = 2;
b = 7;
c = (a > b) ? a : b;
cout << c << '\n';
}
{
//Is the Character male, female, or a goose!
char male, // Are you a male character?, Y or N
female, // Are you a female character?, Y or N
goose; // Are you a goose?, Y or No
cout << "Answer the following questions, please\n";
cout << "with either Y for Yes or ";
cout << "N for No.\n";
cout << "Are you a male character?\n ";
cin >> male;
cin >> female;
cin >> goose;
cout << "Are you a female character?\n" << endl;
cout << "Are you a Goose?!?\n";
if (male == 'Yes')
if (female == 'Yes')
{
if (goose == 'Yes')
{
cout << "You will be an amazing hero";
cout << "No matter what you are.";
}
}
cin >> goose;
cout << "Are you a male?\n ";
cin >> male;
cout << "Are you a female\n "
<< "or are you a bird in disguise?\n ";
cin >> female;
// Is the player pretending to be a goose.
if (goose == 'Yes' && female == 'Yes' && male == 'Yes')
{
cout << "you could be a goose or a female\n"
<< "which one is it?.\n";
}
else
{
cout << "You cannot be a goose\n"
<< "you have to be either a male or female\n"
<< "if you want to play this game.\n";
cin.ignore();
}
{
int x = 1, y;
y = (x == 1 ? 2 : 0);
printf("x value is %d\n", x);
printf("y value is %d", y);
}
int Number;
int error;
// input validation loop
do
{
error = 0;
cout << "Please enter a number:\n ";
cin >> Number;
if (cin.fail())
{
cout << "That is not a valid number\n" << endl;
error = 1;
cin.clear();
cin.ignore(80, '\n');
}
} while (error == 1);
}
{
for (int i = 1; i <= 10; i++)
{
cout << "Am I annoying you?\n";
}
int BadGuys = 100;
while (BadGuys > 0)
{
BadGuys--;
// BadGuys decreases by one each pass through the loop
int choice;
bool gameOn = true;
while (gameOn != false)
{
cout << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
cout << " 1 - Start the game.\n";
cout << " 2 - Story.\n";
cout << " 3 - Help.\n";
cout << " 4 - Exit.\n";
cout << " Enter your choice and press return:\n ";
cin >> choice;
switch (choice)
{
case 1:
cout << " MMM MMM AAA GGGGGGGGGG IIII CCCCCCCCCCCC";
cout << " MMMMM MMMMM AAAA GG GG IIII CC ";
cout << " MMM MM MM MMM AAAAAA GG IIII CC ";
cout << " MMM MM MMM A A GG GGGGG IIII CC ";
cout << " MMM MM MMM AAAAAAAAA GG GG IIII CC ";
cout << " MMM MM MMM AA AA GG GG IIII CC ";
cout << " MMM MM MMM AA AA GGGGGGGGGG IIII CCCCCCCCCCCC";
// rest of code here
break;
case 2:
cout << "Forget the Cow! Take the beans! They will grow on you.\n";
cout << "Introducing Magic Beans! The game of wonder, adventure, and heroes!\n";
cout << "The game takes place in fairy tale medieval times.\n";
cout << "In a land all too far far away, lives an unknown traveler.\n";
cout << "This traveler does not want to be a hero.\n";
cout << "The responsibility is thrust upon him when his family is kidnapped.\n";
cout << "An evil goose has put his family under an ancient spell.They are to abide by his every evil rule.\n";
cout << "Follow this hero on a adventure of a lifetime!\n";
cout << "Through perils and trials! Will he save his family ? !? !Or will he die trying?!!\n";
cout << "It is up to you to save his family! Before they have to clean the evil gooses room!!!!\n";
// rest of code here
break;
case 3:
cout << "Ahahah, you really think I will help you?\n";
// rest of code here
break;
case 4:
cout << "End of Program.\n";
gameOn = false;
break;
default:
cout << "Not a Valid Choice. \n";
cout << "Choose again.\n";
cin >> choice;
break;
int choice;
int quantity;
const int
BLUNT_WEAPON = 1,
RANGED_WEAPON = 2,
LEGENDARY_WEAPON = 3,
DEFENSIVE_WEAPON = 4;
const double
BLUNT = 400.0,
RANGED = 200.0,
LEGENDARY = 500.0;
cout << fixed << showpoint << setprecision(2);
do
{
showMenu();
cin >> choice;
while (choice < BLUNT_WEAPON || choice > DEFENSIVE_WEAPON)
{
cout << "Please enter a valid menu choice: ";
cin >> choice;
}
if (choice != DEFENSIVE_WEAPON)
{
cout << "What quantity would you like to buy?\n";
cin >> quantity;
switch (choice)
{
case BLUNT_WEAPON:
showPrice(BLUNT, quantity);
break;
case RANGED_WEAPON:
showPrice(RANGED, quantity);
break;
case LEGENDARY_WEAPON:
showPrice(LEGENDARY, quantity);
}
}
} while (choice != DEFENSIVE_WEAPON);
return 0;
}
{
cout << "\n\t\YE OLD ARMS DEALER\n\n"
<< "1. Blunt Weapons\n"
<< "2. Ranged Weapons\n"
<< "3. Legendary Weapons\n"
<< "4. Leave the Shoppe\n\n"
<< "Enter your choice: ";
}
{
cout << "You owe the shoppe $"
<< (ItemPrice * quantity) << endl;
}
{
cout << "The Price of 1 Ranged and 1 Defensive Weapon\n";
}
{
int Ranged1 = 200,
int Defensive1 = 300,
total;
total = sum(Ranged1, Defensive1);
cout << "the sum of " << Ranged1 << "and"
<< Defensive1 << " is " << total << endl;
int sum(int num1, int num2)
{
return num1 + num2
}