Playing card with a face value and a suit

Assignment Help Basic Statistics
Reference no: EM13928257

1.

a. Create a Card structure that holds a playing card's face and suit.
struct Card {
string face;
string suit;
};

b. Create a Student structure that holds a first name, last name, and student id.

c. Create a Product structure that holds an item name and price in dollars.

d. Create an Employee structure that holds a full name and a boss(which is are ference to this Employee type).

Note that you might have to look up self--- referencing structures to figure this one out.

2. The Card structure below represents a playing card with a face value and a suit. Using the main code given, set the cards in the deck array to be one of each kind of playing card.

The order doesn't matter.

Set the deck using only one loop.
struct Card {
string face;
string suit;
};
//In main
Card deck[52];
int numFaces = 13;
int numSuits = 4;
string faces[numFaces] = { "Ace", "Two", "Three", "Four",
"Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack",
"Queen", "King" };
string suits[numSuits] = { "Hearts", "Spades", "Diamonds",
"Clubs" };
//Fill deck here

Type aliases

3. What does a type alias do? Does it create a new data type? How do you use an alias after you create it?

4. For each of the following examples, create one type alias using the "typedef" keyword and another using the "using" keyword. The first one is done for you as an example.

a. The type "name" as a string.
typedef string name;
using name = string;

b. The type "student_id" as an unsigned integer.

c. The type "grade" as a pointer to a character.

d. Using the Card structure from the previous question in this homework, create the type "deck" as an array of 52 Cards
(Card[52]).

Pointer Concepts


5. Fill in the blanks of the following statements. You may write them in the blank space under the statements. (4 points each)

A pointer is a variable that contains as its value the _________ of another variable.
The three values you can use to set the pointer to null are__________, ___________, and___________.
c. If you don't initialize a pointer to null, you should set it to ______________________________________________.
The notations used to access values in a sequence in memory are the pointer/________ notation and the pointer/_________ notation.
The sizeof operator determines the size of a type, variable, or constant measured in units of __________.
A pointer---based string ends with a special character called the _____________.

Pointer Practice

6. What does the following code output to the console?

Be sure to format the output exactly as it would appear. There are no errors.

#include <iostream>
using namespace std;
void mystery(int*, int*, size_t);
void printArray(int*, size_t);
int main() {
int numbers1[5] = {1, 2, 3, 4, 5};
int numbers2[5] = {1, 1, 1, 1, 1};
int numbers3[8] = { };
mystery(numbers2, numbers1, 5);
mystery(numbers3 + 3, numbers1, 5);
printArray(numbers1, 5);
printArray(numbers2, 5);
printArray(numbers3, 8);
}
void mystery(int *p1, int *p2, size_t length) {
for(int x = 0; x < length; x++) {
*(p1 + x) += *(p2 + x);
}
}
void printArray(int *p, size_t length) {
for(int x = 0; x < length; x++) {
cout << p[x] << " ";
}
cout << endl;
}

Reference no: EM13928257

Questions Cloud

What is the payback period of the project : Your required rate of return is 8%. If you invest $15,000 today in a project, you will receive the following cash flows: What is the NPV of the project? What is the payback period of the project?
Project with the following projected cash flows : Thompson Industries has a project with the following projected cash flows:
How are emotions linked to memories : Video: https://www.youtube.com/playlist?list=PL35B9B52BF0F4238D. How are emotions linked to memories? Provide some examples to support your answers
What will the WACCs be for each division : Suppose your firm has decided to use a divisional WACC approach to analyze projects. The firm currently has four divisions, A through D, with average betas for each division of 0.9, 1.3, 1.4, and 1.5, respectively. What will the WACCs be for each div..
Playing card with a face value and a suit : The Card structure below represents a playing card with a face value and a suit. Using the main code given, set the cards in the deck array to be one of each kind of playing card.
Calculate net present value of proposed expansion project : Based on its analysis of current conditions in Swiss capital markets, International Foods has determined that the applicable cost of capital for the project is 16 percent. Calculate the net present value of the proposed expansion project.
Forecast for the firm is steady growth over the next decade : You are considering buying shares of stock in the Steel Mill. The forecast for the firm is steady growth over the next decade. The firm just paid its annual dividend of $1.42 per share and has plans to increase that amount by 4 percent annually indef..
Summary of situational analysis : As an existing business Tidmax is a huge international wholesale warehouse that provides it members with quality big box products and low prices.
Preferred stock weight and debt weight : BetterPie Industries has 6 million shares of common stock outstanding, 4 million shares of preferred stock outstanding, and 15,000 bonds. Assume the common shares are selling for $47 per share, the preferred shares are selling for $24.50 per share, a..

Reviews

Write a Review

Basic Statistics Questions & Answers

  In a survey 42 of the repsondents stated they talk to their

in a survey 42 of the repsondents stated they talk to their pets on the answering machine or telephone. a vet believed

  Confidence interval for the true proportion of voters

Find a 95% confidence interval for the true proportion of voters who approve of the way the government is being run.

  Information about control limits

Suppose that you're the Quality Manager for the Emerson D. Meritz Machine Tool Company. Your model IE566 grinding machine is afflicted by three types of defects classified as major (type A), serious (type B) and minor (type C).

  A sample of 8 observations is selected from a normal

a sample of 8 observations is selected from a normal population for which the population standard deviation is known to

  A sample set of 29 scores has a mean of 76 and a standard

a sample set of 29 scores has a mean of 76 and a standard deviation of 7. can we accept the hypothesis that the sample

  Corporate ethical breaches in recent times

Given the corporate ethical breaches in recent times, assess whether or not you believe that the current business and regulatory environment is more conducive to ethical behavior. Provide support for your answer.

  There are 1000 students in the senior class at a certain

there are 1000 students in the senior class at a certain high school. the high school offers two advanced placement

  Develop the objective function

Develop the objective function

  Identify at least one example of probability encountered in

identify at least one example of probability encountered in everyday life.explain how probability is used in that

  According to survey conducted by td ameritrade one out of

according to survey conducted by td ameritrade one out of four investors have exchange-traded funds in their

  What is the probability it fails to detect an under filled

1. an automated weight monitor can detect under filled cans of beverages with probability 0.98. what is the

  Sentinal phoneback answers customer enquiries with

sentinal phoneback answers customer enquiries with telephone calls. when they timed a sample of 40 calls they found a

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd