Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction You will work with a randomly assigned partner - partner assignments will be posted to Canvas. Only one of you should submit the assignment

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Introduction You will work with a randomly assigned partner - partner assignments will be posted to Canvas. Only one of you should submit the assignment In this lab, you will be practicing problem-solving, assignment, input, output, mathematical operations, if statements, while loops, and functions in C. he Lab Setup The following steps will help you set up the lab. For further reference, you may want to look at Lab I 1. Create a new folder in your OneDrive CISC130 folder, call it Lab7 2. In CodeBlocks, make a new c file. Title it name1 _name2 lab7.c and save it in the folder you created above. Where your names take the place of nameX above 3. Make sure your names are at the top of the file in comments. Activities Your task for this lab is to create a program that computes the point value of a hand in a rather convoluted card game called Up-To-9-Card Miracle. Unsurprisingly, a hand of up- to-9-Card Miracle can have between 1 and 9 cards. Each card has a face value. The face values are 2-10 (corresponding to the number on the card) Jacks = 11, Queens = 12, Kings 13, and Aces-1. Cards also have suites: clubs, spades, diamonds, and hearts. Your program should have the following functions: getCards: This function should take an int array argument. It should repeatedly ask the user to enter a card until either they have entered 9 cards or they enter -1. Professor Miracle devised an ingenious encoding so that the user only has to enter a single integer to represent a card. The encoding is as follows: (face value-1)*4+SUIT where SUIT is 0 for clubs, 1 for spades, 2 for diamonds and 3 for hearts. Thus if the user wants to enter the "2 of spades" all they need to do is calculate (2-1)*4+1 which is 5 and enter that Your getCards function should save the results in the passed in array and return the number of cards the user entered. Make sure you only allow the user to enter valid card numbers (i.e. 0-51) or -1. If they enter anything else, you should give them a warning and prompted them to enter a card again. displayCards: This function should take an int array of cards and int numCards (the number of cards held in the array). It should then translate all the integer representations

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

5. Discuss the key roles for training professionals.

Answered: 1 week ago