Exercise 1 - The random character generator
In the game "Dungeons & Dragons" by WoTC, each player controls a character. The character has a number of attributes, specifically, they have Strength, Dexterity, Stamina, Intellect, Wisdom, and Charisma - each which can have a score in the range of 1 to 20. These "ability" scores are used to determine the success and/or failure of skills used, as well as how your character performs in combat. We'll explore more of that later. For this week, I want you to write a program which contains a "Character" class. The character should have attributes representing the 6 ability scores, with accesses for each score. As well, the class should contain two constructors, 1 which takes as input 6 ability scores, and the second which is the default. The default constructor should randomly assign each ability score a value in the range of 1 to 20. To make it easier, I've posted the code below to help generate random numbers. Your main function should create two "characters"....one by using the default constructor, and one by passing in values between 1-20...might want to check in your constructor to make sure the input is valid (1-20). After both characters are created, use your accessors to print the attributes of each character to the screen with appropriate labels.
// Required headers
// Call this ONCE, in your main function to seed the random number generator
srand( (unsigned)time( NULL ) );
// Call this in your default constructor in order to generate a random number from 1 to 20.
int randomNum = ( rand() % 20 ) + 1;
I will not move on until I get this one done...