**Programming
**


Projects:

Text-Based RPG Introduction!


Here is the GitHub link to the project!

This project I used as an opportunity to learn how to optimize and clean up my code using functions in separate files and calling them using header files.
Here a link to the code before I used functions which you will be able to see works, but is untidy and not easily understandable;


JobSelection Function:

I made this function to allow you to choose your job type using jobSelection as the variable to take the number selection in and using if statements to set the jobType variable to the correct string type name of the class/job.


ClothesSelection Function

I made this ClothesSelection function to allow the user to select the type of clothing they want to use on their character (would change nothing but appearance and is only used to describe your finished character in the profile output at the end). I used a series of if statements to check what job the user picked in the JobSelection function and to show and allow the user to choose from specific armour/clothing types fitted to their job type.


ColourSelection Function

I made this colour selection for the simple reason of allowing the user to choose a colour for their armour to be, and saving it to the armourColour string so I can use it in the final character profile.


WeaponSelection Function

I made this function to allow the user to select a weapon. I again used a series of if statements to check the users job type and to output and allow the user to select from certain weapons that are fitted to the users job. Whatever number the user chooses from the list will be their selected weapon and the weapons name will be saved into the weaponSelect string to be outputted later.


Header File

This header file I used to call all of the functions.
I did this to make sure my Main.cpp file didn't get too cluttered. I made sure to #include the file at the top of the Main.cpp file so they are able to be used in there.


Main.cpp File

These are all of my global variables, I declared them here so they are easily referenceable in all other files and functions!

In my int main() function is where I finally called all of my functions to be used, passing in all of the variables that are required for them to work as intended! They then return their outputs to the variables I set them to, to be used in the final character profile.

The final character profile output outputs all of the variables that hold information about the character: username, age, jobType, armourColour, armourType and weaponSelect.
This results in the final output being a full list of what you selected throughout the program.


This was very valuable task for me to complete as it advanced my knowledge of functions and how to use them to clean up my code. I also learned in general how to use them and call them.