Code:
#include <iostream>
class GiantToad
{
public:
void encounter();
void toadChoice();
void fightToad();
void defendToad();
void fleeToad();
};
void GiantToad::encounter()
{
std::cout << "\n\nThe party climbs through a thicket of marsh, suddenly you hear\n"
<< "what sounds like a giant belch. It is actually a giant toad.\n"
<< "It attacks!!\n\n";
std::cout << "What will you do faced with this overgrown reptilian monster?\n\n";
}
void GiantToad::toadChoice()
{
std::cout << "1) Skewer the toad, Giant frog legs are good eating.\n"
<< "2) Defend yourselves, that long tounge looks like trouble\n"
<< "3) Run away, forget the toad!\n";
}
void GiantToad::fightToad()
{
std::cout << "* You try and attack the toad but it swallows one of your party members *\n";
}
void GiantToad::defendToad()
{
std::cout << "* You block the attack, but your confidence in victory is low *\n";
}
void GiantToad::fleeToad()
{
std::cout << "* Runing away is the right choice, you survive the ordeal *\n";
}
int main()
{
GiantToad text;
text.encounter();
text.toadChoice();
int choice;
std::cout << "\n\nEnter your choice 1-3 and hit ENTER..... ";
std::cin >> choice;
while (choice < 1 || choice > 3)
{
std::cout << "Please enter a valid selection ";
std::cin >> choice;
}
switch (choice)
{
case 1:
text.fightToad();
break;
case 2:
text.defendToad();
break;
case 3:
text.fleeToad();
}
return 0;
}
Well I tried this and it works? were should I go from here? any tips on an easier way to do this? or a way to add more monster encounters?