Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Specifications: You are making a silly gaming support application. It wil1 consist of a Dice Roll Showdown and a Simple Character generator. You should start

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Specifications: You are making a silly gaming support application. It wil1 consist of a Dice Roll Showdown and a Simple Character generator. You should start by giving the user an option to either do a Dice Roll Showdown or generate a character. Menu (5% Spec) Show this menu and make it function properly. If the user inputs something incorrect, correct them and loop the menu and prompt. Create a function to run each item in the menu. Welcome to the fantasy player fun tool! Menu: 1- Dice Roll Showdown 2- Generate a Character 3-Macros vs Functions Throw-down Choose an option: Dice Roll Showdown (40% Spec) Create a function for a simple high number wins game. Ask the user how many and what size dice they want to ro11 Then have the Player 2 rol1 the same number of dice. Total the first player's dice and the second player's dice. High value wins. Report each roll value and the total and announce who won. Note: rand) comes from the C library stdlib.h Sample Output: Welcome to the Dice Roll Showdown! How many sides do the dice have (input a positive number):6 How many dice will each player rol1? 2 Player 1 Rolled: 3 Total: 9 Player 2 Rolled 2 Total: 7 Player 1 Wins! Character Generator (40% Spec) Create a function to run a fantasy character generator!! The goal of this section is to procedurally generate random fictional characters. You will generate a random number between 10000 99999 From left to right: First Digit - If it is even output Good if it's odd output Evil Digit 2 & 3 Isolate these and use them to select a name from the file given. Skip the first X-1 lines (where X- the first two digits) and read that name into a C-String 16 Skip 15 lines read and store name "Cesar" (the 16th name) Digit 4 Determines the character's fantasy race. Use an if-else if-else chain or switch-case to output the character's class name 0. Human 1. Elf 2. Halfling 3. Gnome 4. Dwarf . Half-Elf 6. Kobold 7. Half-Ord 8. Dragon-kin 9. Construct Digit 5 - Determines the class of the character. Use an if-else if-else chain or switch-case to output the character's class name 0. Barbarian 1. Bard 2. Cleric 3. Druid 4. Fighter 5. Wizard 6. Monk 7. Paladin 8. Ranger 9. Rogue Keep making characters as long as the user demands. Sample Output Welcome to the Fantasy Character generator! Seed generated 20563: 8. Ranger 9. Rogue Keep making characters as long as the user demands. Sample Output Welcome to the Fantasy Character generator! Seed ge 2-Good 05-Lenna 6-Kobold nerated 20563: Druid Would you like to generate another character? (1 -yes, 0 no): Macro's vs. Functions Throw-down Review C partl.pptx and/or text section 1.4.2 Reminder: Macros are available in most high-level programming 1anguages. The body of a macro 1s simply used to replace a macro-cal during the preprocessing stage. A macro introduces a "true inline" function that is normally more efficient than an "out-1ine" function. However, macros suffer from the side-effect, unwanted, or unexpected modifications to variables Macros should be used cautiously. The main purpose of the following programs are to demonstrate the differences between a function and a macro Other purposes include demonstrating the differences between different programming environments, and learning different ways of writing comments, formatted input and output, variable declaration and initialization, unary operation ++, macro definition/call, function definition/cal1, if-then-else and loop structures, etc. Create these functions in your code Create these functions in your code int subf(int a, int b) ( return a -b; int cubef (int a) return aaa; int minf(int a, int b) if(a <. b return a else int oddf if .. e write four macros that re-implement the above functions and name them: subm cubem minm oddm function will be called from your earlier menu to test compare results of running vs macro. numl num2-7 subf num2 num2-- num1-5 i cubef minf reset num1 between each macro ca17 output result with clear labels. in comment block for this explain why differ. bugs debugging: you should work within reasonable standards. user gives number outside parameters correct loop input prompt again. wi1l not hold responsible bizarre like text into an integer at point. notes tips: would highly recommend use functions. they can really help isolate certain behaviors make code easier debug character generator is similar change problem might have seen cse110. math operations values store them. o find it take apart right left>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions