PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code. Along with the proper indenting it makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/ Hint: You can edit your post, highlight your code and press the <> formatting button. You can use the preview button at the bottom to see how it looks. I found the second link to be the most help. |
|
|
using namespace std;
, which I would redo as:
|
|
return Behavior[SelectRandom()];
. But your code still has a syntax error.
|
|
You must follow these requirements exactly. Your program must loop, asking for character names that may contain spaces, until the word "quit" is entered. Each name should be added to a vector. Once “quit” is entered, loop through the names vector and print out the stats. There are three attributes of a DnD character for which you will write specific functions. These are the signatures. ● void PrintCharacterStats(string name); ● string ChooseRace(); ● string ChooseAlignment(); ● string ChooseBehavior(); Each chooses one value from an array of predefined values at random. string ChooseRace(); can return one of: ● Human ● Orc ● Elf ● Dwarf ● Gnome string ChooseAlignment(); can return one of: ● Lawful ● Neutral ● Chaotic string ChooseBehavior(); can return one of: ● Good ● Neutral ● Evil You must write a function returning a random number within a give range. It will have the signature: int RangeRand(int min, int max); It will return a random integer whose minimum value is specified as the first argument. Its maximum value is one less than the second argument. For example RangeRand(0, 10) returns a random integer from 0 to (including) 9. The mod operator % is important here. You must write a function return a "stat". Stats can range between 6 and 18 inclusive. The highest (18) is special. If you roll an 18 (choose 18 at random) the character gets a special massive boost which comes in the form of a number between 0 and 100 inclusive. Because of this, your function returns a string - not a number. string PickStat(); See the sample output for an example of non-18 values and one special 18 value. You will choose stats for: ● Strength ● Dexterity ● Intelligence ● Charisma ● Wisdom Health is different - it ranges from 6 to 30 inclusive. As a hint, here are the include files I used when writing my implementation: #include <ctime> #include <iostream> #include <string> #include <vector> Style: Sometimes you can have dozens of includes. If they are in an order, they are easier to glance through. void PrintCharacterStats(string name); Should Print out one characters stats following the format in the sample output. Sample output Enter character's name - use "quit" to exit: Hector the Horrible Enter character's name - use "quit" to exit: Furry Curry Murray Enter character's name - use "quit" to exit: quit Hector the Horrible (Elf) is Neutral alignment and Neutral behavior Health: 15 Strength: 8 Dexterity: 13 Intelligence: 7 Charisma: 16 Wisdom: 6 Enter character's name - use "quit" to exit: Furry Curry Murray (Orc) is Lawful alignment and Evil behavior Health: 17 Strength: 17 Dexterity: 9 Intelligence: 9 Charisma: 8 Wisdom: 18 / 74 |
Your program must loop, asking for character names that may contain spaces, until the word "quit" is entered. Each name should be added to a vector. |