Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in c++ Lab 14 -- Programming C++ with Array of Records (Structs) In this lab, we will learm to define a struct data type

code in c++ image text in transcribed
image text in transcribed
Lab 14 -- Programming C++ with Array of Records (Structs) In this lab, we will learm to define a struct data type and use it to form a struct type data array. This lab will also allow you to complete the first component of open lab 4 First create a new project, rename your "main.cpp" file to "struct.cpp". Your program will implement the preparation routine used in a card game, called Hearts. To play the game, first your program will create a deck of (52) cards Each card is described by its suit, value, and points in game. Define a structured data type CandTiype with the following components: suit (string type with values: "Diamond", "Club. "Heat", and "Spade", value (int) and points (int) Define a function FormCards that creates the deck of cards: * he deck of cards should be represented as an array ofCanTypeThe size of the array is 52. Each card is described by its suit, value, and points in game o A card value is the face value of the card which is from 1 to 13, Lc 11 for Jack, 12 for Queen, and 13 for King For card points in game, all the cards of HEART suit have points each HEARTS card of less than 10 face value has 5 points; HEARTS of 10, Jack, Queen, and King have 10 points. All Spade, Diamond, and Club cards have a value 0, except that the Queen of Spade has a point of 100, Jack of Diamond has a point of-100. Special Requirements * The card array should be declared in the main function. . Your main function calls the following two functions: 1. A function "FormCards" that forms the deck of cards, and 2. A second function "DisplayCards" to display the cards on screen. Here is an example output of the program: club Spade Special Requirements The card array should be declared in the main function, Your main function calls the following two functions: A function "FormCards" that forms the deck of cards, and A second function "DisplayCards" to display the cards on screen. 2. Here is an example output of the program: Here is the deck of cards 10 -100 club Club club Spade Spade Spade 100 For this lab, you need to submit one file: sfruct.cpp. Steps to edit, compile, run, and submit the program: * lf after you compile your program, there is compilation errors, then you need to modify the program according to the error messages. You may . Now you can run the program, check to make sure the output is correct. If not, you need to modify the program and recompile and rerun the . Once you are able to successfully the program with the correct outputs, you are ready to submit the program electronically. Only submit the need to edit and compile your program multiple times before it compiles successfully source file. Locate the source file in your "project" directory under your "workspace" directory. For example, if you named your "workspace" as "codelite" under your home directory, and named the project "clal4", then "struct.cpp should be in-codelite/clal4 directory

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

Students also viewed these Databases questions

Question

Describe the linkages between HRM and strategy formulation. page 74

Answered: 1 week ago

Question

Identify approaches to improving retention rates.

Answered: 1 week ago