Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in C please. Concepts to Practice Multi-dimensional arrays Passing arrays to functions Symbolic constants Expand the prelab Submission Information Submit this assignment by following

Code in C please.

image text in transcribedimage text in transcribedimage text in transcribed

Concepts to Practice Multi-dimensional arrays Passing arrays to functions Symbolic constants Expand the prelab Submission Information Submit this assignment by following the instructions given by your TA. SUBMIT ONLY the .c file (no a.out or executable file is required). All the lab assignments must be submitted before the end of the lab using the lab code given by the TA. Use the following submit command: mucs submit For example: mucs submit 1050 lab7 lab7.c Description For the lab assignment, you will be working with the same data you used in your prelab: Character Strength Dexterity Constitution Intelligence Wisdom Charisma Gurn Greyrock 20 15 10 Lady Destry 8 14 Mortimer Waffleglory Thorn Zerith 11 16 10 13 10 15 20 14 14 12 14 14 16 8 20 20 12 12 7 11 14 14 16 9 6 5 4 This time, you will also need to declare an additional array that represents the "modifier" for each ability score. You can find a modifier by looking through the following table and choosing the largest score that is less than or equal to the character's score. Here's the table: Score Modifier 30 10 28 26 8 7 22 20 18 16 3 14 2 12 1 10 0 8 -1 6 -2 4 -3 2 -4 1 -5 For example, if the character's score were 15, then the modifier would be +2. If the character's score were 16, the modifier would be +3. You job is to print out the scores for each character (as you did in the prelab), but this time put the modifier in parentheses next to the score. See the sample output for an example. Important notes Global variables are not allowed! main() should only declare variables, call printf(), and/or call functions that you define. You may want to write a function that in turn calls other functions that you write. This technique ("divide and conquer") allows you to break things down into small pieces that you are more likely to be able to complete. Functions You may write any functions you wish to implement in this program. However, don't forget that you cannot do all of the work in main() - most of the work must be done in functions. Hints You may be able to leverage some of your work from pre-lab. If you want to always explicitly print out a sign (+ or -) with an integer, use "9+d" when calling printf(). For example, printf("%+d",-4) would print "-4" but printf("%+d",4) would print "+4". Sample Output jimr@JimRArea51:~/C51050/SP2021/abs/1ab75 compile 1ab7.c jimrimRArea51: CS1050/SP2021/labs/1ab7$ ./a.out Character scores (modifiers in parentheses): Character #0 20(+5) 15(+2) 20(+5) 11(+0) 14(+2) 10(+0) Character #1 16(+3) 10(+0) 14(+2) 8(-1) 16(+3) 14(+2) Character #2 10(+0) 15(+2) 14(+2) 12(+1) 8(-1) 18(+4) Character #3 13(+2) 20(+5) 12(+1) 12(+1) 14(+2) 11(+0) Character #4 14(+2) 20(+5) 14(+2) 7(-2) 16(+3) 14(+2)

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

More Books

Students also viewed these Databases questions

Question

7. Where Do We Begin?

Answered: 1 week ago